1
0

ivprog.bundle.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./grammar/en/ivprog.g4":
  99. /*!******************************!*\
  100. !*** ./grammar/en/ivprog.g4 ***!
  101. \******************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. module.exports =
  105. /******/ (function(modules) { // webpackBootstrap
  106. /******/ // The module cache
  107. /******/ var installedModules = {};
  108. /******/
  109. /******/ // The require function
  110. /******/ function __webpack_require__(moduleId) {
  111. /******/
  112. /******/ // Check if module is in cache
  113. /******/ if(installedModules[moduleId]) {
  114. /******/ return installedModules[moduleId].exports;
  115. /******/ }
  116. /******/ // Create a new module (and put it into the cache)
  117. /******/ var module = installedModules[moduleId] = {
  118. /******/ i: moduleId,
  119. /******/ l: false,
  120. /******/ exports: {}
  121. /******/ };
  122. /******/
  123. /******/ // Execute the module function
  124. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  125. /******/
  126. /******/ // Flag the module as loaded
  127. /******/ module.l = true;
  128. /******/
  129. /******/ // Return the exports of the module
  130. /******/ return module.exports;
  131. /******/ }
  132. /******/
  133. /******/
  134. /******/ // expose the modules object (__webpack_modules__)
  135. /******/ __webpack_require__.m = modules;
  136. /******/
  137. /******/ // expose the module cache
  138. /******/ __webpack_require__.c = installedModules;
  139. /******/
  140. /******/ // identity function for calling harmony imports with the correct context
  141. /******/ __webpack_require__.i = function(value) { return value; };
  142. /******/
  143. /******/ // define getter function for harmony exports
  144. /******/ __webpack_require__.d = function(exports, name, getter) {
  145. /******/ if(!__webpack_require__.o(exports, name)) {
  146. /******/ Object.defineProperty(exports, name, {
  147. /******/ configurable: false,
  148. /******/ enumerable: true,
  149. /******/ get: getter
  150. /******/ });
  151. /******/ }
  152. /******/ };
  153. /******/
  154. /******/ // getDefaultExport function for compatibility with non-harmony modules
  155. /******/ __webpack_require__.n = function(module) {
  156. /******/ var getter = module && module.__esModule ?
  157. /******/ function getDefault() { return module['default']; } :
  158. /******/ function getModuleExports() { return module; };
  159. /******/ __webpack_require__.d(getter, 'a', getter);
  160. /******/ return getter;
  161. /******/ };
  162. /******/
  163. /******/ // Object.prototype.hasOwnProperty.call
  164. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  165. /******/
  166. /******/ // __webpack_public_path__
  167. /******/ __webpack_require__.p = "";
  168. /******/
  169. /******/ // Load entry module and return exports
  170. /******/ return __webpack_require__(__webpack_require__.s = 1);
  171. /******/ })
  172. /************************************************************************/
  173. /******/ ([
  174. /* 0 */
  175. /***/ (function(module, exports, __webpack_require__) {
  176. // Generated from /tmp/tmp-2028pW6kjV9eRsn3/ivprog.g4 by ANTLR 4.7
  177. // jshint ignore: start
  178. var antlr4 = __webpack_require__(2);
  179. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  180. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  181. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  182. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  183. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  184. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  185. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  186. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  187. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  188. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  189. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  190. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  191. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  192. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  193. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  194. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  195. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  196. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  197. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  198. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  199. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  200. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  201. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  202. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  203. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  204. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  205. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  206. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  207. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  208. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  209. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  210. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  211. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  212. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  213. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  214. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  215. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  216. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  217. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  218. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  219. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  220. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  221. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  222. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  223. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  224. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  225. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  226. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  227. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  228. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  229. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  230. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  231. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  232. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  233. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  234. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  235. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  236. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  237. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  238. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  239. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  240. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  241. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  242. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  243. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  244. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  245. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  246. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  247. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  248. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  249. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  250. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  251. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  252. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  253. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  254. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  255. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  256. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  257. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  258. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  259. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  260. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  261. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  262. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  263. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  264. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  265. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  266. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  267. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  268. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  269. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  270. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  271. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  272. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  273. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  274. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  275. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  276. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  277. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  278. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  279. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  280. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  281. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  282. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  283. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  284. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  285. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  286. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  287. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  288. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  289. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  290. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  291. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  292. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  293. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  294. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  295. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  296. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  297. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  298. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  299. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  300. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  301. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  302. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  303. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  304. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  305. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  306. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  307. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  308. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  309. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  310. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  311. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  312. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  313. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  314. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  315. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  316. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  317. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  318. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  319. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  320. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  321. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  322. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  323. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  324. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  325. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  326. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  327. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  328. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  329. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  330. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  331. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  332. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  333. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  334. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  335. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  336. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  337. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  338. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  339. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  340. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  341. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  342. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  343. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  344. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  345. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  346. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  347. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  348. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  349. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  350. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  351. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  352. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  353. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  354. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  355. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  356. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  357. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  358. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  359. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  360. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  361. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  362. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  363. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  364. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  365. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  366. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  367. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  368. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  369. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  370. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  371. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  372. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  373. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  374. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  375. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  376. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  377. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  378. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  379. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  380. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  381. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  382. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  383. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  384. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  385. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  386. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  387. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  388. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  389. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  390. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  391. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  392. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  393. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  394. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  395. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  396. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  397. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  398. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  399. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  400. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  401. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  402. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  403. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  404. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  405. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  406. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  407. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  408. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  409. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  410. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  411. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  412. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  413. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  414. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  415. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  416. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  417. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  418. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  419. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  420. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  421. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  422. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  423. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  424. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  425. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  426. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  427. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  428. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  429. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  430. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  431. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  432. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  433. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  434. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  435. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  436. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  437. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  438. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  439. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  440. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  441. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  442. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  443. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  444. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  445. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  446. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  447. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  448. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  449. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  450. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  451. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  452. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  453. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  454. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  455. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  456. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  457. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  458. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  459. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  460. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  461. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  462. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  463. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  464. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  465. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  466. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  467. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  468. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  469. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  470. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  471. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  472. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  473. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  474. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  475. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  476. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  477. function ivprog(input) {
  478. antlr4.Lexer.call(this, input);
  479. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  480. return this;
  481. }
  482. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  483. ivprog.prototype.constructor = ivprog;
  484. ivprog.EOF = antlr4.Token.EOF;
  485. ivprog.RK_PROGRAM = 1;
  486. ivprog.RK_REAL = 2;
  487. ivprog.RK_VOID = 3;
  488. ivprog.RK_BOOLEAN = 4;
  489. ivprog.RK_STRING = 5;
  490. ivprog.RK_INTEGER = 6;
  491. ivprog.RK_CHARACTER = 7;
  492. ivprog.RK_SWITCH = 8;
  493. ivprog.RK_CASE = 9;
  494. ivprog.RK_DEFAULT = 10;
  495. ivprog.RK_CONST = 11;
  496. ivprog.RK_FUNCTION = 12;
  497. ivprog.RK_RETURN = 13;
  498. ivprog.RK_FOR = 14;
  499. ivprog.RK_BREAK = 15;
  500. ivprog.RK_DO = 16;
  501. ivprog.RK_WHILE = 17;
  502. ivprog.RK_IF = 18;
  503. ivprog.RK_ELSE = 19;
  504. ivprog.RK_FALSE = 20;
  505. ivprog.RK_TRUE = 21;
  506. ivprog.OPEN_PARENTHESIS = 22;
  507. ivprog.CLOSE_PARENTHESIS = 23;
  508. ivprog.OPEN_BRACE = 24;
  509. ivprog.CLOSE_BRACE = 25;
  510. ivprog.OPEN_CURLY = 26;
  511. ivprog.CLOSE_CURLY = 27;
  512. ivprog.COMMA = 28;
  513. ivprog.EQUAL = 29;
  514. ivprog.SUM_OP = 30;
  515. ivprog.MULTI_OP = 31;
  516. ivprog.AND_OPERATOR = 32;
  517. ivprog.OR_OPERATOR = 33;
  518. ivprog.RELATIONAL_OPERATOR = 34;
  519. ivprog.COLON = 35;
  520. ivprog.NOT_OPERATOR = 36;
  521. ivprog.ID = 37;
  522. ivprog.LIB_ID = 38;
  523. ivprog.INTEGER = 39;
  524. ivprog.REAL = 40;
  525. ivprog.STRING = 41;
  526. ivprog.CHARACTER = 42;
  527. ivprog.WHITESPACE = 43;
  528. ivprog.EOS = 44;
  529. ivprog.COMMENTS = 45;
  530. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  531. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  532. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  533. "'boolean'", "'string'", "'integer'",
  534. "'character'", "'switch'", "'case'", "'otherwise'",
  535. "'const'", "'function'", "'return'", "'for'",
  536. "'break'", "'do'", "'while'", "'if'",
  537. "'else'", "'false'", "'true'", "'('",
  538. "')'", "'['", "']'", "'{'", "'}'", "','",
  539. "'='", null, null, null, null, null, "':'" ];
  540. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  541. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  542. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  543. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  544. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  545. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  546. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  547. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  548. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  549. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  550. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  551. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  552. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  553. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  554. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  555. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  556. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  557. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  558. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  559. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  560. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  561. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  562. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  563. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  564. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  565. "STRING", "STRING_CHARACTER", "CHARACTER",
  566. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  567. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  568. "COMMENTS" ];
  569. ivprog.prototype.grammarFileName = "ivprog.g4";
  570. exports.ivprog = ivprog;
  571. /***/ }),
  572. /* 1 */
  573. /***/ (function(module, exports, __webpack_require__) {
  574. module.exports = {
  575. ivprog: __webpack_require__(0).ivprog
  576. };
  577. /***/ }),
  578. /* 2 */
  579. /***/ (function(module, exports) {
  580. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  581. /***/ })
  582. /******/ ]);
  583. /***/ }),
  584. /***/ "./grammar/en/langFunctions.js":
  585. /*!*************************************!*\
  586. !*** ./grammar/en/langFunctions.js ***!
  587. \*************************************/
  588. /*! no static exports found */
  589. /***/ (function(module, exports, __webpack_require__) {
  590. "use strict";
  591. Object.defineProperty(exports, "__esModule", {
  592. value: true
  593. });
  594. /* This is a dictionary of the language defined functions
  595. **/
  596. exports.default = {
  597. main_function: "start",
  598. $read: "read",
  599. $write: "write",
  600. $numElements: "total_of_elements",
  601. $matrixLines: "total_of_lines",
  602. $matrixColumns: "total_of_columns",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "is_real",
  609. $isInt: "is_integer",
  610. $isBool: "is_logic",
  611. $castReal: "to_real",
  612. $castInt: "to_integer",
  613. $castBool: "to_logic",
  614. $castString: "to_string",
  615. $sin: "sin",
  616. $cos: "cos",
  617. $tan: "tan",
  618. $sqrt: "sqrt",
  619. $pow: "pow",
  620. $log: "log",
  621. $abs: "abs",
  622. $negate: "negate",
  623. $invert: "invert",
  624. $max: "maximum",
  625. $min: "minimum"
  626. };
  627. /***/ }),
  628. /***/ "./grammar/en/langLibs.js":
  629. /*!********************************!*\
  630. !*** ./grammar/en/langLibs.js ***!
  631. \********************************/
  632. /*! no static exports found */
  633. /***/ (function(module, exports, __webpack_require__) {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", {
  636. value: true
  637. });
  638. /**
  639. * This is the dictionary of the language defined libraries
  640. */
  641. exports.default = {
  642. $mathLib: "Mathematic",
  643. $ioLib: "ES",
  644. $strLib: "Texto",
  645. $arrayLib: "Arranjo",
  646. $langLib: "Conversion"
  647. };
  648. /***/ }),
  649. /***/ "./grammar/es/ivprog.g4":
  650. /*!******************************!*\
  651. !*** ./grammar/es/ivprog.g4 ***!
  652. \******************************/
  653. /*! no static exports found */
  654. /***/ (function(module, exports, __webpack_require__) {
  655. module.exports =
  656. /******/ (function(modules) { // webpackBootstrap
  657. /******/ // The module cache
  658. /******/ var installedModules = {};
  659. /******/
  660. /******/ // The require function
  661. /******/ function __webpack_require__(moduleId) {
  662. /******/
  663. /******/ // Check if module is in cache
  664. /******/ if(installedModules[moduleId]) {
  665. /******/ return installedModules[moduleId].exports;
  666. /******/ }
  667. /******/ // Create a new module (and put it into the cache)
  668. /******/ var module = installedModules[moduleId] = {
  669. /******/ i: moduleId,
  670. /******/ l: false,
  671. /******/ exports: {}
  672. /******/ };
  673. /******/
  674. /******/ // Execute the module function
  675. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  676. /******/
  677. /******/ // Flag the module as loaded
  678. /******/ module.l = true;
  679. /******/
  680. /******/ // Return the exports of the module
  681. /******/ return module.exports;
  682. /******/ }
  683. /******/
  684. /******/
  685. /******/ // expose the modules object (__webpack_modules__)
  686. /******/ __webpack_require__.m = modules;
  687. /******/
  688. /******/ // expose the module cache
  689. /******/ __webpack_require__.c = installedModules;
  690. /******/
  691. /******/ // identity function for calling harmony imports with the correct context
  692. /******/ __webpack_require__.i = function(value) { return value; };
  693. /******/
  694. /******/ // define getter function for harmony exports
  695. /******/ __webpack_require__.d = function(exports, name, getter) {
  696. /******/ if(!__webpack_require__.o(exports, name)) {
  697. /******/ Object.defineProperty(exports, name, {
  698. /******/ configurable: false,
  699. /******/ enumerable: true,
  700. /******/ get: getter
  701. /******/ });
  702. /******/ }
  703. /******/ };
  704. /******/
  705. /******/ // getDefaultExport function for compatibility with non-harmony modules
  706. /******/ __webpack_require__.n = function(module) {
  707. /******/ var getter = module && module.__esModule ?
  708. /******/ function getDefault() { return module['default']; } :
  709. /******/ function getModuleExports() { return module; };
  710. /******/ __webpack_require__.d(getter, 'a', getter);
  711. /******/ return getter;
  712. /******/ };
  713. /******/
  714. /******/ // Object.prototype.hasOwnProperty.call
  715. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  716. /******/
  717. /******/ // __webpack_public_path__
  718. /******/ __webpack_require__.p = "";
  719. /******/
  720. /******/ // Load entry module and return exports
  721. /******/ return __webpack_require__(__webpack_require__.s = 1);
  722. /******/ })
  723. /************************************************************************/
  724. /******/ ([
  725. /* 0 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. // Generated from /tmp/tmp-20281fun2UE1Xp6Y/ivprog.g4 by ANTLR 4.7
  728. // jshint ignore: start
  729. var antlr4 = __webpack_require__(2);
  730. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  731. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  732. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  733. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  734. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  735. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  736. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  737. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  738. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  739. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  740. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  741. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  742. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  743. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  744. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  745. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  746. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  747. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  748. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  749. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  750. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  751. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  752. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  753. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  754. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  755. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  756. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  757. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  758. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  759. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  760. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  761. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  762. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  763. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  764. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  765. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  766. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  767. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  768. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  769. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  770. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  771. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  772. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  773. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  774. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  775. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  776. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  777. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  778. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  779. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  780. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  781. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  782. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  783. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  784. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  785. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  786. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  787. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  788. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  789. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  790. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  791. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  792. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  793. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  794. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  795. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  796. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  797. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  798. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  799. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  800. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  801. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  802. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  803. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  804. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  805. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  806. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  807. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  808. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  809. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  810. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  811. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  812. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  813. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  814. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  815. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  816. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  817. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  818. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  819. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  820. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  821. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  822. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  823. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  824. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  825. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  826. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  827. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  828. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  829. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  830. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  831. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  832. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  833. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  834. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  835. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  836. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  837. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  838. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  839. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  840. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  841. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  842. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  843. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  844. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  845. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  846. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  847. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  848. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  849. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  850. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  851. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  852. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  853. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  854. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  855. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  856. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  857. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  858. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  859. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  860. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  861. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  862. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  863. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  864. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  865. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  866. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  867. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  868. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  869. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  870. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  871. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  872. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  873. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  874. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  875. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  876. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  877. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  878. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  879. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  880. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  881. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  882. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  883. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  884. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  885. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  886. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  887. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  888. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  889. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  890. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  891. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  892. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  893. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  894. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  895. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  896. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  897. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  898. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  899. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  900. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  901. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  902. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  903. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  904. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  905. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  906. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  907. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  908. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  909. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  910. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  911. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  912. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  913. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  914. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  915. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  916. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  917. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  918. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  919. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  920. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  921. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  922. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  923. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  924. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  925. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  926. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  927. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  928. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  929. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  930. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  931. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  932. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  933. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  934. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  935. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  936. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  937. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  938. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  939. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  940. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  941. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  942. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  943. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  944. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  945. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  946. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  947. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  948. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  949. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  950. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  951. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  952. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  953. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  954. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  955. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  956. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  957. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  958. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  959. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  960. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  961. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  962. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  963. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  964. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  965. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  966. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  967. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  968. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  969. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  970. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  971. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  972. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  973. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  974. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  975. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  976. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  977. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  978. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  979. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  980. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  981. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  982. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  983. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  984. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  985. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  986. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  987. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  988. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  989. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  990. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  991. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  992. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  993. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  994. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  995. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  996. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  997. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  998. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  999. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1000. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1001. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1002. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1003. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1004. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1005. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1006. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1007. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1008. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1009. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1010. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1011. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1012. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1013. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1014. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1015. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1016. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1017. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1018. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1019. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1020. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1021. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1022. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1023. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1024. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1025. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1026. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1027. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1028. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1029. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1030. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1031. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1032. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1033. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1034. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1035. function ivprog(input) {
  1036. antlr4.Lexer.call(this, input);
  1037. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1038. return this;
  1039. }
  1040. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1041. ivprog.prototype.constructor = ivprog;
  1042. ivprog.EOF = antlr4.Token.EOF;
  1043. ivprog.RK_PROGRAM = 1;
  1044. ivprog.RK_REAL = 2;
  1045. ivprog.RK_VOID = 3;
  1046. ivprog.RK_BOOLEAN = 4;
  1047. ivprog.RK_STRING = 5;
  1048. ivprog.RK_INTEGER = 6;
  1049. ivprog.RK_CHARACTER = 7;
  1050. ivprog.RK_SWITCH = 8;
  1051. ivprog.RK_CASE = 9;
  1052. ivprog.RK_DEFAULT = 10;
  1053. ivprog.RK_CONST = 11;
  1054. ivprog.RK_FUNCTION = 12;
  1055. ivprog.RK_RETURN = 13;
  1056. ivprog.RK_FOR = 14;
  1057. ivprog.RK_BREAK = 15;
  1058. ivprog.RK_DO = 16;
  1059. ivprog.RK_WHILE = 17;
  1060. ivprog.RK_IF = 18;
  1061. ivprog.RK_ELSE = 19;
  1062. ivprog.RK_FALSE = 20;
  1063. ivprog.RK_TRUE = 21;
  1064. ivprog.OPEN_PARENTHESIS = 22;
  1065. ivprog.CLOSE_PARENTHESIS = 23;
  1066. ivprog.OPEN_BRACE = 24;
  1067. ivprog.CLOSE_BRACE = 25;
  1068. ivprog.OPEN_CURLY = 26;
  1069. ivprog.CLOSE_CURLY = 27;
  1070. ivprog.COMMA = 28;
  1071. ivprog.EQUAL = 29;
  1072. ivprog.SUM_OP = 30;
  1073. ivprog.MULTI_OP = 31;
  1074. ivprog.AND_OPERATOR = 32;
  1075. ivprog.OR_OPERATOR = 33;
  1076. ivprog.RELATIONAL_OPERATOR = 34;
  1077. ivprog.COLON = 35;
  1078. ivprog.NOT_OPERATOR = 36;
  1079. ivprog.ID = 37;
  1080. ivprog.LIB_ID = 38;
  1081. ivprog.INTEGER = 39;
  1082. ivprog.REAL = 40;
  1083. ivprog.STRING = 41;
  1084. ivprog.CHARACTER = 42;
  1085. ivprog.WHITESPACE = 43;
  1086. ivprog.EOS = 44;
  1087. ivprog.COMMENTS = 45;
  1088. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1089. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1090. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1091. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1092. "'escolha'", "'caso'", "'contrario'",
  1093. "'const'", "'funcao'", "'retorne'", "'para'",
  1094. "'pare'", "'faca'", "'enquanto'", "'se'",
  1095. "'senao'", "'falso'", "'verdadeiro'",
  1096. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1097. "','", "'='", null, null, null, null,
  1098. null, "':'" ];
  1099. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1100. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1101. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1102. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1103. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1104. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1105. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1106. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1107. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1108. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1109. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1110. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1111. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1112. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1113. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1114. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1115. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1116. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1117. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1118. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1119. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1120. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1121. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1122. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1123. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1124. "STRING", "STRING_CHARACTER", "CHARACTER",
  1125. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1126. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1127. "COMMENTS" ];
  1128. ivprog.prototype.grammarFileName = "ivprog.g4";
  1129. exports.ivprog = ivprog;
  1130. /***/ }),
  1131. /* 1 */
  1132. /***/ (function(module, exports, __webpack_require__) {
  1133. module.exports = {
  1134. ivprog: __webpack_require__(0).ivprog
  1135. };
  1136. /***/ }),
  1137. /* 2 */
  1138. /***/ (function(module, exports) {
  1139. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1140. /***/ })
  1141. /******/ ]);
  1142. /***/ }),
  1143. /***/ "./grammar/es/langFunctions.js":
  1144. /*!*************************************!*\
  1145. !*** ./grammar/es/langFunctions.js ***!
  1146. \*************************************/
  1147. /*! no static exports found */
  1148. /***/ (function(module, exports, __webpack_require__) {
  1149. "use strict";
  1150. Object.defineProperty(exports, "__esModule", {
  1151. value: true
  1152. });
  1153. /* This is a dictionary of the language defined functions
  1154. **/
  1155. exports.default = {
  1156. main_function: "inicio",
  1157. $read: "leia",
  1158. $write: "escreva",
  1159. $numElements: "total_of_elements",
  1160. $matrixLines: "total_of_lines",
  1161. $matrixColumns: "total_of_columns",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "is_real",
  1168. $isInt: "is_integer",
  1169. $isBool: "is_logic",
  1170. $castReal: "to_real",
  1171. $castInt: "to_integer",
  1172. $castBool: "to_logic",
  1173. $castString: "to_string",
  1174. $sin: "sin",
  1175. $cos: "cos",
  1176. $tan: "tan",
  1177. $sqrt: "sqrt",
  1178. $pow: "pow",
  1179. $log: "log",
  1180. $abs: "abs",
  1181. $negate: "negate",
  1182. $invert: "invert",
  1183. $max: "maximum",
  1184. $min: "minimum"
  1185. };
  1186. /***/ }),
  1187. /***/ "./grammar/es/langLibs.js":
  1188. /*!********************************!*\
  1189. !*** ./grammar/es/langLibs.js ***!
  1190. \********************************/
  1191. /*! no static exports found */
  1192. /***/ (function(module, exports, __webpack_require__) {
  1193. "use strict";
  1194. Object.defineProperty(exports, "__esModule", {
  1195. value: true
  1196. });
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. exports.default = {
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "Conversion"
  1206. };
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! no static exports found */
  1213. /***/ (function(module, exports, __webpack_require__) {
  1214. "use strict";
  1215. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1216. var PT = _interopRequireWildcard(_ivprog);
  1217. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1218. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1219. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. var _langLibs2 = _interopRequireDefault(_langLibs);
  1221. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1222. var EN = _interopRequireWildcard(_ivprog2);
  1223. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1224. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1225. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1226. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1227. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1228. var ES = _interopRequireWildcard(_ivprog3);
  1229. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1230. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1231. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1232. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1233. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1234. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1235. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1236. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1237. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1238. /***/ }),
  1239. /***/ "./grammar/pt/ivprog.g4":
  1240. /*!******************************!*\
  1241. !*** ./grammar/pt/ivprog.g4 ***!
  1242. \******************************/
  1243. /*! no static exports found */
  1244. /***/ (function(module, exports, __webpack_require__) {
  1245. module.exports =
  1246. /******/ (function(modules) { // webpackBootstrap
  1247. /******/ // The module cache
  1248. /******/ var installedModules = {};
  1249. /******/
  1250. /******/ // The require function
  1251. /******/ function __webpack_require__(moduleId) {
  1252. /******/
  1253. /******/ // Check if module is in cache
  1254. /******/ if(installedModules[moduleId]) {
  1255. /******/ return installedModules[moduleId].exports;
  1256. /******/ }
  1257. /******/ // Create a new module (and put it into the cache)
  1258. /******/ var module = installedModules[moduleId] = {
  1259. /******/ i: moduleId,
  1260. /******/ l: false,
  1261. /******/ exports: {}
  1262. /******/ };
  1263. /******/
  1264. /******/ // Execute the module function
  1265. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1266. /******/
  1267. /******/ // Flag the module as loaded
  1268. /******/ module.l = true;
  1269. /******/
  1270. /******/ // Return the exports of the module
  1271. /******/ return module.exports;
  1272. /******/ }
  1273. /******/
  1274. /******/
  1275. /******/ // expose the modules object (__webpack_modules__)
  1276. /******/ __webpack_require__.m = modules;
  1277. /******/
  1278. /******/ // expose the module cache
  1279. /******/ __webpack_require__.c = installedModules;
  1280. /******/
  1281. /******/ // identity function for calling harmony imports with the correct context
  1282. /******/ __webpack_require__.i = function(value) { return value; };
  1283. /******/
  1284. /******/ // define getter function for harmony exports
  1285. /******/ __webpack_require__.d = function(exports, name, getter) {
  1286. /******/ if(!__webpack_require__.o(exports, name)) {
  1287. /******/ Object.defineProperty(exports, name, {
  1288. /******/ configurable: false,
  1289. /******/ enumerable: true,
  1290. /******/ get: getter
  1291. /******/ });
  1292. /******/ }
  1293. /******/ };
  1294. /******/
  1295. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1296. /******/ __webpack_require__.n = function(module) {
  1297. /******/ var getter = module && module.__esModule ?
  1298. /******/ function getDefault() { return module['default']; } :
  1299. /******/ function getModuleExports() { return module; };
  1300. /******/ __webpack_require__.d(getter, 'a', getter);
  1301. /******/ return getter;
  1302. /******/ };
  1303. /******/
  1304. /******/ // Object.prototype.hasOwnProperty.call
  1305. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1306. /******/
  1307. /******/ // __webpack_public_path__
  1308. /******/ __webpack_require__.p = "";
  1309. /******/
  1310. /******/ // Load entry module and return exports
  1311. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1312. /******/ })
  1313. /************************************************************************/
  1314. /******/ ([
  1315. /* 0 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. // Generated from /tmp/tmp-202848VL2fXlrSFW/ivprog.g4 by ANTLR 4.7
  1318. // jshint ignore: start
  1319. var antlr4 = __webpack_require__(2);
  1320. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1321. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1322. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1323. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1324. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1325. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1326. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1327. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1328. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1329. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1330. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1331. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1332. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1333. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1334. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1335. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1336. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1337. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1338. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1339. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1340. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1341. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1342. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1343. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1344. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1345. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1346. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1347. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1348. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1349. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1350. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1351. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1352. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1353. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1354. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1355. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1356. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1357. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1358. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1359. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1360. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1361. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1362. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1363. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1364. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1365. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1366. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1367. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1368. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1369. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1370. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1371. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1372. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1373. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1374. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1375. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1376. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1377. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1378. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1379. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1380. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1381. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1382. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1383. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1384. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1385. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1386. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1387. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1388. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1389. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1390. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1391. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1392. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1393. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1394. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1395. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1396. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1397. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1398. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1399. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1400. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1401. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1402. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1403. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1404. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1405. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1406. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1407. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1408. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1409. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1410. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1411. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1412. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1413. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1414. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1415. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1416. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1417. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1418. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1419. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1420. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1421. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1422. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1423. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1424. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1425. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1426. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1427. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1428. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1429. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1430. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1431. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1432. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1433. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1434. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1435. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1436. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1437. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1438. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1439. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1440. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1441. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1442. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1443. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1444. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1445. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1446. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1447. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1448. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1449. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1450. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1451. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1452. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1453. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1454. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1455. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1456. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1457. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1458. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1459. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1460. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1461. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1462. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1463. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1464. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1465. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1466. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1467. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1468. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1469. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1470. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1471. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1472. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1473. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1474. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1475. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1476. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1477. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1478. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1479. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1480. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1481. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1482. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1483. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1484. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1485. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1486. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1487. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1488. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1489. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1490. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1491. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1492. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1493. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1494. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1495. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1496. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1497. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1498. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1499. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1500. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1501. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1502. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1503. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1504. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1505. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1506. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1507. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1508. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1509. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1510. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1511. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1512. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1513. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1514. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1515. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1516. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1517. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1518. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1519. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1520. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1521. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1522. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1523. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1524. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1525. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1526. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1527. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1528. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1529. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1530. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1531. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1532. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1533. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1534. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1535. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1536. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1537. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1538. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1539. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1540. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1541. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1542. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1543. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1544. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1545. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1546. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1547. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1548. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1549. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1550. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1551. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1552. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1553. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1554. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1555. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1556. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1557. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1558. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1559. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1560. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1561. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1562. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1563. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1564. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1565. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1566. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1567. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1568. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1569. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1570. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1571. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1572. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1573. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1574. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1575. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1576. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1577. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1578. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1579. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1580. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1581. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1582. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1583. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1584. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1585. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1586. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1587. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1588. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1589. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1590. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1591. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1592. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1593. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1594. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1595. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1596. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1597. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1598. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1599. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1600. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1601. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1602. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1603. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1604. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1605. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1606. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1607. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1608. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1609. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1610. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1611. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1612. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1613. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1614. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1615. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1616. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1617. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1618. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1619. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1620. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1621. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1622. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1623. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1624. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1625. function ivprog(input) {
  1626. antlr4.Lexer.call(this, input);
  1627. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1628. return this;
  1629. }
  1630. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1631. ivprog.prototype.constructor = ivprog;
  1632. ivprog.EOF = antlr4.Token.EOF;
  1633. ivprog.RK_PROGRAM = 1;
  1634. ivprog.RK_REAL = 2;
  1635. ivprog.RK_VOID = 3;
  1636. ivprog.RK_BOOLEAN = 4;
  1637. ivprog.RK_STRING = 5;
  1638. ivprog.RK_INTEGER = 6;
  1639. ivprog.RK_CHARACTER = 7;
  1640. ivprog.RK_SWITCH = 8;
  1641. ivprog.RK_CASE = 9;
  1642. ivprog.RK_DEFAULT = 10;
  1643. ivprog.RK_CONST = 11;
  1644. ivprog.RK_FUNCTION = 12;
  1645. ivprog.RK_RETURN = 13;
  1646. ivprog.RK_FOR = 14;
  1647. ivprog.RK_BREAK = 15;
  1648. ivprog.RK_DO = 16;
  1649. ivprog.RK_WHILE = 17;
  1650. ivprog.RK_IF = 18;
  1651. ivprog.RK_ELSE = 19;
  1652. ivprog.RK_FALSE = 20;
  1653. ivprog.RK_TRUE = 21;
  1654. ivprog.OPEN_PARENTHESIS = 22;
  1655. ivprog.CLOSE_PARENTHESIS = 23;
  1656. ivprog.OPEN_BRACE = 24;
  1657. ivprog.CLOSE_BRACE = 25;
  1658. ivprog.OPEN_CURLY = 26;
  1659. ivprog.CLOSE_CURLY = 27;
  1660. ivprog.COMMA = 28;
  1661. ivprog.EQUAL = 29;
  1662. ivprog.SUM_OP = 30;
  1663. ivprog.MULTI_OP = 31;
  1664. ivprog.AND_OPERATOR = 32;
  1665. ivprog.OR_OPERATOR = 33;
  1666. ivprog.RELATIONAL_OPERATOR = 34;
  1667. ivprog.COLON = 35;
  1668. ivprog.NOT_OPERATOR = 36;
  1669. ivprog.ID = 37;
  1670. ivprog.LIB_ID = 38;
  1671. ivprog.INTEGER = 39;
  1672. ivprog.REAL = 40;
  1673. ivprog.STRING = 41;
  1674. ivprog.CHARACTER = 42;
  1675. ivprog.WHITESPACE = 43;
  1676. ivprog.EOS = 44;
  1677. ivprog.COMMENTS = 45;
  1678. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1679. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1680. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1681. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1682. "'escolha'", "'caso'", "'contrario'",
  1683. "'const'", "'funcao'", "'retorne'", "'para'",
  1684. "'pare'", "'faca'", "'enquanto'", "'se'",
  1685. "'senao'", "'falso'", "'verdadeiro'",
  1686. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1687. "','", "'='", null, null, null, null,
  1688. null, "':'" ];
  1689. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1690. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1691. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1692. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1693. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1694. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1695. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1696. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1697. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1698. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1699. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1700. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1701. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1702. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1703. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1704. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1705. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1706. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1707. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1708. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1709. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1710. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1711. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1712. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1713. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1714. "STRING", "STRING_CHARACTER", "CHARACTER",
  1715. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1716. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1717. "COMMENTS" ];
  1718. ivprog.prototype.grammarFileName = "ivprog.g4";
  1719. exports.ivprog = ivprog;
  1720. /***/ }),
  1721. /* 1 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. module.exports = {
  1724. ivprog: __webpack_require__(0).ivprog
  1725. };
  1726. /***/ }),
  1727. /* 2 */
  1728. /***/ (function(module, exports) {
  1729. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1730. /***/ })
  1731. /******/ ]);
  1732. /***/ }),
  1733. /***/ "./grammar/pt/langFunctions.js":
  1734. /*!*************************************!*\
  1735. !*** ./grammar/pt/langFunctions.js ***!
  1736. \*************************************/
  1737. /*! no static exports found */
  1738. /***/ (function(module, exports, __webpack_require__) {
  1739. "use strict";
  1740. Object.defineProperty(exports, "__esModule", {
  1741. value: true
  1742. });
  1743. /* This is a dictionary of the language defined functions
  1744. **/
  1745. exports.default = {
  1746. main_function: "inicio",
  1747. $read: "leia",
  1748. $write: "escreva",
  1749. $numElements: "total_de_elementos",
  1750. $matrixLines: "total_de_linhas",
  1751. $matrixColumns: "total_de_colunas",
  1752. $substring: "subcadeia",
  1753. $length: "comprimento",
  1754. $uppercase: "caixa_alta",
  1755. $lowercase: "caixa_baixa",
  1756. $charAt: "char_at",
  1757. $isReal: "e_real",
  1758. $isInt: "e_inteiro",
  1759. $isBool: "e_logico",
  1760. $castReal: "como_real",
  1761. $castInt: "como_inteiro",
  1762. $castBool: "como_logico",
  1763. $castString: "como_cadeia",
  1764. $sin: "seno",
  1765. $cos: "cosseno",
  1766. $tan: "tangente",
  1767. $sqrt: "raiz_quadrada",
  1768. $pow: "potencia",
  1769. $log: "logaritmo",
  1770. $abs: "modulo",
  1771. $negate: "trocar_sinal",
  1772. $invert: "inverter_valor",
  1773. $max: "maximo",
  1774. $min: "minimo"
  1775. };
  1776. /***/ }),
  1777. /***/ "./grammar/pt/langLibs.js":
  1778. /*!********************************!*\
  1779. !*** ./grammar/pt/langLibs.js ***!
  1780. \********************************/
  1781. /*! no static exports found */
  1782. /***/ (function(module, exports, __webpack_require__) {
  1783. "use strict";
  1784. Object.defineProperty(exports, "__esModule", {
  1785. value: true
  1786. });
  1787. /**
  1788. * This is the dictionary of the language defined libraries
  1789. */
  1790. exports.default = {
  1791. $mathLib: "Matematica",
  1792. $ioLib: "ES",
  1793. $strLib: "Texto",
  1794. $arrayLib: "Arranjo",
  1795. $langLib: "Conversao"
  1796. };
  1797. /***/ }),
  1798. /***/ "./i18n/en/error.json":
  1799. /*!****************************!*\
  1800. !*** ./i18n/en/error.json ***!
  1801. \****************************/
  1802. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, id_missing, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */
  1803. /***/ (function(module) {
  1804. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","unexpected_break_command":"Erro interno crítico: Comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida"};
  1805. /***/ }),
  1806. /***/ "./i18n/en/index.js":
  1807. /*!**************************!*\
  1808. !*** ./i18n/en/index.js ***!
  1809. \**************************/
  1810. /*! no static exports found */
  1811. /***/ (function(module, exports, __webpack_require__) {
  1812. "use strict";
  1813. Object.defineProperty(exports, "__esModule", {
  1814. value: true
  1815. });
  1816. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1817. var _error2 = _interopRequireDefault(_error);
  1818. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1819. var _message2 = _interopRequireDefault(_message);
  1820. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1821. var _ui2 = _interopRequireDefault(_ui);
  1822. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1823. exports.default = {
  1824. 'message': _message2.default,
  1825. 'error': _error2.default,
  1826. 'ui': _ui2.default
  1827. };
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: default */
  1834. /***/ (function(module) {
  1835. module.exports = {};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, 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: default */
  1850. /***/ (function(module) {
  1851. module.exports = {};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! no static exports found */
  1858. /***/ (function(module, exports, __webpack_require__) {
  1859. "use strict";
  1860. Object.defineProperty(exports, "__esModule", {
  1861. value: true
  1862. });
  1863. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1864. var _error2 = _interopRequireDefault(_error);
  1865. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1866. var _message2 = _interopRequireDefault(_message);
  1867. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1868. var _ui2 = _interopRequireDefault(_ui);
  1869. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1870. exports.default = {
  1871. 'message': _message2.default,
  1872. 'error': _error2.default,
  1873. 'ui': _ui2.default
  1874. };
  1875. /***/ }),
  1876. /***/ "./i18n/es/message.json":
  1877. /*!******************************!*\
  1878. !*** ./i18n/es/message.json ***!
  1879. \******************************/
  1880. /*! exports provided: default */
  1881. /***/ (function(module) {
  1882. module.exports = {};
  1883. /***/ }),
  1884. /***/ "./i18n/es/ui.json":
  1885. /*!*************************!*\
  1886. !*** ./i18n/es/ui.json ***!
  1887. \*************************/
  1888. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_break, text_else, text_return, text_btn_return, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, $sin, math, arrangement, conversion, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, text_t, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1889. /***/ (function(module) {
  1890. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"Text","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_break":"break","text_else":"else","text_return":"return","text_btn_return":"Return","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_repeatNtimes":"Repeat N times","text_receives":"receives","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematics","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","text_t":"Text","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1891. /***/ }),
  1892. /***/ "./i18n/index.js":
  1893. /*!***********************!*\
  1894. !*** ./i18n/index.js ***!
  1895. \***********************/
  1896. /*! no static exports found */
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. Object.defineProperty(exports, "__esModule", {
  1900. value: true
  1901. });
  1902. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1903. var _en2 = _interopRequireDefault(_en);
  1904. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1905. var _pt2 = _interopRequireDefault(_pt);
  1906. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1907. var _es2 = _interopRequireDefault(_es);
  1908. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1909. exports.default = {
  1910. 'en': _en2.default,
  1911. 'pt': _pt2.default,
  1912. 'es': _es2.default
  1913. };
  1914. /***/ }),
  1915. /***/ "./i18n/pt/error.json":
  1916. /*!****************************!*\
  1917. !*** ./i18n/pt/error.json ***!
  1918. \****************************/
  1919. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, default */
  1920. /***/ (function(module) {
  1921. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição dos laços de repetição deve ser do tipo lógico","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição de um comando se...senao deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1."};
  1922. /***/ }),
  1923. /***/ "./i18n/pt/index.js":
  1924. /*!**************************!*\
  1925. !*** ./i18n/pt/index.js ***!
  1926. \**************************/
  1927. /*! no static exports found */
  1928. /***/ (function(module, exports, __webpack_require__) {
  1929. "use strict";
  1930. Object.defineProperty(exports, "__esModule", {
  1931. value: true
  1932. });
  1933. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1934. var _error2 = _interopRequireDefault(_error);
  1935. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1936. var _message2 = _interopRequireDefault(_message);
  1937. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1938. var _ui2 = _interopRequireDefault(_ui);
  1939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1940. exports.default = {
  1941. 'message': _message2.default,
  1942. 'error': _error2.default,
  1943. 'ui': _ui2.default
  1944. };
  1945. /***/ }),
  1946. /***/ "./i18n/pt/message.json":
  1947. /*!******************************!*\
  1948. !*** ./i18n/pt/message.json ***!
  1949. \******************************/
  1950. /*! exports provided: default */
  1951. /***/ (function(module) {
  1952. module.exports = {};
  1953. /***/ }),
  1954. /***/ "./i18n/pt/ui.json":
  1955. /*!*************************!*\
  1956. !*** ./i18n/pt/ui.json ***!
  1957. \*************************/
  1958. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, and, or, not, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_return, text_btn_return, text_comment, join_or, matrix_string, vector_string, text_attribution, text_if, text_break, text_else, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, $sin, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1959. /***/ (function(module) {
  1960. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","and":"E","or":"OU","not":"nao","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","matrix_string":"matriz de $0","vector_string":"vetor de $0","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faca","text_command_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Relacional","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Construir uma expressão lógica","$sin":"seno","math":"Matematica","text_t":"Texto","inform_valid_name":"Informe um nome válido!","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","inform_valid_name_duplicated":"Este nome já está em uso por outra função!","inform_valid_global_duplicated":"Já existe uma variável global com o nome informado.","inform_valid_variable_duplicated":"Já existe uma variável local com o nome informado.","arrangement":"Arranjo","conversion":"Conversao","$cos":"cosseno","$tan":"tangente","$sqrt":"raiz_quadrada","$pow":"potencia","$log":"logaritmo","$abs":"modulo","$negate":"trocar_sinal","$invert":"inverter_valor","$max":"maximo","$min":"minimo","$substring":"subcadeia","$length":"comprimento","$uppercase":"caixa_alta","$lowercase":"caixa_baixa","$charAt":"texto_na_posicao","$numElements":"total_de_elementos","$matrixLines":"total_de_linhas","$matrixColumns":"total_de_colunas","$isReal":"e_real","$isInt":"e_inteiro","$isBool":"e_logico","$castReal":"como_real","$castInt":"como_inteiro","$castBool":"como_logico","$castString":"como_cadeia","text_ivprog_version":"Versão"};
  1961. /***/ }),
  1962. /***/ "./js/Sortable.js":
  1963. /*!************************!*\
  1964. !*** ./js/Sortable.js ***!
  1965. \************************/
  1966. /*! no static exports found */
  1967. /***/ (function(module, exports, __webpack_require__) {
  1968. "use strict";
  1969. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1970. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1971. /**!
  1972. * Sortable
  1973. * @author RubaXa <trash@rubaxa.org>
  1974. * @license MIT
  1975. */
  1976. (function sortableModule(factory) {
  1977. "use strict";
  1978. if (true) {
  1979. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1980. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1981. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1982. __WEBPACK_AMD_DEFINE_FACTORY__),
  1983. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1984. } else {}
  1985. })(function sortableFactory() {
  1986. "use strict";
  1987. if (typeof window == "undefined" || !window.document) {
  1988. return function sortableError() {
  1989. throw new Error("Sortable.js requires a window with a document");
  1990. };
  1991. }
  1992. var dragEl,
  1993. parentEl,
  1994. ghostEl,
  1995. cloneEl,
  1996. rootEl,
  1997. nextEl,
  1998. lastDownEl,
  1999. scrollEl,
  2000. scrollParentEl,
  2001. scrollCustomFn,
  2002. lastEl,
  2003. lastCSS,
  2004. lastParentCSS,
  2005. oldIndex,
  2006. newIndex,
  2007. activeGroup,
  2008. putSortable,
  2009. autoScroll = {},
  2010. tapEvt,
  2011. touchEvt,
  2012. moved,
  2013. /** @const */
  2014. R_SPACE = /\s+/g,
  2015. R_FLOAT = /left|right|inline/,
  2016. expando = 'Sortable' + new Date().getTime(),
  2017. win = window,
  2018. document = win.document,
  2019. parseInt = win.parseInt,
  2020. $ = win.jQuery || win.Zepto,
  2021. Polymer = win.Polymer,
  2022. captureMode = false,
  2023. supportDraggable = !!('draggable' in document.createElement('div')),
  2024. supportCssPointerEvents = function (el) {
  2025. // false when IE11
  2026. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2027. return false;
  2028. }
  2029. el = document.createElement('x');
  2030. el.style.cssText = 'pointer-events:auto';
  2031. return el.style.pointerEvents === 'auto';
  2032. }(),
  2033. _silent = false,
  2034. abs = Math.abs,
  2035. min = Math.min,
  2036. savedInputChecked = [],
  2037. touchDragOverListeners = [],
  2038. _autoScroll = _throttle(function ( /**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  2039. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2040. if (rootEl && options.scroll) {
  2041. var _this = rootEl[expando],
  2042. el,
  2043. rect,
  2044. sens = options.scrollSensitivity,
  2045. speed = options.scrollSpeed,
  2046. x = evt.clientX,
  2047. y = evt.clientY,
  2048. winWidth = window.innerWidth,
  2049. winHeight = window.innerHeight,
  2050. vx,
  2051. vy,
  2052. scrollOffsetX,
  2053. scrollOffsetY;
  2054. // Delect scrollEl
  2055. if (scrollParentEl !== rootEl) {
  2056. scrollEl = options.scroll;
  2057. scrollParentEl = rootEl;
  2058. scrollCustomFn = options.scrollFn;
  2059. if (scrollEl === true) {
  2060. scrollEl = rootEl;
  2061. do {
  2062. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2063. break;
  2064. }
  2065. /* jshint boss:true */
  2066. } while (scrollEl = scrollEl.parentNode);
  2067. }
  2068. }
  2069. if (scrollEl) {
  2070. el = scrollEl;
  2071. rect = scrollEl.getBoundingClientRect();
  2072. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2073. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2074. }
  2075. if (!(vx || vy)) {
  2076. vx = (winWidth - x <= sens) - (x <= sens);
  2077. vy = (winHeight - y <= sens) - (y <= sens);
  2078. /* jshint expr:true */
  2079. (vx || vy) && (el = win);
  2080. }
  2081. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2082. autoScroll.el = el;
  2083. autoScroll.vx = vx;
  2084. autoScroll.vy = vy;
  2085. clearInterval(autoScroll.pid);
  2086. if (el) {
  2087. autoScroll.pid = setInterval(function () {
  2088. scrollOffsetY = vy ? vy * speed : 0;
  2089. scrollOffsetX = vx ? vx * speed : 0;
  2090. if ('function' === typeof scrollCustomFn) {
  2091. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2092. }
  2093. if (el === win) {
  2094. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2095. } else {
  2096. el.scrollTop += scrollOffsetY;
  2097. el.scrollLeft += scrollOffsetX;
  2098. }
  2099. }, 24);
  2100. }
  2101. }
  2102. }
  2103. }, 30),
  2104. _prepareGroup = function _prepareGroup(options) {
  2105. function toFn(value, pull) {
  2106. if (value === void 0 || value === true) {
  2107. value = group.name;
  2108. }
  2109. if (typeof value === 'function') {
  2110. return value;
  2111. } else {
  2112. return function (to, from) {
  2113. var fromGroup = from.options.group.name;
  2114. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2115. };
  2116. }
  2117. }
  2118. var group = {};
  2119. var originalGroup = options.group;
  2120. if (!originalGroup || (typeof originalGroup === "undefined" ? "undefined" : _typeof(originalGroup)) != 'object') {
  2121. originalGroup = { name: originalGroup };
  2122. }
  2123. group.name = originalGroup.name;
  2124. group.checkPull = toFn(originalGroup.pull, true);
  2125. group.checkPut = toFn(originalGroup.put);
  2126. group.revertClone = originalGroup.revertClone;
  2127. options.group = group;
  2128. };
  2129. /**
  2130. * @class Sortable
  2131. * @param {HTMLElement} el
  2132. * @param {Object} [options]
  2133. */
  2134. function Sortable(el, options) {
  2135. if (!(el && el.nodeType && el.nodeType === 1)) {
  2136. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2137. }
  2138. this.el = el; // root element
  2139. this.options = options = _extend({}, options);
  2140. // Export instance
  2141. el[expando] = this;
  2142. // Default options
  2143. var defaults = {
  2144. group: Math.random(),
  2145. sort: true,
  2146. disabled: false,
  2147. store: null,
  2148. handle: null,
  2149. scroll: true,
  2150. scrollSensitivity: 30,
  2151. scrollSpeed: 10,
  2152. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2153. ghostClass: 'sortable-ghost',
  2154. chosenClass: 'sortable-chosen',
  2155. dragClass: 'sortable-drag',
  2156. ignore: 'a, img',
  2157. filter: null,
  2158. preventOnFilter: true,
  2159. animation: 0,
  2160. setData: function setData(dataTransfer, dragEl) {
  2161. dataTransfer.setData('Text', dragEl.textContent);
  2162. },
  2163. dropBubble: false,
  2164. dragoverBubble: false,
  2165. dataIdAttr: 'data-id',
  2166. delay: 0,
  2167. forceFallback: false,
  2168. fallbackClass: 'sortable-fallback',
  2169. fallbackOnBody: false,
  2170. fallbackTolerance: 0,
  2171. fallbackOffset: { x: 0, y: 0 }
  2172. };
  2173. // Set default options
  2174. for (var name in defaults) {
  2175. !(name in options) && (options[name] = defaults[name]);
  2176. }
  2177. _prepareGroup(options);
  2178. // Bind all private methods
  2179. for (var fn in this) {
  2180. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2181. this[fn] = this[fn].bind(this);
  2182. }
  2183. }
  2184. // Setup drag mode
  2185. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  2186. // Bind events
  2187. _on(el, 'mousedown', this._onTapStart);
  2188. _on(el, 'touchstart', this._onTapStart);
  2189. _on(el, 'pointerdown', this._onTapStart);
  2190. if (this.nativeDraggable) {
  2191. _on(el, 'dragover', this);
  2192. _on(el, 'dragenter', this);
  2193. }
  2194. touchDragOverListeners.push(this._onDragOver);
  2195. // Restore sorting
  2196. options.store && this.sort(options.store.get(this));
  2197. }
  2198. Sortable.prototype = /** @lends Sortable.prototype */{
  2199. constructor: Sortable,
  2200. _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
  2201. var _this = this,
  2202. el = this.el,
  2203. options = this.options,
  2204. preventOnFilter = options.preventOnFilter,
  2205. type = evt.type,
  2206. touch = evt.touches && evt.touches[0],
  2207. target = (touch || evt).target,
  2208. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2209. filter = options.filter,
  2210. startIndex;
  2211. _saveInputCheckedState(el);
  2212. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2213. if (dragEl) {
  2214. return;
  2215. }
  2216. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2217. return; // only left button or enabled
  2218. }
  2219. target = _closest(target, options.draggable, el);
  2220. if (!target) {
  2221. return;
  2222. }
  2223. if (lastDownEl === target) {
  2224. // Ignoring duplicate `down`
  2225. return;
  2226. }
  2227. // Get the index of the dragged element within its parent
  2228. startIndex = _index(target, options.draggable);
  2229. // Check filter
  2230. if (typeof filter === 'function') {
  2231. if (filter.call(this, evt, target, this)) {
  2232. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2233. preventOnFilter && evt.preventDefault();
  2234. return; // cancel dnd
  2235. }
  2236. } else if (filter) {
  2237. filter = filter.split(',').some(function (criteria) {
  2238. criteria = _closest(originalTarget, criteria.trim(), el);
  2239. if (criteria) {
  2240. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2241. return true;
  2242. }
  2243. });
  2244. if (filter) {
  2245. preventOnFilter && evt.preventDefault();
  2246. return; // cancel dnd
  2247. }
  2248. }
  2249. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2250. return;
  2251. }
  2252. // Prepare `dragstart`
  2253. this._prepareDragStart(evt, touch, target, startIndex);
  2254. },
  2255. _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  2256. var _this = this,
  2257. el = _this.el,
  2258. options = _this.options,
  2259. ownerDocument = el.ownerDocument,
  2260. dragStartFn;
  2261. if (target && !dragEl && target.parentNode === el) {
  2262. tapEvt = evt;
  2263. rootEl = el;
  2264. dragEl = target;
  2265. parentEl = dragEl.parentNode;
  2266. nextEl = dragEl.nextSibling;
  2267. lastDownEl = target;
  2268. activeGroup = options.group;
  2269. oldIndex = startIndex;
  2270. this._lastX = (touch || evt).clientX;
  2271. this._lastY = (touch || evt).clientY;
  2272. dragEl.style['will-change'] = 'transform';
  2273. dragStartFn = function dragStartFn() {
  2274. // Delayed drag has been triggered
  2275. // we can re-enable the events: touchmove/mousemove
  2276. _this._disableDelayedDrag();
  2277. // Make the element draggable
  2278. dragEl.draggable = _this.nativeDraggable;
  2279. // Chosen item
  2280. _toggleClass(dragEl, options.chosenClass, true);
  2281. // Bind the events: dragstart/dragend
  2282. _this._triggerDragStart(evt, touch);
  2283. // Drag start event
  2284. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2285. };
  2286. // Disable "draggable"
  2287. options.ignore.split(',').forEach(function (criteria) {
  2288. _find(dragEl, criteria.trim(), _disableDraggable);
  2289. });
  2290. _on(ownerDocument, 'mouseup', _this._onDrop);
  2291. _on(ownerDocument, 'touchend', _this._onDrop);
  2292. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2293. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2294. _on(ownerDocument, 'selectstart', _this);
  2295. if (options.delay) {
  2296. // If the user moves the pointer or let go the click or touch
  2297. // before the delay has been reached:
  2298. // disable the delayed drag
  2299. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2300. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2301. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2302. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2303. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2304. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2305. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2306. } else {
  2307. dragStartFn();
  2308. }
  2309. }
  2310. },
  2311. _disableDelayedDrag: function _disableDelayedDrag() {
  2312. var ownerDocument = this.el.ownerDocument;
  2313. clearTimeout(this._dragStartTimer);
  2314. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2315. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2316. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2317. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2318. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2319. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2320. },
  2321. _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
  2322. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2323. if (touch) {
  2324. // Touch device support
  2325. tapEvt = {
  2326. target: dragEl,
  2327. clientX: touch.clientX,
  2328. clientY: touch.clientY
  2329. };
  2330. this._onDragStart(tapEvt, 'touch');
  2331. } else if (!this.nativeDraggable) {
  2332. this._onDragStart(tapEvt, true);
  2333. } else {
  2334. _on(dragEl, 'dragend', this);
  2335. _on(rootEl, 'dragstart', this._onDragStart);
  2336. }
  2337. try {
  2338. if (document.selection) {
  2339. // Timeout neccessary for IE9
  2340. setTimeout(function () {
  2341. document.selection.empty();
  2342. });
  2343. } else {
  2344. window.getSelection().removeAllRanges();
  2345. }
  2346. } catch (err) {}
  2347. },
  2348. _dragStarted: function _dragStarted() {
  2349. if (rootEl && dragEl) {
  2350. var options = this.options;
  2351. // Apply effect
  2352. _toggleClass(dragEl, options.ghostClass, true);
  2353. _toggleClass(dragEl, options.dragClass, false);
  2354. Sortable.active = this;
  2355. // Drag start event
  2356. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2357. } else {
  2358. this._nulling();
  2359. }
  2360. },
  2361. _emulateDragOver: function _emulateDragOver() {
  2362. if (touchEvt) {
  2363. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2364. return;
  2365. }
  2366. this._lastX = touchEvt.clientX;
  2367. this._lastY = touchEvt.clientY;
  2368. if (!supportCssPointerEvents) {
  2369. _css(ghostEl, 'display', 'none');
  2370. }
  2371. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2372. parent = target,
  2373. i = touchDragOverListeners.length;
  2374. if (parent) {
  2375. do {
  2376. if (parent[expando]) {
  2377. while (i--) {
  2378. touchDragOverListeners[i]({
  2379. clientX: touchEvt.clientX,
  2380. clientY: touchEvt.clientY,
  2381. target: target,
  2382. rootEl: parent
  2383. });
  2384. }
  2385. break;
  2386. }
  2387. target = parent; // store last element
  2388. }
  2389. /* jshint boss:true */
  2390. while (parent = parent.parentNode);
  2391. }
  2392. if (!supportCssPointerEvents) {
  2393. _css(ghostEl, 'display', '');
  2394. }
  2395. }
  2396. },
  2397. _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
  2398. if (tapEvt) {
  2399. var options = this.options,
  2400. fallbackTolerance = options.fallbackTolerance,
  2401. fallbackOffset = options.fallbackOffset,
  2402. touch = evt.touches ? evt.touches[0] : evt,
  2403. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2404. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2405. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  2406. // only set the status to dragging, when we are actually dragging
  2407. if (!Sortable.active) {
  2408. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2409. return;
  2410. }
  2411. this._dragStarted();
  2412. }
  2413. // as well as creating the ghost element on the document body
  2414. this._appendGhost();
  2415. moved = true;
  2416. touchEvt = touch;
  2417. _css(ghostEl, 'webkitTransform', translate3d);
  2418. _css(ghostEl, 'mozTransform', translate3d);
  2419. _css(ghostEl, 'msTransform', translate3d);
  2420. _css(ghostEl, 'transform', translate3d);
  2421. evt.preventDefault();
  2422. }
  2423. },
  2424. _appendGhost: function _appendGhost() {
  2425. if (!ghostEl) {
  2426. var rect = dragEl.getBoundingClientRect(),
  2427. css = _css(dragEl),
  2428. options = this.options,
  2429. ghostRect;
  2430. ghostEl = dragEl.cloneNode(true);
  2431. _toggleClass(ghostEl, options.ghostClass, false);
  2432. _toggleClass(ghostEl, options.fallbackClass, true);
  2433. _toggleClass(ghostEl, options.dragClass, true);
  2434. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2435. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2436. _css(ghostEl, 'width', rect.width);
  2437. _css(ghostEl, 'height', rect.height);
  2438. _css(ghostEl, 'opacity', '0.8');
  2439. _css(ghostEl, 'position', 'fixed');
  2440. _css(ghostEl, 'zIndex', '100000');
  2441. _css(ghostEl, 'pointerEvents', 'none');
  2442. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  2443. // Fixing dimensions.
  2444. ghostRect = ghostEl.getBoundingClientRect();
  2445. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2446. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2447. }
  2448. },
  2449. _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/useFallback) {
  2450. var dataTransfer = evt.dataTransfer,
  2451. options = this.options;
  2452. this._offUpEvents();
  2453. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2454. cloneEl = _clone(dragEl);
  2455. cloneEl.draggable = false;
  2456. cloneEl.style['will-change'] = '';
  2457. _css(cloneEl, 'display', 'none');
  2458. _toggleClass(cloneEl, this.options.chosenClass, false);
  2459. rootEl.insertBefore(cloneEl, dragEl);
  2460. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2461. }
  2462. _toggleClass(dragEl, options.dragClass, true);
  2463. if (useFallback) {
  2464. if (useFallback === 'touch') {
  2465. // Bind touch events
  2466. _on(document, 'touchmove', this._onTouchMove);
  2467. _on(document, 'touchend', this._onDrop);
  2468. _on(document, 'touchcancel', this._onDrop);
  2469. _on(document, 'pointermove', this._onTouchMove);
  2470. _on(document, 'pointerup', this._onDrop);
  2471. } else {
  2472. // Old brwoser
  2473. _on(document, 'mousemove', this._onTouchMove);
  2474. _on(document, 'mouseup', this._onDrop);
  2475. }
  2476. this._loopId = setInterval(this._emulateDragOver, 50);
  2477. } else {
  2478. if (dataTransfer) {
  2479. dataTransfer.effectAllowed = 'move';
  2480. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2481. }
  2482. _on(document, 'drop', this);
  2483. setTimeout(this._dragStarted, 0);
  2484. }
  2485. },
  2486. _onDragOver: function _onDragOver( /**Event*/evt) {
  2487. var el = this.el,
  2488. target,
  2489. dragRect,
  2490. targetRect,
  2491. revert,
  2492. options = this.options,
  2493. group = options.group,
  2494. activeSortable = Sortable.active,
  2495. isOwner = activeGroup === group,
  2496. isMovingBetweenSortable = false,
  2497. canSort = options.sort;
  2498. if (evt.preventDefault !== void 0) {
  2499. evt.preventDefault();
  2500. !options.dragoverBubble && evt.stopPropagation();
  2501. }
  2502. if (dragEl.animated) {
  2503. return;
  2504. }
  2505. moved = true;
  2506. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2507. : putSortable === this || (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt)) && (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  2508. ) {
  2509. // Smart auto-scrolling
  2510. _autoScroll(evt, options, this.el);
  2511. if (_silent) {
  2512. return;
  2513. }
  2514. target = _closest(evt.target, options.draggable, el);
  2515. dragRect = dragEl.getBoundingClientRect();
  2516. if (putSortable !== this) {
  2517. putSortable = this;
  2518. isMovingBetweenSortable = true;
  2519. }
  2520. if (revert) {
  2521. _cloneHide(activeSortable, true);
  2522. parentEl = rootEl; // actualization
  2523. if (cloneEl || nextEl) {
  2524. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2525. } else if (!canSort) {
  2526. rootEl.appendChild(dragEl);
  2527. }
  2528. return;
  2529. }
  2530. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2531. //assign target only if condition is true
  2532. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2533. target = el.lastElementChild;
  2534. }
  2535. if (target) {
  2536. if (target.animated) {
  2537. return;
  2538. }
  2539. targetRect = target.getBoundingClientRect();
  2540. }
  2541. _cloneHide(activeSortable, isOwner);
  2542. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2543. if (!dragEl.contains(el)) {
  2544. el.appendChild(dragEl);
  2545. parentEl = el; // actualization
  2546. }
  2547. this._animate(dragRect, dragEl);
  2548. target && this._animate(targetRect, target);
  2549. }
  2550. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2551. if (lastEl !== target) {
  2552. lastEl = target;
  2553. lastCSS = _css(target);
  2554. lastParentCSS = _css(target.parentNode);
  2555. }
  2556. targetRect = target.getBoundingClientRect();
  2557. var width = targetRect.right - targetRect.left,
  2558. height = targetRect.bottom - targetRect.top,
  2559. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2560. isWide = target.offsetWidth > dragEl.offsetWidth,
  2561. isLong = target.offsetHeight > dragEl.offsetHeight,
  2562. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2563. nextSibling = target.nextElementSibling,
  2564. after = false;
  2565. if (floating) {
  2566. var elTop = dragEl.offsetTop,
  2567. tgTop = target.offsetTop;
  2568. if (elTop === tgTop) {
  2569. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2570. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2571. after = (evt.clientY - targetRect.top) / height > 0.5;
  2572. } else {
  2573. after = tgTop > elTop;
  2574. }
  2575. } else if (!isMovingBetweenSortable) {
  2576. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2577. }
  2578. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2579. if (moveVector !== false) {
  2580. if (moveVector === 1 || moveVector === -1) {
  2581. after = moveVector === 1;
  2582. }
  2583. _silent = true;
  2584. setTimeout(_unsilent, 30);
  2585. _cloneHide(activeSortable, isOwner);
  2586. if (!dragEl.contains(el)) {
  2587. if (after && !nextSibling) {
  2588. el.appendChild(dragEl);
  2589. } else {
  2590. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2591. }
  2592. }
  2593. parentEl = dragEl.parentNode; // actualization
  2594. this._animate(dragRect, dragEl);
  2595. this._animate(targetRect, target);
  2596. }
  2597. }
  2598. }
  2599. },
  2600. _animate: function _animate(prevRect, target) {
  2601. var ms = this.options.animation;
  2602. if (ms) {
  2603. var currentRect = target.getBoundingClientRect();
  2604. if (prevRect.nodeType === 1) {
  2605. prevRect = prevRect.getBoundingClientRect();
  2606. }
  2607. _css(target, 'transition', 'none');
  2608. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2609. target.offsetWidth; // repaint
  2610. _css(target, 'transition', 'all ' + ms + 'ms');
  2611. _css(target, 'transform', 'translate3d(0,0,0)');
  2612. clearTimeout(target.animated);
  2613. target.animated = setTimeout(function () {
  2614. _css(target, 'transition', '');
  2615. _css(target, 'transform', '');
  2616. target.animated = false;
  2617. }, ms);
  2618. }
  2619. },
  2620. _offUpEvents: function _offUpEvents() {
  2621. var ownerDocument = this.el.ownerDocument;
  2622. _off(document, 'touchmove', this._onTouchMove);
  2623. _off(document, 'pointermove', this._onTouchMove);
  2624. _off(ownerDocument, 'mouseup', this._onDrop);
  2625. _off(ownerDocument, 'touchend', this._onDrop);
  2626. _off(ownerDocument, 'pointerup', this._onDrop);
  2627. _off(ownerDocument, 'touchcancel', this._onDrop);
  2628. _off(ownerDocument, 'pointercancel', this._onDrop);
  2629. _off(ownerDocument, 'selectstart', this);
  2630. },
  2631. _onDrop: function _onDrop( /**Event*/evt) {
  2632. var el = this.el,
  2633. options = this.options;
  2634. clearInterval(this._loopId);
  2635. clearInterval(autoScroll.pid);
  2636. clearTimeout(this._dragStartTimer);
  2637. // Unbind events
  2638. _off(document, 'mousemove', this._onTouchMove);
  2639. if (this.nativeDraggable) {
  2640. _off(document, 'drop', this);
  2641. _off(el, 'dragstart', this._onDragStart);
  2642. }
  2643. this._offUpEvents();
  2644. if (evt) {
  2645. if (moved) {
  2646. evt.preventDefault();
  2647. !options.dropBubble && evt.stopPropagation();
  2648. }
  2649. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2650. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2651. // Remove clone
  2652. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2653. }
  2654. if (dragEl) {
  2655. if (this.nativeDraggable) {
  2656. _off(dragEl, 'dragend', this);
  2657. }
  2658. _disableDraggable(dragEl);
  2659. dragEl.style['will-change'] = '';
  2660. // Remove class's
  2661. _toggleClass(dragEl, this.options.ghostClass, false);
  2662. _toggleClass(dragEl, this.options.chosenClass, false);
  2663. // Drag stop event
  2664. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2665. if (rootEl !== parentEl) {
  2666. newIndex = _index(dragEl, options.draggable);
  2667. if (newIndex >= 0) {
  2668. // Add event
  2669. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  2670. // Remove event
  2671. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  2672. // drag from one list and drop into another
  2673. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2674. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2675. }
  2676. } else {
  2677. if (dragEl.nextSibling !== nextEl) {
  2678. // Get the index of the dragged element within its parent
  2679. newIndex = _index(dragEl, options.draggable);
  2680. if (newIndex >= 0) {
  2681. // drag & drop within the same list
  2682. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2683. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2684. }
  2685. }
  2686. }
  2687. if (Sortable.active) {
  2688. /* jshint eqnull:true */
  2689. if (newIndex == null || newIndex === -1) {
  2690. newIndex = oldIndex;
  2691. }
  2692. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  2693. // Save sorting
  2694. this.save();
  2695. }
  2696. }
  2697. }
  2698. this._nulling();
  2699. },
  2700. _nulling: function _nulling() {
  2701. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2702. savedInputChecked.forEach(function (el) {
  2703. el.checked = true;
  2704. });
  2705. savedInputChecked.length = 0;
  2706. },
  2707. handleEvent: function handleEvent( /**Event*/evt) {
  2708. switch (evt.type) {
  2709. case 'drop':
  2710. case 'dragend':
  2711. this._onDrop(evt);
  2712. break;
  2713. case 'dragover':
  2714. case 'dragenter':
  2715. if (dragEl) {
  2716. this._onDragOver(evt);
  2717. _globalDragOver(evt);
  2718. }
  2719. break;
  2720. case 'selectstart':
  2721. evt.preventDefault();
  2722. break;
  2723. }
  2724. },
  2725. /**
  2726. * Serializes the item into an array of string.
  2727. * @returns {String[]}
  2728. */
  2729. toArray: function toArray() {
  2730. var order = [],
  2731. el,
  2732. children = this.el.children,
  2733. i = 0,
  2734. n = children.length,
  2735. options = this.options;
  2736. for (; i < n; i++) {
  2737. el = children[i];
  2738. if (_closest(el, options.draggable, this.el)) {
  2739. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2740. }
  2741. }
  2742. return order;
  2743. },
  2744. /**
  2745. * Sorts the elements according to the array.
  2746. * @param {String[]} order order of the items
  2747. */
  2748. sort: function sort(order) {
  2749. var items = {},
  2750. rootEl = this.el;
  2751. this.toArray().forEach(function (id, i) {
  2752. var el = rootEl.children[i];
  2753. if (_closest(el, this.options.draggable, rootEl)) {
  2754. items[id] = el;
  2755. }
  2756. }, this);
  2757. order.forEach(function (id) {
  2758. if (items[id]) {
  2759. rootEl.removeChild(items[id]);
  2760. rootEl.appendChild(items[id]);
  2761. }
  2762. });
  2763. },
  2764. /**
  2765. * Save the current sorting
  2766. */
  2767. save: function save() {
  2768. var store = this.options.store;
  2769. store && store.set(this);
  2770. },
  2771. /**
  2772. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  2773. * @param {HTMLElement} el
  2774. * @param {String} [selector] default: `options.draggable`
  2775. * @returns {HTMLElement|null}
  2776. */
  2777. closest: function closest(el, selector) {
  2778. return _closest(el, selector || this.options.draggable, this.el);
  2779. },
  2780. /**
  2781. * Set/get option
  2782. * @param {string} name
  2783. * @param {*} [value]
  2784. * @returns {*}
  2785. */
  2786. option: function option(name, value) {
  2787. var options = this.options;
  2788. if (value === void 0) {
  2789. return options[name];
  2790. } else {
  2791. options[name] = value;
  2792. if (name === 'group') {
  2793. _prepareGroup(options);
  2794. }
  2795. }
  2796. },
  2797. /**
  2798. * Destroy
  2799. */
  2800. destroy: function destroy() {
  2801. var el = this.el;
  2802. el[expando] = null;
  2803. _off(el, 'mousedown', this._onTapStart);
  2804. _off(el, 'touchstart', this._onTapStart);
  2805. _off(el, 'pointerdown', this._onTapStart);
  2806. if (this.nativeDraggable) {
  2807. _off(el, 'dragover', this);
  2808. _off(el, 'dragenter', this);
  2809. }
  2810. // Remove draggable attributes
  2811. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2812. el.removeAttribute('draggable');
  2813. });
  2814. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2815. this._onDrop();
  2816. this.el = el = null;
  2817. }
  2818. };
  2819. function _cloneHide(sortable, state) {
  2820. if (sortable.lastPullMode !== 'clone') {
  2821. state = true;
  2822. }
  2823. if (cloneEl && cloneEl.state !== state) {
  2824. _css(cloneEl, 'display', state ? 'none' : '');
  2825. if (!state) {
  2826. if (cloneEl.state) {
  2827. if (sortable.options.group.revertClone) {
  2828. rootEl.insertBefore(cloneEl, nextEl);
  2829. sortable._animate(dragEl, cloneEl);
  2830. } else {
  2831. rootEl.insertBefore(cloneEl, dragEl);
  2832. }
  2833. }
  2834. }
  2835. cloneEl.state = state;
  2836. }
  2837. }
  2838. function _closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  2839. if (el) {
  2840. ctx = ctx || document;
  2841. do {
  2842. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2843. return el;
  2844. }
  2845. /* jshint boss:true */
  2846. } while (el = _getParentOrHost(el));
  2847. }
  2848. return null;
  2849. }
  2850. function _getParentOrHost(el) {
  2851. var parent = el.host;
  2852. return parent && parent.nodeType ? parent : el.parentNode;
  2853. }
  2854. function _globalDragOver( /**Event*/evt) {
  2855. if (evt.dataTransfer) {
  2856. evt.dataTransfer.dropEffect = 'move';
  2857. }
  2858. evt.preventDefault();
  2859. }
  2860. function _on(el, event, fn) {
  2861. el.addEventListener(event, fn, captureMode);
  2862. }
  2863. function _off(el, event, fn) {
  2864. el.removeEventListener(event, fn, captureMode);
  2865. }
  2866. function _toggleClass(el, name, state) {
  2867. if (el) {
  2868. if (el.classList) {
  2869. el.classList[state ? 'add' : 'remove'](name);
  2870. } else {
  2871. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2872. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2873. }
  2874. }
  2875. }
  2876. function _css(el, prop, val) {
  2877. var style = el && el.style;
  2878. if (style) {
  2879. if (val === void 0) {
  2880. if (document.defaultView && document.defaultView.getComputedStyle) {
  2881. val = document.defaultView.getComputedStyle(el, '');
  2882. } else if (el.currentStyle) {
  2883. val = el.currentStyle;
  2884. }
  2885. return prop === void 0 ? val : val[prop];
  2886. } else {
  2887. if (!(prop in style)) {
  2888. prop = '-webkit-' + prop;
  2889. }
  2890. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2891. }
  2892. }
  2893. }
  2894. function _find(ctx, tagName, iterator) {
  2895. if (ctx) {
  2896. var list = ctx.getElementsByTagName(tagName),
  2897. i = 0,
  2898. n = list.length;
  2899. if (iterator) {
  2900. for (; i < n; i++) {
  2901. iterator(list[i], i);
  2902. }
  2903. }
  2904. return list;
  2905. }
  2906. return [];
  2907. }
  2908. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2909. sortable = sortable || rootEl[expando];
  2910. var evt = document.createEvent('Event'),
  2911. options = sortable.options,
  2912. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2913. evt.initEvent(name, true, true);
  2914. evt.to = rootEl;
  2915. evt.from = fromEl || rootEl;
  2916. evt.item = targetEl || rootEl;
  2917. evt.clone = cloneEl;
  2918. evt.oldIndex = startIndex;
  2919. evt.newIndex = newIndex;
  2920. rootEl.dispatchEvent(evt);
  2921. if (options[onName]) {
  2922. options[onName].call(sortable, evt);
  2923. }
  2924. }
  2925. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2926. var evt,
  2927. sortable = fromEl[expando],
  2928. onMoveFn = sortable.options.onMove,
  2929. retVal;
  2930. evt = document.createEvent('Event');
  2931. evt.initEvent('move', true, true);
  2932. evt.to = toEl;
  2933. evt.from = fromEl;
  2934. evt.dragged = dragEl;
  2935. evt.draggedRect = dragRect;
  2936. evt.related = targetEl || toEl;
  2937. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2938. evt.willInsertAfter = willInsertAfter;
  2939. fromEl.dispatchEvent(evt);
  2940. if (onMoveFn) {
  2941. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2942. }
  2943. return retVal;
  2944. }
  2945. function _disableDraggable(el) {
  2946. el.draggable = false;
  2947. }
  2948. function _unsilent() {
  2949. _silent = false;
  2950. }
  2951. /** @returns {HTMLElement|false} */
  2952. function _ghostIsLast(el, evt) {
  2953. var lastEl = el.lastElementChild,
  2954. rect = lastEl.getBoundingClientRect();
  2955. // 5 — min delta
  2956. // abs — нельзя добавлять, а то глюки при наведении сверху
  2957. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2958. }
  2959. /**
  2960. * Generate id
  2961. * @param {HTMLElement} el
  2962. * @returns {String}
  2963. * @private
  2964. */
  2965. function _generateId(el) {
  2966. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2967. i = str.length,
  2968. sum = 0;
  2969. while (i--) {
  2970. sum += str.charCodeAt(i);
  2971. }
  2972. return sum.toString(36);
  2973. }
  2974. /**
  2975. * Returns the index of an element within its parent for a selected set of
  2976. * elements
  2977. * @param {HTMLElement} el
  2978. * @param {selector} selector
  2979. * @return {number}
  2980. */
  2981. function _index(el, selector) {
  2982. var index = 0;
  2983. if (!el || !el.parentNode) {
  2984. return -1;
  2985. }
  2986. while (el && (el = el.previousElementSibling)) {
  2987. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2988. index++;
  2989. }
  2990. }
  2991. return index;
  2992. }
  2993. function _matches( /**HTMLElement*/el, /**String*/selector) {
  2994. if (el) {
  2995. selector = selector.split('.');
  2996. var tag = selector.shift().toUpperCase(),
  2997. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  2998. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  2999. }
  3000. return false;
  3001. }
  3002. function _throttle(callback, ms) {
  3003. var args, _this;
  3004. return function () {
  3005. if (args === void 0) {
  3006. args = arguments;
  3007. _this = this;
  3008. setTimeout(function () {
  3009. if (args.length === 1) {
  3010. callback.call(_this, args[0]);
  3011. } else {
  3012. callback.apply(_this, args);
  3013. }
  3014. args = void 0;
  3015. }, ms);
  3016. }
  3017. };
  3018. }
  3019. function _extend(dst, src) {
  3020. if (dst && src) {
  3021. for (var key in src) {
  3022. if (src.hasOwnProperty(key)) {
  3023. dst[key] = src[key];
  3024. }
  3025. }
  3026. }
  3027. return dst;
  3028. }
  3029. function _clone(el) {
  3030. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3031. }
  3032. function _saveInputCheckedState(root) {
  3033. var inputs = root.getElementsByTagName('input');
  3034. var idx = inputs.length;
  3035. while (idx--) {
  3036. var el = inputs[idx];
  3037. el.checked && savedInputChecked.push(el);
  3038. }
  3039. }
  3040. // Fixed #973:
  3041. _on(document, 'touchmove', function (evt) {
  3042. if (Sortable.active) {
  3043. evt.preventDefault();
  3044. }
  3045. });
  3046. try {
  3047. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3048. get: function get() {
  3049. captureMode = {
  3050. capture: false,
  3051. passive: false
  3052. };
  3053. }
  3054. }));
  3055. } catch (err) {}
  3056. // Export utils
  3057. Sortable.utils = {
  3058. on: _on,
  3059. off: _off,
  3060. css: _css,
  3061. find: _find,
  3062. is: function is(el, selector) {
  3063. return !!_closest(el, selector, el);
  3064. },
  3065. extend: _extend,
  3066. throttle: _throttle,
  3067. closest: _closest,
  3068. toggleClass: _toggleClass,
  3069. clone: _clone,
  3070. index: _index
  3071. };
  3072. /**
  3073. * Create sortable instance
  3074. * @param {HTMLElement} el
  3075. * @param {Object} [options]
  3076. */
  3077. Sortable.create = function (el, options) {
  3078. return new Sortable(el, options);
  3079. };
  3080. // Export
  3081. Sortable.version = '1.6.1';
  3082. return Sortable;
  3083. });
  3084. /***/ }),
  3085. /***/ "./js/assessment/ivprogAssessment.js":
  3086. /*!*******************************************!*\
  3087. !*** ./js/assessment/ivprogAssessment.js ***!
  3088. \*******************************************/
  3089. /*! no static exports found */
  3090. /***/ (function(module, exports, __webpack_require__) {
  3091. "use strict";
  3092. Object.defineProperty(exports, "__esModule", {
  3093. value: true
  3094. });
  3095. exports.IVProgAssessment = undefined;
  3096. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3097. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3098. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3099. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3100. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3101. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3103. var IVProgAssessment = exports.IVProgAssessment = function () {
  3104. function IVProgAssessment(textCode, testCases, domConsole) {
  3105. _classCallCheck(this, IVProgAssessment);
  3106. this.textCode = textCode;
  3107. this.testCases = testCases;
  3108. this.domConsole = domConsole;
  3109. }
  3110. _createClass(IVProgAssessment, [{
  3111. key: "runTest",
  3112. value: function runTest() {
  3113. var _this = this;
  3114. try {
  3115. // try and show error messages through domconsole
  3116. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  3117. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  3118. var validTree = semantic.analyseTree();
  3119. // loop test cases and show messages through domconsole
  3120. var partialTests = this.testCases.map(function (t, name) {
  3121. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  3122. });
  3123. var testResult = partialTests.reduce(function (acc, curr) {
  3124. return acc.then(curr);
  3125. }, Promise.resolve(0));
  3126. return testResult.then(function (total) {
  3127. return Promise.resolve(total / _this.testCases.length);
  3128. }).catch(function (err) {
  3129. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3130. _this.domConsole.err(err.message);
  3131. return Promise.resolve(0);
  3132. });
  3133. } catch (error) {
  3134. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3135. this.domConsole.err(error.message);
  3136. return Promise.resolve(0);
  3137. }
  3138. }
  3139. }, {
  3140. key: "evaluateTestCase",
  3141. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3142. var outerThis = this;
  3143. var input = new _inputTest.InputTest(inputList);
  3144. var output = new _outputTest.OutputTest();
  3145. prog.registerInput(input);
  3146. prog.registerOutput(output);
  3147. var startTime = Date.now();
  3148. return prog.interpretAST().then(function (_) {
  3149. var millis = Date.now() - startTime;
  3150. if (input.inputList.length !== input.index) {
  3151. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  3152. outerThis.domConsole.info("Levou " + millis + "ms");
  3153. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3154. } else if (output.list.length < outputList.length) {
  3155. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3156. outerThis.domConsole.info("Levou " + millis + "ms");
  3157. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3158. } else if (output.list.length > outputList.length) {
  3159. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3160. outerThis.domConsole.info("Levou " + millis + "ms");
  3161. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3162. } else {
  3163. var isOk = outerThis.checkOutput(output.list, outputList);
  3164. if (!isOk) {
  3165. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3166. outerThis.domConsole.info("Levou " + millis + "ms");
  3167. return Promise.resolve(accumulator);
  3168. } else {
  3169. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  3170. outerThis.domConsole.info("Levou " + millis + "ms");
  3171. return Promise.resolve(accumulator + 1);
  3172. }
  3173. }
  3174. }).catch(function (_) {
  3175. return Promise.resolve(accumulator);
  3176. });
  3177. }
  3178. }, {
  3179. key: "partialEvaluateTestCase",
  3180. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3181. var _this2 = this;
  3182. var partial = function partial(accumulator) {
  3183. return _this2.evaluateTestCase(prog, inputList, outputList, name, accumulator);
  3184. };
  3185. partial = partial.bind(this);
  3186. return partial;
  3187. }
  3188. }, {
  3189. key: "checkOutput",
  3190. value: function checkOutput(aList, bList) {
  3191. for (var i = 0; i < aList.length; i++) {
  3192. var outValue = aList[i];
  3193. if (outValue != bList[i]) {
  3194. return false;
  3195. }
  3196. }
  3197. return true;
  3198. }
  3199. }]);
  3200. return IVProgAssessment;
  3201. }();
  3202. /***/ }),
  3203. /***/ "./js/ast/commands/arrayAssign.js":
  3204. /*!****************************************!*\
  3205. !*** ./js/ast/commands/arrayAssign.js ***!
  3206. \****************************************/
  3207. /*! no static exports found */
  3208. /***/ (function(module, exports, __webpack_require__) {
  3209. "use strict";
  3210. Object.defineProperty(exports, "__esModule", {
  3211. value: true
  3212. });
  3213. exports.ArrayIndexAssign = undefined;
  3214. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3215. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3216. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3217. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3218. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3219. _inherits(ArrayIndexAssign, _Assign);
  3220. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3221. _classCallCheck(this, ArrayIndexAssign);
  3222. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3223. _this.line = lineExpression;
  3224. _this.column = columnExpression;
  3225. return _this;
  3226. }
  3227. return ArrayIndexAssign;
  3228. }(_assign.Assign);
  3229. /***/ }),
  3230. /***/ "./js/ast/commands/arrayDeclaration.js":
  3231. /*!*********************************************!*\
  3232. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3233. \*********************************************/
  3234. /*! no static exports found */
  3235. /***/ (function(module, exports, __webpack_require__) {
  3236. "use strict";
  3237. Object.defineProperty(exports, "__esModule", {
  3238. value: true
  3239. });
  3240. exports.ArrayDeclaration = undefined;
  3241. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3242. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3243. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3244. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3245. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3246. _inherits(ArrayDeclaration, _Declaration);
  3247. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3248. _classCallCheck(this, ArrayDeclaration);
  3249. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3250. _this.lines = lines;
  3251. _this.columns = columns;
  3252. return _this;
  3253. }
  3254. return ArrayDeclaration;
  3255. }(_declaration.Declaration);
  3256. /***/ }),
  3257. /***/ "./js/ast/commands/assign.js":
  3258. /*!***********************************!*\
  3259. !*** ./js/ast/commands/assign.js ***!
  3260. \***********************************/
  3261. /*! no static exports found */
  3262. /***/ (function(module, exports, __webpack_require__) {
  3263. "use strict";
  3264. Object.defineProperty(exports, "__esModule", {
  3265. value: true
  3266. });
  3267. exports.Assign = undefined;
  3268. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3269. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3270. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3271. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3272. var Assign = exports.Assign = function (_Command) {
  3273. _inherits(Assign, _Command);
  3274. function Assign(id, expression) {
  3275. _classCallCheck(this, Assign);
  3276. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3277. _this.id = id;
  3278. _this.expression = expression;
  3279. return _this;
  3280. }
  3281. return Assign;
  3282. }(_command.Command);
  3283. /***/ }),
  3284. /***/ "./js/ast/commands/break.js":
  3285. /*!**********************************!*\
  3286. !*** ./js/ast/commands/break.js ***!
  3287. \**********************************/
  3288. /*! no static exports found */
  3289. /***/ (function(module, exports, __webpack_require__) {
  3290. "use strict";
  3291. Object.defineProperty(exports, "__esModule", {
  3292. value: true
  3293. });
  3294. exports.Break = undefined;
  3295. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3296. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3297. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3298. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3299. var Break = exports.Break = function (_Command) {
  3300. _inherits(Break, _Command);
  3301. function Break() {
  3302. _classCallCheck(this, Break);
  3303. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3304. }
  3305. return Break;
  3306. }(_command.Command);
  3307. /***/ }),
  3308. /***/ "./js/ast/commands/case.js":
  3309. /*!*********************************!*\
  3310. !*** ./js/ast/commands/case.js ***!
  3311. \*********************************/
  3312. /*! no static exports found */
  3313. /***/ (function(module, exports, __webpack_require__) {
  3314. "use strict";
  3315. Object.defineProperty(exports, "__esModule", {
  3316. value: true
  3317. });
  3318. exports.Case = undefined;
  3319. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3320. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3321. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3322. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3323. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3324. var Case = exports.Case = function (_Command) {
  3325. _inherits(Case, _Command);
  3326. function Case(expression) {
  3327. _classCallCheck(this, Case);
  3328. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3329. _this.expression = expression;
  3330. _this.commands = [];
  3331. return _this;
  3332. }
  3333. _createClass(Case, [{
  3334. key: 'setCommands',
  3335. value: function setCommands(commands) {
  3336. this.commands = commands;
  3337. }
  3338. }, {
  3339. key: 'isDefault',
  3340. get: function get() {
  3341. return this.expression === null;
  3342. }
  3343. }]);
  3344. return Case;
  3345. }(_command.Command);
  3346. /***/ }),
  3347. /***/ "./js/ast/commands/command.js":
  3348. /*!************************************!*\
  3349. !*** ./js/ast/commands/command.js ***!
  3350. \************************************/
  3351. /*! no static exports found */
  3352. /***/ (function(module, exports, __webpack_require__) {
  3353. "use strict";
  3354. Object.defineProperty(exports, "__esModule", {
  3355. value: true
  3356. });
  3357. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3358. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3359. var Command = exports.Command = function () {
  3360. function Command() {
  3361. _classCallCheck(this, Command);
  3362. this._sourceInfo = null;
  3363. }
  3364. _createClass(Command, [{
  3365. key: "sourceInfo",
  3366. set: function set(sourceInfo) {
  3367. this._sourceInfo = sourceInfo;
  3368. },
  3369. get: function get() {
  3370. return this._sourceInfo;
  3371. }
  3372. }]);
  3373. return Command;
  3374. }();
  3375. /***/ }),
  3376. /***/ "./js/ast/commands/commandBlock.js":
  3377. /*!*****************************************!*\
  3378. !*** ./js/ast/commands/commandBlock.js ***!
  3379. \*****************************************/
  3380. /*! no static exports found */
  3381. /***/ (function(module, exports, __webpack_require__) {
  3382. "use strict";
  3383. Object.defineProperty(exports, "__esModule", {
  3384. value: true
  3385. });
  3386. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3387. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3388. var CommandBlock = exports.CommandBlock = function () {
  3389. function CommandBlock(variables, commands) {
  3390. _classCallCheck(this, CommandBlock);
  3391. this.variables = variables;
  3392. this.commands = commands;
  3393. this._sourceInfo = null;
  3394. }
  3395. _createClass(CommandBlock, [{
  3396. key: "sourceInfo",
  3397. set: function set(sourceInfo) {
  3398. this._sourceInfo = sourceInfo;
  3399. },
  3400. get: function get() {
  3401. return this._sourceInfo;
  3402. }
  3403. }]);
  3404. return CommandBlock;
  3405. }();
  3406. /***/ }),
  3407. /***/ "./js/ast/commands/declaration.js":
  3408. /*!****************************************!*\
  3409. !*** ./js/ast/commands/declaration.js ***!
  3410. \****************************************/
  3411. /*! no static exports found */
  3412. /***/ (function(module, exports, __webpack_require__) {
  3413. "use strict";
  3414. Object.defineProperty(exports, "__esModule", {
  3415. value: true
  3416. });
  3417. exports.Declaration = undefined;
  3418. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3419. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3420. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3421. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3422. var Declaration = exports.Declaration = function (_Command) {
  3423. _inherits(Declaration, _Command);
  3424. function Declaration(id, type, initial, isConst) {
  3425. _classCallCheck(this, Declaration);
  3426. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3427. _this.id = id;
  3428. _this.type = type;
  3429. _this.initial = initial;
  3430. _this.isConst = isConst;
  3431. return _this;
  3432. }
  3433. return Declaration;
  3434. }(_command.Command);
  3435. /***/ }),
  3436. /***/ "./js/ast/commands/doWhile.js":
  3437. /*!************************************!*\
  3438. !*** ./js/ast/commands/doWhile.js ***!
  3439. \************************************/
  3440. /*! no static exports found */
  3441. /***/ (function(module, exports, __webpack_require__) {
  3442. "use strict";
  3443. Object.defineProperty(exports, "__esModule", {
  3444. value: true
  3445. });
  3446. exports.DoWhile = undefined;
  3447. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3448. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3449. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3450. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3451. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3452. var DoWhile = exports.DoWhile = function (_While) {
  3453. _inherits(DoWhile, _While);
  3454. function DoWhile(condition, commandBlock) {
  3455. _classCallCheck(this, DoWhile);
  3456. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3457. }
  3458. _createClass(DoWhile, [{
  3459. key: 'testFirst',
  3460. get: function get() {
  3461. return false;
  3462. }
  3463. }]);
  3464. return DoWhile;
  3465. }(_while.While);
  3466. /***/ }),
  3467. /***/ "./js/ast/commands/for.js":
  3468. /*!********************************!*\
  3469. !*** ./js/ast/commands/for.js ***!
  3470. \********************************/
  3471. /*! no static exports found */
  3472. /***/ (function(module, exports, __webpack_require__) {
  3473. "use strict";
  3474. Object.defineProperty(exports, "__esModule", {
  3475. value: true
  3476. });
  3477. exports.For = undefined;
  3478. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3479. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3480. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3481. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3482. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3483. var For = exports.For = function (_Command) {
  3484. _inherits(For, _Command);
  3485. function For(assignment, condition, increment, commandBlock) {
  3486. _classCallCheck(this, For);
  3487. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3488. _this.assignment = assignment;
  3489. _this.condition = condition;
  3490. _this.increment = increment;
  3491. _this.commandBlock = commandBlock;
  3492. return _this;
  3493. }
  3494. _createClass(For, [{
  3495. key: 'commands',
  3496. get: function get() {
  3497. return this.commandBlock.commands;
  3498. }
  3499. }]);
  3500. return For;
  3501. }(_command.Command);
  3502. /***/ }),
  3503. /***/ "./js/ast/commands/formalParameter.js":
  3504. /*!********************************************!*\
  3505. !*** ./js/ast/commands/formalParameter.js ***!
  3506. \********************************************/
  3507. /*! no static exports found */
  3508. /***/ (function(module, exports, __webpack_require__) {
  3509. "use strict";
  3510. Object.defineProperty(exports, "__esModule", {
  3511. value: true
  3512. });
  3513. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3514. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3515. var FormalParameter = exports.FormalParameter = function () {
  3516. function FormalParameter(type, id) {
  3517. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3518. _classCallCheck(this, FormalParameter);
  3519. this.type = type;
  3520. this.id = id;
  3521. this.byRef = byRef;
  3522. this._sourceInfo = null;
  3523. }
  3524. _createClass(FormalParameter, [{
  3525. key: "sourceInfo",
  3526. set: function set(sourceInfo) {
  3527. this._sourceInfo = sourceInfo;
  3528. },
  3529. get: function get() {
  3530. return this._sourceInfo;
  3531. }
  3532. }]);
  3533. return FormalParameter;
  3534. }();
  3535. /***/ }),
  3536. /***/ "./js/ast/commands/function.js":
  3537. /*!*************************************!*\
  3538. !*** ./js/ast/commands/function.js ***!
  3539. \*************************************/
  3540. /*! no static exports found */
  3541. /***/ (function(module, exports, __webpack_require__) {
  3542. "use strict";
  3543. Object.defineProperty(exports, "__esModule", {
  3544. value: true
  3545. });
  3546. exports.Function = undefined;
  3547. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3548. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3549. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3550. var Function = exports.Function = function () {
  3551. function Function(name, returnType, formalParameters, commandBlock) {
  3552. _classCallCheck(this, Function);
  3553. this.name = name;
  3554. this.returnType = returnType;
  3555. this.formalParameters = formalParameters;
  3556. this.commandBlock = commandBlock;
  3557. this._sourceInfo = null;
  3558. }
  3559. _createClass(Function, [{
  3560. key: 'isMain',
  3561. get: function get() {
  3562. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3563. }
  3564. }, {
  3565. key: 'commands',
  3566. get: function get() {
  3567. return this.commandBlock.commands;
  3568. }
  3569. }, {
  3570. key: 'variablesDeclarations',
  3571. get: function get() {
  3572. return this.commandBlock.variables;
  3573. }
  3574. }, {
  3575. key: 'sourceInfo',
  3576. set: function set(sourceInfo) {
  3577. this._sourceInfo = sourceInfo;
  3578. },
  3579. get: function get() {
  3580. return this._sourceInfo;
  3581. }
  3582. }]);
  3583. return Function;
  3584. }();
  3585. /***/ }),
  3586. /***/ "./js/ast/commands/ifThenElse.js":
  3587. /*!***************************************!*\
  3588. !*** ./js/ast/commands/ifThenElse.js ***!
  3589. \***************************************/
  3590. /*! no static exports found */
  3591. /***/ (function(module, exports, __webpack_require__) {
  3592. "use strict";
  3593. Object.defineProperty(exports, "__esModule", {
  3594. value: true
  3595. });
  3596. exports.IfThenElse = undefined;
  3597. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3598. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3599. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3600. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3601. var IfThenElse = exports.IfThenElse = function (_Command) {
  3602. _inherits(IfThenElse, _Command);
  3603. function IfThenElse(condition, ifTrue, ifFalse) {
  3604. _classCallCheck(this, IfThenElse);
  3605. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3606. _this.condition = condition;
  3607. _this.ifTrue = ifTrue;
  3608. _this.ifFalse = ifFalse;
  3609. return _this;
  3610. }
  3611. return IfThenElse;
  3612. }(_command.Command);
  3613. /***/ }),
  3614. /***/ "./js/ast/commands/index.js":
  3615. /*!**********************************!*\
  3616. !*** ./js/ast/commands/index.js ***!
  3617. \**********************************/
  3618. /*! no static exports found */
  3619. /***/ (function(module, exports, __webpack_require__) {
  3620. "use strict";
  3621. Object.defineProperty(exports, "__esModule", {
  3622. value: true
  3623. });
  3624. exports.FunctionCall = exports.FormalParameter = exports.SysCall = exports.Case = exports.Switch = exports.DoWhile = exports.CommandBlock = exports.IfThenElse = exports.Function = exports.For = exports.While = exports.ArrayDeclaration = exports.Declaration = exports.ArrayIndexAssign = exports.Assign = exports.Return = exports.Break = undefined;
  3625. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3626. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3627. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3628. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3629. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3630. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3631. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3632. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3633. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3634. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3635. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3636. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3637. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3638. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3639. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3640. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3641. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3642. //Proxy to expression since they do exatcly the same thing
  3643. exports.Break = _break.Break;
  3644. exports.Return = _return.Return;
  3645. exports.Assign = _assign.Assign;
  3646. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3647. exports.Declaration = _declaration.Declaration;
  3648. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3649. exports.While = _while.While;
  3650. exports.For = _for.For;
  3651. exports.Function = _function.Function;
  3652. exports.IfThenElse = _ifThenElse.IfThenElse;
  3653. exports.CommandBlock = _commandBlock.CommandBlock;
  3654. exports.DoWhile = _doWhile.DoWhile;
  3655. exports.Switch = _switch.Switch;
  3656. exports.Case = _case.Case;
  3657. exports.SysCall = _sysCall.SysCall;
  3658. exports.FormalParameter = _formalParameter.FormalParameter;
  3659. exports.FunctionCall = _functionCall.FunctionCall;
  3660. /***/ }),
  3661. /***/ "./js/ast/commands/return.js":
  3662. /*!***********************************!*\
  3663. !*** ./js/ast/commands/return.js ***!
  3664. \***********************************/
  3665. /*! no static exports found */
  3666. /***/ (function(module, exports, __webpack_require__) {
  3667. "use strict";
  3668. Object.defineProperty(exports, "__esModule", {
  3669. value: true
  3670. });
  3671. exports.Return = undefined;
  3672. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3673. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3674. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3675. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3676. var Return = exports.Return = function (_Command) {
  3677. _inherits(Return, _Command);
  3678. function Return(expression) {
  3679. _classCallCheck(this, Return);
  3680. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3681. _this.expression = expression;
  3682. return _this;
  3683. }
  3684. return Return;
  3685. }(_command.Command);
  3686. /***/ }),
  3687. /***/ "./js/ast/commands/switch.js":
  3688. /*!***********************************!*\
  3689. !*** ./js/ast/commands/switch.js ***!
  3690. \***********************************/
  3691. /*! no static exports found */
  3692. /***/ (function(module, exports, __webpack_require__) {
  3693. "use strict";
  3694. Object.defineProperty(exports, "__esModule", {
  3695. value: true
  3696. });
  3697. exports.Switch = undefined;
  3698. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3699. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3700. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3701. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3702. var Switch = exports.Switch = function (_Command) {
  3703. _inherits(Switch, _Command);
  3704. function Switch(expression, cases) {
  3705. _classCallCheck(this, Switch);
  3706. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3707. _this.expression = expression;
  3708. _this.cases = cases;
  3709. return _this;
  3710. }
  3711. return Switch;
  3712. }(_command.Command);
  3713. /***/ }),
  3714. /***/ "./js/ast/commands/sysCall.js":
  3715. /*!************************************!*\
  3716. !*** ./js/ast/commands/sysCall.js ***!
  3717. \************************************/
  3718. /*! no static exports found */
  3719. /***/ (function(module, exports, __webpack_require__) {
  3720. "use strict";
  3721. Object.defineProperty(exports, "__esModule", {
  3722. value: true
  3723. });
  3724. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3725. /**
  3726. * This class represents all the language defined functions.
  3727. * The language processor uses the id provided here to properly execute the desired function.
  3728. * The function is actually implemented inside the language processor.
  3729. * All the functions can be found at: js/processor/definedFunctions.js
  3730. */
  3731. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3732. _classCallCheck(this, SysCall);
  3733. this.langFunc = langFunc;
  3734. };
  3735. /***/ }),
  3736. /***/ "./js/ast/commands/while.js":
  3737. /*!**********************************!*\
  3738. !*** ./js/ast/commands/while.js ***!
  3739. \**********************************/
  3740. /*! no static exports found */
  3741. /***/ (function(module, exports, __webpack_require__) {
  3742. "use strict";
  3743. Object.defineProperty(exports, "__esModule", {
  3744. value: true
  3745. });
  3746. exports.While = undefined;
  3747. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3748. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3749. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3750. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3751. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3752. var While = exports.While = function (_Command) {
  3753. _inherits(While, _Command);
  3754. function While(expression, commandBlock) {
  3755. _classCallCheck(this, While);
  3756. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3757. _this.expression = expression;
  3758. _this.commandBlock = commandBlock;
  3759. return _this;
  3760. }
  3761. _createClass(While, [{
  3762. key: 'commands',
  3763. get: function get() {
  3764. return this.commandBlock.commands;
  3765. }
  3766. }, {
  3767. key: 'testFirst',
  3768. get: function get() {
  3769. return true;
  3770. }
  3771. }]);
  3772. return While;
  3773. }(_command.Command);
  3774. /***/ }),
  3775. /***/ "./js/ast/error/syntaxError.js":
  3776. /*!*************************************!*\
  3777. !*** ./js/ast/error/syntaxError.js ***!
  3778. \*************************************/
  3779. /*! no static exports found */
  3780. /***/ (function(module, exports, __webpack_require__) {
  3781. "use strict";
  3782. Object.defineProperty(exports, "__esModule", {
  3783. value: true
  3784. });
  3785. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3786. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3787. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3788. var SyntaxError = exports.SyntaxError = function (_Error) {
  3789. _inherits(SyntaxError, _Error);
  3790. function SyntaxError() {
  3791. var _ref;
  3792. _classCallCheck(this, SyntaxError);
  3793. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3794. msg[_key] = arguments[_key];
  3795. }
  3796. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3797. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3798. return _this;
  3799. }
  3800. return SyntaxError;
  3801. }(Error);
  3802. /***/ }),
  3803. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3804. /*!********************************************!*\
  3805. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3806. \********************************************/
  3807. /*! no static exports found */
  3808. /***/ (function(module, exports, __webpack_require__) {
  3809. "use strict";
  3810. Object.defineProperty(exports, "__esModule", {
  3811. value: true
  3812. });
  3813. exports.SyntaxErrorFactory = undefined;
  3814. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3815. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3816. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3817. extra_lines: function extra_lines() {
  3818. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3819. },
  3820. token_missing_one: function token_missing_one(expected, token) {
  3821. var context = [expected, token.text, token.line, token.column];
  3822. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3823. },
  3824. token_missing_list: function token_missing_list(expectedList, token) {
  3825. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3826. return SyntaxErrorFactory.token_missing_one(line, token);
  3827. },
  3828. id_missing: function id_missing(token) {
  3829. var context = [token.text, token.line, token.column];
  3830. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3831. },
  3832. eos_missing: function eos_missing(token) {
  3833. var context = [token.line, token.column];
  3834. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3835. },
  3836. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3837. var context = [token.line, token.column, typeName];
  3838. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3839. },
  3840. invalid_array_size: function invalid_array_size(token) {
  3841. var context = [token.line];
  3842. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3843. },
  3844. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3845. var context = [name, typeName, token.line];
  3846. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3847. },
  3848. invalid_var_declaration: function invalid_var_declaration(token) {
  3849. var context = [token.line];
  3850. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3851. },
  3852. invalid_break_command: function invalid_break_command(cmdName, token) {
  3853. var context = [token.line, cmdName];
  3854. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3855. },
  3856. invalid_terminal: function invalid_terminal(token) {
  3857. var context = [token.text, token.line, token.column];
  3858. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3859. },
  3860. invalid_type: function invalid_type(list, token) {
  3861. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3862. var context = [token.text, token.line, token.column, line];
  3863. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3864. },
  3865. const_not_init: function const_not_init(token) {
  3866. var context = [token.line, token.column];
  3867. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3868. },
  3869. invalid_id_format: function invalid_id_format(token) {
  3870. var context = [token.text, token.line, token.column];
  3871. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3872. },
  3873. duplicate_function: function duplicate_function(token) {
  3874. var context = [token.text, token.line, token.column];
  3875. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3876. },
  3877. main_parameters: function main_parameters() {
  3878. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3879. },
  3880. duplicate_variable: function duplicate_variable(token) {
  3881. var context = [token.text, token.line, token.column];
  3882. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3883. }
  3884. });
  3885. /***/ }),
  3886. /***/ "./js/ast/expressions/arrayAccess.js":
  3887. /*!*******************************************!*\
  3888. !*** ./js/ast/expressions/arrayAccess.js ***!
  3889. \*******************************************/
  3890. /*! no static exports found */
  3891. /***/ (function(module, exports, __webpack_require__) {
  3892. "use strict";
  3893. Object.defineProperty(exports, "__esModule", {
  3894. value: true
  3895. });
  3896. exports.ArrayAccess = undefined;
  3897. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3898. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3899. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3900. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3901. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3902. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3903. _inherits(ArrayAccess, _Expression);
  3904. function ArrayAccess(id, line, column) {
  3905. _classCallCheck(this, ArrayAccess);
  3906. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3907. _this.id = id;
  3908. _this.line = line;
  3909. _this.column = column;
  3910. return _this;
  3911. }
  3912. _createClass(ArrayAccess, [{
  3913. key: 'toString',
  3914. value: function toString() {
  3915. var strLine = this.line.toString();
  3916. var strColumn = null;
  3917. if (this.column) {
  3918. strColumn = this.column.toString();
  3919. }
  3920. if (strColumn) {
  3921. return this.id + '[' + strLine + '][' + strColumn + ']';
  3922. } else {
  3923. return this.id + '[' + strLine + ']';
  3924. }
  3925. }
  3926. }]);
  3927. return ArrayAccess;
  3928. }(_expression.Expression);
  3929. /***/ }),
  3930. /***/ "./js/ast/expressions/arrayLiteral.js":
  3931. /*!********************************************!*\
  3932. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3933. \********************************************/
  3934. /*! no static exports found */
  3935. /***/ (function(module, exports, __webpack_require__) {
  3936. "use strict";
  3937. Object.defineProperty(exports, "__esModule", {
  3938. value: true
  3939. });
  3940. exports.ArrayLiteral = undefined;
  3941. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3942. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3943. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3944. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3945. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3946. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3947. _inherits(ArrayLiteral, _Literal);
  3948. function ArrayLiteral(type, value) {
  3949. _classCallCheck(this, ArrayLiteral);
  3950. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3951. _this.value = value;
  3952. return _this;
  3953. }
  3954. _createClass(ArrayLiteral, [{
  3955. key: 'validateType',
  3956. value: function validateType() {
  3957. // let valid = true;
  3958. // if(this.columns !== null) {
  3959. // const len = this.columns;
  3960. // const len2 = this.lines;
  3961. // for (let i = len - 1; i >= 0; i--) {
  3962. // for (let j = len2 - 1; j >= 0; j--) {
  3963. // if(this.value[i].value[j].type !== this.subtype) {
  3964. // valid = false;
  3965. // break;
  3966. // }
  3967. // }
  3968. // }
  3969. // } else {
  3970. // const len = this.lines;
  3971. // for (var i = len - 1; i >= 0; i--) {
  3972. // if(this.value[i].type !== this.subtype) {
  3973. // valid = false;
  3974. // break;
  3975. // }
  3976. // }
  3977. // }
  3978. return true; //valid;
  3979. }
  3980. }, {
  3981. key: 'validateSize',
  3982. value: function validateSize() {
  3983. var valid = true;
  3984. if (this.columns !== null) {
  3985. var equalityTest = data.value.map(function (v) {
  3986. return v.length;
  3987. }).reduce(function (old, next) {
  3988. if (old === null) {
  3989. return next;
  3990. } else if (old === next) {
  3991. return old;
  3992. } else {
  3993. return -1;
  3994. }
  3995. }, null);
  3996. valid = equalityTest !== -1;
  3997. }
  3998. return valid;
  3999. }
  4000. }, {
  4001. key: 'toString',
  4002. value: function toString() {
  4003. var strList = this.value.map(function (arrayLiteral) {
  4004. return arrayLiteral.toString();
  4005. });
  4006. return "{" + strList.join(',') + "}";
  4007. }
  4008. }, {
  4009. key: 'subtype',
  4010. get: function get() {
  4011. var element = this.value[0];
  4012. if (element instanceof ArrayLiteral) {
  4013. return element.value[0].type;
  4014. } else {
  4015. return element.type;
  4016. }
  4017. }
  4018. }, {
  4019. key: 'lines',
  4020. get: function get() {
  4021. return this.value.length;
  4022. }
  4023. }, {
  4024. key: 'columns',
  4025. get: function get() {
  4026. var element = this.value[0];
  4027. if (!(element instanceof ArrayLiteral)) {
  4028. return null;
  4029. } else {
  4030. return element.value[0].length;
  4031. }
  4032. }
  4033. }, {
  4034. key: 'isVector',
  4035. get: function get() {
  4036. return this.columns === null;
  4037. }
  4038. }, {
  4039. key: 'isValid',
  4040. get: function get() {
  4041. return true; //this.validateType() && this.validateSize();
  4042. }
  4043. }]);
  4044. return ArrayLiteral;
  4045. }(_literal.Literal);
  4046. /***/ }),
  4047. /***/ "./js/ast/expressions/boolLiteral.js":
  4048. /*!*******************************************!*\
  4049. !*** ./js/ast/expressions/boolLiteral.js ***!
  4050. \*******************************************/
  4051. /*! no static exports found */
  4052. /***/ (function(module, exports, __webpack_require__) {
  4053. "use strict";
  4054. Object.defineProperty(exports, "__esModule", {
  4055. value: true
  4056. });
  4057. exports.BoolLiteral = undefined;
  4058. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4059. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4060. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4061. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4062. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4063. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4064. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4065. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4066. _inherits(BoolLiteral, _Literal);
  4067. function BoolLiteral(value) {
  4068. _classCallCheck(this, BoolLiteral);
  4069. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4070. _this.value = value;
  4071. return _this;
  4072. }
  4073. _createClass(BoolLiteral, [{
  4074. key: 'toString',
  4075. value: function toString() {
  4076. return (0, _parsers.convertBoolToString)(this.value);
  4077. }
  4078. }]);
  4079. return BoolLiteral;
  4080. }(_literal.Literal);
  4081. /***/ }),
  4082. /***/ "./js/ast/expressions/expression.js":
  4083. /*!******************************************!*\
  4084. !*** ./js/ast/expressions/expression.js ***!
  4085. \******************************************/
  4086. /*! no static exports found */
  4087. /***/ (function(module, exports, __webpack_require__) {
  4088. "use strict";
  4089. Object.defineProperty(exports, "__esModule", {
  4090. value: true
  4091. });
  4092. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4093. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4094. var Expression = exports.Expression = function () {
  4095. function Expression() {
  4096. _classCallCheck(this, Expression);
  4097. this._sourceInfo = null;
  4098. }
  4099. _createClass(Expression, [{
  4100. key: "sourceInfo",
  4101. set: function set(sourceInfo) {
  4102. this._sourceInfo = sourceInfo;
  4103. },
  4104. get: function get() {
  4105. return this._sourceInfo;
  4106. }
  4107. }]);
  4108. return Expression;
  4109. }();
  4110. /***/ }),
  4111. /***/ "./js/ast/expressions/functionCall.js":
  4112. /*!********************************************!*\
  4113. !*** ./js/ast/expressions/functionCall.js ***!
  4114. \********************************************/
  4115. /*! no static exports found */
  4116. /***/ (function(module, exports, __webpack_require__) {
  4117. "use strict";
  4118. Object.defineProperty(exports, "__esModule", {
  4119. value: true
  4120. });
  4121. exports.FunctionCall = undefined;
  4122. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4123. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4124. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4125. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4126. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4127. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4128. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4129. _inherits(FunctionCall, _Expression);
  4130. function FunctionCall(id, actualParameters) {
  4131. _classCallCheck(this, FunctionCall);
  4132. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4133. _this.id = id;
  4134. _this.actualParameters = actualParameters;
  4135. return _this;
  4136. }
  4137. _createClass(FunctionCall, [{
  4138. key: 'toString',
  4139. value: function toString() {
  4140. var name = null;
  4141. if (this.isMainCall) {
  4142. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4143. } else {
  4144. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4145. }
  4146. var params = null;
  4147. if (this.actualParameters.length == 0) {
  4148. params = "()";
  4149. } else {
  4150. var strParams = this.actualParameters.map(function (v) {
  4151. return v.toString();
  4152. });
  4153. params = "(" + strParams.join(",") + ")";
  4154. }
  4155. return name + params;
  4156. }
  4157. }, {
  4158. key: 'isMainCall',
  4159. get: function get() {
  4160. return this.id === null;
  4161. }
  4162. }, {
  4163. key: 'parametersSize',
  4164. get: function get() {
  4165. return this.actualParameters.length;
  4166. }
  4167. }]);
  4168. return FunctionCall;
  4169. }(_expression.Expression);
  4170. /***/ }),
  4171. /***/ "./js/ast/expressions/index.js":
  4172. /*!*************************************!*\
  4173. !*** ./js/ast/expressions/index.js ***!
  4174. \*************************************/
  4175. /*! no static exports found */
  4176. /***/ (function(module, exports, __webpack_require__) {
  4177. "use strict";
  4178. Object.defineProperty(exports, "__esModule", {
  4179. value: true
  4180. });
  4181. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4182. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4183. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4184. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4185. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4186. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4187. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4188. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4189. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4190. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4191. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4192. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4193. exports.FunctionCall = _functionCall.FunctionCall;
  4194. exports.IntLiteral = _intLiteral.IntLiteral;
  4195. exports.RealLiteral = _realLiteral.RealLiteral;
  4196. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4197. exports.StringLiteral = _stringLiteral.StringLiteral;
  4198. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4199. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4200. exports.InfixApp = _infixApp.InfixApp;
  4201. exports.UnaryApp = _unaryApp.UnaryApp;
  4202. /***/ }),
  4203. /***/ "./js/ast/expressions/infixApp.js":
  4204. /*!****************************************!*\
  4205. !*** ./js/ast/expressions/infixApp.js ***!
  4206. \****************************************/
  4207. /*! no static exports found */
  4208. /***/ (function(module, exports, __webpack_require__) {
  4209. "use strict";
  4210. Object.defineProperty(exports, "__esModule", {
  4211. value: true
  4212. });
  4213. exports.InfixApp = undefined;
  4214. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4215. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4216. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4217. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4218. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4219. var InfixApp = exports.InfixApp = function (_Expression) {
  4220. _inherits(InfixApp, _Expression);
  4221. function InfixApp(op, left, right) {
  4222. _classCallCheck(this, InfixApp);
  4223. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4224. _this.op = op;
  4225. _this.left = left;
  4226. _this.right = right;
  4227. return _this;
  4228. }
  4229. _createClass(InfixApp, [{
  4230. key: 'toString',
  4231. value: function toString() {
  4232. var l = this.left.toString();
  4233. var op = this.op.value;
  4234. var r = this.right.toString();
  4235. return l + op + r;
  4236. }
  4237. }]);
  4238. return InfixApp;
  4239. }(_expression.Expression);
  4240. /***/ }),
  4241. /***/ "./js/ast/expressions/intLiteral.js":
  4242. /*!******************************************!*\
  4243. !*** ./js/ast/expressions/intLiteral.js ***!
  4244. \******************************************/
  4245. /*! no static exports found */
  4246. /***/ (function(module, exports, __webpack_require__) {
  4247. "use strict";
  4248. Object.defineProperty(exports, "__esModule", {
  4249. value: true
  4250. });
  4251. exports.IntLiteral = undefined;
  4252. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4253. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4254. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4255. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4256. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4257. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4258. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4259. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4260. _inherits(IntLiteral, _Literal);
  4261. function IntLiteral(value) {
  4262. _classCallCheck(this, IntLiteral);
  4263. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4264. _this.value = value;
  4265. return _this;
  4266. }
  4267. _createClass(IntLiteral, [{
  4268. key: 'toString',
  4269. value: function toString() {
  4270. return (0, _parsers.convertToString)(this.value, this.type);
  4271. }
  4272. }]);
  4273. return IntLiteral;
  4274. }(_literal.Literal);
  4275. /***/ }),
  4276. /***/ "./js/ast/expressions/literal.js":
  4277. /*!***************************************!*\
  4278. !*** ./js/ast/expressions/literal.js ***!
  4279. \***************************************/
  4280. /*! no static exports found */
  4281. /***/ (function(module, exports, __webpack_require__) {
  4282. "use strict";
  4283. Object.defineProperty(exports, "__esModule", {
  4284. value: true
  4285. });
  4286. exports.Literal = undefined;
  4287. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4288. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4289. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4290. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4291. var Literal = exports.Literal = function (_Expression) {
  4292. _inherits(Literal, _Expression);
  4293. function Literal(type) {
  4294. _classCallCheck(this, Literal);
  4295. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4296. _this.type = type;
  4297. return _this;
  4298. }
  4299. return Literal;
  4300. }(_expression.Expression);
  4301. /***/ }),
  4302. /***/ "./js/ast/expressions/realLiteral.js":
  4303. /*!*******************************************!*\
  4304. !*** ./js/ast/expressions/realLiteral.js ***!
  4305. \*******************************************/
  4306. /*! no static exports found */
  4307. /***/ (function(module, exports, __webpack_require__) {
  4308. "use strict";
  4309. Object.defineProperty(exports, "__esModule", {
  4310. value: true
  4311. });
  4312. exports.RealLiteral = undefined;
  4313. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4314. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4315. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4316. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4317. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4318. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4319. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4320. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4321. _inherits(RealLiteral, _Literal);
  4322. function RealLiteral(value) {
  4323. _classCallCheck(this, RealLiteral);
  4324. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4325. _this.value = value;
  4326. return _this;
  4327. }
  4328. _createClass(RealLiteral, [{
  4329. key: 'toString',
  4330. value: function toString() {
  4331. return (0, _parsers.convertToString)(this.value, this.type);
  4332. }
  4333. }]);
  4334. return RealLiteral;
  4335. }(_literal.Literal);
  4336. /***/ }),
  4337. /***/ "./js/ast/expressions/stringLiteral.js":
  4338. /*!*********************************************!*\
  4339. !*** ./js/ast/expressions/stringLiteral.js ***!
  4340. \*********************************************/
  4341. /*! no static exports found */
  4342. /***/ (function(module, exports, __webpack_require__) {
  4343. "use strict";
  4344. Object.defineProperty(exports, "__esModule", {
  4345. value: true
  4346. });
  4347. exports.StringLiteral = undefined;
  4348. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4349. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4350. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4351. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4352. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4353. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4354. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4355. _inherits(StringLiteral, _Literal);
  4356. function StringLiteral(value) {
  4357. _classCallCheck(this, StringLiteral);
  4358. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4359. _this.value = value;
  4360. return _this;
  4361. }
  4362. _createClass(StringLiteral, [{
  4363. key: 'toString',
  4364. value: function toString() {
  4365. return this.value;
  4366. }
  4367. }]);
  4368. return StringLiteral;
  4369. }(_literal.Literal);
  4370. /***/ }),
  4371. /***/ "./js/ast/expressions/unaryApp.js":
  4372. /*!****************************************!*\
  4373. !*** ./js/ast/expressions/unaryApp.js ***!
  4374. \****************************************/
  4375. /*! no static exports found */
  4376. /***/ (function(module, exports, __webpack_require__) {
  4377. "use strict";
  4378. Object.defineProperty(exports, "__esModule", {
  4379. value: true
  4380. });
  4381. exports.UnaryApp = undefined;
  4382. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4383. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4384. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4385. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4386. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4387. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4388. _inherits(UnaryApp, _InfixApp);
  4389. function UnaryApp(op, left) {
  4390. _classCallCheck(this, UnaryApp);
  4391. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4392. }
  4393. _createClass(UnaryApp, [{
  4394. key: 'toString',
  4395. value: function toString() {
  4396. var l = this.left.toString();
  4397. var op = this.op.value;
  4398. return op + l;
  4399. }
  4400. }]);
  4401. return UnaryApp;
  4402. }(_infixApp.InfixApp);
  4403. /***/ }),
  4404. /***/ "./js/ast/expressions/variableLiteral.js":
  4405. /*!***********************************************!*\
  4406. !*** ./js/ast/expressions/variableLiteral.js ***!
  4407. \***********************************************/
  4408. /*! no static exports found */
  4409. /***/ (function(module, exports, __webpack_require__) {
  4410. "use strict";
  4411. Object.defineProperty(exports, "__esModule", {
  4412. value: true
  4413. });
  4414. exports.VariableLiteral = undefined;
  4415. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4416. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4417. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4418. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4419. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4420. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4421. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4422. _inherits(VariableLiteral, _Literal);
  4423. function VariableLiteral(id) {
  4424. _classCallCheck(this, VariableLiteral);
  4425. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4426. _this.id = id;
  4427. return _this;
  4428. }
  4429. _createClass(VariableLiteral, [{
  4430. key: 'toString',
  4431. value: function toString() {
  4432. return this.id;
  4433. }
  4434. }]);
  4435. return VariableLiteral;
  4436. }(_literal.Literal);
  4437. /***/ }),
  4438. /***/ "./js/ast/ivprogParser.js":
  4439. /*!********************************!*\
  4440. !*** ./js/ast/ivprogParser.js ***!
  4441. \********************************/
  4442. /*! no static exports found */
  4443. /***/ (function(module, exports, __webpack_require__) {
  4444. "use strict";
  4445. Object.defineProperty(exports, "__esModule", {
  4446. value: true
  4447. });
  4448. exports.IVProgParser = undefined;
  4449. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4450. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4451. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4452. var Expressions = _interopRequireWildcard(_expressions);
  4453. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4454. var Commands = _interopRequireWildcard(_commands);
  4455. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4456. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4457. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4458. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4459. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4460. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4461. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4462. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4463. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4464. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4465. var IVProgParser = exports.IVProgParser = function () {
  4466. _createClass(IVProgParser, null, [{
  4467. key: 'createParser',
  4468. value: function createParser(input) {
  4469. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4470. return new IVProgParser(input, lexerClass);
  4471. }
  4472. // <BEGIN scope consts>
  4473. }, {
  4474. key: 'BASE',
  4475. get: function get() {
  4476. return 0;
  4477. }
  4478. }, {
  4479. key: 'FUNCTION',
  4480. get: function get() {
  4481. return 1;
  4482. }
  4483. }, {
  4484. key: 'COMMAND',
  4485. get: function get() {
  4486. return 2;
  4487. }
  4488. }, {
  4489. key: 'BREAKABLE',
  4490. get: function get() {
  4491. return 4;
  4492. }
  4493. // </ END scope consts>
  4494. }]);
  4495. function IVProgParser(input, lexerClass) {
  4496. _classCallCheck(this, IVProgParser);
  4497. this.lexerClass = lexerClass;
  4498. this.lexer = new lexerClass(new _index.InputStream(input));
  4499. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4500. this.tokenStream.fill();
  4501. this.pos = 1;
  4502. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4503. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4504. this.parsingArrayDimension = 0;
  4505. this.scope = [];
  4506. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4507. this.definedFuncsNameList = [];
  4508. this.definedVariablesStack = [];
  4509. }
  4510. _createClass(IVProgParser, [{
  4511. key: 'parseTree',
  4512. value: function parseTree() {
  4513. return this.parseProgram();
  4514. }
  4515. }, {
  4516. key: 'getToken',
  4517. value: function getToken() {
  4518. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4519. // if(index === null)
  4520. // index = this.pos;
  4521. return this.tokenStream.LT(index);
  4522. }
  4523. }, {
  4524. key: 'insideScope',
  4525. value: function insideScope(scope) {
  4526. if (this.scope.length <= 0) {
  4527. return IVProgParser.BASE === scope;
  4528. } else {
  4529. return this.scope[this.scope.length - 1] === scope;
  4530. }
  4531. }
  4532. }, {
  4533. key: 'pushScope',
  4534. value: function pushScope(scope) {
  4535. this.scope.push(scope);
  4536. }
  4537. }, {
  4538. key: 'pushVariableStack',
  4539. value: function pushVariableStack() {
  4540. this.definedVariablesStack.push([]);
  4541. }
  4542. }, {
  4543. key: 'popScope',
  4544. value: function popScope() {
  4545. return this.scope.pop();
  4546. }
  4547. }, {
  4548. key: 'popVariableStack',
  4549. value: function popVariableStack() {
  4550. return this.definedVariablesStack.pop();
  4551. }
  4552. }, {
  4553. key: 'getCurrentVariableStack',
  4554. value: function getCurrentVariableStack() {
  4555. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4556. }
  4557. }, {
  4558. key: 'isEOF',
  4559. value: function isEOF() {
  4560. this.getToken(this.pos);
  4561. return this.tokenStream.fetchedEOF;
  4562. }
  4563. }, {
  4564. key: 'parseProgram',
  4565. value: function parseProgram() {
  4566. var token = this.getToken();
  4567. var globalVars = [];
  4568. var functions = [];
  4569. if (this.lexerClass.RK_PROGRAM === token.type) {
  4570. this.pos++;
  4571. this.consumeNewLines();
  4572. this.checkOpenCurly();
  4573. this.pos++;
  4574. this.pushVariableStack();
  4575. while (true) {
  4576. this.consumeNewLines();
  4577. var _token = this.getToken();
  4578. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4579. globalVars = globalVars.concat(this.parseGlobalVariables());
  4580. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4581. this.pushVariableStack();
  4582. functions = functions.concat(this.parseFunction());
  4583. this.popVariableStack();
  4584. } else {
  4585. break;
  4586. }
  4587. }
  4588. this.consumeNewLines();
  4589. this.checkCloseCurly();
  4590. this.pos++;
  4591. this.consumeNewLines();
  4592. if (!this.isEOF()) {
  4593. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4594. }
  4595. this.popVariableStack();
  4596. return { global: globalVars, functions: functions };
  4597. } else {
  4598. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4599. }
  4600. }
  4601. }, {
  4602. key: 'checkOpenCurly',
  4603. value: function checkOpenCurly() {
  4604. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4605. var token = this.getToken();
  4606. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4607. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4608. }
  4609. return true;
  4610. }
  4611. }, {
  4612. key: 'checkCloseCurly',
  4613. value: function checkCloseCurly() {
  4614. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4615. var token = this.getToken();
  4616. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4617. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4618. }
  4619. return true;
  4620. }
  4621. /* It checks if the current token at position pos is a ']'.
  4622. * As a check function it doesn't increment pos.
  4623. *
  4624. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4625. *
  4626. * @returns true if the attempt is true and current token is '[',
  4627. * false is attempt is true and current token is not '['
  4628. **/
  4629. }, {
  4630. key: 'checkOpenBrace',
  4631. value: function checkOpenBrace() {
  4632. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4633. var token = this.getToken();
  4634. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4635. if (!attempt) {
  4636. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4637. } else {
  4638. return false;
  4639. }
  4640. }
  4641. return true;
  4642. }
  4643. }, {
  4644. key: 'checkCloseBrace',
  4645. value: function checkCloseBrace() {
  4646. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4647. var token = this.getToken();
  4648. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4649. if (!attempt) {
  4650. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4651. } else {
  4652. return false;
  4653. }
  4654. }
  4655. return true;
  4656. }
  4657. }, {
  4658. key: 'checkOpenParenthesis',
  4659. value: function checkOpenParenthesis() {
  4660. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4661. var token = this.getToken();
  4662. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4663. if (!attempt) {
  4664. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4665. } else {
  4666. return false;
  4667. }
  4668. }
  4669. return true;
  4670. }
  4671. }, {
  4672. key: 'checkCloseParenthesis',
  4673. value: function checkCloseParenthesis() {
  4674. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4675. var token = this.getToken();
  4676. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4677. if (!attempt) {
  4678. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4679. } else {
  4680. return false;
  4681. }
  4682. }
  4683. return true;
  4684. }
  4685. }, {
  4686. key: 'checkEOS',
  4687. value: function checkEOS() {
  4688. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4689. var eosToken = this.getToken();
  4690. if (eosToken.type !== this.lexerClass.EOS) {
  4691. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4692. }
  4693. return true;
  4694. }
  4695. }, {
  4696. key: 'checkFunctionDuplicate',
  4697. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4698. var id = functionID === null ? "$main" : functionID;
  4699. var index = this.definedFuncsNameList.indexOf(id);
  4700. if (index !== -1) {
  4701. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4702. }
  4703. this.definedFuncsNameList.push(id);
  4704. }
  4705. }, {
  4706. key: 'checkVariableDuplicate',
  4707. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4708. var index = this.getCurrentVariableStack().indexOf(variableID);
  4709. if (index !== -1) {
  4710. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4711. }
  4712. this.getCurrentVariableStack().push(variableID);
  4713. }
  4714. }, {
  4715. key: 'consumeForSemiColon',
  4716. value: function consumeForSemiColon() {
  4717. var eosToken = this.getToken();
  4718. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4719. this.pos++;
  4720. return;
  4721. }
  4722. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4723. }
  4724. }, {
  4725. key: 'parseGlobalVariables',
  4726. value: function parseGlobalVariables() {
  4727. var decl = this.parseMaybeConst();
  4728. this.checkEOS();
  4729. this.pos++;
  4730. return decl;
  4731. }
  4732. /*
  4733. * Checks if the next token is PR_CONST. It's only available
  4734. * at global variables declaration level
  4735. * @returns Declararion(const, type, id, initVal?)
  4736. **/
  4737. }, {
  4738. key: 'parseMaybeConst',
  4739. value: function parseMaybeConst() {
  4740. var constToken = this.getToken();
  4741. if (constToken.type === this.lexerClass.RK_CONST) {
  4742. this.pos++;
  4743. var typeString = this.parseType();
  4744. return this.parseDeclaration(typeString, true);
  4745. } else if (this.isVariableType(constToken)) {
  4746. var _typeString = this.parseType();
  4747. return this.parseDeclaration(_typeString);
  4748. } else {
  4749. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4750. }
  4751. }
  4752. /*
  4753. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4754. * @returns a list of Declararion(const, type, id, initVal?)
  4755. **/
  4756. }, {
  4757. key: 'parseDeclaration',
  4758. value: function parseDeclaration(typeString) {
  4759. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4760. var initial = null;
  4761. var dim1 = null;
  4762. var dim2 = null;
  4763. var idToken = this.getToken();
  4764. var idString = this.parseID();
  4765. this.checkVariableDuplicate(idString, idToken);
  4766. // Check for array or vector
  4767. // ID[int/IDi][int/IDj]
  4768. if (this.checkOpenBrace(true)) {
  4769. this.pos++;
  4770. this.consumeNewLines();
  4771. dim1 = this.parseArrayDimension();
  4772. this.consumeNewLines();
  4773. this.checkCloseBrace();
  4774. this.pos++;
  4775. if (this.checkOpenBrace(true)) {
  4776. this.pos++;
  4777. this.consumeNewLines();
  4778. dim2 = this.parseArrayDimension();
  4779. this.consumeNewLines();
  4780. this.checkCloseBrace();
  4781. this.pos++;
  4782. }
  4783. }
  4784. var equalsToken = this.getToken();
  4785. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4786. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4787. }
  4788. if (equalsToken.type === this.lexerClass.EQUAL) {
  4789. this.pos++;
  4790. initial = this.parseExpressionOR();
  4791. }
  4792. var declaration = null;
  4793. var dimensions = 0;
  4794. if (dim1 !== null) {
  4795. dimensions++;
  4796. if (dim2 !== null) {
  4797. dimensions++;
  4798. }
  4799. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4800. } else {
  4801. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4802. }
  4803. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4804. var commaToken = this.getToken();
  4805. if (commaToken.type === this.lexerClass.COMMA) {
  4806. this.pos++;
  4807. this.consumeNewLines();
  4808. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4809. } else {
  4810. return [declaration];
  4811. }
  4812. }
  4813. }, {
  4814. key: 'consumeNewLines',
  4815. value: function consumeNewLines() {
  4816. var token = this.getToken();
  4817. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4818. this.pos++;
  4819. token = this.getToken();
  4820. }
  4821. }
  4822. }, {
  4823. key: 'isVariableType',
  4824. value: function isVariableType(token) {
  4825. return this.variableTypes.find(function (v) {
  4826. return v === token.type;
  4827. });
  4828. }
  4829. /*
  4830. * Reads the next token of the stream to check if it is a Integer or an ID.
  4831. * @returns Integer | ID
  4832. **/
  4833. }, {
  4834. key: 'parseArrayDimension',
  4835. value: function parseArrayDimension() {
  4836. var dimToken = this.getToken();
  4837. if (dimToken.type === this.lexerClass.INTEGER) {
  4838. //parse as int literal
  4839. this.pos++;
  4840. return this.getIntLiteral(dimToken);
  4841. } else if (dimToken.type === this.lexerClass.ID) {
  4842. //parse as variable
  4843. this.pos++;
  4844. return this.parseVariable(dimToken);
  4845. } else {
  4846. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4847. }
  4848. }
  4849. /*
  4850. * Returns an object {type: 'int', value: value}.
  4851. * It checks for binary and hexadecimal integers.
  4852. * @returns object with fields type and value
  4853. **/
  4854. }, {
  4855. key: 'getIntLiteral',
  4856. value: function getIntLiteral(token) {
  4857. var text = token.text;
  4858. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4859. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4860. exp.sourceInfo = sourceInfo;
  4861. return exp;
  4862. }
  4863. }, {
  4864. key: 'getRealLiteral',
  4865. value: function getRealLiteral(token) {
  4866. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4867. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4868. exp.sourceInfo = sourceInfo;
  4869. return exp;
  4870. }
  4871. }, {
  4872. key: 'getStringLiteral',
  4873. value: function getStringLiteral(token) {
  4874. var text = token.text;
  4875. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4876. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4877. exp.sourceInfo = sourceInfo;
  4878. return exp;
  4879. }
  4880. }, {
  4881. key: 'getBoolLiteral',
  4882. value: function getBoolLiteral(token) {
  4883. var val = (0, _parsers.toBool)(token.text);
  4884. var exp = new Expressions.BoolLiteral(val);
  4885. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4886. return exp;
  4887. }
  4888. }, {
  4889. key: 'parseArrayLiteral',
  4890. value: function parseArrayLiteral() {
  4891. this.checkOpenCurly();
  4892. var beginArray = this.getToken();
  4893. if (this.parsingArrayDimension >= 2) {
  4894. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4895. }
  4896. this.pos++;
  4897. this.parsingArrayDimension++;
  4898. this.consumeNewLines();
  4899. var data = this.parseExpressionList();
  4900. this.consumeNewLines();
  4901. this.checkCloseCurly();
  4902. var endArray = this.getToken();
  4903. this.pos++;
  4904. this.parsingArrayDimension--;
  4905. if (this.parsingArrayDimension === 0) {
  4906. // if (!data.isValid) {
  4907. // // TODO: better error message
  4908. // console.log('invalid array');
  4909. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4910. // }
  4911. }
  4912. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4913. var dataDim = 1;
  4914. if (data[0] instanceof Expressions.ArrayLiteral) {
  4915. dataDim++;
  4916. }
  4917. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4918. var exp = new Expressions.ArrayLiteral(type, data);
  4919. exp.sourceInfo = sourceInfo;
  4920. return exp;
  4921. }
  4922. /*
  4923. * Returns an object {type: 'variable', value: value}.
  4924. * @returns object with fields type and value
  4925. **/
  4926. }, {
  4927. key: 'parseVariable',
  4928. value: function parseVariable(token) {
  4929. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4930. var exp = new Expressions.VariableLiteral(token.text);
  4931. exp.sourceInfo = sourceInfo;
  4932. return exp;
  4933. }
  4934. /*
  4935. * Returns an object representing a function. It has
  4936. * four attributes: returnType, id, formalParams and block.
  4937. * The block object has two attributes: declarations and commands
  4938. **/
  4939. }, {
  4940. key: 'parseFunction',
  4941. value: function parseFunction() {
  4942. this.pushScope(IVProgParser.FUNCTION);
  4943. var formalParams = [];
  4944. var token = this.getToken();
  4945. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4946. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4947. return null;
  4948. }
  4949. this.pos++;
  4950. var funType = this.parseType();
  4951. var dimensions = 0;
  4952. if (this.checkOpenBrace(true)) {
  4953. this.pos++;
  4954. this.checkCloseBrace();
  4955. this.pos++;
  4956. dimensions++;
  4957. if (this.checkOpenBrace(true)) {
  4958. this.pos++;
  4959. this.checkCloseBrace();
  4960. this.pos++;
  4961. dimensions++;
  4962. }
  4963. }
  4964. var funcIDToken = this.getToken();
  4965. var functionID = this.parseID();
  4966. this.checkFunctionDuplicate(functionID, funcIDToken);
  4967. this.checkOpenParenthesis();
  4968. this.pos++;
  4969. this.consumeNewLines();
  4970. if (!this.checkCloseParenthesis(true)) {
  4971. formalParams = this.parseFormalParameters(); // formal parameters
  4972. this.consumeNewLines();
  4973. this.checkCloseParenthesis();
  4974. this.pos++;
  4975. } else {
  4976. this.pos++;
  4977. }
  4978. this.consumeNewLines();
  4979. var commandsBlock = this.parseCommandBlock();
  4980. var returnType = funType;
  4981. if (dimensions > 0) {
  4982. returnType = new _compoundType.CompoundType(funType, dimensions);
  4983. }
  4984. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  4985. if (functionID === null && !func.isMain) {
  4986. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  4987. } else if (func.isMain && formalParams.length !== 0) {
  4988. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  4989. }
  4990. this.popScope();
  4991. return func;
  4992. }
  4993. /*
  4994. * Parse the formal parameters of a function.
  4995. * @returns a list of objects with the following attributes: type, id and dimensions.
  4996. **/
  4997. }, {
  4998. key: 'parseFormalParameters',
  4999. value: function parseFormalParameters() {
  5000. var list = [];
  5001. while (true) {
  5002. var dimensions = 0;
  5003. var typeString = this.parseType();
  5004. var idToken = this.getToken();
  5005. var idString = this.parseID();
  5006. this.checkVariableDuplicate(idString, idToken);
  5007. if (this.checkOpenBrace(true)) {
  5008. this.pos++;
  5009. dimensions++;
  5010. this.checkCloseBrace();
  5011. this.pos++;
  5012. if (this.checkOpenBrace(true)) {
  5013. this.pos++;
  5014. dimensions++;
  5015. this.checkCloseBrace();
  5016. this.pos++;
  5017. }
  5018. }
  5019. var type = null;
  5020. if (dimensions > 0) {
  5021. type = new _compoundType.CompoundType(typeString, dimensions);
  5022. } else {
  5023. type = typeString;
  5024. }
  5025. list.push(new Commands.FormalParameter(type, idString));
  5026. var commaToken = this.getToken();
  5027. if (commaToken.type !== this.lexerClass.COMMA) break;
  5028. this.pos++;
  5029. this.consumeNewLines();
  5030. }
  5031. return list;
  5032. }
  5033. }, {
  5034. key: 'parseID',
  5035. value: function parseID() {
  5036. var token = this.getToken();
  5037. if (token.type !== this.lexerClass.ID) {
  5038. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5039. }
  5040. this.pos++;
  5041. if (this.insideScope(IVProgParser.FUNCTION)) {
  5042. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5043. return null;
  5044. }
  5045. }
  5046. return token.text;
  5047. }
  5048. }, {
  5049. key: 'parseMaybeLibID',
  5050. value: function parseMaybeLibID() {
  5051. var token = this.getToken();
  5052. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5053. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5054. }
  5055. this.pos++;
  5056. return token.text;
  5057. }
  5058. }, {
  5059. key: 'parseType',
  5060. value: function parseType() {
  5061. var token = this.getToken();
  5062. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5063. return _types.Types.VOID;
  5064. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5065. this.pos++;
  5066. return _types.Types.VOID;
  5067. } else if (this.isVariableType(token)) {
  5068. this.pos++;
  5069. switch (token.type) {
  5070. case this.lexerClass.RK_INTEGER:
  5071. return _types.Types.INTEGER;
  5072. case this.lexerClass.RK_BOOLEAN:
  5073. return _types.Types.BOOLEAN;
  5074. case this.lexerClass.RK_REAL:
  5075. return _types.Types.REAL;
  5076. case this.lexerClass.RK_STRING:
  5077. return _types.Types.STRING;
  5078. default:
  5079. break;
  5080. }
  5081. }
  5082. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5083. }
  5084. }, {
  5085. key: 'parseCommandBlock',
  5086. value: function parseCommandBlock() {
  5087. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5088. var variablesDecl = [];
  5089. var commands = [];
  5090. var hasOpen = false;
  5091. if (this.checkOpenCurly(optionalCurly)) {
  5092. this.pos++;
  5093. hasOpen = true;
  5094. }
  5095. this.consumeNewLines();
  5096. while (true) {
  5097. var cmd = this.parseCommand();
  5098. if (cmd === null) break;
  5099. if (cmd !== -1) {
  5100. if (cmd instanceof Array) {
  5101. variablesDecl = variablesDecl.concat(cmd);
  5102. } else {
  5103. commands.push(cmd);
  5104. }
  5105. }
  5106. }
  5107. this.consumeNewLines();
  5108. if (hasOpen) {
  5109. this.checkCloseCurly();
  5110. this.pos++;
  5111. this.consumeNewLines();
  5112. }
  5113. return new Commands.CommandBlock(variablesDecl, commands);
  5114. }
  5115. }, {
  5116. key: 'parseCommand',
  5117. value: function parseCommand() {
  5118. var token = this.getToken();
  5119. if (this.isVariableType(token)) {
  5120. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5121. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5122. }
  5123. this.pushScope(IVProgParser.BASE);
  5124. var varType = this.parseType();
  5125. this.popScope();
  5126. var cmd = this.parseDeclaration(varType);
  5127. this.checkEOS();
  5128. this.pos++;
  5129. return cmd;
  5130. } else if (token.type === this.lexerClass.ID) {
  5131. return this.parseIDCommand();
  5132. } else if (token.type === this.lexerClass.LIB_ID) {
  5133. return this.parseIDCommand();
  5134. } else if (token.type === this.lexerClass.RK_RETURN) {
  5135. return this.parseReturn();
  5136. } else if (token.type === this.lexerClass.RK_WHILE) {
  5137. return this.parseWhile();
  5138. } else if (token.type === this.lexerClass.RK_FOR) {
  5139. return this.parseFor();
  5140. } else if (token.type === this.lexerClass.RK_BREAK) {
  5141. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5142. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5143. }
  5144. return this.parseBreak();
  5145. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5146. return this.parseSwitchCase();
  5147. } else if (token.type === this.lexerClass.RK_DO) {
  5148. return this.parseDoWhile();
  5149. } else if (token.type === this.lexerClass.RK_IF) {
  5150. return this.parseIfThenElse();
  5151. } else if (this.checkEOS(true)) {
  5152. this.pos++;
  5153. return -1;
  5154. } else {
  5155. return null;
  5156. }
  5157. }
  5158. }, {
  5159. key: 'parseSwitchCase',
  5160. value: function parseSwitchCase() {
  5161. this.pushScope(IVProgParser.BREAKABLE);
  5162. this.pos++;
  5163. this.checkOpenParenthesis();
  5164. this.pos++;
  5165. this.consumeNewLines();
  5166. var exp = this.parseExpressionOR();
  5167. this.consumeNewLines();
  5168. this.checkCloseParenthesis();
  5169. this.pos++;
  5170. this.consumeNewLines();
  5171. this.checkOpenCurly();
  5172. this.pos++;
  5173. this.consumeNewLines();
  5174. var casesList = this.parseCases();
  5175. this.consumeNewLines();
  5176. this.checkCloseCurly();
  5177. this.pos++;
  5178. this.consumeNewLines();
  5179. this.popScope();
  5180. return new Commands.Switch(exp, casesList);
  5181. }
  5182. }, {
  5183. key: 'parseDoWhile',
  5184. value: function parseDoWhile() {
  5185. this.pos++;
  5186. this.consumeNewLines();
  5187. this.pushScope(IVProgParser.BREAKABLE);
  5188. var commandsBlock = this.parseCommandBlock();
  5189. this.consumeNewLines(); //Maybe not...
  5190. var whileToken = this.getToken();
  5191. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5192. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5193. }
  5194. this.pos++;
  5195. this.checkOpenParenthesis();
  5196. this.pos++;
  5197. this.consumeNewLines();
  5198. var condition = this.parseExpressionOR();
  5199. this.consumeNewLines();
  5200. this.checkCloseParenthesis();
  5201. this.pos++;
  5202. this.checkEOS();
  5203. this.popScope();
  5204. return new Commands.DoWhile(condition, commandsBlock);
  5205. }
  5206. }, {
  5207. key: 'parseIfThenElse',
  5208. value: function parseIfThenElse() {
  5209. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5210. this.pushScope(IVProgParser.BREAKABLE);
  5211. } else {
  5212. this.pushScope(IVProgParser.COMMAND);
  5213. }
  5214. this.pos++;
  5215. this.checkOpenParenthesis();
  5216. this.pos++;
  5217. this.consumeNewLines();
  5218. var logicalExpression = this.parseExpressionOR();
  5219. this.consumeNewLines();
  5220. this.checkCloseParenthesis();
  5221. this.pos++;
  5222. this.consumeNewLines();
  5223. var cmdBlocks = this.parseCommandBlock();
  5224. var maybeElse = this.getToken();
  5225. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5226. this.pos++;
  5227. this.consumeNewLines();
  5228. var maybeIf = this.getToken();
  5229. var elseBlock = null;
  5230. if (this.checkOpenCurly(true)) {
  5231. elseBlock = this.parseCommandBlock();
  5232. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5233. elseBlock = this.parseIfThenElse();
  5234. } else {
  5235. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5236. }
  5237. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5238. }
  5239. this.popScope();
  5240. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5241. }
  5242. }, {
  5243. key: 'parseFor',
  5244. value: function parseFor() {
  5245. this.pushScope(IVProgParser.BREAKABLE);
  5246. this.pos++;
  5247. this.checkOpenParenthesis();
  5248. this.pos++;
  5249. this.consumeNewLines();
  5250. var attribution = this.parseForAssign();
  5251. this.consumeNewLines();
  5252. var condition = this.parseExpressionOR();
  5253. this.consumeForSemiColon();
  5254. var increment = this.parseForAssign(true);
  5255. this.checkCloseParenthesis();
  5256. this.pos++;
  5257. this.consumeNewLines();
  5258. var commandsBlock = this.parseCommandBlock();
  5259. this.popScope();
  5260. return new Commands.For(attribution, condition, increment, commandsBlock);
  5261. }
  5262. }, {
  5263. key: 'parseWhile',
  5264. value: function parseWhile() {
  5265. this.pushScope(IVProgParser.BREAKABLE);
  5266. this.pos++;
  5267. this.checkOpenParenthesis();
  5268. this.pos++;
  5269. this.consumeNewLines();
  5270. var logicalExpression = this.parseExpressionOR();
  5271. this.consumeNewLines();
  5272. this.checkCloseParenthesis();
  5273. this.pos++;
  5274. this.consumeNewLines();
  5275. var cmdBlocks = this.parseCommandBlock();
  5276. this.popScope();
  5277. return new Commands.While(logicalExpression, cmdBlocks);
  5278. }
  5279. }, {
  5280. key: 'parseBreak',
  5281. value: function parseBreak() {
  5282. this.pos++;
  5283. this.checkEOS();
  5284. this.pos++;
  5285. return new Commands.Break();
  5286. }
  5287. }, {
  5288. key: 'parseReturn',
  5289. value: function parseReturn() {
  5290. this.pos++;
  5291. var exp = null;
  5292. if (!this.checkEOS(true)) {
  5293. exp = this.parseExpressionOR();
  5294. this.checkEOS();
  5295. }
  5296. this.pos++;
  5297. return new Commands.Return(exp);
  5298. }
  5299. }, {
  5300. key: 'parseIDCommand',
  5301. value: function parseIDCommand() {
  5302. var refToken = this.getToken();
  5303. var isID = refToken.type === this.lexerClass.ID;
  5304. var id = this.parseMaybeLibID();
  5305. if (this.checkOpenBrace(true)) {
  5306. this.pos++;
  5307. var lineExpression = null;
  5308. var columnExpression = null;
  5309. this.consumeNewLines();
  5310. lineExpression = this.parseExpression();
  5311. this.consumeNewLines();
  5312. this.checkCloseBrace();
  5313. this.pos++;
  5314. if (this.checkOpenBrace(true)) {
  5315. this.pos++;
  5316. this.consumeNewLines();
  5317. columnExpression = this.parseExpression();
  5318. this.consumeNewLines();
  5319. this.checkCloseBrace();
  5320. this.pos++;
  5321. }
  5322. var equalToken = this.getToken();
  5323. if (equalToken.type !== this.lexerClass.EQUAL) {
  5324. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5325. }
  5326. this.pos++;
  5327. var exp = this.parseExpressionOR();
  5328. this.checkEOS();
  5329. this.pos++;
  5330. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5331. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5332. return cmd;
  5333. }
  5334. var equalOrParenthesis = this.getToken();
  5335. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5336. this.pos++;
  5337. var _exp = this.parseExpressionOR();
  5338. this.checkEOS();
  5339. this.pos++;
  5340. var _cmd = new Commands.Assign(id, _exp);
  5341. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5342. return _cmd;
  5343. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5344. var funcCall = this.parseFunctionCallCommand(id);
  5345. this.checkEOS();
  5346. this.pos++;
  5347. return funcCall;
  5348. } else if (isID) {
  5349. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5350. } else {
  5351. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5352. }
  5353. }
  5354. }, {
  5355. key: 'parseForAssign',
  5356. value: function parseForAssign() {
  5357. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5358. if (!isLast) this.consumeNewLines();
  5359. if (this.checkEOS(true)) {
  5360. return null;
  5361. }
  5362. var id = this.parseID();
  5363. var equal = this.getToken();
  5364. if (equal.type !== this.lexerClass.EQUAL) {
  5365. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5366. }
  5367. this.pos++;
  5368. var exp = this.parseExpressionOR();
  5369. if (!isLast) {
  5370. this.consumeForSemiColon();
  5371. }
  5372. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5373. var cmd = new Commands.Assign(id, exp);
  5374. cmd.sourceInfo = sourceInfo;
  5375. return cmd;
  5376. }
  5377. }, {
  5378. key: 'parseCases',
  5379. value: function parseCases() {
  5380. var token = this.getToken();
  5381. if (token.type !== this.lexerClass.RK_CASE) {
  5382. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5383. }
  5384. this.pos++;
  5385. var nextToken = this.getToken();
  5386. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5387. this.pos++;
  5388. var colonToken = this.getToken();
  5389. if (colonToken.type !== this.lexerClass.COLON) {
  5390. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5391. }
  5392. this.pos++;
  5393. this.consumeNewLines();
  5394. var block = this.parseCommandBlock(true);
  5395. var defaultCase = new Commands.Case(null);
  5396. defaultCase.setCommands(block.commands);
  5397. return [defaultCase];
  5398. } else {
  5399. var exp = this.parseExpressionOR();
  5400. var _colonToken = this.getToken();
  5401. if (_colonToken.type !== this.lexerClass.COLON) {
  5402. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5403. }
  5404. this.pos++;
  5405. this.consumeNewLines();
  5406. var _block = this.parseCommandBlock(true);
  5407. var aCase = new Commands.Case(exp);
  5408. aCase.setCommands(_block.commands);
  5409. var caseToken = this.getToken();
  5410. if (caseToken.type === this.lexerClass.RK_CASE) {
  5411. return [aCase].concat(this.parseCases());
  5412. } else {
  5413. return [aCase];
  5414. }
  5415. }
  5416. }
  5417. /*
  5418. * Parses an Expression following the structure:
  5419. *
  5420. * EOR => EAnd ( 'or' EOR)? #expression and
  5421. *
  5422. * EOR => ENot ('and' EOR)? #expression or
  5423. *
  5424. * ENot => 'not'? ER #expression not
  5425. *
  5426. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5427. *
  5428. * E => factor ((+, -) E)? #expression
  5429. *
  5430. * factor=> term ((*, /, %) factor)?
  5431. *
  5432. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5433. **/
  5434. }, {
  5435. key: 'parseExpressionOR',
  5436. value: function parseExpressionOR() {
  5437. var exp1 = this.parseExpressionAND();
  5438. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5439. var opToken = this.getToken();
  5440. this.pos++;
  5441. var or = (0, _operators.convertFromString)('or');
  5442. this.consumeNewLines();
  5443. var exp2 = this.parseExpressionAND();
  5444. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5445. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5446. exp1 = _finalExp;
  5447. }
  5448. return exp1;
  5449. }
  5450. }, {
  5451. key: 'parseExpressionAND',
  5452. value: function parseExpressionAND() {
  5453. var exp1 = this.parseExpressionNot();
  5454. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5455. var opToken = this.getToken();
  5456. this.pos++;
  5457. var and = (0, _operators.convertFromString)('and');
  5458. this.consumeNewLines();
  5459. var exp2 = this.parseExpressionNot();
  5460. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5461. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5462. exp1 = _finalExp2;
  5463. }
  5464. return exp1;
  5465. }
  5466. }, {
  5467. key: 'parseExpressionNot',
  5468. value: function parseExpressionNot() {
  5469. var maybeNotToken = this.getToken();
  5470. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5471. var opToken = this.getToken();
  5472. this.pos++;
  5473. var not = (0, _operators.convertFromString)('not');
  5474. var exp1 = this.parseExpressionRel();
  5475. finalExp = new Expressions.UnaryApp(not, exp1);
  5476. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5477. return finalExp;
  5478. } else {
  5479. return this.parseExpressionRel();
  5480. }
  5481. }
  5482. }, {
  5483. key: 'parseExpressionRel',
  5484. value: function parseExpressionRel() {
  5485. var exp1 = this.parseExpression();
  5486. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5487. var relToken = this.getToken();
  5488. this.pos++;
  5489. var rel = (0, _operators.convertFromString)(relToken.text);
  5490. var exp2 = this.parseExpression();
  5491. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5492. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5493. exp1 = _finalExp3;
  5494. }
  5495. return exp1;
  5496. }
  5497. }, {
  5498. key: 'parseExpression',
  5499. value: function parseExpression() {
  5500. var factor = this.parseFactor();
  5501. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5502. var sumOpToken = this.getToken();
  5503. this.pos++;
  5504. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5505. var factor2 = this.parseFactor();
  5506. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5507. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5508. factor = _finalExp4;
  5509. }
  5510. return factor;
  5511. }
  5512. }, {
  5513. key: 'parseFactor',
  5514. value: function parseFactor() {
  5515. var term = this.parseTerm();
  5516. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5517. var multOpToken = this.getToken();
  5518. this.pos++;
  5519. var op = (0, _operators.convertFromString)(multOpToken.text);
  5520. var term2 = this.parseTerm();
  5521. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5522. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5523. term = _finalExp5;
  5524. }
  5525. return term;
  5526. }
  5527. }, {
  5528. key: 'parseTerm',
  5529. value: function parseTerm() {
  5530. var token = this.getToken();
  5531. var sourceInfo = null;
  5532. switch (token.type) {
  5533. case this.lexerClass.SUM_OP:
  5534. this.pos++;
  5535. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5536. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5537. exp.sourceInfo = sourceInfo;
  5538. return exp;
  5539. case this.lexerClass.INTEGER:
  5540. this.pos++;
  5541. return this.getIntLiteral(token);
  5542. case this.lexerClass.REAL:
  5543. this.pos++;
  5544. return this.getRealLiteral(token);
  5545. case this.lexerClass.STRING:
  5546. this.pos++;
  5547. return this.getStringLiteral(token);
  5548. case this.lexerClass.RK_TRUE:
  5549. case this.lexerClass.RK_FALSE:
  5550. this.pos++;
  5551. return this.getBoolLiteral(token);
  5552. case this.lexerClass.OPEN_CURLY:
  5553. return this.parseArrayLiteral();
  5554. case this.lexerClass.ID:
  5555. case this.lexerClass.LIB_ID:
  5556. return this.parseIDTerm();
  5557. case this.lexerClass.OPEN_PARENTHESIS:
  5558. return this.parseParenthesisExp();
  5559. default:
  5560. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5561. }
  5562. }
  5563. }, {
  5564. key: 'parseIDTerm',
  5565. value: function parseIDTerm() {
  5566. var tokenA = this.getToken();
  5567. var id = this.parseMaybeLibID();
  5568. var isID = tokenA.type === this.lexerClass.ID;
  5569. if (isID && this.checkOpenBrace(true)) {
  5570. var tokenB = null;
  5571. this.pos++;
  5572. var firstIndex = this.parseExpression();
  5573. var secondIndex = null;
  5574. this.consumeNewLines();
  5575. this.checkCloseBrace();
  5576. tokenB = this.getToken();
  5577. this.pos++;
  5578. if (this.checkOpenBrace(true)) {
  5579. this.pos++;
  5580. secondIndex = this.parseExpression();
  5581. this.consumeNewLines();
  5582. this.checkCloseBrace();
  5583. tokenB = this.getToken();
  5584. this.pos++;
  5585. }
  5586. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5587. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5588. exp.sourceInfo = sourceInfo;
  5589. return exp;
  5590. } else if (this.checkOpenParenthesis(true)) {
  5591. return this.parseFunctionCallExpression(id);
  5592. } else if (isID) {
  5593. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5594. var _exp2 = new Expressions.VariableLiteral(id);
  5595. _exp2.sourceInfo = _sourceInfo;
  5596. return _exp2;
  5597. } else {
  5598. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5599. }
  5600. }
  5601. }, {
  5602. key: 'getFunctionName',
  5603. value: function getFunctionName(id) {
  5604. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5605. if (name === null) {
  5606. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5607. return null;
  5608. }
  5609. return id;
  5610. } else {
  5611. return name;
  5612. }
  5613. }
  5614. }, {
  5615. key: 'parseFunctionCallExpression',
  5616. value: function parseFunctionCallExpression(id) {
  5617. var tokenA = this.getToken(this.pos - 1);
  5618. var actualParameters = this.parseActualParameters();
  5619. var tokenB = this.getToken(this.pos - 1);
  5620. var funcName = this.getFunctionName(id);
  5621. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5622. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5623. cmd.sourceInfo = sourceInfo;
  5624. return cmd;
  5625. }
  5626. }, {
  5627. key: 'parseFunctionCallCommand',
  5628. value: function parseFunctionCallCommand(id) {
  5629. return this.parseFunctionCallExpression(id);
  5630. }
  5631. }, {
  5632. key: 'parseParenthesisExp',
  5633. value: function parseParenthesisExp() {
  5634. this.checkOpenParenthesis();
  5635. var tokenA = this.getToken();
  5636. this.pos++;
  5637. this.consumeNewLines();
  5638. var exp = this.parseExpressionOR();
  5639. this.consumeNewLines();
  5640. this.checkCloseParenthesis();
  5641. var tokenB = this.getToken();
  5642. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5643. this.pos++;
  5644. exp.sourceInfo = sourceInfo;
  5645. return exp;
  5646. }
  5647. }, {
  5648. key: 'parseActualParameters',
  5649. value: function parseActualParameters() {
  5650. this.checkOpenParenthesis();
  5651. this.pos++;
  5652. if (this.checkCloseParenthesis(true)) {
  5653. this.pos++;
  5654. return [];
  5655. }
  5656. this.consumeNewLines();
  5657. var list = this.parseExpressionList();
  5658. this.consumeNewLines();
  5659. this.checkCloseParenthesis();
  5660. this.pos++;
  5661. return list;
  5662. }
  5663. }, {
  5664. key: 'parseExpressionList',
  5665. value: function parseExpressionList() {
  5666. var list = [];
  5667. while (true) {
  5668. var exp = this.parseExpressionOR();
  5669. list.push(exp);
  5670. var maybeToken = this.getToken();
  5671. if (maybeToken.type !== this.lexerClass.COMMA) {
  5672. break;
  5673. } else {
  5674. this.pos++;
  5675. this.consumeNewLines();
  5676. }
  5677. }
  5678. return list;
  5679. }
  5680. }, {
  5681. key: 'getTypeArray',
  5682. value: function getTypeArray() {
  5683. var _this = this;
  5684. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5685. return types.map(function (x) {
  5686. return _this.lexer.literalNames[x];
  5687. });
  5688. }
  5689. }]);
  5690. return IVProgParser;
  5691. }();
  5692. /***/ }),
  5693. /***/ "./js/ast/operators.js":
  5694. /*!*****************************!*\
  5695. !*** ./js/ast/operators.js ***!
  5696. \*****************************/
  5697. /*! no static exports found */
  5698. /***/ (function(module, exports, __webpack_require__) {
  5699. "use strict";
  5700. Object.defineProperty(exports, "__esModule", {
  5701. value: true
  5702. });
  5703. exports.convertFromString = convertFromString;
  5704. var Operators = exports.Operators = Object.freeze({
  5705. ADD: { ord: 0, value: "+" },
  5706. SUB: { ord: 1, value: "-" },
  5707. MULT: { ord: 2, value: '*' },
  5708. DIV: { ord: 3, value: '/' },
  5709. MOD: { ord: 4, value: '%' },
  5710. GT: { ord: 5, value: '>' },
  5711. GE: { ord: 6, value: '>=' },
  5712. LT: { ord: 7, value: '<' },
  5713. LE: { ord: 8, value: '<=' },
  5714. EQ: { ord: 9, value: '==' },
  5715. NEQ: { ord: 10, value: '!=' },
  5716. AND: { ord: 11, value: 'and' },
  5717. OR: { ord: 12, value: 'or' },
  5718. NOT: { ord: 13, value: 'not' }
  5719. });
  5720. function convertFromString(op) {
  5721. switch (op) {
  5722. case '+':
  5723. return Operators.ADD;
  5724. case '-':
  5725. return Operators.SUB;
  5726. case '*':
  5727. return Operators.MULT;
  5728. case '/':
  5729. return Operators.DIV;
  5730. case '%':
  5731. return Operators.MOD;
  5732. case '>':
  5733. return Operators.GT;
  5734. case '>=':
  5735. return Operators.GE;
  5736. case '<':
  5737. return Operators.LT;
  5738. case '<=':
  5739. return Operators.LE;
  5740. case '==':
  5741. return Operators.EQ;
  5742. case '!=':
  5743. return Operators.NEQ;
  5744. case 'and':
  5745. return Operators.AND;
  5746. case 'or':
  5747. return Operators.OR;
  5748. case 'not':
  5749. return Operators.NOT;
  5750. }
  5751. }
  5752. /***/ }),
  5753. /***/ "./js/ast/sourceInfo.js":
  5754. /*!******************************!*\
  5755. !*** ./js/ast/sourceInfo.js ***!
  5756. \******************************/
  5757. /*! no static exports found */
  5758. /***/ (function(module, exports, __webpack_require__) {
  5759. "use strict";
  5760. Object.defineProperty(exports, "__esModule", {
  5761. value: true
  5762. });
  5763. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5764. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5765. var SourceInfo = exports.SourceInfo = function () {
  5766. _createClass(SourceInfo, null, [{
  5767. key: "createSourceInfo",
  5768. value: function createSourceInfo(token) {
  5769. return new SourceInfo(token.line, token.column, token.text.length);
  5770. }
  5771. }, {
  5772. key: "createSourceInfoFromList",
  5773. value: function createSourceInfoFromList(tokenA, tokenB) {
  5774. var line = tokenA.line;
  5775. var column = tokenA.column;
  5776. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5777. // No idea why...
  5778. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5779. return new SourceInfo(line, column, size);
  5780. }
  5781. }]);
  5782. function SourceInfo(line, column, size) {
  5783. _classCallCheck(this, SourceInfo);
  5784. this.line = line;
  5785. this.column = column;
  5786. this.size = size;
  5787. }
  5788. return SourceInfo;
  5789. }();
  5790. /***/ }),
  5791. /***/ "./js/io/domConsole.js":
  5792. /*!*****************************!*\
  5793. !*** ./js/io/domConsole.js ***!
  5794. \*****************************/
  5795. /*! no static exports found */
  5796. /***/ (function(module, exports, __webpack_require__) {
  5797. "use strict";
  5798. Object.defineProperty(exports, "__esModule", {
  5799. value: true
  5800. });
  5801. exports.DOMConsole = undefined;
  5802. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5803. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5804. var _jquery2 = _interopRequireDefault(_jquery);
  5805. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5806. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5807. var DOMConsole = exports.DOMConsole = function () {
  5808. _createClass(DOMConsole, null, [{
  5809. key: 'USER',
  5810. get: function get() {
  5811. return 0;
  5812. }
  5813. }, {
  5814. key: 'INFO',
  5815. get: function get() {
  5816. return 1;
  5817. }
  5818. }, {
  5819. key: 'ERR',
  5820. get: function get() {
  5821. return 2;
  5822. }
  5823. }]);
  5824. function DOMConsole(elementID) {
  5825. _classCallCheck(this, DOMConsole);
  5826. this.input = null;
  5827. this.needInput = false;
  5828. this.termDiv = null;
  5829. this.anyKey = false;
  5830. this.parent = (0, _jquery2.default)(elementID);
  5831. this.setup();
  5832. this.inputListeners = [];
  5833. }
  5834. _createClass(DOMConsole, [{
  5835. key: 'setup',
  5836. value: function setup() {
  5837. this._setupDom();
  5838. this._setupEvents();
  5839. }
  5840. }, {
  5841. key: '_setupEvents',
  5842. value: function _setupEvents() {
  5843. var _this = this;
  5844. this.input.on("keydown", function (event) {
  5845. if (!_this.needInput) {
  5846. event.preventDefault();
  5847. return;
  5848. }
  5849. var keyCode = event.which;
  5850. if (keyCode === 13 || _this.anyKey) {
  5851. var text = _this.input.val();
  5852. text = text.replace('[\n\r]+', '');
  5853. _this.notifyListeners(text);
  5854. _this.write(text);
  5855. _this.input.val("");
  5856. }
  5857. });
  5858. }
  5859. }, {
  5860. key: '_setupDom',
  5861. value: function _setupDom() {
  5862. this.termDiv = (0, _jquery2.default)("<div></div>");
  5863. this.termDiv.addClass("ivprog-term-div");
  5864. this.input = (0, _jquery2.default)('<input text="type">');
  5865. this.input.addClass("ivprog-term-input");
  5866. this.termDiv.append(this.input);
  5867. this.parent.append(this.termDiv);
  5868. }
  5869. }, {
  5870. key: 'notifyListeners',
  5871. value: function notifyListeners(text) {
  5872. this.inputListeners.forEach(function (resolve) {
  5873. return resolve(text);
  5874. });
  5875. this.inputListeners.splice(0, this.inputListeners.length);
  5876. this.hideInput();
  5877. this.anyKey = false;
  5878. }
  5879. }, {
  5880. key: 'write',
  5881. value: function write(text) {
  5882. this._appendText(text, DOMConsole.USER);
  5883. }
  5884. }, {
  5885. key: 'info',
  5886. value: function info(text) {
  5887. this._appendText(text, DOMConsole.INFO);
  5888. }
  5889. }, {
  5890. key: 'err',
  5891. value: function err(text) {
  5892. this._appendText(text, DOMConsole.ERR);
  5893. }
  5894. }, {
  5895. key: '_appendText',
  5896. value: function _appendText(text, type) {
  5897. var divClass = this.getClassForType(type);
  5898. var textDiv = (0, _jquery2.default)("<div></div>");
  5899. textDiv.addClass(divClass);
  5900. textDiv.append(text);
  5901. textDiv.insertBefore(this.input);
  5902. this.scrollTerm();
  5903. }
  5904. }, {
  5905. key: 'scrollTerm',
  5906. value: function scrollTerm() {
  5907. this.termDiv.animate({
  5908. scrollTop: this.termDiv.prop('scrollHeight')
  5909. }, 0);
  5910. }
  5911. }, {
  5912. key: 'getClassForType',
  5913. value: function getClassForType(type) {
  5914. switch (type) {
  5915. case DOMConsole.USER:
  5916. return "ivprog-term-userText";
  5917. case DOMConsole.INFO:
  5918. return "ivprog-term-info";
  5919. case DOMConsole.ERR:
  5920. return "ivprog-term-error";
  5921. }
  5922. }
  5923. }, {
  5924. key: 'dispose',
  5925. value: function dispose() {
  5926. this.parent.off();
  5927. this.input.off();
  5928. this.input = null;
  5929. this.parent.empty();
  5930. }
  5931. }, {
  5932. key: 'showInput',
  5933. value: function showInput() {
  5934. this.needInput = true;
  5935. this.input.show();
  5936. this.input.focus();
  5937. }
  5938. }, {
  5939. key: 'hideInput',
  5940. value: function hideInput() {
  5941. this.needInput = false;
  5942. this.input.hide();
  5943. }
  5944. }, {
  5945. key: 'requestInput',
  5946. value: function requestInput(callback) {
  5947. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5948. this.inputListeners.push(callback);
  5949. this.anyKey = anyKey;
  5950. this.showInput();
  5951. }
  5952. }, {
  5953. key: 'sendOutput',
  5954. value: function sendOutput(text) {
  5955. var _this2 = this;
  5956. text.split("\n").forEach(function (t) {
  5957. t = t.replace(/\t/g, '&#9;');
  5958. _this2.write(t);
  5959. });
  5960. }
  5961. }, {
  5962. key: 'clear',
  5963. value: function clear() {
  5964. this.input.parent().children().not(this.input).remove();
  5965. this.input.val("");
  5966. }
  5967. }]);
  5968. return DOMConsole;
  5969. }();
  5970. /***/ }),
  5971. /***/ "./js/io/input.js":
  5972. /*!************************!*\
  5973. !*** ./js/io/input.js ***!
  5974. \************************/
  5975. /*! no static exports found */
  5976. /***/ (function(module, exports, __webpack_require__) {
  5977. "use strict";
  5978. Object.defineProperty(exports, "__esModule", {
  5979. value: true
  5980. });
  5981. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5982. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5983. var Input = exports.Input = function () {
  5984. function Input() {
  5985. _classCallCheck(this, Input);
  5986. }
  5987. _createClass(Input, [{
  5988. key: "requestInput",
  5989. value: function requestInput(callback) {
  5990. throw new Error("Must be implemented");
  5991. }
  5992. }]);
  5993. return Input;
  5994. }();
  5995. /***/ }),
  5996. /***/ "./js/io/output.js":
  5997. /*!*************************!*\
  5998. !*** ./js/io/output.js ***!
  5999. \*************************/
  6000. /*! no static exports found */
  6001. /***/ (function(module, exports, __webpack_require__) {
  6002. "use strict";
  6003. Object.defineProperty(exports, "__esModule", {
  6004. value: true
  6005. });
  6006. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6007. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6008. var Output = exports.Output = function () {
  6009. function Output() {
  6010. _classCallCheck(this, Output);
  6011. }
  6012. _createClass(Output, [{
  6013. key: "sendOutput",
  6014. value: function sendOutput(text) {
  6015. throw new Error("Must be implemented");
  6016. }
  6017. }]);
  6018. return Output;
  6019. }();
  6020. /***/ }),
  6021. /***/ "./js/main.js":
  6022. /*!********************!*\
  6023. !*** ./js/main.js ***!
  6024. \********************/
  6025. /*! no static exports found */
  6026. /***/ (function(module, exports, __webpack_require__) {
  6027. "use strict";
  6028. Object.defineProperty(exports, "__esModule", {
  6029. value: true
  6030. });
  6031. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6032. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6033. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6034. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6035. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6036. var i18n = _i18nHelper.i18nHelper.i18n;
  6037. exports.runner = _runner.runner;
  6038. exports.initVisualUI = _functions.initVisualUI;
  6039. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6040. exports.i18n = i18n;
  6041. /***/ }),
  6042. /***/ "./js/processor/compatibilityTable.js":
  6043. /*!********************************************!*\
  6044. !*** ./js/processor/compatibilityTable.js ***!
  6045. \********************************************/
  6046. /*! no static exports found */
  6047. /***/ (function(module, exports, __webpack_require__) {
  6048. "use strict";
  6049. Object.defineProperty(exports, "__esModule", {
  6050. value: true
  6051. });
  6052. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6053. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6054. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6055. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6056. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6057. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6058. function buildInfixAddTable() {
  6059. var table = [[], [], [], []];
  6060. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6061. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6062. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6063. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6064. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6065. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6066. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6067. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6068. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6069. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6070. return table;
  6071. }
  6072. function buildInfixMultiDivSubTable() {
  6073. var table = [[], [], [], []];
  6074. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6075. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6076. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6077. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6078. return table;
  6079. }
  6080. function buildInfixEqualityInequalityTable() {
  6081. var table = [[], [], [], []];
  6082. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6083. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6084. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6085. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6086. return table;
  6087. }
  6088. function buildInfixRelationalTable() {
  6089. var table = [[], [], [], []];
  6090. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6091. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6092. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6093. return table;
  6094. }
  6095. function buildInfixAndOrTable() {
  6096. var table = [[], [], [], []];
  6097. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6098. return table;
  6099. }
  6100. function buildInfixModTable() {
  6101. var table = [[], [], [], []];
  6102. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6103. return table;
  6104. }
  6105. function buildUnarySumSubList() {
  6106. var list = [];
  6107. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6108. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6109. return list;
  6110. }
  6111. function buildUnaryNegList() {
  6112. var list = [];
  6113. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6114. return list;
  6115. }
  6116. function buildInfixCompatibilityTable() {
  6117. var compatibilityMap = new WeakMap();
  6118. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6119. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6120. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6121. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6122. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6123. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6124. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6125. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6126. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6127. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6128. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6129. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6130. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6131. return compatibilityMap;
  6132. }
  6133. function buildUnaryCompatibilityTable() {
  6134. var compatibilityMap = new WeakMap();
  6135. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6136. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6137. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6138. return compatibilityMap;
  6139. }
  6140. var infixMap = buildInfixCompatibilityTable();
  6141. var unaryMap = buildUnaryCompatibilityTable();
  6142. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6143. try {
  6144. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6145. var newMulti = [];
  6146. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6147. var element = leftExpressionType.types[i];
  6148. if (rightExpressionType.types.indexOf(element) !== -1) {
  6149. newMulti.push(element);
  6150. }
  6151. }
  6152. if (newMulti.length <= 0) {
  6153. if (_config.Config.enable_type_casting) {
  6154. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6155. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6156. return new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]);
  6157. }
  6158. }
  6159. }
  6160. return _types.Types.UNDEFINED;
  6161. } else {
  6162. return new _multiType.MultiType(newMulti);
  6163. }
  6164. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6165. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6166. return rightExpressionType;
  6167. } else {
  6168. if (_config.Config.enable_type_casting) {
  6169. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6170. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6171. return rightExpressionType;
  6172. }
  6173. }
  6174. }
  6175. return _types.Types.UNDEFINED;
  6176. }
  6177. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6178. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6179. return leftExpressionType;
  6180. } else {
  6181. if (_config.Config.enable_type_casting) {
  6182. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6183. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6184. return leftExpressionType;
  6185. }
  6186. }
  6187. }
  6188. return _types.Types.UNDEFINED;
  6189. }
  6190. }
  6191. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6192. if (resultType === null || resultType === undefined) {
  6193. if (_config.Config.enable_type_casting) {
  6194. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6195. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6196. if (operator === _operators.Operators.MOD) {
  6197. return _types.Types.INTEGER;
  6198. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6199. return _types.Types.BOOLEAN;
  6200. }
  6201. }
  6202. }
  6203. }
  6204. return _types.Types.UNDEFINED;
  6205. }
  6206. return resultType;
  6207. } catch (e) {
  6208. if (e instanceof TypeError) {
  6209. return _types.Types.UNDEFINED;
  6210. } else {
  6211. throw e;
  6212. }
  6213. }
  6214. }
  6215. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6216. try {
  6217. if (leftExpressionType instanceof _multiType.MultiType) {
  6218. return leftExpressionType;
  6219. }
  6220. return unaryMap.get(operator)[leftExpressionType.ord];
  6221. } catch (e) {
  6222. if (e instanceof TypeError) {
  6223. return _types.Types.UNDEFINED;
  6224. } else {
  6225. throw e;
  6226. }
  6227. }
  6228. }
  6229. /***/ }),
  6230. /***/ "./js/processor/context.js":
  6231. /*!*********************************!*\
  6232. !*** ./js/processor/context.js ***!
  6233. \*********************************/
  6234. /*! no static exports found */
  6235. /***/ (function(module, exports, __webpack_require__) {
  6236. "use strict";
  6237. Object.defineProperty(exports, "__esModule", {
  6238. value: true
  6239. });
  6240. var Context = exports.Context = Object.freeze({
  6241. BASE: Symbol('context:base'),
  6242. BREAKABLE: Symbol('context:breakable'),
  6243. FUNCTION: Symbol('context:function')
  6244. });
  6245. /***/ }),
  6246. /***/ "./js/processor/definedFunctions.js":
  6247. /*!******************************************!*\
  6248. !*** ./js/processor/definedFunctions.js ***!
  6249. \******************************************/
  6250. /*! no static exports found */
  6251. /***/ (function(module, exports, __webpack_require__) {
  6252. "use strict";
  6253. Object.defineProperty(exports, "__esModule", {
  6254. value: true
  6255. });
  6256. exports.LanguageDefinedFunction = undefined;
  6257. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6258. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6259. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6260. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6261. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6262. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6263. function valueToKey(value, object) {
  6264. for (var key in object) {
  6265. if (object.hasOwnProperty(key)) {
  6266. if (object[key] === value) {
  6267. return key;
  6268. }
  6269. }
  6270. }
  6271. return null;
  6272. }
  6273. function concatObjects() {
  6274. var result = {};
  6275. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6276. objs[_key] = arguments[_key];
  6277. }
  6278. for (var i = 0; i < objs.length; i++) {
  6279. var obj = objs[i];
  6280. for (var key in obj) {
  6281. if (obj.hasOwnProperty(key)) {
  6282. result[key] = obj[key];
  6283. }
  6284. }
  6285. }
  6286. return result;
  6287. }
  6288. var libsObject = {
  6289. $mathLib: {
  6290. $sin: (0, _math.createSinFun)(),
  6291. $cos: (0, _math.createCosFun)(),
  6292. $tan: (0, _math.createTanFun)(),
  6293. $sqrt: (0, _math.createSqrtFun)(),
  6294. $pow: (0, _math.createPowFun)(),
  6295. $log: (0, _math.createLogFun)(),
  6296. $abs: (0, _math.createAbsFun)(),
  6297. $negate: (0, _math.createNegateFun)(),
  6298. $invert: (0, _math.createInvertFun)(),
  6299. $max: (0, _math.createMaxFun)(),
  6300. $min: (0, _math.createMinFun)()
  6301. },
  6302. $ioLib: {
  6303. $read: (0, _io.createInputFun)(),
  6304. $write: (0, _io.createOutputFun)()
  6305. },
  6306. $strLib: {
  6307. $substring: (0, _strings.createSubstringFun)(),
  6308. $length: (0, _strings.createLengthFun)(),
  6309. $uppercase: (0, _strings.createUppercaseFun)(),
  6310. $lowercase: (0, _strings.createLowercaseFun)(),
  6311. $charAt: (0, _strings.createrCharAtFun)()
  6312. },
  6313. $arrayLib: {
  6314. $numElements: (0, _arrays.createNumElementsFun)(),
  6315. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6316. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6317. },
  6318. $langLib: {
  6319. $isReal: (0, _lang.createIsRealFun)(),
  6320. $isInt: (0, _lang.createIsIntFun)(),
  6321. $isBool: (0, _lang.createIsBoolFun)(),
  6322. $castReal: (0, _lang.createCastRealFun)(),
  6323. $castInt: (0, _lang.createCastIntFun)(),
  6324. $castBool: (0, _lang.createCastBoolFun)(),
  6325. $castString: (0, _lang.createCastStringFun)()
  6326. }
  6327. };
  6328. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6329. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6330. getMainFunctionName: function getMainFunctionName() {
  6331. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6332. },
  6333. getInternalName: function getInternalName(localName) {
  6334. if (localName.indexOf(".") !== -1) {
  6335. var names = localName.split(".");
  6336. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6337. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6338. if (lib === null || internalName === null) {
  6339. return null;
  6340. }
  6341. return lib + "." + internalName;
  6342. }
  6343. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6344. if (funcName !== null) {
  6345. if (funcsObject[funcName]) {
  6346. return funcName;
  6347. }
  6348. }
  6349. return null;
  6350. },
  6351. getFunction: function getFunction(internalName) {
  6352. if (internalName.indexOf(".") !== -1) {
  6353. var names = internalName.split(".");
  6354. var libName = names[0];
  6355. var funName = names[1];
  6356. return libsObject[libName][funName];
  6357. }
  6358. return funcsObject[internalName];
  6359. },
  6360. getLocalName: function getLocalName(internalName) {
  6361. if (internalName.indexOf(".") !== -1) {
  6362. var names = internalName.split(".");
  6363. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6364. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6365. return libName + '.' + funName;
  6366. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6367. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6368. } else {
  6369. return internalName;
  6370. }
  6371. }
  6372. });
  6373. /***/ }),
  6374. /***/ "./js/processor/error/processorErrorFactory.js":
  6375. /*!*****************************************************!*\
  6376. !*** ./js/processor/error/processorErrorFactory.js ***!
  6377. \*****************************************************/
  6378. /*! no static exports found */
  6379. /***/ (function(module, exports, __webpack_require__) {
  6380. "use strict";
  6381. Object.defineProperty(exports, "__esModule", {
  6382. value: true
  6383. });
  6384. exports.ProcessorErrorFactory = undefined;
  6385. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6386. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6387. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6388. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6389. function translateType(type, dim) {
  6390. switch (dim) {
  6391. case 0:
  6392. return _localizedStringsService.LocalizedStrings.getUI(type);
  6393. default:
  6394. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6395. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6396. }
  6397. }
  6398. function translateOp(op) {
  6399. switch (op.ord) {
  6400. case _operators.Operators.AND.ord:
  6401. case _operators.Operators.OR.ord:
  6402. case _operators.Operators.NOT.ord:
  6403. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6404. default:
  6405. return op.value;
  6406. }
  6407. }
  6408. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6409. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6410. if (sourceInfo) {
  6411. var context = [id, sourceInfo.line, sourceInfo.column];
  6412. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6413. } else {
  6414. return ProcessorErrorFactory.symbol_not_found(id);
  6415. }
  6416. },
  6417. symbol_not_found: function symbol_not_found(id) {
  6418. var context = [id];
  6419. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6420. },
  6421. function_missing_full: function function_missing_full(id, sourceInfo) {
  6422. if (sourceInfo) {
  6423. var context = [id, sourceInfo.line, sourceInfo.column];
  6424. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6425. } else {
  6426. return ProcessorErrorFactory.function_missing(id);
  6427. }
  6428. },
  6429. function_missing: function function_missing(id) {
  6430. var context = [id];
  6431. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6432. },
  6433. main_missing: function main_missing() {
  6434. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6435. }, // TODO: better urgent error message
  6436. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6437. if (sourceInfo) {
  6438. var context = [sourceInfo.line];
  6439. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6440. } else {
  6441. return ProcessorErrorFactory.array_dimension_not_int();
  6442. }
  6443. },
  6444. array_dimension_not_int: function array_dimension_not_int() {
  6445. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6446. },
  6447. unknown_command_full: function unknown_command_full(sourceInfo) {
  6448. if (sourceInfo) {
  6449. var context = [sourceInfo.line];
  6450. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6451. } else {
  6452. return ProcessorErrorFactory.unknown_command();
  6453. }
  6454. },
  6455. unknown_command: function unknown_command() {
  6456. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6457. },
  6458. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6459. if (sourceInfo) {
  6460. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6461. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6462. } else {
  6463. return ProcessorErrorFactory.incompatible_types(type, dim);
  6464. }
  6465. },
  6466. incompatible_types: function incompatible_types(type, dim) {
  6467. var context = [translateType(type, dim)];
  6468. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6469. },
  6470. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6471. if (sourceInfo) {
  6472. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6473. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6474. } else {
  6475. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6476. }
  6477. },
  6478. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6479. var context = [exp, translateType(type, dim)];
  6480. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6481. },
  6482. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  6483. if (sourceInfo) {
  6484. var context = [sourceInfo.line, sourceInfo.column];
  6485. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6486. } else {
  6487. return ProcessorErrorFactory.loop_condition_type();
  6488. }
  6489. },
  6490. loop_condition_type: function loop_condition_type() {
  6491. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  6492. },
  6493. endless_loop_full: function endless_loop_full(sourceInfo) {
  6494. if (sourceInfo) {
  6495. var context = [sourceInfo.line];
  6496. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6497. } else {
  6498. return ProcessorErrorFactory.endless_loop();
  6499. }
  6500. },
  6501. endless_loop: function endless_loop() {
  6502. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6503. },
  6504. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  6505. if (sourceInfo) {
  6506. var context = [sourceInfo.line, sourceInfo.column];
  6507. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6508. } else {
  6509. return ProcessorErrorFactory.for_condition_type();
  6510. }
  6511. },
  6512. for_condition_type: function for_condition_type() {
  6513. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  6514. },
  6515. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  6516. if (sourceInfo) {
  6517. var context = [sourceInfo.line, sourceInfo.column];
  6518. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6519. } else {
  6520. return ProcessorErrorFactory.if_condition_type();
  6521. }
  6522. },
  6523. if_condition_type: function if_condition_type() {
  6524. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  6525. },
  6526. invalid_global_var: function invalid_global_var() {
  6527. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6528. },
  6529. not_implemented: function not_implemented(id) {
  6530. var context = [id];
  6531. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6532. },
  6533. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6534. if (sourceInfo) {
  6535. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6536. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6537. } else {
  6538. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6539. }
  6540. },
  6541. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6542. var context = [exp, translateType(type, dim)];
  6543. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6544. },
  6545. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6546. if (sourceInfo) {
  6547. var context = [sourceInfo.line, sourceInfo.column, id];
  6548. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6549. } else {
  6550. return ProcessorErrorFactory.void_in_expression(id);
  6551. }
  6552. },
  6553. void_in_expression: function void_in_expression(id) {
  6554. var context = [id];
  6555. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6556. },
  6557. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6558. if (sourceInfo) {
  6559. var context = [id, sourceInfo.line, sourceInfo.column];
  6560. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6561. } else {
  6562. return ProcessorErrorFactory.invalid_array_access(id);
  6563. }
  6564. },
  6565. invalid_array_access: function invalid_array_access(id) {
  6566. var context = [id];
  6567. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6568. },
  6569. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6570. if (sourceInfo) {
  6571. var context = [id, sourceInfo.line, sourceInfo.column];
  6572. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6573. } else {
  6574. return ProcessorErrorFactory.invalid_matrix_access(id);
  6575. }
  6576. },
  6577. invalid_matrix_access: function invalid_matrix_access(id) {
  6578. var context = [id];
  6579. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6580. },
  6581. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6582. if (sourceInfo) {
  6583. var context = [sourceInfo.line, value, id, columns];
  6584. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6585. } else {
  6586. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6587. }
  6588. },
  6589. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6590. var context = [value, id, columns];
  6591. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6592. },
  6593. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6594. if (sourceInfo) {
  6595. var context = [sourceInfo.line, value, id, lines];
  6596. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6597. } else {
  6598. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6599. }
  6600. },
  6601. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6602. var context = [value, id, lines];
  6603. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6604. },
  6605. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6606. if (sourceInfo) {
  6607. var context = [sourceInfo.line, value, id, lines];
  6608. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6609. } else {
  6610. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6611. }
  6612. },
  6613. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6614. var context = [value, id, lines];
  6615. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6616. },
  6617. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6618. if (sourceInfo) {
  6619. var context = [sourceInfo.line, id];
  6620. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6621. } else {
  6622. return ProcessorErrorFactory.vector_not_matrix(id);
  6623. }
  6624. },
  6625. vector_not_matrix: function vector_not_matrix(id) {
  6626. var context = [id];
  6627. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6628. },
  6629. function_no_return: function function_no_return(id) {
  6630. var context = [id];
  6631. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6632. },
  6633. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6634. if (sourceInfo) {
  6635. var context = [sourceInfo.line, id, translateType(type, dim)];
  6636. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6637. } else {
  6638. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6639. }
  6640. },
  6641. invalid_void_return: function invalid_void_return(id, type, dim) {
  6642. var context = [id, translateType(type, dim)];
  6643. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6644. },
  6645. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6646. if (sourceInfo) {
  6647. var context = [sourceInfo.line, id, translateType(type, dim)];
  6648. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6649. } else {
  6650. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6651. }
  6652. },
  6653. invalid_return_type: function invalid_return_type(id, type, dim) {
  6654. var context = [id, translateType(type, dim)];
  6655. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6656. },
  6657. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6658. if (sourceInfo) {
  6659. var context = [sourceInfo.line, id, expected, actual];
  6660. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6661. } else {
  6662. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6663. }
  6664. },
  6665. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6666. var context = [id, expected, actual];
  6667. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6668. },
  6669. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6670. if (sourceInfo) {
  6671. var context = [exp, id, sourceInfo.line];
  6672. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6673. } else {
  6674. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6675. }
  6676. },
  6677. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6678. var context = [exp, id];
  6679. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6680. },
  6681. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6682. if (sourceInfo) {
  6683. var context = [exp, id, sourceInfo.line];
  6684. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6685. } else {
  6686. return ProcessorErrorFactory.invalid_ref(id, exp);
  6687. }
  6688. },
  6689. invalid_ref: function invalid_ref(id, exp) {
  6690. var context = [exp, id];
  6691. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6692. },
  6693. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6694. if (sourceInfo) {
  6695. var context = [sourceInfo.line];
  6696. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6697. } else {
  6698. return ProcessorErrorFactory.unexpected_break_command();
  6699. }
  6700. },
  6701. unexpected_break_command: function unexpected_break_command() {
  6702. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6703. },
  6704. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6705. if (sourceInfo) {
  6706. var context = [sourceInfo.line, exp];
  6707. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6708. } else {
  6709. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6710. }
  6711. },
  6712. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6713. var context = [exp];
  6714. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6715. },
  6716. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6717. if (sourceInfo) {
  6718. var context = [sourceInfo.line, expected, actual];
  6719. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6720. } else {
  6721. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6722. }
  6723. },
  6724. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6725. var context = [expected, actual];
  6726. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6727. },
  6728. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6729. if (sourceInfo) {
  6730. var context = [sourceInfo.line, expected, actual];
  6731. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6732. } else {
  6733. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6734. }
  6735. },
  6736. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6737. var context = [expected, actual];
  6738. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6739. },
  6740. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6741. if (sourceInfo) {
  6742. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6743. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6744. } else {
  6745. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6746. }
  6747. },
  6748. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6749. var context = [translateOp(opName), translateType(type, dim)];
  6750. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6751. },
  6752. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6753. if (sourceInfo) {
  6754. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6755. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6756. } else {
  6757. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6758. }
  6759. },
  6760. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6761. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6762. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6763. },
  6764. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6765. if (sourceInfo) {
  6766. var context = [sourceInfo.line];
  6767. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6768. } else {
  6769. return ProcessorErrorFactory.array_dimension_not_positive();
  6770. }
  6771. },
  6772. array_dimension_not_positive: function array_dimension_not_positive() {
  6773. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6774. }
  6775. });
  6776. /***/ }),
  6777. /***/ "./js/processor/error/runtimeError.js":
  6778. /*!********************************************!*\
  6779. !*** ./js/processor/error/runtimeError.js ***!
  6780. \********************************************/
  6781. /*! no static exports found */
  6782. /***/ (function(module, exports, __webpack_require__) {
  6783. "use strict";
  6784. Object.defineProperty(exports, "__esModule", {
  6785. value: true
  6786. });
  6787. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6788. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6789. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6790. var RuntimeError = exports.RuntimeError = function (_Error) {
  6791. _inherits(RuntimeError, _Error);
  6792. function RuntimeError() {
  6793. var _ref;
  6794. _classCallCheck(this, RuntimeError);
  6795. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6796. msg[_key] = arguments[_key];
  6797. }
  6798. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6799. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6800. return _this;
  6801. }
  6802. return RuntimeError;
  6803. }(Error);
  6804. /***/ }),
  6805. /***/ "./js/processor/error/semanticError.js":
  6806. /*!*********************************************!*\
  6807. !*** ./js/processor/error/semanticError.js ***!
  6808. \*********************************************/
  6809. /*! no static exports found */
  6810. /***/ (function(module, exports, __webpack_require__) {
  6811. "use strict";
  6812. Object.defineProperty(exports, "__esModule", {
  6813. value: true
  6814. });
  6815. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6816. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6817. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6818. var SemanticError = exports.SemanticError = function (_Error) {
  6819. _inherits(SemanticError, _Error);
  6820. function SemanticError() {
  6821. var _ref;
  6822. _classCallCheck(this, SemanticError);
  6823. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6824. msg[_key] = arguments[_key];
  6825. }
  6826. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6827. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6828. return _this;
  6829. }
  6830. return SemanticError;
  6831. }(Error);
  6832. /***/ }),
  6833. /***/ "./js/processor/ivprogProcessor.js":
  6834. /*!*****************************************!*\
  6835. !*** ./js/processor/ivprogProcessor.js ***!
  6836. \*****************************************/
  6837. /*! no static exports found */
  6838. /***/ (function(module, exports, __webpack_require__) {
  6839. "use strict";
  6840. Object.defineProperty(exports, "__esModule", {
  6841. value: true
  6842. });
  6843. exports.IVProgProcessor = undefined;
  6844. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6845. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6846. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6847. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6848. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6849. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6850. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6851. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6852. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6853. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6854. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6855. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6856. var Commands = _interopRequireWildcard(_commands);
  6857. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6858. var Expressions = _interopRequireWildcard(_expressions);
  6859. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6860. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6861. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6862. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6863. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6864. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6865. var _decimal2 = _interopRequireDefault(_decimal);
  6866. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6867. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6868. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6869. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6870. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6871. var IVProgProcessor = exports.IVProgProcessor = function () {
  6872. _createClass(IVProgProcessor, null, [{
  6873. key: 'LOOP_TIMEOUT',
  6874. get: function get() {
  6875. return _config.Config.loopTimeout;
  6876. },
  6877. set: function set(ms) {
  6878. _config.Config.setConfig({ loopTimeout: ms });
  6879. }
  6880. }, {
  6881. key: 'MAIN_INTERNAL_ID',
  6882. get: function get() {
  6883. return "$main";
  6884. }
  6885. }]);
  6886. function IVProgProcessor(ast) {
  6887. _classCallCheck(this, IVProgProcessor);
  6888. this.ast = ast;
  6889. this.globalStore = new _store.Store("$global");
  6890. this.stores = [this.globalStore];
  6891. this.context = [_context.Context.BASE];
  6892. this.input = null;
  6893. this.forceKill = false;
  6894. this.loopTimers = [];
  6895. this.output = null;
  6896. }
  6897. _createClass(IVProgProcessor, [{
  6898. key: 'registerInput',
  6899. value: function registerInput(input) {
  6900. if (this.input !== null) this.input = null;
  6901. this.input = input;
  6902. }
  6903. }, {
  6904. key: 'registerOutput',
  6905. value: function registerOutput(output) {
  6906. if (this.output !== null) this.output = null;
  6907. this.output = output;
  6908. }
  6909. }, {
  6910. key: 'checkContext',
  6911. value: function checkContext(context) {
  6912. return this.context[this.context.length - 1] === context;
  6913. }
  6914. }, {
  6915. key: 'ignoreSwitchCases',
  6916. value: function ignoreSwitchCases(store) {
  6917. if (store.mode === _modes.Modes.RETURN) {
  6918. return true;
  6919. } else if (store.mode === _modes.Modes.BREAK) {
  6920. return true;
  6921. } else {
  6922. return false;
  6923. }
  6924. }
  6925. }, {
  6926. key: 'prepareState',
  6927. value: function prepareState() {
  6928. if (this.stores !== null) {
  6929. for (var i = 0; i < this.stores.length; i++) {
  6930. delete this.stores[i];
  6931. }
  6932. this.stores = null;
  6933. }
  6934. if (this.globalStore !== null) this.globalStore = null;
  6935. this.globalStore = new _store.Store("$global");
  6936. this.stores = [this.globalStore];
  6937. this.context = [_context.Context.BASE];
  6938. }
  6939. }, {
  6940. key: 'interpretAST',
  6941. value: function interpretAST() {
  6942. var _this = this;
  6943. this.prepareState();
  6944. return this.initGlobal().then(function (_) {
  6945. var mainFunc = _this.findMainFunction();
  6946. if (mainFunc === null) {
  6947. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6948. }
  6949. return _this.runFunction(mainFunc, [], _this.globalStore);
  6950. });
  6951. }
  6952. }, {
  6953. key: 'initGlobal',
  6954. value: function initGlobal() {
  6955. if (!this.checkContext(_context.Context.BASE)) {
  6956. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6957. }
  6958. return this.executeCommands(this.globalStore, this.ast.global);
  6959. }
  6960. }, {
  6961. key: 'findMainFunction',
  6962. value: function findMainFunction() {
  6963. return this.ast.functions.find(function (v) {
  6964. return v.isMain;
  6965. });
  6966. }
  6967. }, {
  6968. key: 'findFunction',
  6969. value: function findFunction(name) {
  6970. if (name.match(/^\$.+$/)) {
  6971. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6972. if (!!!fun) {
  6973. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  6974. }
  6975. return fun;
  6976. } else {
  6977. var val = this.ast.functions.find(function (v) {
  6978. return v.name === name;
  6979. });
  6980. if (!!!val) {
  6981. // TODO: better error message;
  6982. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  6983. }
  6984. return val;
  6985. }
  6986. }
  6987. }, {
  6988. key: 'runFunction',
  6989. value: function runFunction(func, actualParameters, store) {
  6990. var _this2 = this;
  6991. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  6992. var funcStore = new _store.Store(funcName);
  6993. funcStore.extendStore(this.globalStore);
  6994. var returnStoreObject = null;
  6995. if (func.returnType instanceof _compoundType.CompoundType) {
  6996. if (func.returnType.dimensions > 1) {
  6997. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  6998. } else {
  6999. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  7000. }
  7001. } else {
  7002. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  7003. }
  7004. funcStore.insertStore('$', returnStoreObject);
  7005. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  7006. return newFuncStore$.then(function (sto) {
  7007. _this2.context.push(_context.Context.FUNCTION);
  7008. _this2.stores.push(sto);
  7009. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7010. return _this2.executeCommands(stoWithVars, func.commands);
  7011. }).then(function (finalSto) {
  7012. _this2.stores.pop();
  7013. _this2.context.pop();
  7014. return finalSto;
  7015. });
  7016. });
  7017. }
  7018. }, {
  7019. key: 'associateParameters',
  7020. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7021. var _this3 = this;
  7022. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  7023. if (formalList.length != actualList.length) {
  7024. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  7025. }
  7026. var promises$ = actualList.map(function (actualParameter) {
  7027. return _this3.evaluateExpression(callerStore, actualParameter);
  7028. });
  7029. return Promise.all(promises$).then(function (values) {
  7030. for (var i = 0; i < values.length; i++) {
  7031. var stoObj = values[i];
  7032. var exp = actualList[i];
  7033. var shouldTypeCast = false;
  7034. var formalParameter = formalList[i];
  7035. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7036. if (_config.Config.enable_type_casting && !formalParameter.byRef && _store.Store.canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7037. shouldTypeCast = true;
  7038. } else {
  7039. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7040. }
  7041. }
  7042. if (formalParameter.byRef && !stoObj.inStore) {
  7043. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7044. }
  7045. if (formalParameter.byRef) {
  7046. var ref = null;
  7047. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7048. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7049. } else {
  7050. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7051. }
  7052. calleeStore.insertStore(formalParameter.id, ref);
  7053. } else {
  7054. var realValue = _this3.parseStoreObjectValue(stoObj);
  7055. if (shouldTypeCast) {
  7056. realValue = _store.Store.doImplicitCasting(formalParameter.type, realValue);
  7057. }
  7058. calleeStore.insertStore(formalParameter.id, realValue);
  7059. }
  7060. }
  7061. return calleeStore;
  7062. });
  7063. }
  7064. }, {
  7065. key: 'executeCommands',
  7066. value: function executeCommands(store, cmds) {
  7067. // helper to partially apply a function, in this case executeCommand
  7068. var outerRef = this;
  7069. var partial = function partial(fun, cmd) {
  7070. return function (sto) {
  7071. return fun(sto, cmd);
  7072. };
  7073. };
  7074. return cmds.reduce(function (lastCommand, next) {
  7075. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7076. return lastCommand.then(nextCommand);
  7077. }, Promise.resolve(store));
  7078. }
  7079. }, {
  7080. key: 'executeCommand',
  7081. value: function executeCommand(store, cmd) {
  7082. if (this.forceKill) {
  7083. return Promise.reject("FORCED_KILL!");
  7084. } else if (store.mode === _modes.Modes.PAUSE) {
  7085. return Promise.resolve(this.executeCommand(store, cmd));
  7086. } else if (store.mode === _modes.Modes.RETURN) {
  7087. return Promise.resolve(store);
  7088. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7089. return Promise.resolve(store);
  7090. }
  7091. if (cmd instanceof Commands.Declaration) {
  7092. return this.executeDeclaration(store, cmd);
  7093. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7094. return this.executeArrayIndexAssign(store, cmd);
  7095. } else if (cmd instanceof Commands.Assign) {
  7096. return this.executeAssign(store, cmd);
  7097. } else if (cmd instanceof Commands.Break) {
  7098. return this.executeBreak(store, cmd);
  7099. } else if (cmd instanceof Commands.Return) {
  7100. return this.executeReturn(store, cmd);
  7101. } else if (cmd instanceof Commands.IfThenElse) {
  7102. return this.executeIfThenElse(store, cmd);
  7103. } else if (cmd instanceof Commands.While) {
  7104. return this.executeWhile(store, cmd);
  7105. } else if (cmd instanceof Commands.DoWhile) {
  7106. return this.executeDoWhile(store, cmd);
  7107. } else if (cmd instanceof Commands.For) {
  7108. return this.executeFor(store, cmd);
  7109. } else if (cmd instanceof Commands.Switch) {
  7110. return this.executeSwitch(store, cmd);
  7111. } else if (cmd instanceof Expressions.FunctionCall) {
  7112. return this.executeFunctionCall(store, cmd);
  7113. } else if (cmd instanceof Commands.SysCall) {
  7114. return this.executeSysCall(store, cmd);
  7115. } else {
  7116. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7117. }
  7118. }
  7119. }, {
  7120. key: 'executeSysCall',
  7121. value: function executeSysCall(store, cmd) {
  7122. var func = cmd.langFunc.bind(this);
  7123. return func(store, cmd);
  7124. }
  7125. }, {
  7126. key: 'executeFunctionCall',
  7127. value: function executeFunctionCall(store, cmd) {
  7128. var func = null;
  7129. if (cmd.isMainCall) {
  7130. func = this.findMainFunction();
  7131. } else {
  7132. func = this.findFunction(cmd.id);
  7133. }
  7134. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7135. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7136. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7137. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7138. } else {
  7139. return store;
  7140. }
  7141. });
  7142. }
  7143. }, {
  7144. key: 'executeSwitch',
  7145. value: function executeSwitch(store, cmd) {
  7146. var _this4 = this;
  7147. this.context.push(_context.Context.BREAKABLE);
  7148. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7149. return promise.then(function (result) {
  7150. var sto = result.sto;
  7151. if (_this4.ignoreSwitchCases(sto)) {
  7152. return Promise.resolve(result);
  7153. } else if (result.wasTrue || aCase.isDefault) {
  7154. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7155. return $newSto.then(function (nSto) {
  7156. return Promise.resolve({ wasTrue: true, sto: nSto });
  7157. });
  7158. } else {
  7159. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7160. return $value.then(function (vl) {
  7161. if (vl.value) {
  7162. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7163. return _$newSto.then(function (nSto) {
  7164. return Promise.resolve({ wasTrue: true, sto: nSto });
  7165. });
  7166. } else {
  7167. return Promise.resolve({ wasTrue: false, sto: sto });
  7168. }
  7169. });
  7170. }
  7171. });
  7172. };
  7173. try {
  7174. var breakLoop = false;
  7175. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7176. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7177. var aCase = cmd.cases[index];
  7178. $result = auxCaseFun($result, cmd.expression, aCase);
  7179. $result.then(function (r) {
  7180. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7181. });
  7182. }
  7183. return $result.then(function (r) {
  7184. _this4.context.pop();
  7185. if (r.sto.mode === _modes.Modes.BREAK) {
  7186. r.sto.mode = _modes.Modes.RUN;
  7187. }
  7188. return r.sto;
  7189. });
  7190. } catch (error) {
  7191. return Promise.reject(error);
  7192. }
  7193. }
  7194. }, {
  7195. key: 'executeFor',
  7196. value: function executeFor(store, cmd) {
  7197. try {
  7198. //BEGIN for -> while rewrite
  7199. var initCmd = cmd.assignment;
  7200. var condition = cmd.condition;
  7201. var increment = cmd.increment;
  7202. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7203. var forAsWhile = new Commands.While(condition, whileBlock);
  7204. forAsWhile.sourceInfo = cmd.sourceInfo;
  7205. //END for -> while rewrite
  7206. var newCmdList = [initCmd, forAsWhile];
  7207. return this.executeCommands(store, newCmdList);
  7208. } catch (error) {
  7209. return Promise.reject(error);
  7210. }
  7211. }
  7212. }, {
  7213. key: 'executeDoWhile',
  7214. value: function executeDoWhile(store, cmd) {
  7215. var outerRef = this;
  7216. try {
  7217. outerRef.loopTimers.push(Date.now());
  7218. outerRef.context.push(_context.Context.BREAKABLE);
  7219. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7220. return $newStore.then(function (sto) {
  7221. if (sto.mode === _modes.Modes.BREAK) {
  7222. outerRef.context.pop();
  7223. sto.mode = _modes.Modes.RUN;
  7224. outerRef.loopTimers.pop();
  7225. return sto;
  7226. }
  7227. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7228. return $value.then(function (vl) {
  7229. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7230. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7231. }
  7232. if (vl.value) {
  7233. outerRef.context.pop();
  7234. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7235. var time = outerRef.loopTimers[i];
  7236. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7237. outerRef.forceKill = true;
  7238. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7239. }
  7240. }
  7241. return outerRef.executeCommand(sto, cmd);
  7242. } else {
  7243. outerRef.context.pop();
  7244. outerRef.loopTimers.pop();
  7245. return sto;
  7246. }
  7247. });
  7248. });
  7249. } catch (error) {
  7250. return Promise.reject(error);
  7251. }
  7252. }
  7253. }, {
  7254. key: 'executeWhile',
  7255. value: function executeWhile(store, cmd) {
  7256. var outerRef = this;
  7257. try {
  7258. outerRef.loopTimers.push(Date.now());
  7259. outerRef.context.push(_context.Context.BREAKABLE);
  7260. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7261. return $value.then(function (vl) {
  7262. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7263. if (vl.value) {
  7264. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7265. return $newStore.then(function (sto) {
  7266. outerRef.context.pop();
  7267. if (sto.mode === _modes.Modes.BREAK) {
  7268. outerRef.loopTimers.pop();
  7269. sto.mode = _modes.Modes.RUN;
  7270. return sto;
  7271. }
  7272. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7273. var time = outerRef.loopTimers[i];
  7274. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7275. outerRef.forceKill = true;
  7276. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7277. }
  7278. }
  7279. return outerRef.executeCommand(sto, cmd);
  7280. });
  7281. } else {
  7282. outerRef.context.pop();
  7283. outerRef.loopTimers.pop();
  7284. return store;
  7285. }
  7286. } else {
  7287. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7288. }
  7289. });
  7290. } catch (error) {
  7291. return Promise.reject(error);
  7292. }
  7293. }
  7294. }, {
  7295. key: 'executeIfThenElse',
  7296. value: function executeIfThenElse(store, cmd) {
  7297. var _this5 = this;
  7298. try {
  7299. var $value = this.evaluateExpression(store, cmd.condition);
  7300. return $value.then(function (vl) {
  7301. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7302. if (vl.value) {
  7303. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7304. } else if (cmd.ifFalse !== null) {
  7305. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7306. return _this5.executeCommand(store, cmd.ifFalse);
  7307. } else {
  7308. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7309. }
  7310. } else {
  7311. return Promise.resolve(store);
  7312. }
  7313. } else {
  7314. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  7315. }
  7316. });
  7317. } catch (error) {
  7318. return Promise.reject(error);
  7319. }
  7320. }
  7321. }, {
  7322. key: 'executeReturn',
  7323. value: function executeReturn(store, cmd) {
  7324. var _this6 = this;
  7325. try {
  7326. var funcType = store.applyStore('$').type;
  7327. var $value = this.evaluateExpression(store, cmd.expression);
  7328. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7329. return $value.then(function (vl) {
  7330. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7331. return Promise.resolve(store);
  7332. }
  7333. if (vl === null || !funcType.isCompatible(vl.type)) {
  7334. var stringInfo = funcType.stringInfo();
  7335. var info = stringInfo[0];
  7336. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7337. } else {
  7338. var realValue = _this6.parseStoreObjectValue(vl);
  7339. store.updateStore('$', realValue);
  7340. store.mode = _modes.Modes.RETURN;
  7341. return Promise.resolve(store);
  7342. }
  7343. });
  7344. } catch (error) {
  7345. return Promise.reject(error);
  7346. }
  7347. }
  7348. }, {
  7349. key: 'executeBreak',
  7350. value: function executeBreak(store, cmd) {
  7351. if (this.checkContext(_context.Context.BREAKABLE)) {
  7352. store.mode = _modes.Modes.BREAK;
  7353. return Promise.resolve(store);
  7354. } else {
  7355. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7356. }
  7357. }
  7358. }, {
  7359. key: 'executeAssign',
  7360. value: function executeAssign(store, cmd) {
  7361. var _this7 = this;
  7362. try {
  7363. var inStore = store.applyStore(cmd.id);
  7364. var $value = this.evaluateExpression(store, cmd.expression);
  7365. return $value.then(function (vl) {
  7366. var realValue = _this7.parseStoreObjectValue(vl);
  7367. if (!inStore.type.isCompatible(realValue.type)) {
  7368. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(inStore.type, vl.type)) {
  7369. realValue = _store.Store.doImplicitCasting(inStore.type, realValue);
  7370. } else {
  7371. var stringInfo = inStore.type.stringInfo();
  7372. var info = stringInfo[0];
  7373. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7374. }
  7375. }
  7376. store.updateStore(cmd.id, realValue);
  7377. return store;
  7378. });
  7379. } catch (error) {
  7380. return Promise.reject(error);
  7381. }
  7382. }
  7383. }, {
  7384. key: 'executeArrayIndexAssign',
  7385. value: function executeArrayIndexAssign(store, cmd) {
  7386. var _this8 = this;
  7387. var mustBeArray = store.applyStore(cmd.id);
  7388. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7389. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7390. }
  7391. var line$ = this.evaluateExpression(store, cmd.line);
  7392. var column$ = this.evaluateExpression(store, cmd.column);
  7393. var value$ = this.evaluateExpression(store, cmd.expression);
  7394. return Promise.all([line$, column$, value$]).then(function (results) {
  7395. var lineSO = results[0];
  7396. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7397. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7398. }
  7399. var line = lineSO.number;
  7400. var columnSO = results[1];
  7401. var column = null;
  7402. if (columnSO !== null) {
  7403. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7404. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7405. }
  7406. column = columnSO.number;
  7407. }
  7408. var value = _this8.parseStoreObjectValue(results[2]);
  7409. if (line >= mustBeArray.lines) {
  7410. if (mustBeArray.isVector) {
  7411. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7412. } else {
  7413. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7414. }
  7415. } else if (line < 0) {
  7416. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7417. }
  7418. if (column !== null && mustBeArray.columns === null) {
  7419. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7420. }
  7421. if (column !== null) {
  7422. if (column >= mustBeArray.columns) {
  7423. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7424. } else if (column < 0) {
  7425. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7426. }
  7427. }
  7428. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7429. if (column !== null) {
  7430. if (value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7431. var type = mustBeArray.type.innerType;
  7432. var stringInfo = type.stringInfo();
  7433. var info = stringInfo[0];
  7434. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7435. }
  7436. newArray.value[line].value[column] = value;
  7437. store.updateStore(cmd.id, newArray);
  7438. } else {
  7439. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7440. var _type = mustBeArray.type;
  7441. var _stringInfo = _type.stringInfo();
  7442. var _info = _stringInfo[0];
  7443. var exp = cmd.expression.toString();
  7444. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7445. }
  7446. newArray.value[line] = value;
  7447. store.updateStore(cmd.id, newArray);
  7448. }
  7449. return store;
  7450. });
  7451. }
  7452. }, {
  7453. key: 'executeDeclaration',
  7454. value: function executeDeclaration(store, cmd) {
  7455. try {
  7456. var $value = this.evaluateExpression(store, cmd.initial);
  7457. if (cmd instanceof Commands.ArrayDeclaration) {
  7458. var $lines = this.evaluateExpression(store, cmd.lines);
  7459. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7460. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7461. var lineSO = values[0];
  7462. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7463. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7464. }
  7465. var line = lineSO.number;
  7466. if (line < 0) {
  7467. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7468. }
  7469. var columnSO = values[1];
  7470. var column = null;
  7471. if (columnSO !== null) {
  7472. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7473. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7474. }
  7475. column = columnSO.number;
  7476. if (column < 0) {
  7477. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7478. }
  7479. }
  7480. var value = values[2];
  7481. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7482. store.insertStore(cmd.id, temp);
  7483. var realValue = value;
  7484. if (value !== null) {
  7485. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7486. if (value.type instanceof _compoundType.CompoundType) {
  7487. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7488. } else {
  7489. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7490. }
  7491. }
  7492. } else {
  7493. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7494. if (column !== null) {
  7495. for (var i = 0; i < line; i++) {
  7496. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7497. }
  7498. }
  7499. }
  7500. realValue.readOnly = cmd.isConst;
  7501. store.updateStore(cmd.id, realValue);
  7502. return store;
  7503. });
  7504. } else {
  7505. var temp = new _storeObject.StoreObject(cmd.type, null);
  7506. store.insertStore(cmd.id, temp);
  7507. return $value.then(function (vl) {
  7508. var realValue = vl;
  7509. if (vl !== null) {
  7510. if (!vl.type.isCompatible(cmd.type)) {
  7511. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(cmd.type, vl.type)) {
  7512. realValue = _store.Store.doImplicitCasting(cmd.type, realValue);
  7513. } else {
  7514. var stringInfo = typeInfo.type.stringInfo();
  7515. var info = stringInfo[0];
  7516. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7517. }
  7518. }
  7519. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7520. if (vl.type instanceof _compoundType.CompoundType) {
  7521. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7522. } else {
  7523. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7524. }
  7525. }
  7526. } else {
  7527. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7528. }
  7529. realValue.readOnly = cmd.isConst;
  7530. store.updateStore(cmd.id, realValue);
  7531. return store;
  7532. });
  7533. }
  7534. } catch (e) {
  7535. return Promise.reject(e);
  7536. }
  7537. }
  7538. }, {
  7539. key: 'evaluateExpression',
  7540. value: function evaluateExpression(store, exp) {
  7541. if (exp instanceof Expressions.UnaryApp) {
  7542. return this.evaluateUnaryApp(store, exp);
  7543. } else if (exp instanceof Expressions.InfixApp) {
  7544. return this.evaluateInfixApp(store, exp);
  7545. } else if (exp instanceof Expressions.ArrayAccess) {
  7546. return this.evaluateArrayAccess(store, exp);
  7547. } else if (exp instanceof Expressions.VariableLiteral) {
  7548. return this.evaluateVariableLiteral(store, exp);
  7549. } else if (exp instanceof Expressions.IntLiteral) {
  7550. return this.evaluateLiteral(store, exp);
  7551. } else if (exp instanceof Expressions.RealLiteral) {
  7552. return this.evaluateLiteral(store, exp);
  7553. } else if (exp instanceof Expressions.BoolLiteral) {
  7554. return this.evaluateLiteral(store, exp);
  7555. } else if (exp instanceof Expressions.StringLiteral) {
  7556. return this.evaluateLiteral(store, exp);
  7557. } else if (exp instanceof Expressions.ArrayLiteral) {
  7558. return this.evaluateArrayLiteral(store, exp);
  7559. } else if (exp instanceof Expressions.FunctionCall) {
  7560. return this.evaluateFunctionCall(store, exp);
  7561. }
  7562. return Promise.resolve(null);
  7563. }
  7564. }, {
  7565. key: 'evaluateFunctionCall',
  7566. value: function evaluateFunctionCall(store, exp) {
  7567. if (exp.isMainCall) {
  7568. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7569. }
  7570. var func = this.findFunction(exp.id);
  7571. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7572. // TODO: better error message
  7573. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7574. }
  7575. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7576. return $newStore.then(function (sto) {
  7577. if (sto.mode !== _modes.Modes.RETURN) {
  7578. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7579. }
  7580. var val = sto.applyStore('$');
  7581. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7582. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7583. } else {
  7584. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7585. }
  7586. });
  7587. }
  7588. }, {
  7589. key: 'evaluateArrayLiteral',
  7590. value: function evaluateArrayLiteral(store, exp) {
  7591. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7592. var errorCode = validationResult[0];
  7593. switch (errorCode) {
  7594. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7595. {
  7596. var columnValue = validationResult[1];
  7597. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7598. }
  7599. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7600. {
  7601. var lineValue = validationResult[1];
  7602. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7603. }
  7604. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7605. {
  7606. var line = null;
  7607. var strExp = null;
  7608. if (validationResult.length > 2) {
  7609. line = validationResult[1];
  7610. var column = validationResult[2];
  7611. strExp = exp.value[line].value[column].toString();
  7612. } else {
  7613. line = validationResult[1];
  7614. strExp = exp.value[line].toString();
  7615. }
  7616. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7617. }
  7618. }
  7619. };
  7620. if (!exp.isVector) {
  7621. var $matrix = this.evaluateMatrix(store, exp.value);
  7622. return $matrix.then(function (list) {
  7623. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7624. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7625. var checkResult = arr.isValid;
  7626. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7627. return errorHelperFunction(checkResult, exp);
  7628. }
  7629. });
  7630. } else {
  7631. return this.evaluateVector(store, exp.value).then(function (list) {
  7632. var type = new _compoundType.CompoundType(list[0].type, 1);
  7633. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7634. var checkResult = stoArray.isValid;
  7635. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7636. return errorHelperFunction(checkResult, exp);
  7637. }
  7638. });
  7639. }
  7640. }
  7641. }, {
  7642. key: 'evaluateVector',
  7643. value: function evaluateVector(store, exps) {
  7644. var _this9 = this;
  7645. return Promise.all(exps.map(function (exp) {
  7646. return _this9.evaluateExpression(store, exp);
  7647. }));
  7648. }
  7649. }, {
  7650. key: 'evaluateMatrix',
  7651. value: function evaluateMatrix(store, exps) {
  7652. var _this10 = this;
  7653. return Promise.all(exps.map(function (vector) {
  7654. var $vector = _this10.evaluateVector(store, vector.value);
  7655. return $vector.then(function (list) {
  7656. var type = new _compoundType.CompoundType(list[0].type, 1);
  7657. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7658. });
  7659. }));
  7660. }
  7661. }, {
  7662. key: 'evaluateLiteral',
  7663. value: function evaluateLiteral(_, exp) {
  7664. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7665. }
  7666. }, {
  7667. key: 'evaluateVariableLiteral',
  7668. value: function evaluateVariableLiteral(store, exp) {
  7669. try {
  7670. var val = store.applyStore(exp.id);
  7671. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7672. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7673. } else {
  7674. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7675. }
  7676. } catch (error) {
  7677. return Promise.reject(error);
  7678. }
  7679. }
  7680. }, {
  7681. key: 'evaluateArrayAccess',
  7682. value: function evaluateArrayAccess(store, exp) {
  7683. var mustBeArray = store.applyStore(exp.id);
  7684. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7685. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7686. }
  7687. var $line = this.evaluateExpression(store, exp.line);
  7688. var $column = this.evaluateExpression(store, exp.column);
  7689. return Promise.all([$line, $column]).then(function (values) {
  7690. var lineSO = values[0];
  7691. var columnSO = values[1];
  7692. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7693. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7694. }
  7695. var line = lineSO.number;
  7696. var column = null;
  7697. if (columnSO !== null) {
  7698. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7699. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7700. }
  7701. column = columnSO.number;
  7702. }
  7703. if (line >= mustBeArray.lines) {
  7704. if (mustBeArray.isVector) {
  7705. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7706. } else {
  7707. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7708. }
  7709. } else if (line < 0) {
  7710. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7711. }
  7712. if (column !== null && mustBeArray.columns === null) {
  7713. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7714. }
  7715. if (column !== null) {
  7716. if (column >= mustBeArray.columns) {
  7717. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7718. } else if (column < 0) {
  7719. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7720. }
  7721. }
  7722. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7723. });
  7724. }
  7725. }, {
  7726. key: 'evaluateUnaryApp',
  7727. value: function evaluateUnaryApp(store, unaryApp) {
  7728. var $left = this.evaluateExpression(store, unaryApp.left);
  7729. return $left.then(function (left) {
  7730. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7731. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7732. var stringInfo = left.type.stringInfo();
  7733. var info = stringInfo[0];
  7734. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7735. }
  7736. switch (unaryApp.op.ord) {
  7737. case _operators.Operators.ADD.ord:
  7738. return new _storeObject.StoreObject(resultType, left.value);
  7739. case _operators.Operators.SUB.ord:
  7740. return new _storeObject.StoreObject(resultType, left.value.negated());
  7741. case _operators.Operators.NOT.ord:
  7742. return new _storeObject.StoreObject(resultType, !left.value);
  7743. default:
  7744. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7745. }
  7746. });
  7747. }
  7748. }, {
  7749. key: 'evaluateInfixApp',
  7750. value: function evaluateInfixApp(store, infixApp) {
  7751. var $left = this.evaluateExpression(store, infixApp.left);
  7752. var $right = this.evaluateExpression(store, infixApp.right);
  7753. return Promise.all([$left, $right]).then(function (values) {
  7754. var shouldImplicitCast = false;
  7755. var left = values[0];
  7756. var right = values[1];
  7757. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7758. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7759. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(left.type, right.type)) {
  7760. shouldImplicitCast = true;
  7761. } else {
  7762. var stringInfoLeft = left.type.stringInfo();
  7763. var infoLeft = stringInfoLeft[0];
  7764. var stringInfoRight = right.type.stringInfo();
  7765. var infoRight = stringInfoRight[0];
  7766. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7767. }
  7768. }
  7769. var result = null;
  7770. switch (infixApp.op.ord) {
  7771. case _operators.Operators.ADD.ord:
  7772. {
  7773. if (_types.Types.STRING.isCompatible(left.type)) {
  7774. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7775. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7776. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7777. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7778. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7779. } else {
  7780. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7781. }
  7782. }
  7783. case _operators.Operators.SUB.ord:
  7784. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7785. case _operators.Operators.MULT.ord:
  7786. {
  7787. result = left.value.times(right.value);
  7788. if (result.dp() > _config.Config.decimalPlaces) {
  7789. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7790. }
  7791. return new _storeObject.StoreObject(resultType, result);
  7792. }
  7793. case _operators.Operators.DIV.ord:
  7794. {
  7795. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7796. if (result.dp() > _config.Config.decimalPlaces) {
  7797. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7798. }
  7799. return new _storeObject.StoreObject(resultType, result);
  7800. }
  7801. case _operators.Operators.MOD.ord:
  7802. {
  7803. var leftValue = left.value;
  7804. var rightValue = right.value;
  7805. if (shouldImplicitCast) {
  7806. resultType = _types.Types.INTEGER;
  7807. leftValue = leftValue.trunc();
  7808. rightValue = rightValue.trunc();
  7809. }
  7810. result = leftValue.modulo(rightValue);
  7811. if (result.dp() > _config.Config.decimalPlaces) {
  7812. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7813. }
  7814. return new _storeObject.StoreObject(resultType, result);
  7815. }
  7816. case _operators.Operators.GT.ord:
  7817. {
  7818. var _leftValue = left.value;
  7819. var _rightValue = right.value;
  7820. if (_types.Types.STRING.isCompatible(left.type)) {
  7821. result = left.value.length > right.value.length;
  7822. } else {
  7823. if (shouldImplicitCast) {
  7824. resultType = _types.Types.BOOLEAN;
  7825. _leftValue = _leftValue.trunc();
  7826. _rightValue = _rightValue.trunc();
  7827. }
  7828. result = _leftValue.gt(_rightValue);
  7829. }
  7830. return new _storeObject.StoreObject(resultType, result);
  7831. }
  7832. case _operators.Operators.GE.ord:
  7833. {
  7834. var _leftValue2 = left.value;
  7835. var _rightValue2 = right.value;
  7836. if (_types.Types.STRING.isCompatible(left.type)) {
  7837. result = left.value.length >= right.value.length;
  7838. } else {
  7839. if (shouldImplicitCast) {
  7840. resultType = _types.Types.BOOLEAN;
  7841. _leftValue2 = _leftValue2.trunc();
  7842. _rightValue2 = _rightValue2.trunc();
  7843. }
  7844. result = _leftValue2.gte(_rightValue2);
  7845. }
  7846. return new _storeObject.StoreObject(resultType, result);
  7847. }
  7848. case _operators.Operators.LT.ord:
  7849. {
  7850. var _leftValue3 = left.value;
  7851. var _rightValue3 = right.value;
  7852. if (_types.Types.STRING.isCompatible(left.type)) {
  7853. result = left.value.length < right.value.length;
  7854. } else {
  7855. if (shouldImplicitCast) {
  7856. resultType = _types.Types.BOOLEAN;
  7857. _leftValue3 = _leftValue3.trunc();
  7858. _rightValue3 = _rightValue3.trunc();
  7859. }
  7860. result = _leftValue3.lt(_rightValue3);
  7861. }
  7862. return new _storeObject.StoreObject(resultType, result);
  7863. }
  7864. case _operators.Operators.LE.ord:
  7865. {
  7866. var _leftValue4 = left.value;
  7867. var _rightValue4 = right.value;
  7868. if (_types.Types.STRING.isCompatible(left.type)) {
  7869. result = left.value.length <= right.value.length;
  7870. } else {
  7871. if (shouldImplicitCast) {
  7872. resultType = _types.Types.BOOLEAN;
  7873. _leftValue4 = _leftValue4.trunc();
  7874. _rightValue4 = _rightValue4.trunc();
  7875. }
  7876. result = _leftValue4.lte(_rightValue4);
  7877. }
  7878. return new _storeObject.StoreObject(resultType, result);
  7879. }
  7880. case _operators.Operators.EQ.ord:
  7881. {
  7882. var _leftValue5 = left.value;
  7883. var _rightValue5 = right.value;
  7884. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7885. if (shouldImplicitCast) {
  7886. resultType = _types.Types.BOOLEAN;
  7887. _leftValue5 = _leftValue5.trunc();
  7888. _rightValue5 = _rightValue5.trunc();
  7889. }
  7890. result = _leftValue5.eq(_rightValue5);
  7891. } else {
  7892. result = left.value === right.value;
  7893. }
  7894. return new _storeObject.StoreObject(resultType, result);
  7895. }
  7896. case _operators.Operators.NEQ.ord:
  7897. {
  7898. var _leftValue6 = left.value;
  7899. var _rightValue6 = right.value;
  7900. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7901. if (shouldImplicitCast) {
  7902. resultType = _types.Types.BOOLEAN;
  7903. _leftValue6 = _leftValue6.trunc();
  7904. _rightValue6 = _rightValue6.trunc();
  7905. }
  7906. result = !_leftValue6.eq(_rightValue6);
  7907. } else {
  7908. result = left.value !== right.value;
  7909. }
  7910. return new _storeObject.StoreObject(resultType, result);
  7911. }
  7912. case _operators.Operators.AND.ord:
  7913. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7914. case _operators.Operators.OR.ord:
  7915. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7916. default:
  7917. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7918. }
  7919. });
  7920. }
  7921. }, {
  7922. key: 'parseStoreObjectValue',
  7923. value: function parseStoreObjectValue(vl) {
  7924. var realValue = vl;
  7925. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7926. if (vl.type instanceof _compoundType.CompoundType) {
  7927. switch (vl.type.dimensions) {
  7928. case 1:
  7929. {
  7930. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7931. break;
  7932. }
  7933. default:
  7934. {
  7935. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7936. }
  7937. }
  7938. } else {
  7939. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7940. }
  7941. }
  7942. return realValue;
  7943. }
  7944. }]);
  7945. return IVProgProcessor;
  7946. }();
  7947. /***/ }),
  7948. /***/ "./js/processor/lib/arrays.js":
  7949. /*!************************************!*\
  7950. !*** ./js/processor/lib/arrays.js ***!
  7951. \************************************/
  7952. /*! no static exports found */
  7953. /***/ (function(module, exports, __webpack_require__) {
  7954. "use strict";
  7955. Object.defineProperty(exports, "__esModule", {
  7956. value: true
  7957. });
  7958. exports.createNumElementsFun = createNumElementsFun;
  7959. exports.createMatrixLinesFun = createMatrixLinesFun;
  7960. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7961. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7962. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7963. var Commands = _interopRequireWildcard(_commands);
  7964. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7965. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7966. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7967. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7968. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7969. /**
  7970. * num_elements
  7971. * matrix_lines
  7972. * matrix_columns
  7973. */
  7974. function createNumElementsFun() {
  7975. var numElementsFun = function numElementsFun(sto, _) {
  7976. var vector = sto.applyStore("vector");
  7977. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  7978. sto.mode = _modes.Modes.RETURN;
  7979. return Promise.resolve(sto.updateStore("$", temp));
  7980. };
  7981. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  7982. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  7983. return func;
  7984. }
  7985. function createMatrixLinesFun() {
  7986. var matrixLinesFun = function matrixLinesFun(sto, _) {
  7987. var matrix = sto.applyStore("matrix");
  7988. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  7989. sto.mode = _modes.Modes.RETURN;
  7990. return Promise.resolve(sto.updateStore("$", temp));
  7991. };
  7992. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  7993. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7994. return func;
  7995. }
  7996. function createMatrixColumnsFun() {
  7997. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  7998. var matrix = sto.applyStore("matrix");
  7999. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  8000. sto.mode = _modes.Modes.RETURN;
  8001. return Promise.resolve(sto.updateStore("$", temp));
  8002. };
  8003. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  8004. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  8005. return func;
  8006. }
  8007. /***/ }),
  8008. /***/ "./js/processor/lib/io.js":
  8009. /*!********************************!*\
  8010. !*** ./js/processor/lib/io.js ***!
  8011. \********************************/
  8012. /*! no static exports found */
  8013. /***/ (function(module, exports, __webpack_require__) {
  8014. "use strict";
  8015. Object.defineProperty(exports, "__esModule", {
  8016. value: true
  8017. });
  8018. exports.createOutputFun = createOutputFun;
  8019. exports.createInputFun = createInputFun;
  8020. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8021. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8022. var Commands = _interopRequireWildcard(_commands);
  8023. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8024. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8025. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8026. function createOutputFun() {
  8027. var writeFunction = function writeFunction(store, _) {
  8028. var val = store.applyStore('p1');
  8029. this.output.sendOutput((0, _parsers.convertToString)(val.value, val.type));
  8030. return Promise.resolve(store);
  8031. };
  8032. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  8033. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  8034. return func;
  8035. }
  8036. function createInputFun() {
  8037. var readFunction = function readFunction(store, _) {
  8038. var _this = this;
  8039. var request = new Promise(function (resolve, _) {
  8040. _this.input.requestInput(resolve);
  8041. });
  8042. return request.then(function (text) {
  8043. var typeToConvert = store.applyStore('p1').type;
  8044. var stoObj = null;
  8045. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  8046. var val = (0, _parsers.toInt)(text);
  8047. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  8048. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  8049. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  8050. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  8051. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  8052. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  8053. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  8054. }
  8055. _this.loopTimers.splice(0, _this.loopTimers.length);
  8056. store.updateStore('p1', stoObj);
  8057. return Promise.resolve(store);
  8058. });
  8059. };
  8060. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  8061. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  8062. return func;
  8063. }
  8064. /***/ }),
  8065. /***/ "./js/processor/lib/lang.js":
  8066. /*!**********************************!*\
  8067. !*** ./js/processor/lib/lang.js ***!
  8068. \**********************************/
  8069. /*! no static exports found */
  8070. /***/ (function(module, exports, __webpack_require__) {
  8071. "use strict";
  8072. Object.defineProperty(exports, "__esModule", {
  8073. value: true
  8074. });
  8075. exports.createIsRealFun = createIsRealFun;
  8076. exports.createIsIntFun = createIsIntFun;
  8077. exports.createIsBoolFun = createIsBoolFun;
  8078. exports.createCastRealFun = createCastRealFun;
  8079. exports.createCastIntFun = createCastIntFun;
  8080. exports.createCastBoolFun = createCastBoolFun;
  8081. exports.createCastStringFun = createCastStringFun;
  8082. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8083. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8084. var Commands = _interopRequireWildcard(_commands);
  8085. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8086. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8087. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8088. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8089. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8090. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8091. /**
  8092. *
  8093. * is_real
  8094. * is_int
  8095. * is_bool
  8096. * cast_real
  8097. * cast_int
  8098. * cast_bool
  8099. * cast_string
  8100. */
  8101. function createIsRealFun() {
  8102. var isRealFun = function isRealFun(sto, _) {
  8103. var str = sto.applyStore("str");
  8104. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8105. var result = false;
  8106. try {
  8107. var val = parser.parseTerm();
  8108. if (val instanceof _expressions.RealLiteral) {
  8109. result = true;
  8110. }
  8111. } catch (error) {}
  8112. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8113. sto.mode = _modes.Modes.RETURN;
  8114. return Promise.resolve(sto.updateStore("$", temp));
  8115. };
  8116. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8117. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8118. return func;
  8119. }
  8120. function createIsIntFun() {
  8121. var isIntFun = function isIntFun(sto, _) {
  8122. var str = sto.applyStore("str");
  8123. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8124. var result = false;
  8125. try {
  8126. var val = parser.parseTerm();
  8127. if (val instanceof _expressions.IntLiteral) {
  8128. result = true;
  8129. }
  8130. } catch (error) {}
  8131. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8132. sto.mode = _modes.Modes.RETURN;
  8133. return Promise.resolve(sto.updateStore("$", temp));
  8134. };
  8135. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8136. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8137. return func;
  8138. }
  8139. function createIsBoolFun() {
  8140. var isBoolFun = function isBoolFun(sto, _) {
  8141. var str = sto.applyStore("str");
  8142. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8143. var result = false;
  8144. try {
  8145. var val = parser.parseTerm();
  8146. if (val instanceof _expressions.BoolLiteral) {
  8147. result = true;
  8148. }
  8149. } catch (error) {}
  8150. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8151. sto.mode = _modes.Modes.RETURN;
  8152. return Promise.resolve(sto.updateStore("$", temp));
  8153. };
  8154. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8155. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8156. return func;
  8157. }
  8158. function createCastRealFun() {
  8159. var castRealFun = function castRealFun(sto, _) {
  8160. var val = sto.applyStore("val");
  8161. switch (val.type.ord) {
  8162. case _types.Types.INTEGER.ord:
  8163. {
  8164. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8165. sto.mode = _modes.Modes.RETURN;
  8166. return Promise.resolve(sto.updateStore("$", temp));
  8167. }
  8168. case _types.Types.STRING.ord:
  8169. {
  8170. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8171. try {
  8172. var result = parser.parseTerm();
  8173. if (result instanceof _expressions.RealLiteral) {
  8174. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8175. sto.mode = _modes.Modes.RETURN;
  8176. return Promise.resolve(sto.updateStore("$", _temp));
  8177. }
  8178. } catch (error) {
  8179. return Promise.reject("cannot convert string to real");
  8180. }
  8181. }
  8182. }
  8183. };
  8184. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8185. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8186. return func;
  8187. }
  8188. function createCastIntFun() {
  8189. var castIntFun = function castIntFun(sto, _) {
  8190. var val = sto.applyStore("val");
  8191. switch (val.type.ord) {
  8192. case _types.Types.REAL.ord:
  8193. {
  8194. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8195. sto.mode = _modes.Modes.RETURN;
  8196. return Promise.resolve(sto.updateStore("$", temp));
  8197. }
  8198. case _types.Types.STRING.ord:
  8199. {
  8200. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8201. try {
  8202. var result = parser.parseTerm();
  8203. if (result instanceof _expressions.IntLiteral) {
  8204. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8205. sto.mode = _modes.Modes.RETURN;
  8206. return Promise.resolve(sto.updateStore("$", _temp2));
  8207. }
  8208. } catch (error) {
  8209. return Promise.reject("cannot convert string to real");
  8210. }
  8211. }
  8212. }
  8213. };
  8214. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8215. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8216. return func;
  8217. }
  8218. function createCastBoolFun() {
  8219. var castBoolFun = function castBoolFun(sto, _) {
  8220. var str = sto.applyStore("str");
  8221. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8222. try {
  8223. var val = parser.parseTerm();
  8224. if (val instanceof _expressions.BoolLiteral) {
  8225. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8226. sto.mode = _modes.Modes.RETURN;
  8227. return Promise.resolve(sto.updateStore("$", temp));
  8228. }
  8229. } catch (error) {}
  8230. return Promise.reject("cannot convert " + str.value + " to boolean");
  8231. };
  8232. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8233. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8234. return func;
  8235. }
  8236. function createCastStringFun() {
  8237. var castStringFun = function castStringFun(store, _) {
  8238. var val = store.applyStore('str');
  8239. var result = (0, _parsers.convertToString)(val);
  8240. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8241. sto.mode = _modes.Modes.RETURN;
  8242. return Promise.resolve(sto.updateStore("$", temp));
  8243. };
  8244. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8245. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8246. return func;
  8247. }
  8248. /***/ }),
  8249. /***/ "./js/processor/lib/math.js":
  8250. /*!**********************************!*\
  8251. !*** ./js/processor/lib/math.js ***!
  8252. \**********************************/
  8253. /*! no static exports found */
  8254. /***/ (function(module, exports, __webpack_require__) {
  8255. "use strict";
  8256. Object.defineProperty(exports, "__esModule", {
  8257. value: true
  8258. });
  8259. exports.createSinFun = createSinFun;
  8260. exports.createCosFun = createCosFun;
  8261. exports.createTanFun = createTanFun;
  8262. exports.createSqrtFun = createSqrtFun;
  8263. exports.createPowFun = createPowFun;
  8264. exports.createLogFun = createLogFun;
  8265. exports.createAbsFun = createAbsFun;
  8266. exports.createNegateFun = createNegateFun;
  8267. exports.createInvertFun = createInvertFun;
  8268. exports.createMaxFun = createMaxFun;
  8269. exports.createMinFun = createMinFun;
  8270. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8271. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8272. var Commands = _interopRequireWildcard(_commands);
  8273. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8274. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8275. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8276. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8277. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8278. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8279. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8280. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8281. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  8282. /**
  8283. * sin
  8284. * cos
  8285. * tan
  8286. * sqrt
  8287. * pow
  8288. * log
  8289. * abs
  8290. * negate
  8291. * invert
  8292. * max
  8293. * min
  8294. */
  8295. function convertToRadians(degrees) {
  8296. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8297. }
  8298. function createSinFun() {
  8299. var sinFun = function sinFun(sto, _) {
  8300. var x = sto.applyStore('x');
  8301. var angle = x.value.mod(360);
  8302. var result = null;
  8303. if (angle.eq(90)) {
  8304. result = new _decimal.Decimal(1);
  8305. } else if (angle.eq(180)) {
  8306. result = new _decimal.Decimal(0);
  8307. } else if (angle.eq(270)) {
  8308. result = new _decimal.Decimal(-1);
  8309. } else {
  8310. result = _decimal.Decimal.sin(convertToRadians(angle));
  8311. }
  8312. if (result.dp() > _config.Config.decimalPlaces) {
  8313. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8314. }
  8315. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8316. sto.mode = _modes.Modes.RETURN;
  8317. return Promise.resolve(sto.updateStore('$', temp));
  8318. };
  8319. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8320. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8321. return func;
  8322. }
  8323. function createCosFun() {
  8324. var cosFun = function cosFun(sto, _) {
  8325. var x = sto.applyStore('x');
  8326. var angle = x.value.mod(360);
  8327. var result = null;
  8328. if (angle.eq(90)) {
  8329. result = new _decimal.Decimal(0);
  8330. } else if (angle.eq(180)) {
  8331. result = new _decimal.Decimal(-1);
  8332. } else if (angle.eq(270)) {
  8333. result = new _decimal.Decimal(0);
  8334. }
  8335. result = _decimal.Decimal.cos(convertToRadians(angle));
  8336. if (result.dp() > _config.Config.decimalPlaces) {
  8337. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8338. }
  8339. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8340. sto.mode = _modes.Modes.RETURN;
  8341. return Promise.resolve(sto.updateStore('$', temp));
  8342. };
  8343. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8344. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8345. return func;
  8346. }
  8347. function createTanFun() {
  8348. var tanFun = function tanFun(sto, _) {
  8349. var x = sto.applyStore('x');
  8350. var angle = x.value.mod(360);
  8351. if (angle.eq(90) || angle.eq(270)) {
  8352. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8353. }
  8354. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8355. if (result.dp() > _config.Config.decimalPlaces) {
  8356. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8357. }
  8358. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8359. sto.mode = _modes.Modes.RETURN;
  8360. return Promise.resolve(sto.updateStore('$', temp));
  8361. };
  8362. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8363. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8364. return func;
  8365. }
  8366. function createSqrtFun() {
  8367. var sqrtFun = function sqrtFun(sto, _) {
  8368. var x = sto.applyStore('x');
  8369. var result = x.value.sqrt();
  8370. if (result.dp() > _config.Config.decimalPlaces) {
  8371. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8372. }
  8373. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8374. sto.mode = _modes.Modes.RETURN;
  8375. return Promise.resolve(sto.updateStore('$', temp));
  8376. };
  8377. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8378. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8379. return func;
  8380. }
  8381. function createPowFun() {
  8382. var powFun = function powFun(sto, _) {
  8383. var x = sto.applyStore('x');
  8384. var y = sto.applyStore('y');
  8385. var result = x.value.pow(y.value);
  8386. if (result.dp() > _config.Config.decimalPlaces) {
  8387. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8388. }
  8389. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8390. sto.mode = _modes.Modes.RETURN;
  8391. return Promise.resolve(sto.updateStore('$', temp));
  8392. };
  8393. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8394. var func = new Commands.Function('$pow', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false), new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'y', false)], block);
  8395. return func;
  8396. }
  8397. function createLogFun() {
  8398. var logFun = function logFun(sto, _) {
  8399. var x = sto.applyStore('x');
  8400. if (x.value.isNegative()) {
  8401. return Promise.reject("the value passed to log function cannot be negative");
  8402. }
  8403. var result = _decimal.Decimal.log10(x.value);
  8404. if (result.dp() > _config.Config.decimalPlaces) {
  8405. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8406. }
  8407. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8408. sto.mode = _modes.Modes.RETURN;
  8409. return Promise.resolve(sto.updateStore('$', temp));
  8410. };
  8411. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  8412. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8413. return func;
  8414. }
  8415. function createAbsFun() {
  8416. var absFun = function absFun(sto, _) {
  8417. var x = sto.applyStore('x');
  8418. var result = x.value.abs();
  8419. var temp = new _storeObject.StoreObject(x.type, result);
  8420. sto.mode = _modes.Modes.RETURN;
  8421. return Promise.resolve(sto.updateStore('$', temp));
  8422. };
  8423. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8424. var func = new Commands.Function('$abs', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8425. return func;
  8426. }
  8427. function createNegateFun() {
  8428. var negateFun = function negateFun(sto, _) {
  8429. var x = sto.applyStore('x');
  8430. var result = x.value.negated();
  8431. var temp = new _storeObject.StoreObject(x.type, result);
  8432. sto.mode = _modes.Modes.RETURN;
  8433. return Promise.resolve(sto.updateStore('$', temp));
  8434. };
  8435. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8436. var func = new Commands.Function('$negate', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8437. return func;
  8438. }
  8439. function createInvertFun() {
  8440. var invertFun = function invertFun(sto, _) {
  8441. var x = sto.applyStore('x');
  8442. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8443. if (result.dp() > _config.Config.decimalPlaces) {
  8444. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8445. }
  8446. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8447. sto.mode = _modes.Modes.RETURN;
  8448. return Promise.resolve(sto.updateStore('$', temp));
  8449. };
  8450. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8451. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8452. return func;
  8453. }
  8454. function createMaxFun() {
  8455. var maxFun = function maxFun(sto, _) {
  8456. var x = sto.applyStore('x');
  8457. var numbers = x.value.map(function (stoObj) {
  8458. return stoObj.value;
  8459. });
  8460. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8461. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8462. sto.mode = _modes.Modes.RETURN;
  8463. return Promise.resolve(sto.updateStore('$', temp));
  8464. };
  8465. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8466. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8467. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8468. return func;
  8469. }
  8470. function createMinFun() {
  8471. var minFun = function minFun(sto, _) {
  8472. var x = sto.applyStore('x');
  8473. var numbers = x.value.map(function (stoObj) {
  8474. return stoObj.value;
  8475. });
  8476. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8477. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8478. sto.mode = _modes.Modes.RETURN;
  8479. return Promise.resolve(sto.updateStore('$', temp));
  8480. };
  8481. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8482. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8483. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8484. return func;
  8485. }
  8486. /***/ }),
  8487. /***/ "./js/processor/lib/strings.js":
  8488. /*!*************************************!*\
  8489. !*** ./js/processor/lib/strings.js ***!
  8490. \*************************************/
  8491. /*! no static exports found */
  8492. /***/ (function(module, exports, __webpack_require__) {
  8493. "use strict";
  8494. Object.defineProperty(exports, "__esModule", {
  8495. value: true
  8496. });
  8497. exports.createSubstringFun = createSubstringFun;
  8498. exports.createLengthFun = createLengthFun;
  8499. exports.createUppercaseFun = createUppercaseFun;
  8500. exports.createLowercaseFun = createLowercaseFun;
  8501. exports.createrCharAtFun = createrCharAtFun;
  8502. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8503. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8504. var Commands = _interopRequireWildcard(_commands);
  8505. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8506. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8507. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8508. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8509. /*
  8510. * substring
  8511. * length
  8512. * uppercase
  8513. * lowercase
  8514. * charAt
  8515. **/
  8516. function createSubstringFun() {
  8517. var substringFun = function substringFun(sto, _) {
  8518. var str = sto.applyStore("str");
  8519. var start = sto.applyStore("start");
  8520. var end = sto.applyStore("end");
  8521. var result = str.value.substring(start.value, end.value);
  8522. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8523. sto.mode = _modes.Modes.RETURN;
  8524. return Promise.resolve(sto.updateStore("$", temp));
  8525. };
  8526. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8527. var func = new Commands.Function('$substring', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'start', false), new Commands.FormalParameter(_types.Types.INTEGER, 'end', false)], block);
  8528. return func;
  8529. }
  8530. function createLengthFun() {
  8531. var lengthFun = function lengthFun(sto, _) {
  8532. var str = sto.applyStore("str");
  8533. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8534. sto.mode = _modes.Modes.RETURN;
  8535. return Promise.resolve(sto.updateStore("$", temp));
  8536. };
  8537. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8538. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8539. return func;
  8540. }
  8541. function createUppercaseFun() {
  8542. var uppercaseFun = function uppercaseFun(sto, _) {
  8543. var str = sto.applyStore("str");
  8544. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8545. sto.mode = _modes.Modes.RETURN;
  8546. return Promise.resolve(sto.updateStore("$", temp));
  8547. };
  8548. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8549. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8550. return func;
  8551. }
  8552. function createLowercaseFun() {
  8553. var lowercaseFun = function lowercaseFun(sto, _) {
  8554. var str = sto.applyStore("str");
  8555. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8556. sto.mode = _modes.Modes.RETURN;
  8557. return Promise.resolve(sto.updateStore("$", temp));
  8558. };
  8559. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8560. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8561. return func;
  8562. }
  8563. function createrCharAtFun() {
  8564. var charAtFun = function charAtFun(sto, _) {
  8565. var str = sto.applyStore("str");
  8566. var idx = sto.applyStore("index");
  8567. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8568. return Promise.reject(new Error("invalid string position"));
  8569. }
  8570. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8571. sto.mode = _modes.Modes.RETURN;
  8572. return Promise.resolve(sto.updateStore("$", temp));
  8573. };
  8574. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8575. var func = new Commands.Function('$charAt', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'index', false)], block);
  8576. return func;
  8577. }
  8578. /***/ }),
  8579. /***/ "./js/processor/modes.js":
  8580. /*!*******************************!*\
  8581. !*** ./js/processor/modes.js ***!
  8582. \*******************************/
  8583. /*! no static exports found */
  8584. /***/ (function(module, exports, __webpack_require__) {
  8585. "use strict";
  8586. Object.defineProperty(exports, "__esModule", {
  8587. value: true
  8588. });
  8589. var Modes = exports.Modes = Object.freeze({
  8590. RETURN: Symbol('mode:return'),
  8591. BREAK: Symbol('mode:break'),
  8592. PAUSE: Symbol('mode:pause'),
  8593. RUN: Symbol('mode:run')
  8594. });
  8595. /***/ }),
  8596. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8597. /*!***************************************************!*\
  8598. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8599. \***************************************************/
  8600. /*! no static exports found */
  8601. /***/ (function(module, exports, __webpack_require__) {
  8602. "use strict";
  8603. Object.defineProperty(exports, "__esModule", {
  8604. value: true
  8605. });
  8606. exports.SemanticAnalyser = undefined;
  8607. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8608. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8609. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8610. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8611. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8612. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8613. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8614. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8615. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8616. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8617. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8618. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8619. var _store = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8620. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8621. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8622. function SemanticAnalyser(ast) {
  8623. _classCallCheck(this, SemanticAnalyser);
  8624. this.ast = ast;
  8625. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8626. var lexer = new this.lexerClass(null);
  8627. this.literalNames = lexer.literalNames;
  8628. this.symbolMap = null;
  8629. this.currentFunction = null;
  8630. }
  8631. _createClass(SemanticAnalyser, [{
  8632. key: 'pushMap',
  8633. value: function pushMap() {
  8634. if (this.symbolMap === null) {
  8635. this.symbolMap = { map: {}, next: null };
  8636. } else {
  8637. var n = { map: {}, next: this.symbolMap };
  8638. this.symbolMap = n;
  8639. }
  8640. }
  8641. }, {
  8642. key: 'popMap',
  8643. value: function popMap() {
  8644. if (this.symbolMap !== null) {
  8645. this.symbolMap = this.symbolMap.next;
  8646. }
  8647. }
  8648. }, {
  8649. key: 'insertSymbol',
  8650. value: function insertSymbol(id, typeInfo) {
  8651. this.symbolMap.map[id] = typeInfo;
  8652. }
  8653. }, {
  8654. key: 'findSymbol',
  8655. value: function findSymbol(id, symMap) {
  8656. if (!symMap.map[id]) {
  8657. if (symMap.next) {
  8658. return this.findSymbol(id, symMap.next);
  8659. }
  8660. return null;
  8661. } else {
  8662. return symMap.map[id];
  8663. }
  8664. }
  8665. }, {
  8666. key: 'getMainFunction',
  8667. value: function getMainFunction() {
  8668. return this.ast.functions.find(function (v) {
  8669. return v.isMain;
  8670. });
  8671. }
  8672. }, {
  8673. key: 'findFunction',
  8674. value: function findFunction(name) {
  8675. console.log(name);
  8676. if (name.match(/^\$.+$/)) {
  8677. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8678. if (!!!fun) {
  8679. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8680. }
  8681. return fun;
  8682. } else {
  8683. var val = this.ast.functions.find(function (v) {
  8684. return v.name === name;
  8685. });
  8686. if (!!!val) {
  8687. return null;
  8688. }
  8689. return val;
  8690. }
  8691. }
  8692. }, {
  8693. key: 'analyseTree',
  8694. value: function analyseTree() {
  8695. var globalVars = this.ast.global;
  8696. this.pushMap();
  8697. this.assertDeclarations(globalVars);
  8698. var functions = this.ast.functions;
  8699. var mainFunc = functions.filter(function (f) {
  8700. return f.name === null;
  8701. });
  8702. if (mainFunc.length <= 0) {
  8703. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8704. }
  8705. for (var i = 0; i < functions.length; i++) {
  8706. var fun = functions[i];
  8707. this.assertFunction(fun);
  8708. }
  8709. return this.ast;
  8710. }
  8711. }, {
  8712. key: 'assertDeclarations',
  8713. value: function assertDeclarations(list) {
  8714. for (var i = 0; i < list.length; i++) {
  8715. this.assertDeclaration(list[i]);
  8716. }
  8717. }
  8718. }, {
  8719. key: 'assertDeclaration',
  8720. value: function assertDeclaration(declaration) {
  8721. if (declaration instanceof _commands.ArrayDeclaration) {
  8722. if (declaration.initial === null) {
  8723. var lineType = this.evaluateExpressionType(declaration.lines);
  8724. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8725. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8726. }
  8727. if (declaration.columns !== null) {
  8728. var columnType = this.evaluateExpressionType(declaration.columns);
  8729. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8730. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8731. }
  8732. }
  8733. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8734. return;
  8735. }
  8736. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8737. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8738. } else {
  8739. if (declaration.initial === null) {
  8740. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8741. return;
  8742. }
  8743. var resultType = this.evaluateExpressionType(declaration.initial);
  8744. if (resultType instanceof _multiType.MultiType) {
  8745. if (!resultType.isCompatible(declaration.type)) {
  8746. var stringInfo = declaration.type.stringInfo();
  8747. var info = stringInfo[0];
  8748. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8749. }
  8750. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8751. } else if (!declaration.type.isCompatible(resultType) && !_config.Config.enable_type_casting || !declaration.type.isCompatible(resultType) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(declaration.type, resultType)) {
  8752. var _stringInfo = declaration.type.stringInfo();
  8753. var _info = _stringInfo[0];
  8754. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8755. } else {
  8756. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8757. }
  8758. }
  8759. }
  8760. }, {
  8761. key: 'evaluateExpressionType',
  8762. value: function evaluateExpressionType(expression) {
  8763. if (expression instanceof _expressions.UnaryApp) {
  8764. var op = expression.op;
  8765. var resultType = this.evaluateExpressionType(expression.left);
  8766. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8767. } else if (expression instanceof _expressions.InfixApp) {
  8768. var _op = expression.op;
  8769. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8770. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8771. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8772. } else if (expression instanceof _literal.Literal) {
  8773. return this.evaluateLiteralType(expression);
  8774. } else if (expression instanceof _expressions.FunctionCall) {
  8775. if (expression.isMainCall) {
  8776. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8777. }
  8778. var fun = this.findFunction(expression.id);
  8779. if (fun === null) {
  8780. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8781. }
  8782. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8783. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8784. }
  8785. this.assertParameters(fun, expression.actualParameters);
  8786. return fun.returnType;
  8787. } else if (expression instanceof _expressions.ArrayAccess) {
  8788. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8789. if (arrayTypeInfo === null) {
  8790. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8791. }
  8792. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8793. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8794. }
  8795. var lineType = this.evaluateExpressionType(expression.line);
  8796. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8797. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8798. }
  8799. if (expression.column !== null) {
  8800. if (arrayTypeInfo.columns === null) {
  8801. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8802. }
  8803. var columnType = this.evaluateExpressionType(expression.column);
  8804. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8805. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8806. }
  8807. }
  8808. var arrType = arrayTypeInfo.type;
  8809. if (expression.column !== null) {
  8810. // indexing matrix
  8811. return arrType.innerType;
  8812. } else {
  8813. if (arrayTypeInfo.columns === null) {
  8814. return arrType.innerType;
  8815. }
  8816. return new _compoundType.CompoundType(arrType.innerType, 1);
  8817. }
  8818. }
  8819. }
  8820. }, {
  8821. key: 'evaluateLiteralType',
  8822. value: function evaluateLiteralType(literal) {
  8823. if (literal instanceof _expressions.IntLiteral) {
  8824. return literal.type;
  8825. } else if (literal instanceof _expressions.RealLiteral) {
  8826. return literal.type;
  8827. } else if (literal instanceof _expressions.StringLiteral) {
  8828. return literal.type;
  8829. } else if (literal instanceof _expressions.BoolLiteral) {
  8830. return literal.type;
  8831. } else if (literal instanceof _expressions.VariableLiteral) {
  8832. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8833. if (typeInfo === null) {
  8834. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8835. }
  8836. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8837. return typeInfo.type;
  8838. }
  8839. return typeInfo.type;
  8840. } else {
  8841. console.warn("Evaluating type only for an array literal...");
  8842. var last = null;
  8843. if (literal.value.length === 1) {
  8844. last = this.evaluateExpressionType(literal.value[0]);
  8845. } else {
  8846. for (var i = 0; i < literal.value.length; i++) {
  8847. var e = this.evaluateExpressionType(literal.value[i]);
  8848. if (last === null) {
  8849. last = e;
  8850. } else if (!last.isCompatible(e)) {
  8851. var strInfo = last.stringInfo();
  8852. var info = strInfo[0];
  8853. var strExp = literal.toString();
  8854. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8855. }
  8856. }
  8857. }
  8858. if (last instanceof _compoundType.CompoundType) {
  8859. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8860. }
  8861. return new _compoundType.CompoundType(last, 1);
  8862. }
  8863. }
  8864. }, {
  8865. key: 'evaluateArrayLiteral',
  8866. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8867. /* if (literal instanceof ArrayLiteral) {
  8868. const dimType = this.evaluateExpressionType(lines);
  8869. if (!dimType.isCompatible(Types.INTEGER)) {
  8870. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8871. }
  8872. if ((lines instanceof IntLiteral)) {
  8873. if (!lines.value.eq(literal.value.length)) {
  8874. if(type.dimensions > 1) {
  8875. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8876. } else {
  8877. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8878. }
  8879. } else if (lines.value.isNeg()) {
  8880. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8881. }
  8882. }
  8883. if (columns === null) {
  8884. // it's a vector...
  8885. literal.value.reduce((last, next) => {
  8886. const eType = this.evaluateExpressionType(next);
  8887. if (!last.canAccept(eType)) {
  8888. const strInfo = last.stringInfo();
  8889. const info = strInfo[0];
  8890. const strExp = literal.toString();
  8891. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8892. }
  8893. return last;
  8894. }, type);
  8895. return true;
  8896. } else {
  8897. const dimType = this.evaluateExpressionType(columns);
  8898. if (!dimType.isCompatible(Types.INTEGER)) {
  8899. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8900. }
  8901. if ((columns instanceof IntLiteral)) {
  8902. const columnValue = literal.value[0].value.length;
  8903. if (!columns.value.eq(columnValue)) {
  8904. if(type.dimensions > 1) {
  8905. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  8906. } else {
  8907. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8908. }
  8909. } else if (columns.value.isNeg()) {
  8910. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8911. }
  8912. for (let i = 0; i < columns; i++) {
  8913. const anotherArray = literal.value[i];
  8914. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  8915. }
  8916. }
  8917. }
  8918. } else {
  8919. const resultType = this.evaluateExpressionType(literal);
  8920. if (!(resultType instanceof CompoundType)) {
  8921. const strInfo = type.stringInfo();
  8922. const info = strInfo[0];
  8923. const strExp = literal.toString();
  8924. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8925. }
  8926. if (!type.isCompatible(resultType)) {
  8927. const strInfo = type.stringInfo();
  8928. const info = strInfo[0];
  8929. const strExp = literal.toString();
  8930. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8931. }
  8932. return true;
  8933. } */
  8934. return true;
  8935. }
  8936. }, {
  8937. key: 'assertFunction',
  8938. value: function assertFunction(fun) {
  8939. var _this = this;
  8940. this.pushMap();
  8941. this.currentFunction = fun;
  8942. fun.formalParameters.forEach(function (formalParam) {
  8943. if (formalParam.type instanceof _compoundType.CompoundType) {
  8944. if (formalParam.type.dimensions > 1) {
  8945. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8946. } else {
  8947. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8948. }
  8949. } else {
  8950. _this.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8951. }
  8952. });
  8953. this.assertDeclarations(fun.variablesDeclarations);
  8954. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8955. var valid = this.assertReturn(fun, optional);
  8956. if (!valid) {
  8957. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8958. }
  8959. this.popMap();
  8960. }
  8961. }, {
  8962. key: 'assertReturn',
  8963. value: function assertReturn(fun, optional) {
  8964. var _this2 = this;
  8965. return fun.commands.reduce(function (last, next) {
  8966. return _this2.checkCommand(fun.returnType, next, optional) || last;
  8967. }, optional);
  8968. }
  8969. }, {
  8970. key: 'checkCommand',
  8971. value: function checkCommand(type, cmd, optional) {
  8972. if (cmd instanceof _commands.While) {
  8973. var resultType = this.evaluateExpressionType(cmd.expression);
  8974. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  8975. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  8976. }
  8977. this.checkCommands(type, cmd.commands, optional);
  8978. return false;
  8979. } else if (cmd instanceof _commands.For) {
  8980. this.checkCommand(type, cmd.assignment, optional);
  8981. var _resultType = this.evaluateExpressionType(cmd.condition);
  8982. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  8983. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  8984. }
  8985. this.checkCommand(type, cmd.increment, optional);
  8986. this.checkCommands(type, cmd.commands, optional);
  8987. return false;
  8988. } else if (cmd instanceof _commands.Switch) {
  8989. var sType = this.evaluateExpressionType(cmd.expression);
  8990. var result = optional;
  8991. var hasDefault = false;
  8992. for (var i = 0; i < cmd.cases.length; i++) {
  8993. var aCase = cmd.cases[i];
  8994. if (aCase.expression !== null) {
  8995. var caseType = this.evaluateExpressionType(aCase.expression);
  8996. if (!sType.isCompatible(caseType)) {
  8997. var strInfo = sType.stringInfo();
  8998. var info = strInfo[0];
  8999. var strExp = aCase.expression.toString();
  9000. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9001. }
  9002. } else {
  9003. hasDefault = true;
  9004. }
  9005. result = result && this.checkCommands(type, aCase.commands, result);
  9006. }
  9007. return result && hasDefault;
  9008. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  9009. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9010. if (typeInfo === null) {
  9011. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9012. }
  9013. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  9014. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9015. }
  9016. var exp = cmd.expression;
  9017. var lineExp = cmd.line;
  9018. var lineType = this.evaluateExpressionType(lineExp);
  9019. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  9020. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9021. }
  9022. var columnExp = cmd.column;
  9023. if (typeInfo.columns === null && columnExp !== null) {
  9024. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9025. } else if (columnExp !== null) {
  9026. var columnType = this.evaluateExpressionType(columnExp);
  9027. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  9028. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9029. }
  9030. }
  9031. // exp can be a arrayLiteral, a single value exp or an array access
  9032. if (exp instanceof _expressions.ArrayLiteral) {
  9033. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9034. } else {
  9035. // cannot properly evaluate since type system is poorly constructed
  9036. }
  9037. return optional;
  9038. } else if (cmd instanceof _commands.Assign) {
  9039. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9040. if (_typeInfo === null) {
  9041. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9042. }
  9043. var _exp = cmd.expression;
  9044. if (_exp instanceof _expressions.ArrayLiteral) {
  9045. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  9046. var stringInfo = _typeInfo.type.stringInfo();
  9047. var _info2 = stringInfo[0];
  9048. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9049. }
  9050. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9051. } else {
  9052. var _resultType2 = this.evaluateExpressionType(_exp);
  9053. if (!_resultType2.isCompatible(_typeInfo.type) && !_config.Config.enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9054. var _stringInfo2 = _typeInfo.type.stringInfo();
  9055. var _info3 = _stringInfo2[0];
  9056. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9057. }
  9058. }
  9059. return optional;
  9060. } else if (cmd instanceof _commands.Break) {
  9061. return optional;
  9062. } else if (cmd instanceof _commands.IfThenElse) {
  9063. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9064. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  9065. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  9066. }
  9067. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  9068. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9069. } else {
  9070. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9071. }
  9072. } else if (cmd instanceof _expressions.FunctionCall) {
  9073. var fun = null;
  9074. if (cmd.isMainCall) {
  9075. fun = this.getMainFunction();
  9076. } else {
  9077. fun = this.findFunction(cmd.id);
  9078. }
  9079. if (fun === null) {
  9080. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  9081. }
  9082. this.assertParameters(fun, cmd.actualParameters);
  9083. return optional;
  9084. } else if (cmd instanceof _commands.Return) {
  9085. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  9086. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  9087. var _stringInfo3 = type.stringInfo();
  9088. var _info4 = _stringInfo3[0];
  9089. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9090. } else if (cmd.expression !== null) {
  9091. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9092. if (!type.isCompatible(_resultType4)) {
  9093. var _stringInfo4 = type.stringInfo();
  9094. var _info5 = _stringInfo4[0];
  9095. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9096. } else {
  9097. return true;
  9098. }
  9099. } else {
  9100. return true;
  9101. }
  9102. }
  9103. }
  9104. }, {
  9105. key: 'checkCommands',
  9106. value: function checkCommands(type, cmds, optional) {
  9107. var _this3 = this;
  9108. return cmds.reduce(function (last, next) {
  9109. return _this3.checkCommand(type, next, optional) || last;
  9110. }, optional);
  9111. }
  9112. }, {
  9113. key: 'assertParameters',
  9114. value: function assertParameters(fun, actualParametersList) {
  9115. if (fun.formalParameters.length !== actualParametersList.length) {
  9116. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9117. }
  9118. for (var i = 0; i < actualParametersList.length; i++) {
  9119. var param = actualParametersList[i];
  9120. var formalParam = fun.formalParameters[i];
  9121. var id = formalParam.id;
  9122. if (formalParam.byRef) {
  9123. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9124. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9125. }
  9126. }
  9127. var resultType = this.evaluateExpressionType(param);
  9128. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9129. var shared = 0;
  9130. for (var j = 0; j < resultType.types.length; j++) {
  9131. var element = resultType.types[j];
  9132. if (formalParam.type.types.indexOf(element) !== -1) {
  9133. shared++;
  9134. }
  9135. }
  9136. if (shared <= 0) {
  9137. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9138. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9139. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9140. continue;
  9141. }
  9142. }
  9143. }
  9144. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9145. }
  9146. } else if (resultType instanceof _multiType.MultiType) {
  9147. if (!resultType.isCompatible(formalParam.type)) {
  9148. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9149. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9150. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9151. continue;
  9152. }
  9153. }
  9154. }
  9155. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9156. }
  9157. } else if (!formalParam.type.isCompatible(resultType)) {
  9158. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9159. if (_store.Store.canImplicitTypeCast(formalParam.type, resultType)) {
  9160. continue;
  9161. }
  9162. }
  9163. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9164. }
  9165. }
  9166. }
  9167. }]);
  9168. return SemanticAnalyser;
  9169. }();
  9170. /***/ }),
  9171. /***/ "./js/processor/store/store.js":
  9172. /*!*************************************!*\
  9173. !*** ./js/processor/store/store.js ***!
  9174. \*************************************/
  9175. /*! no static exports found */
  9176. /***/ (function(module, exports, __webpack_require__) {
  9177. "use strict";
  9178. Object.defineProperty(exports, "__esModule", {
  9179. value: true
  9180. });
  9181. exports.Store = undefined;
  9182. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9183. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9184. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9185. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9186. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9187. var Store = exports.Store = function () {
  9188. _createClass(Store, null, [{
  9189. key: 'canImplicitTypeCast',
  9190. value: function canImplicitTypeCast(castType, sourceType) {
  9191. if (castType.isCompatible(_types.Types.INTEGER) || castType.isCompatible(_types.Types.REAL)) {
  9192. if (sourceType.isCompatible(_types.Types.INTEGER) || sourceType.isCompatible(_types.Types.REAL)) {
  9193. return true;
  9194. }
  9195. }
  9196. return false;
  9197. }
  9198. }, {
  9199. key: 'doImplicitCasting',
  9200. value: function doImplicitCasting(castType, stoObj) {
  9201. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9202. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9203. }
  9204. if (_types.Types.INTEGER.isCompatible(castType)) {
  9205. return new _storeObject.StoreObject(castType, stoObj.value.trunc());
  9206. } else {
  9207. return new _storeObject.StoreObject(castType, stoObj.value);
  9208. }
  9209. }
  9210. }]);
  9211. function Store(name) {
  9212. _classCallCheck(this, Store);
  9213. this.name = name;
  9214. this.store = {};
  9215. this.nextStore = null;
  9216. this.mode = _modes.Modes.RUN;
  9217. }
  9218. _createClass(Store, [{
  9219. key: 'extendStore',
  9220. value: function extendStore(nextStore) {
  9221. this.nextStore = nextStore;
  9222. }
  9223. }, {
  9224. key: 'applyStore',
  9225. value: function applyStore(id) {
  9226. if (!this.store[id]) {
  9227. if (this.nextStore !== null) {
  9228. return this.nextStore.applyStore(id);
  9229. } else {
  9230. throw new Error('Variable ' + id + ' not found.');
  9231. }
  9232. }
  9233. var val = this.store[id];
  9234. if (val.isRef) {
  9235. return val.getRefObj();
  9236. }
  9237. return this.store[id];
  9238. }
  9239. }, {
  9240. key: 'updateStore',
  9241. value: function updateStore(id, stoObj) {
  9242. if (!this.store[id]) {
  9243. if (this.nextStore !== null) {
  9244. this.nextStore.updateStore(id, stoObj);
  9245. return this;
  9246. } else {
  9247. // TODO: better error message
  9248. throw new Error('Variable ' + id + ' not found.');
  9249. }
  9250. } else {
  9251. var oldObj = this.store[id];
  9252. if (oldObj.readOnly) {
  9253. // TODO: better error message
  9254. throw new Error("Cannot change value of a read only variable: " + id);
  9255. }
  9256. if (oldObj.isRef) {
  9257. oldObj.updateRef(stoObj);
  9258. return this;
  9259. } else if (oldObj.isCompatible(stoObj)) {
  9260. stoObj.setID(id);
  9261. this.store[id] = Object.freeze(stoObj);
  9262. return this;
  9263. } else {
  9264. var oldType = oldObj.type;
  9265. var stoType = stoObj.type;
  9266. // TODO: better error message
  9267. throw new Error(oldType + ' is not compatible with type ' + stoType + ' given');
  9268. }
  9269. }
  9270. }
  9271. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9272. // and no the StoreObject refferenced by it
  9273. // updateStoreRef(id, stoObjAddress) {...}
  9274. }, {
  9275. key: 'insertStore',
  9276. value: function insertStore(id, stoObj) {
  9277. if (this.store[id]) {
  9278. // TODO: better error message
  9279. throw new Error(id + ' is already defined');
  9280. }
  9281. stoObj.setID(id);
  9282. this.store[id] = Object.freeze(stoObj);
  9283. return this;
  9284. }
  9285. }]);
  9286. return Store;
  9287. }();
  9288. /***/ }),
  9289. /***/ "./js/processor/store/storeObject.js":
  9290. /*!*******************************************!*\
  9291. !*** ./js/processor/store/storeObject.js ***!
  9292. \*******************************************/
  9293. /*! no static exports found */
  9294. /***/ (function(module, exports, __webpack_require__) {
  9295. "use strict";
  9296. Object.defineProperty(exports, "__esModule", {
  9297. value: true
  9298. });
  9299. exports.StoreObject = undefined;
  9300. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9301. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9302. var _decimal2 = _interopRequireDefault(_decimal);
  9303. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9304. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9305. var StoreObject = exports.StoreObject = function () {
  9306. function StoreObject(type, value) {
  9307. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9308. _classCallCheck(this, StoreObject);
  9309. this._type = type;
  9310. this._value = value;
  9311. this._readOnly = readOnly;
  9312. this._id = null;
  9313. }
  9314. _createClass(StoreObject, [{
  9315. key: 'setID',
  9316. value: function setID(id) {
  9317. this._id = id;
  9318. }
  9319. }, {
  9320. key: 'isCompatible',
  9321. value: function isCompatible(another) {
  9322. if (another instanceof StoreObject) {
  9323. return this.type.isCompatible(another.type);
  9324. }
  9325. return false;
  9326. }
  9327. }, {
  9328. key: 'id',
  9329. get: function get() {
  9330. return this._id;
  9331. }
  9332. }, {
  9333. key: 'inStore',
  9334. get: function get() {
  9335. return this.id !== null;
  9336. }
  9337. }, {
  9338. key: 'type',
  9339. get: function get() {
  9340. return this._type;
  9341. }
  9342. }, {
  9343. key: 'value',
  9344. get: function get() {
  9345. return this._value;
  9346. }
  9347. }, {
  9348. key: 'number',
  9349. get: function get() {
  9350. if (this._value instanceof _decimal2.default) {
  9351. return this._value.toNumber();
  9352. } else {
  9353. return null;
  9354. }
  9355. }
  9356. }, {
  9357. key: 'readOnly',
  9358. get: function get() {
  9359. return this._readOnly;
  9360. },
  9361. set: function set(value) {
  9362. this._readOnly = value;
  9363. }
  9364. }]);
  9365. return StoreObject;
  9366. }();
  9367. /***/ }),
  9368. /***/ "./js/processor/store/storeObjectArray.js":
  9369. /*!************************************************!*\
  9370. !*** ./js/processor/store/storeObjectArray.js ***!
  9371. \************************************************/
  9372. /*! no static exports found */
  9373. /***/ (function(module, exports, __webpack_require__) {
  9374. "use strict";
  9375. Object.defineProperty(exports, "__esModule", {
  9376. value: true
  9377. });
  9378. exports.StoreObjectArray = undefined;
  9379. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9380. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9381. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9382. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9383. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9384. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9385. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9386. _inherits(StoreObjectArray, _StoreObject);
  9387. _createClass(StoreObjectArray, null, [{
  9388. key: 'WRONG_LINE_NUMBER',
  9389. get: function get() {
  9390. return 1;
  9391. }
  9392. }, {
  9393. key: 'WRONG_TYPE',
  9394. get: function get() {
  9395. return 2;
  9396. }
  9397. }, {
  9398. key: 'WRONG_COLUMN_NUMBER',
  9399. get: function get() {
  9400. return 3;
  9401. }
  9402. }]);
  9403. function StoreObjectArray(type, lines, columns) {
  9404. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9405. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9406. _classCallCheck(this, StoreObjectArray);
  9407. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9408. _this._lines = lines;
  9409. _this._columns = columns;
  9410. return _this;
  9411. }
  9412. _createClass(StoreObjectArray, [{
  9413. key: 'isCompatible',
  9414. value: function isCompatible(another) {
  9415. if (another instanceof _storeObject.StoreObject) {
  9416. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9417. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9418. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9419. }
  9420. }
  9421. }
  9422. return false;
  9423. }
  9424. }, {
  9425. key: 'lines',
  9426. get: function get() {
  9427. return this._lines;
  9428. }
  9429. }, {
  9430. key: 'columns',
  9431. get: function get() {
  9432. return this._columns;
  9433. }
  9434. }, {
  9435. key: 'isVector',
  9436. get: function get() {
  9437. return this.type.dimensions === 1;
  9438. }
  9439. }, {
  9440. key: 'isValid',
  9441. get: function get() {
  9442. var _this2 = this;
  9443. if (this.value !== null) {
  9444. if (this.isVector) {
  9445. if (this.value.length !== this.lines) {
  9446. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9447. }
  9448. var mustBeNull = this.value.find(function (v) {
  9449. return !_this2.type.canAccept(v.type);
  9450. });
  9451. if (!!mustBeNull) {
  9452. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9453. }
  9454. }
  9455. return [];
  9456. } else {
  9457. if (this.lines !== this.value.length) {
  9458. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9459. }
  9460. for (var i = 0; i < this.lines; i++) {
  9461. for (var j = 0; j < this.columns; j++) {
  9462. var arr = this.value[i];
  9463. if (arr.length !== this.columns) {
  9464. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9465. }
  9466. var _mustBeNull = arr.find(function (v) {
  9467. return !_this2.type.canAccept(v.type);
  9468. });
  9469. if (!!_mustBeNull) {
  9470. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9471. }
  9472. }
  9473. }
  9474. return [];
  9475. }
  9476. }
  9477. }]);
  9478. return StoreObjectArray;
  9479. }(_storeObject.StoreObject);
  9480. /***/ }),
  9481. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9482. /*!*******************************************************!*\
  9483. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9484. \*******************************************************/
  9485. /*! no static exports found */
  9486. /***/ (function(module, exports, __webpack_require__) {
  9487. "use strict";
  9488. Object.defineProperty(exports, "__esModule", {
  9489. value: true
  9490. });
  9491. exports.StoreObjectArrayAddress = undefined;
  9492. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9493. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9494. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9495. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9496. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9497. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9498. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9499. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9500. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9501. _inherits(StoreObjectArrayAddress, _StoreObject);
  9502. function StoreObjectArrayAddress(refID, line, column, store) {
  9503. _classCallCheck(this, StoreObjectArrayAddress);
  9504. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9505. _this.refID = refID;
  9506. _this.store = store;
  9507. _this.line = line;
  9508. _this.column = column;
  9509. return _this;
  9510. }
  9511. _createClass(StoreObjectArrayAddress, [{
  9512. key: 'getArrayObject',
  9513. value: function getArrayObject() {
  9514. return this.store.applyStore(this.refID);
  9515. }
  9516. }, {
  9517. key: 'updateArrayObject',
  9518. value: function updateArrayObject(stoObj) {
  9519. var anArray = this.getArrayObject();
  9520. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9521. if (!stoObj.type.isCompatible(this.type)) {
  9522. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9523. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9524. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9525. }
  9526. if (this.column !== null) {
  9527. newArray.value[this.line].value[this.column] = stoObj;
  9528. return newArray;
  9529. } else {
  9530. newArray.value[this.line] = stoObj;
  9531. return newArray;
  9532. }
  9533. }
  9534. }, {
  9535. key: 'isCompatible',
  9536. value: function isCompatible(another) {
  9537. if (this.type.isCompatible(another.type)) {
  9538. if (another.type instanceof _compoundType.CompoundType) {
  9539. return this.lines === another.lines && this.columns === another.columns;
  9540. } else {
  9541. this.refValue.isCompatible(another);
  9542. }
  9543. }
  9544. }
  9545. }, {
  9546. key: 'isRef',
  9547. get: function get() {
  9548. return false;
  9549. }
  9550. }, {
  9551. key: 'inStore',
  9552. get: function get() {
  9553. return true;
  9554. }
  9555. }, {
  9556. key: 'refValue',
  9557. get: function get() {
  9558. var refLine = this.store.applyStore(this.refID).value[this.line];
  9559. if (!refLine) {
  9560. if (this.getArrayObject().isVector) {
  9561. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9562. } else {
  9563. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9564. }
  9565. }
  9566. if (this.column !== null) {
  9567. var refColumn = refLine.value[this.column];
  9568. if (!refColumn) {
  9569. if (this.getArrayObject().isVector) {
  9570. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9571. } else {
  9572. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9573. }
  9574. }
  9575. return refColumn;
  9576. }
  9577. return refLine;
  9578. }
  9579. }, {
  9580. key: 'value',
  9581. get: function get() {
  9582. return this.refValue.value;
  9583. }
  9584. }, {
  9585. key: 'type',
  9586. get: function get() {
  9587. return this.refValue.type;
  9588. }
  9589. }, {
  9590. key: 'lines',
  9591. get: function get() {
  9592. if (!(this.type instanceof _compoundType.CompoundType)) {
  9593. return null;
  9594. }
  9595. return this.refValue.value.length;
  9596. }
  9597. }, {
  9598. key: 'columns',
  9599. get: function get() {
  9600. switch (this.type.dimensions) {
  9601. case 2:
  9602. return this.refValue.value[0].value.length;
  9603. default:
  9604. return null;
  9605. }
  9606. }
  9607. }]);
  9608. return StoreObjectArrayAddress;
  9609. }(_storeObject.StoreObject);
  9610. /***/ }),
  9611. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9612. /*!**********************************************************!*\
  9613. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9614. \**********************************************************/
  9615. /*! no static exports found */
  9616. /***/ (function(module, exports, __webpack_require__) {
  9617. "use strict";
  9618. Object.defineProperty(exports, "__esModule", {
  9619. value: true
  9620. });
  9621. exports.StoreObjectArrayAddressRef = undefined;
  9622. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9623. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9624. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9625. var _decimal2 = _interopRequireDefault(_decimal);
  9626. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9627. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9628. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9629. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9630. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9631. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9632. function StoreObjectArrayAddressRef(address) {
  9633. _classCallCheck(this, StoreObjectArrayAddressRef);
  9634. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9635. _this.address = address;
  9636. return _this;
  9637. }
  9638. _createClass(StoreObjectArrayAddressRef, [{
  9639. key: 'getRefObj',
  9640. value: function getRefObj() {
  9641. return this.address.refValue;
  9642. }
  9643. }, {
  9644. key: 'updateRef',
  9645. value: function updateRef(stoObj) {
  9646. var newArray = this.address.updateArrayObject(stoObj);
  9647. this.address.store.updateStore(this.address.refID, newArray);
  9648. }
  9649. }, {
  9650. key: 'isCompatible',
  9651. value: function isCompatible(another) {
  9652. return this.address.isCompatible(another);
  9653. }
  9654. }, {
  9655. key: 'isRef',
  9656. get: function get() {
  9657. return true;
  9658. }
  9659. }, {
  9660. key: 'type',
  9661. get: function get() {
  9662. return this.address.type;
  9663. }
  9664. }, {
  9665. key: 'value',
  9666. get: function get() {
  9667. return this.address.value;
  9668. }
  9669. }, {
  9670. key: 'number',
  9671. get: function get() {
  9672. if (this.value instanceof _decimal2.default) {
  9673. return this.value.toNumber();
  9674. } else {
  9675. return null;
  9676. }
  9677. }
  9678. }]);
  9679. return StoreObjectArrayAddressRef;
  9680. }(_storeObject.StoreObject);
  9681. /***/ }),
  9682. /***/ "./js/processor/store/storeObjectRef.js":
  9683. /*!**********************************************!*\
  9684. !*** ./js/processor/store/storeObjectRef.js ***!
  9685. \**********************************************/
  9686. /*! no static exports found */
  9687. /***/ (function(module, exports, __webpack_require__) {
  9688. "use strict";
  9689. Object.defineProperty(exports, "__esModule", {
  9690. value: true
  9691. });
  9692. exports.StoreObjectRef = undefined;
  9693. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9694. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9695. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9696. var _decimal2 = _interopRequireDefault(_decimal);
  9697. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9698. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9699. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9700. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9701. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9702. _inherits(StoreObjectRef, _StoreObject);
  9703. function StoreObjectRef(refID, store) {
  9704. _classCallCheck(this, StoreObjectRef);
  9705. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9706. _this.refID = refID;
  9707. _this.store = store;
  9708. return _this;
  9709. }
  9710. _createClass(StoreObjectRef, [{
  9711. key: 'getRefObj',
  9712. value: function getRefObj() {
  9713. return this.store.applyStore(this.refID);
  9714. }
  9715. }, {
  9716. key: 'updateRef',
  9717. value: function updateRef(stoObj) {
  9718. this.store.updateStore(this.refID, stoObj);
  9719. }
  9720. }, {
  9721. key: 'isCompatible',
  9722. value: function isCompatible(another) {
  9723. return this.store.applyStore(this.refID).isCompatible(another);
  9724. }
  9725. }, {
  9726. key: 'isRef',
  9727. get: function get() {
  9728. return true;
  9729. }
  9730. }, {
  9731. key: 'type',
  9732. get: function get() {
  9733. return this.store.applyStore(this.refID).type;
  9734. }
  9735. }, {
  9736. key: 'value',
  9737. get: function get() {
  9738. return this.store.applyStore(this.refID).value;
  9739. }
  9740. }, {
  9741. key: 'number',
  9742. get: function get() {
  9743. if (this.value instanceof _decimal2.default) {
  9744. return this.value.toNumber();
  9745. } else {
  9746. return null;
  9747. }
  9748. }
  9749. }]);
  9750. return StoreObjectRef;
  9751. }(_storeObject.StoreObject);
  9752. /***/ }),
  9753. /***/ "./js/runner.js":
  9754. /*!**********************!*\
  9755. !*** ./js/runner.js ***!
  9756. \**********************/
  9757. /*! no static exports found */
  9758. /***/ (function(module, exports, __webpack_require__) {
  9759. "use strict";
  9760. Object.defineProperty(exports, "__esModule", {
  9761. value: true
  9762. });
  9763. exports.runner = runner;
  9764. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9765. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9766. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9767. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9768. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9769. function runner() {
  9770. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9771. // const lexer = new ivprogLexer(new InputStream(input));
  9772. // const stream = new CommonTokenStream(lexer);
  9773. // stream.fill();
  9774. // let i = 1;
  9775. // let token = null;
  9776. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9777. // console.log(`${token.type}-${token.text}`);
  9778. // console.log('\n')
  9779. // i++;
  9780. // }
  9781. // const anaSin = new IVProgParser(input, ivprogLexer);
  9782. var editor = new JsonEditor('#json-renderer', {});
  9783. var domConsole = new _domConsole.DOMConsole("#console");
  9784. // proc.interpretAST().then( sto => {
  9785. // console.log(sto.applyStore('a'));
  9786. // }).catch(e => console.log(e));
  9787. try {
  9788. $('#btn').click(function () {
  9789. var input = $('#input').val();
  9790. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9791. try {
  9792. var data = analiser.parseTree();
  9793. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9794. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9795. proc.registerInput(domConsole);
  9796. domConsole.clear();
  9797. proc.registerOutput(domConsole);
  9798. proc.interpretAST().then(function (sto) {
  9799. return editor.load(sto.store);
  9800. }).catch(function (e) {
  9801. alert(e);console.log(e);
  9802. });
  9803. } catch (error) {
  9804. alert(error);
  9805. console.log(error);
  9806. }
  9807. });
  9808. } catch (a) {
  9809. console.log(a);
  9810. }
  9811. }
  9812. /***/ }),
  9813. /***/ "./js/semantic/semantic.min.js":
  9814. /*!*************************************!*\
  9815. !*** ./js/semantic/semantic.min.js ***!
  9816. \*************************************/
  9817. /*! no static exports found */
  9818. /***/ (function(module, exports, __webpack_require__) {
  9819. "use strict";
  9820. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  9821. /*
  9822. * # Semantic UI - 2.3.3
  9823. * https://github.com/Semantic-Org/Semantic-UI
  9824. * http://www.semantic-ui.com/
  9825. *
  9826. * Copyright 2014 Contributors
  9827. * Released under the MIT license
  9828. * http://opensource.org/licenses/MIT
  9829. *
  9830. */
  9831. !function (e, t, n, i) {
  9832. e.site = e.fn.site = function (o) {
  9833. var a,
  9834. r,
  9835. s = new Date().getTime(),
  9836. l = [],
  9837. c = arguments[0],
  9838. u = "string" == typeof c,
  9839. d = [].slice.call(arguments, 1),
  9840. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9841. m = f.namespace,
  9842. g = f.error,
  9843. p = "module-" + m,
  9844. h = e(n),
  9845. v = this,
  9846. b = h.data(p);return a = { initialize: function initialize() {
  9847. a.instantiate();
  9848. }, instantiate: function instantiate() {
  9849. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9850. }, normalize: function normalize() {
  9851. a.fix.console(), a.fix.requestAnimationFrame();
  9852. }, fix: { console: function (_console) {
  9853. function console() {
  9854. return _console.apply(this, arguments);
  9855. }
  9856. console.toString = function () {
  9857. return _console.toString();
  9858. };
  9859. return console;
  9860. }(function () {
  9861. 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 () {});
  9862. }), consoleClear: function consoleClear() {
  9863. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9864. }, requestAnimationFrame: function requestAnimationFrame() {
  9865. 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) {
  9866. setTimeout(e, 0);
  9867. });
  9868. } }, moduleExists: function moduleExists(t) {
  9869. return e.fn[t] !== i && e.fn[t].settings !== i;
  9870. }, enabled: { modules: function modules(t) {
  9871. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9872. a.moduleExists(t) && n.push(t);
  9873. }), n;
  9874. } }, disabled: { modules: function modules(t) {
  9875. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9876. a.moduleExists(t) || n.push(t);
  9877. }), n;
  9878. } }, change: { setting: function setting(t, n, o, r) {
  9879. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9880. var s,
  9881. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;a.moduleExists(o) && (a.verbose("Changing default setting", t, n, o), e.fn[o].settings[t] = n, r && l && (s = e(":data(module-" + l + ")")).length > 0 && (a.verbose("Modifying existing settings", s), s[o]("setting", t, n)));
  9882. });
  9883. }, settings: function settings(t, n, o) {
  9884. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9885. var r;a.moduleExists(i) && (a.verbose("Changing default setting", t, i), e.extend(!0, e.fn[i].settings, t), o && m && (r = e(":data(module-" + m + ")")).length > 0 && (a.verbose("Modifying existing settings", r), r[i]("setting", t)));
  9886. });
  9887. } }, enable: { console: function console() {
  9888. a.console(!0);
  9889. }, debug: function debug(e, t) {
  9890. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9891. }, verbose: function verbose(e, t) {
  9892. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9893. } }, disable: { console: function console() {
  9894. a.console(!1);
  9895. }, debug: function debug(e, t) {
  9896. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9897. }, verbose: function verbose(e, t) {
  9898. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9899. } }, console: function console(e) {
  9900. if (e) {
  9901. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9902. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = { clear: function clear() {}, error: function error() {}, group: function group() {}, groupCollapsed: function groupCollapsed() {}, groupEnd: function groupEnd() {}, info: function info() {}, log: function log() {}, markTimeline: function markTimeline() {}, warn: function warn() {} };
  9903. }, destroy: function destroy() {
  9904. a.verbose("Destroying previous site for", h), h.removeData(p);
  9905. }, cache: {}, setting: function setting(t, n) {
  9906. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9907. if (n === i) return f[t];f[t] = n;
  9908. }
  9909. }, internal: function internal(t, n) {
  9910. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9911. if (n === i) return a[t];a[t] = n;
  9912. }
  9913. }, debug: function debug() {
  9914. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9915. }, verbose: function verbose() {
  9916. 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)));
  9917. }, error: function error() {
  9918. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9919. }, performance: { log: function log(e) {
  9920. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Element: v, Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  9921. }, display: function display() {
  9922. var t = f.name + ":",
  9923. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9924. n += t["Execution Time"];
  9925. }), 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) {
  9926. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9927. }), console.groupEnd()), l = [];
  9928. } }, invoke: function invoke(t, n, o) {
  9929. var s,
  9930. l,
  9931. c,
  9932. u = b;return n = n || d, o = v || o, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  9933. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  9934. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  9935. }
  9936. })), 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;
  9937. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9938. }, e.site.settings = { name: "Site", namespace: "site", error: { console: "Console cannot be restored, most likely it was overwritten outside of module", method: "The method you called is not defined." }, debug: !1, verbose: !1, performance: !0, modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"], siteNamespace: "site", namespaceStub: { cache: {}, config: {}, sections: {}, section: {}, utilities: {} } }, e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  9939. return function (n) {
  9940. return !!e.data(n, t);
  9941. };
  9942. }) : function (t, n, i) {
  9943. return !!e.data(t, i[3]);
  9944. } });
  9945. }(jQuery, window, document), function (e, t, n, i) {
  9946. "use strict";
  9947. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9948. var o,
  9949. a = e(this),
  9950. r = a.selector || "",
  9951. s = new Date().getTime(),
  9952. l = [],
  9953. c = arguments[0],
  9954. u = arguments[1],
  9955. d = "string" == typeof c,
  9956. f = [].slice.call(arguments, 1);return a.each(function () {
  9957. var m,
  9958. g,
  9959. p,
  9960. h,
  9961. v,
  9962. b,
  9963. y,
  9964. x,
  9965. C,
  9966. w,
  9967. S,
  9968. k,
  9969. T,
  9970. A,
  9971. R,
  9972. P,
  9973. E = e(this),
  9974. F = this,
  9975. O = [],
  9976. D = !1;(P = { initialize: function initialize() {
  9977. 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());
  9978. }, instantiate: function instantiate() {
  9979. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  9980. }, destroy: function destroy() {
  9981. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  9982. }, refresh: function refresh() {
  9983. 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);
  9984. }, submit: function submit() {
  9985. P.verbose("Submitting form", E), E.submit();
  9986. }, attachEvents: function attachEvents(t, n) {
  9987. n = n || "submit", e(t).on("click" + A, function (e) {
  9988. P[n](), e.preventDefault();
  9989. });
  9990. }, bindEvents: function bindEvents() {
  9991. 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 () {
  9992. var t = e(this),
  9993. n = t.prop("type"),
  9994. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  9995. });
  9996. }, clear: function clear() {
  9997. m.each(function () {
  9998. var t = e(this),
  9999. n = t.parent(),
  10000. i = t.closest(g),
  10001. o = i.find(x.prompt),
  10002. a = t.data(y.defaultValue) || "",
  10003. r = n.is(x.uiCheckbox),
  10004. s = n.is(x.uiDropdown);i.hasClass(C.error) && (P.verbose("Resetting error on field", i), i.removeClass(C.error), o.remove()), s ? (P.verbose("Resetting dropdown value", n, a), n.dropdown("clear")) : r ? t.prop("checked", !1) : (P.verbose("Resetting field value", t, a), t.val(""));
  10005. });
  10006. }, reset: function reset() {
  10007. m.each(function () {
  10008. var t = e(this),
  10009. n = t.parent(),
  10010. o = t.closest(g),
  10011. a = o.find(x.prompt),
  10012. r = t.data(y.defaultValue),
  10013. s = n.is(x.uiCheckbox),
  10014. l = n.is(x.uiDropdown),
  10015. c = o.hasClass(C.error);r !== i && (c && (P.verbose("Resetting error on field", o), o.removeClass(C.error), a.remove()), l ? (P.verbose("Resetting dropdown value", n, r), n.dropdown("restore defaults")) : s ? (P.verbose("Resetting checkbox value", n, r), t.prop("checked", r)) : (P.verbose("Resetting field value", t, r), t.val(r)));
  10016. });
  10017. }, determine: { isValid: function isValid() {
  10018. var t = !0;return e.each(b, function (e, n) {
  10019. P.validate.field(n, e, !0) || (t = !1);
  10020. }), t;
  10021. } }, is: { bracketedRule: function bracketedRule(e) {
  10022. return e.type && e.type.match(v.regExp.bracket);
  10023. }, shorthandFields: function shorthandFields(e) {
  10024. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  10025. }, shorthandRules: function shorthandRules(t) {
  10026. return "string" == typeof t || e.isArray(t);
  10027. }, empty: function empty(e) {
  10028. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10029. }, blank: function blank(t) {
  10030. return "" === e.trim(t.val());
  10031. }, valid: function valid(t) {
  10032. var n = !0;return t ? (P.verbose("Checking if field is valid", t), P.validate.field(b[t], t, !1)) : (P.verbose("Checking if form is valid"), e.each(b, function (e, t) {
  10033. P.is.valid(e) || (n = !1);
  10034. }), n);
  10035. } }, removeEvents: function removeEvents() {
  10036. E.off(A), m.off(A), h.off(A), m.off(A);
  10037. }, event: { field: { keydown: function keydown(t) {
  10038. var n = e(this),
  10039. i = t.which,
  10040. o = n.is(x.input),
  10041. a = n.is(x.checkbox),
  10042. r = n.closest(x.uiDropdown).length > 0,
  10043. s = 13;i == 27 && (P.verbose("Escape key pressed blurring field"), n.blur()), t.ctrlKey || i != s || !o || r || a || (D || (n.one("keyup" + A, P.event.field.keyup), P.submit(), P.debug("Enter pressed on input submitting form")), D = !0);
  10044. }, keyup: function keyup() {
  10045. D = !1;
  10046. }, blur: function blur(t) {
  10047. var n = e(this),
  10048. i = n.closest(g),
  10049. o = P.get.validation(n);i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  10050. }, change: function change(t) {
  10051. var n = e(this),
  10052. i = n.closest(g),
  10053. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10054. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10055. }, v.delay));
  10056. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  10057. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10058. }, ruleName: function ruleName(e) {
  10059. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10060. }, changeEvent: function changeEvent(e, t) {
  10061. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10062. }, inputEvent: function inputEvent() {
  10063. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10064. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  10065. var n = {};return e.each(t, function (t, i) {
  10066. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  10067. n[t].rules.push({ type: i });
  10068. });
  10069. }), n;
  10070. }, prompt: function prompt(t, n) {
  10071. var i,
  10072. o,
  10073. a = P.get.ruleName(t),
  10074. r = P.get.ancillaryValue(t),
  10075. s = P.get.field(n.identifier),
  10076. l = s.val(),
  10077. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10078. u = -1 !== c.search("{value}"),
  10079. d = -1 !== c.search("{name}");return u && (c = c.replace("{value}", s.val())), d && (o = 1 == (i = s.closest(x.group).find("label").eq(0)).length ? i.text() : s.prop("placeholder") || v.text.unspecifiedField, c = c.replace("{name}", o)), c = (c = c.replace("{identifier}", n.identifier)).replace("{ruleValue}", r), t.prompt || P.verbose("Using default validation prompt for type", c, a), c;
  10080. }, settings: function settings() {
  10081. if (e.isPlainObject(t)) {
  10082. var n = Object.keys(t);n.length > 0 && t[n[0]].identifier !== i && t[n[0]].rules !== i ? (v = e.extend(!0, {}, e.fn.form.settings, u), b = e.extend({}, e.fn.form.settings.defaults, t), P.error(v.error.oldSyntax, F), P.verbose("Extending settings from legacy parameters", b, v)) : (t.fields && P.is.shorthandFields(t.fields) && (t.fields = P.get.fieldsFromShorthand(t.fields)), v = e.extend(!0, {}, e.fn.form.settings, t), b = e.extend({}, e.fn.form.settings.defaults, v.fields), P.verbose("Extending settings", b, v));
  10083. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);k = v.namespace, y = v.metadata, x = v.selector, C = v.className, w = v.regExp, S = v.error, T = "module-" + k, A = "." + k, R = E.data(T), P.refresh();
  10084. }, field: function field(t) {
  10085. 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/>");
  10086. }, fields: function fields(t) {
  10087. var n = e();return e.each(t, function (e, t) {
  10088. n = n.add(P.get.field(t));
  10089. }), n;
  10090. }, validation: function validation(t) {
  10091. var n, i;return !!b && (e.each(b, function (e, o) {
  10092. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10093. }), n || !1);
  10094. }, value: function value(e) {
  10095. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  10096. }, values: function values(t) {
  10097. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10098. var a = e(o),
  10099. r = (a.prop("type"), a.prop("name")),
  10100. s = a.val(),
  10101. l = a.is(x.checkbox),
  10102. c = a.is(x.radio),
  10103. u = -1 !== r.indexOf("[]"),
  10104. d = !!l && a.is(":checked");r && (u ? (r = r.replace("[]", ""), n[r] || (n[r] = []), l ? d ? n[r].push(s || !0) : n[r].push(!1) : n[r].push(s)) : c ? n[r] !== i && 0 != n[r] || (n[r] = !!d && (s || !0)) : n[r] = l ? !!d && (s || !0) : s);
  10105. }), n;
  10106. } }, has: { field: function field(e) {
  10107. 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;
  10108. } }, escape: { string: function string(e) {
  10109. return (e = String(e)).replace(w.escape, "\\$&");
  10110. } }, add: { rule: function rule(e, t) {
  10111. P.add.field(e, t);
  10112. }, field: function field(t, n) {
  10113. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  10114. i[t].rules.push({ type: n });
  10115. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10116. }, fields: function fields(t) {
  10117. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10118. }, prompt: function prompt(t, n) {
  10119. var o = P.get.field(t).closest(g),
  10120. a = o.children(x.prompt),
  10121. r = 0 !== a.length;n = "string" == typeof n ? [n] : n, P.verbose("Adding field error state", t), o.addClass(C.error), v.inline && (r || (a = v.templates.prompt(n)).appendTo(o), a.html(n[0]), r ? P.verbose("Inline errors are disabled, no inline error added", t) : v.transition && e.fn.transition !== i && E.transition("is supported") ? (P.verbose("Displaying error with css transition", v.transition), a.transition(v.transition + " in", v.duration)) : (P.verbose("Displaying error with fallback javascript animation"), a.fadeIn(v.duration)));
  10122. }, errors: function errors(e) {
  10123. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10124. } }, remove: { rule: function rule(t, n) {
  10125. var o = e.isArray(n) ? n : [n];if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  10126. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10127. });
  10128. }, field: function field(t) {
  10129. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  10130. P.remove.rule(t);
  10131. });
  10132. }, rules: function rules(t, n) {
  10133. e.isArray(t) ? e.each(fields, function (e, t) {
  10134. P.remove.rule(t, n);
  10135. }) : P.remove.rule(t, n);
  10136. }, fields: function fields(e) {
  10137. P.remove.field(e);
  10138. }, prompt: function prompt(t) {
  10139. var n = P.get.field(t).closest(g),
  10140. o = n.children(x.prompt);n.removeClass(C.error), v.inline && o.is(":visible") && (P.verbose("Removing prompt for field", t), v.transition && e.fn.transition !== i && E.transition("is supported") ? o.transition(v.transition + " out", v.duration, function () {
  10141. o.remove();
  10142. }) : o.fadeOut(v.duration, function () {
  10143. o.remove();
  10144. }));
  10145. } }, set: { success: function success() {
  10146. E.removeClass(C.error).addClass(C.success);
  10147. }, defaults: function defaults() {
  10148. m.each(function () {
  10149. var t = e(this),
  10150. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10151. });
  10152. }, error: function error() {
  10153. E.removeClass(C.success).addClass(C.error);
  10154. }, value: function value(e, t) {
  10155. var n = {};return n[e] = t, P.set.values.call(F, n);
  10156. }, values: function values(t) {
  10157. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10158. var i,
  10159. o = P.get.field(t),
  10160. a = o.parent(),
  10161. r = e.isArray(n),
  10162. s = a.is(x.uiCheckbox),
  10163. l = a.is(x.uiDropdown),
  10164. c = o.is(x.radio) && s;o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10165. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10166. })) : 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)));
  10167. });
  10168. } }, validate: { form: function form(e, t) {
  10169. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10170. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10171. } 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);
  10172. }, field: function field(t, n, o) {
  10173. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10174. r = P.get.field(a),
  10175. s = !!t.depends && P.get.field(t.depends),
  10176. l = !0,
  10177. c = [];return t.identifier || (P.debug("Using field name as identifier", a), t.identifier = a), r.prop("disabled") ? (P.debug("Field is disabled. Skipping", a), l = !0) : t.optional && P.is.blank(r) ? (P.debug("Field is optional and blank. Skipping", a), l = !0) : t.depends && P.is.empty(s) ? (P.debug("Field depends on another value that is not present or empty. Skipping", s), l = !0) : t.rules !== i && e.each(t.rules, function (e, n) {
  10178. 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);
  10179. }), 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);
  10180. }, rule: function rule(t, n) {
  10181. var o = P.get.field(t.identifier),
  10182. a = (n.type, o.val()),
  10183. r = P.get.ancillaryValue(n),
  10184. s = P.get.ruleName(n),
  10185. l = v.rules[s];if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);P.error(S.noRule, s);
  10186. } }, setting: function setting(t, n) {
  10187. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10188. if (n === i) return v[t];v[t] = n;
  10189. }
  10190. }, internal: function internal(t, n) {
  10191. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10192. if (n === i) return P[t];P[t] = n;
  10193. }
  10194. }, debug: function debug() {
  10195. !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)));
  10196. }, verbose: function verbose() {
  10197. !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)));
  10198. }, error: function error() {
  10199. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10200. }, performance: { log: function log(e) {
  10201. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10202. }, display: function display() {
  10203. var t = v.name + ":",
  10204. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10205. n += t["Execution Time"];
  10206. }), 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) {
  10207. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10208. }), console.groupEnd()), l = [];
  10209. } }, invoke: function invoke(t, n, a) {
  10210. var r,
  10211. s,
  10212. l,
  10213. c = R;return n = n || f, a = F || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10214. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10215. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10216. }
  10217. })), 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;
  10218. } }).initialize();
  10219. }), o !== i ? o : this;
  10220. }, e.fn.form.settings = { name: "Form", namespace: "form", debug: !1, verbose: !1, performance: !0, fields: !1, keyboardShortcuts: !0, on: "submit", inline: !1, delay: 200, revalidate: !0, transition: "scale", duration: 200, onValid: function onValid() {}, onInvalid: function onInvalid() {}, onSuccess: function onSuccess() {
  10221. return !0;
  10222. }, onFailure: function onFailure() {
  10223. return !1;
  10224. }, metadata: { defaultValue: "default", validate: "validate" }, regExp: { htmlID: /^[a-zA-Z][\w:.-]*$/g, bracket: /\[(.*)\]/i, decimal: /^\d+\.?\d*$/, email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, flags: /^\/(.*)\/(.*)?/, integer: /^\-?\d+$/, number: /^\-?\d*(\.\d+)?$/, url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i }, text: { unspecifiedRule: "Please enter a valid value", unspecifiedField: "This field" }, prompt: { empty: "{name} must have a value", checked: "{name} must be checked", email: "{name} must be a valid e-mail", url: "{name} must be a valid url", regExp: "{name} is not formatted correctly", integer: "{name} must be an integer", decimal: "{name} must be a decimal number", number: "{name} must be set to a number", is: '{name} must be "{ruleValue}"', isExactly: '{name} must be exactly "{ruleValue}"', not: '{name} cannot be set to "{ruleValue}"', notExactly: '{name} cannot be set to exactly "{ruleValue}"', contain: '{name} must contain "{ruleValue}"', containExactly: '{name} must contain exactly "{ruleValue}"', doesntContain: '{name} cannot contain "{ruleValue}"', doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"', minLength: "{name} must be at least {ruleValue} characters", length: "{name} must be at least {ruleValue} characters", exactLength: "{name} must be exactly {ruleValue} characters", maxLength: "{name} cannot be longer than {ruleValue} characters", match: "{name} must match {ruleValue} field", different: "{name} must have a different value than {ruleValue} field", creditCard: "{name} must be a valid credit card number", minCount: "{name} must have at least {ruleValue} choices", exactCount: "{name} must have exactly {ruleValue} choices", maxCount: "{name} must have {ruleValue} or less choices" }, selector: { checkbox: 'input[type="checkbox"], input[type="radio"]', clear: ".clear", field: "input, textarea, select", group: ".field", input: "input", message: ".error.message", prompt: ".prompt.label", radio: 'input[type="radio"]', reset: '.reset:not([type="reset"])', submit: '.submit:not([type="submit"])', uiCheckbox: ".ui.checkbox", uiDropdown: ".ui.dropdown" }, className: { error: "error", label: "ui prompt label", pressed: "down", success: "success" }, error: { identifier: "You must specify a string identifier for each field", method: "The method you called is not defined.", noRule: "There is no rule matching the one you specified", oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically." }, templates: { error: function error(t) {
  10225. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10226. n += "<li>" + t + "</li>";
  10227. }), e(n += "</ul>");
  10228. }, prompt: function prompt(t) {
  10229. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10230. } }, rules: { empty: function empty(t) {
  10231. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10232. }, checked: function checked() {
  10233. return e(this).filter(":checked").length > 0;
  10234. }, email: function email(t) {
  10235. return e.fn.form.settings.regExp.email.test(t);
  10236. }, url: function url(t) {
  10237. return e.fn.form.settings.regExp.url.test(t);
  10238. }, regExp: function regExp(t, n) {
  10239. if (n instanceof RegExp) return t.match(n);var i,
  10240. o = n.match(e.fn.form.settings.regExp.flags);return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10241. }, integer: function integer(t, n) {
  10242. var o,
  10243. a,
  10244. r,
  10245. s = e.fn.form.settings.regExp.integer;return n && -1 === ["", ".."].indexOf(n) && (-1 == n.indexOf("..") ? s.test(n) && (o = a = n - 0) : (r = n.split("..", 2), s.test(r[0]) && (o = r[0] - 0), s.test(r[1]) && (a = r[1] - 0))), s.test(t) && (o === i || t >= o) && (a === i || t <= a);
  10246. }, decimal: function decimal(t) {
  10247. return e.fn.form.settings.regExp.decimal.test(t);
  10248. }, number: function number(t) {
  10249. return e.fn.form.settings.regExp.number.test(t);
  10250. }, is: function is(e, t) {
  10251. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10252. }, isExactly: function isExactly(e, t) {
  10253. return e == t;
  10254. }, not: function not(e, t) {
  10255. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10256. }, notExactly: function notExactly(e, t) {
  10257. return e != t;
  10258. }, contains: function contains(t, n) {
  10259. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10260. }, containsExactly: function containsExactly(t, n) {
  10261. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10262. }, doesntContain: function doesntContain(t, n) {
  10263. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10264. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10265. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10266. }, minLength: function minLength(e, t) {
  10267. return e !== i && e.length >= t;
  10268. }, length: function length(e, t) {
  10269. return e !== i && e.length >= t;
  10270. }, exactLength: function exactLength(e, t) {
  10271. return e !== i && e.length == t;
  10272. }, maxLength: function maxLength(e, t) {
  10273. return e !== i && e.length <= t;
  10274. }, match: function match(t, n) {
  10275. var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() == o.toString();
  10276. }, different: function different(t, n) {
  10277. var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() !== o.toString();
  10278. }, creditCard: function creditCard(t, n) {
  10279. var i,
  10280. o,
  10281. a = { visa: { pattern: /^4/, length: [16] }, amex: { pattern: /^3[47]/, length: [15] }, mastercard: { pattern: /^5[1-5]/, length: [16] }, discover: { pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/, length: [16] }, unionPay: { pattern: /^(62|88)/, length: [16, 17, 18, 19] }, jcb: { pattern: /^35(2[89]|[3-8][0-9])/, length: [16] }, maestro: { pattern: /^(5018|5020|5038|6304|6759|676[1-3])/, length: [12, 13, 14, 15, 16, 17, 18, 19] }, dinersClub: { pattern: /^(30[0-5]|^36)/, length: [14] }, laser: { pattern: /^(6304|670[69]|6771)/, length: [16, 17, 18, 19] }, visaElectron: { pattern: /^(4026|417500|4508|4844|491(3|7))/, length: [16] } },
  10282. r = {},
  10283. s = !1,
  10284. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10285. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10286. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10287. }), !s)) return !1;if ((i = { number: -1 !== e.inArray(t.length, a.unionPay.length), pattern: -1 !== t.search(a.unionPay.pattern) }).number && i.pattern) return !0;for (var c = t.length, u = 0, d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]], f = 0; c--;) {
  10288. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10289. }return f % 10 == 0 && f > 0;
  10290. }
  10291. }, minCount: function minCount(e, t) {
  10292. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10293. }, exactCount: function exactCount(e, t) {
  10294. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10295. }, maxCount: function maxCount(e, t) {
  10296. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10297. } } };
  10298. }(jQuery, window, document), function (e, t, n, i) {
  10299. "use strict";
  10300. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10301. var o,
  10302. a = e(this),
  10303. r = new Date().getTime(),
  10304. s = [],
  10305. l = arguments[0],
  10306. c = "string" == typeof l,
  10307. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10308. var d,
  10309. f,
  10310. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10311. g = m.className,
  10312. p = m.namespace,
  10313. h = m.selector,
  10314. v = m.error,
  10315. b = "." + p,
  10316. y = "module-" + p,
  10317. x = a.selector || "",
  10318. C = e(this),
  10319. w = C.find(h.title),
  10320. S = C.find(h.content),
  10321. k = this,
  10322. T = C.data(y);f = { initialize: function initialize() {
  10323. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10324. }, instantiate: function instantiate() {
  10325. T = f, C.data(y, f);
  10326. }, destroy: function destroy() {
  10327. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10328. }, refresh: function refresh() {
  10329. w = C.find(h.title), S = C.find(h.content);
  10330. }, observeChanges: function observeChanges() {
  10331. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10332. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10333. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10334. }, bind: { events: function events() {
  10335. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10336. } }, event: { click: function click() {
  10337. f.toggle.call(this);
  10338. } }, toggle: function toggle(t) {
  10339. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10340. o = n.next(S),
  10341. a = o.hasClass(g.animating),
  10342. r = o.hasClass(g.active),
  10343. s = r && !a,
  10344. l = !r && a;f.debug("Toggling visibility of content", n), s || l ? m.collapsible ? f.close.call(n) : f.debug("Cannot close accordion content collapsing is disabled") : f.open.call(n);
  10345. }, open: function open(t) {
  10346. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10347. o = n.next(S),
  10348. a = o.hasClass(g.animating);o.hasClass(g.active) || a ? f.debug("Accordion already open, skipping", o) : (f.debug("Opening accordion content", n), m.onOpening.call(o), m.onChanging.call(o), m.exclusive && f.closeOthers.call(n), n.addClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade in", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 1 }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  10349. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10350. }));
  10351. }, close: function close(t) {
  10352. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10353. o = n.next(S),
  10354. a = o.hasClass(g.animating),
  10355. r = o.hasClass(g.active);!r && !(!r && a) || r && a || (f.debug("Closing accordion content", o), m.onClosing.call(o), m.onChanging.call(o), n.removeClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade out", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  10356. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10357. }));
  10358. }, closeOthers: function closeOthers(t) {
  10359. var n,
  10360. o,
  10361. a,
  10362. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10363. s = r.parents(h.content).prev(h.title),
  10364. l = r.closest(h.accordion),
  10365. c = h.title + "." + g.active + ":visible",
  10366. u = h.content + "." + g.active + ":visible";m.closeNested ? a = (n = l.find(c).not(s)).next(S) : (n = l.find(c).not(s), o = l.find(u).find(c).not(s), a = (n = n.not(o)).next(S)), n.length > 0 && (f.debug("Exclusive enabled, closing other content", n), n.removeClass(g.active), a.removeClass(g.animating).stop(!0, !0), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? a.children().transition({ animation: "fade out", useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : a.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  10367. e(this).removeClass(g.active), f.reset.display.call(this);
  10368. }));
  10369. }, reset: { display: function display() {
  10370. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10371. }, opacity: function opacity() {
  10372. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10373. } }, setting: function setting(t, n) {
  10374. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10375. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10376. }
  10377. }, internal: function internal(t, n) {
  10378. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10379. }, debug: function debug() {
  10380. !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)));
  10381. }, verbose: function verbose() {
  10382. !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)));
  10383. }, error: function error() {
  10384. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10385. }, performance: { log: function log(e) {
  10386. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  10387. }, display: function display() {
  10388. var t = m.name + ":",
  10389. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10390. n += t["Execution Time"];
  10391. }), 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) {
  10392. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10393. }), console.groupEnd()), s = [];
  10394. } }, invoke: function invoke(t, n, a) {
  10395. var r,
  10396. s,
  10397. l,
  10398. c = T;return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10399. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10400. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  10401. }
  10402. })), 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;
  10403. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10404. }), o !== i ? o : this;
  10405. }, e.fn.accordion.settings = { name: "Accordion", namespace: "accordion", silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", observeChanges: !0, exclusive: !0, collapsible: !0, closeNested: !1, animateChildren: !0, duration: 350, easing: "easeOutQuad", onOpening: function onOpening() {}, onClosing: function onClosing() {}, onChanging: function onChanging() {}, onOpen: function onOpen() {}, onClose: function onClose() {}, onChange: function onChange() {}, error: { method: "The method you called is not defined" }, className: { active: "active", animating: "animating" }, selector: { accordion: ".accordion", title: ".title", trigger: ".title", content: ".content" } }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  10406. return -i * (t /= o) * (t - 2) + n;
  10407. } });
  10408. }(jQuery, window, document), function (e, t, n, i) {
  10409. "use strict";
  10410. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10411. var a,
  10412. r = e(this),
  10413. s = r.selector || "",
  10414. l = new Date().getTime(),
  10415. c = [],
  10416. u = arguments[0],
  10417. d = "string" == typeof u,
  10418. f = [].slice.call(arguments, 1);return r.each(function () {
  10419. var r,
  10420. m,
  10421. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10422. p = g.className,
  10423. h = g.namespace,
  10424. v = g.selector,
  10425. b = g.error,
  10426. y = "." + h,
  10427. x = "module-" + h,
  10428. C = e(this),
  10429. w = e(this).children(v.label),
  10430. S = e(this).children(v.input),
  10431. k = S[0],
  10432. T = !1,
  10433. A = !1,
  10434. R = C.data(x),
  10435. P = this;m = { initialize: function initialize() {
  10436. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10437. }, instantiate: function instantiate() {
  10438. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10439. }, destroy: function destroy() {
  10440. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10441. }, fix: { reference: function reference() {
  10442. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10443. } }, setup: function setup() {
  10444. 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();
  10445. }, refresh: function refresh() {
  10446. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10447. }, hide: { input: function input() {
  10448. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10449. } }, show: { input: function input() {
  10450. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10451. } }, observeChanges: function observeChanges() {
  10452. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10453. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10454. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10455. }, attachEvents: function attachEvents(t, n) {
  10456. var i = e(t);n = e.isFunction(m[n]) ? m[n] : m.toggle, i.length > 0 ? (m.debug("Attaching checkbox events to element", t, n), i.on("click" + y, n)) : m.error(b.notFound);
  10457. }, event: { click: function click(t) {
  10458. var n = e(t.target);n.is(v.input) ? m.verbose("Using default check action on initialized checkbox") : n.is(v.link) ? m.debug("Clicking link inside checkbox, skipping toggle") : (m.toggle(), S.focus(), t.preventDefault());
  10459. }, keydown: function keydown(e) {
  10460. var t = e.which,
  10461. n = 13,
  10462. i = 32;t == 27 ? (m.verbose("Escape key pressed blurring field"), S.blur(), A = !0) : e.ctrlKey || t != i && t != n ? A = !1 : (m.verbose("Enter/space key pressed, toggling checkbox"), m.toggle(), A = !0);
  10463. }, keyup: function keyup(e) {
  10464. A && e.preventDefault();
  10465. } }, check: function check() {
  10466. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10467. }, uncheck: function uncheck() {
  10468. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10469. }, indeterminate: function indeterminate() {
  10470. 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)));
  10471. }, determinate: function determinate() {
  10472. 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)));
  10473. }, enable: function enable() {
  10474. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10475. }, disable: function disable() {
  10476. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10477. }, get: { radios: function radios() {
  10478. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10479. }, otherRadios: function otherRadios() {
  10480. return m.get.radios().not(C);
  10481. }, name: function name() {
  10482. return S.attr("name");
  10483. } }, is: { initialLoad: function initialLoad() {
  10484. return T;
  10485. }, radio: function radio() {
  10486. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10487. }, indeterminate: function indeterminate() {
  10488. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10489. }, checked: function checked() {
  10490. return S.prop("checked") !== i && S.prop("checked");
  10491. }, disabled: function disabled() {
  10492. return S.prop("disabled") !== i && S.prop("disabled");
  10493. }, enabled: function enabled() {
  10494. return !m.is.disabled();
  10495. }, determinate: function determinate() {
  10496. return !m.is.indeterminate();
  10497. }, unchecked: function unchecked() {
  10498. return !m.is.checked();
  10499. } }, should: { allowCheck: function allowCheck() {
  10500. 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);
  10501. }, allowUncheck: function allowUncheck() {
  10502. 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);
  10503. }, allowIndeterminate: function allowIndeterminate() {
  10504. 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);
  10505. }, allowDeterminate: function allowDeterminate() {
  10506. 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);
  10507. }, forceCallbacks: function forceCallbacks() {
  10508. return m.is.initialLoad() && g.fireOnInit;
  10509. }, ignoreCallbacks: function ignoreCallbacks() {
  10510. return T && !g.fireOnInit;
  10511. } }, can: { change: function change() {
  10512. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10513. }, uncheck: function uncheck() {
  10514. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10515. } }, set: { initialLoad: function initialLoad() {
  10516. T = !0;
  10517. }, checked: function checked() {
  10518. 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");
  10519. }, unchecked: function unchecked() {
  10520. 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");
  10521. }, indeterminate: function indeterminate() {
  10522. 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());
  10523. }, determinate: function determinate() {
  10524. 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));
  10525. }, disabled: function disabled() {
  10526. 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());
  10527. }, enabled: function enabled() {
  10528. 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());
  10529. }, tabbable: function tabbable() {
  10530. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10531. } }, remove: { initialLoad: function initialLoad() {
  10532. T = !1;
  10533. } }, trigger: { change: function change() {
  10534. var e = n.createEvent("HTMLEvents"),
  10535. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10536. } }, create: { label: function label() {
  10537. 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));
  10538. } }, has: { label: function label() {
  10539. return w.length > 0;
  10540. } }, bind: { events: function events() {
  10541. 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);
  10542. } }, unbind: { events: function events() {
  10543. m.debug("Removing events"), C.off(y);
  10544. } }, uncheckOthers: function uncheckOthers() {
  10545. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10546. }, toggle: function toggle() {
  10547. 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");
  10548. }, setting: function setting(t, n) {
  10549. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10550. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10551. }
  10552. }, internal: function internal(t, n) {
  10553. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10554. if (n === i) return m[t];m[t] = n;
  10555. }
  10556. }, debug: function debug() {
  10557. !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)));
  10558. }, verbose: function verbose() {
  10559. !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)));
  10560. }, error: function error() {
  10561. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10562. }, performance: { log: function log(e) {
  10563. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10564. }, display: function display() {
  10565. var t = g.name + ":",
  10566. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10567. n += t["Execution Time"];
  10568. }), 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) {
  10569. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10570. }), console.groupEnd()), c = [];
  10571. } }, invoke: function invoke(t, n, o) {
  10572. var r,
  10573. s,
  10574. l,
  10575. c = R;return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10576. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10577. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10578. }
  10579. })), 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;
  10580. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10581. }), a !== i ? a : this;
  10582. }, e.fn.checkbox.settings = { name: "Checkbox", namespace: "checkbox", silent: !1, debug: !1, verbose: !0, performance: !0, uncheckable: "auto", fireOnInit: !1, onChange: function onChange() {}, beforeChecked: function beforeChecked() {}, beforeUnchecked: function beforeUnchecked() {}, beforeDeterminate: function beforeDeterminate() {}, beforeIndeterminate: function beforeIndeterminate() {}, onChecked: function onChecked() {}, onUnchecked: function onUnchecked() {}, onDeterminate: function onDeterminate() {}, onIndeterminate: function onIndeterminate() {}, onEnable: function onEnable() {}, onDisable: function onDisable() {}, onEnabled: function onEnabled() {}, onDisabled: function onDisabled() {}, className: { checked: "checked", indeterminate: "indeterminate", disabled: "disabled", hidden: "hidden", radio: "radio", readOnly: "read-only" }, error: { method: "The method you called is not defined" }, selector: { checkbox: ".ui.checkbox", label: "label, .box", input: 'input[type="checkbox"], input[type="radio"]', link: "a[href]" } };
  10583. }(jQuery, window, document), function (e, t, n, i) {
  10584. "use strict";
  10585. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10586. var o,
  10587. a = e(this),
  10588. r = new Date().getTime(),
  10589. s = [],
  10590. l = arguments[0],
  10591. c = "string" == typeof l,
  10592. u = [].slice.call(arguments, 1);return a.each(function () {
  10593. var d,
  10594. f,
  10595. m,
  10596. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10597. p = g.selector,
  10598. h = g.namespace,
  10599. v = g.className,
  10600. b = g.error,
  10601. y = "." + h,
  10602. x = "module-" + h,
  10603. C = a.selector || "",
  10604. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10605. S = e(this),
  10606. k = this,
  10607. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10608. 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());
  10609. }, initialize: function initialize() {
  10610. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10611. }, instantiate: function instantiate() {
  10612. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10613. }, destroy: function destroy() {
  10614. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10615. }, bind: { events: function events() {
  10616. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, { passive: !1 }), "hover" == g.on ? f.on("mouseenter" + y, m.show).on("mouseleave" + y, m.hide) : "click" == g.on && f.on(w + y, m.toggle), m.is.page() && (m.debug("Setting as a page dimmer", f), m.set.pageDimmer()), m.is.closable() && (m.verbose("Adding dimmer close event", d), f.on(w + y, p.dimmer, m.event.click));
  10617. } }, unbind: { events: function events() {
  10618. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10619. } }, event: { click: function click(t) {
  10620. 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());
  10621. }, preventScroll: function preventScroll(e) {
  10622. e.preventDefault();
  10623. } }, addContent: function addContent(t) {
  10624. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10625. }, create: function create() {
  10626. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10627. }, show: function show(t) {
  10628. 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));
  10629. }, hide: function hide(t) {
  10630. 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");
  10631. }, toggle: function toggle() {
  10632. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10633. }, animate: { show: function show(t) {
  10634. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({ displayType: "flex", animation: g.transition + " in", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10635. m.set.dimmed();
  10636. }, onComplete: function onComplete() {
  10637. m.set.active(), t();
  10638. } })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({ opacity: 0, width: "100%", height: "100%" }).fadeTo(m.get.duration(), g.opacity, function () {
  10639. d.removeAttr("style"), m.set.active(), t();
  10640. }));
  10641. }, hide: function hide(t) {
  10642. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({ displayType: "flex", animation: g.transition + " out", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10643. m.remove.dimmed();
  10644. }, onComplete: function onComplete() {
  10645. m.remove.active(), t();
  10646. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10647. m.remove.active(), d.removeAttr("style"), t();
  10648. }));
  10649. } }, get: { dimmer: function dimmer() {
  10650. return d;
  10651. }, duration: function duration() {
  10652. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10653. } }, has: { dimmer: function dimmer() {
  10654. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10655. } }, is: { active: function active() {
  10656. return d.hasClass(v.active);
  10657. }, animating: function animating() {
  10658. return d.is(":animated") || d.hasClass(v.animating);
  10659. }, closable: function closable() {
  10660. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10661. }, dimmer: function dimmer() {
  10662. return S.hasClass(v.dimmer);
  10663. }, dimmable: function dimmable() {
  10664. return S.hasClass(v.dimmable);
  10665. }, dimmed: function dimmed() {
  10666. return f.hasClass(v.dimmed);
  10667. }, disabled: function disabled() {
  10668. return f.hasClass(v.disabled);
  10669. }, enabled: function enabled() {
  10670. return !m.is.disabled();
  10671. }, page: function page() {
  10672. return f.is("body");
  10673. }, pageDimmer: function pageDimmer() {
  10674. return d.hasClass(v.pageDimmer);
  10675. } }, can: { show: function show() {
  10676. return !d.hasClass(v.disabled);
  10677. } }, set: { opacity: function opacity(e) {
  10678. var t = d.css("background-color"),
  10679. n = t.split(","),
  10680. i = n && 3 == n.length,
  10681. o = n && 4 == n.length;e = 0 === g.opacity ? 0 : g.opacity || e, i || o ? (n[3] = e + ")", t = n.join(",")) : t = "rgba(0, 0, 0, " + e + ")", m.debug("Setting opacity to", e), d.css("background-color", t);
  10682. }, active: function active() {
  10683. d.addClass(v.active);
  10684. }, dimmable: function dimmable() {
  10685. f.addClass(v.dimmable);
  10686. }, dimmed: function dimmed() {
  10687. f.addClass(v.dimmed);
  10688. }, pageDimmer: function pageDimmer() {
  10689. d.addClass(v.pageDimmer);
  10690. }, disabled: function disabled() {
  10691. d.addClass(v.disabled);
  10692. }, variation: function variation(e) {
  10693. (e = e || g.variation) && d.addClass(e);
  10694. } }, remove: { active: function active() {
  10695. d.removeClass(v.active);
  10696. }, dimmed: function dimmed() {
  10697. f.removeClass(v.dimmed);
  10698. }, disabled: function disabled() {
  10699. d.removeClass(v.disabled);
  10700. }, variation: function variation(e) {
  10701. (e = e || g.variation) && d.removeClass(e);
  10702. } }, setting: function setting(t, n) {
  10703. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10704. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10705. }
  10706. }, internal: function internal(t, n) {
  10707. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10708. if (n === i) return m[t];m[t] = n;
  10709. }
  10710. }, debug: function debug() {
  10711. !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)));
  10712. }, verbose: function verbose() {
  10713. !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)));
  10714. }, error: function error() {
  10715. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10716. }, performance: { log: function log(e) {
  10717. var t, n;g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10718. }, display: function display() {
  10719. var t = g.name + ":",
  10720. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10721. n += t["Execution Time"];
  10722. }), 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) {
  10723. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10724. }), console.groupEnd()), s = [];
  10725. } }, invoke: function invoke(t, n, a) {
  10726. var r,
  10727. s,
  10728. l,
  10729. c = T;return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10730. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10731. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10732. }
  10733. })), 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;
  10734. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10735. }), o !== i ? o : this;
  10736. }, e.fn.dimmer.settings = { name: "Dimmer", namespace: "dimmer", silent: !1, debug: !1, verbose: !1, performance: !0, dimmerName: !1, variation: !1, closable: "auto", useCSS: !0, transition: "fade", on: !1, opacity: "auto", duration: { show: 500, hide: 500 }, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, error: { method: "The method you called is not defined." }, className: { active: "active", animating: "animating", dimmable: "dimmable", dimmed: "dimmed", dimmer: "dimmer", disabled: "disabled", hide: "hide", pageDimmer: "page", show: "show" }, selector: { dimmer: "> .ui.dimmer", content: ".ui.dimmer > .content, .ui.dimmer > .content > .center" }, template: { dimmer: function dimmer() {
  10737. return e("<div />").attr("class", "ui dimmer");
  10738. } } };
  10739. }(jQuery, window, document), function (e, t, n, i) {
  10740. "use strict";
  10741. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10742. var a,
  10743. r = e(this),
  10744. s = e(n),
  10745. l = r.selector || "",
  10746. c = "ontouchstart" in n.documentElement,
  10747. u = new Date().getTime(),
  10748. d = [],
  10749. f = arguments[0],
  10750. m = "string" == typeof f,
  10751. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10752. var h,
  10753. v,
  10754. b,
  10755. y,
  10756. x,
  10757. C,
  10758. w,
  10759. S,
  10760. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10761. T = k.className,
  10762. A = k.message,
  10763. R = k.fields,
  10764. P = k.keys,
  10765. E = k.metadata,
  10766. F = k.namespace,
  10767. O = k.regExp,
  10768. D = k.selector,
  10769. q = k.error,
  10770. j = k.templates,
  10771. z = "." + F,
  10772. I = "module-" + F,
  10773. M = e(this),
  10774. L = e(k.context),
  10775. V = M.find(D.text),
  10776. N = M.find(D.search),
  10777. H = M.find(D.sizer),
  10778. U = M.find(D.input),
  10779. W = M.find(D.icon),
  10780. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10781. Q = M.children(D.menu),
  10782. X = Q.find(D.item),
  10783. $ = !1,
  10784. Y = !1,
  10785. Z = !1,
  10786. K = this,
  10787. J = M.data(I);S = { initialize: function initialize() {
  10788. 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());
  10789. }, instantiate: function instantiate() {
  10790. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10791. }, destroy: function destroy() {
  10792. 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();
  10793. }, observeChanges: function observeChanges() {
  10794. "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());
  10795. }, disconnect: { menuObserver: function menuObserver() {
  10796. w && w.disconnect();
  10797. }, selectObserver: function selectObserver() {
  10798. C && C.disconnect();
  10799. } }, observe: { select: function select() {
  10800. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10801. }, menu: function menu() {
  10802. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10803. } }, create: { id: function id() {
  10804. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10805. }, userChoice: function userChoice(t) {
  10806. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10807. !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));
  10808. }), n);
  10809. }, userLabels: function userLabels(t) {
  10810. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10811. S.verbose("Adding custom user value"), S.add.label(t, t);
  10812. }));
  10813. }, menu: function menu() {
  10814. Q = e("<div />").addClass(T.menu).appendTo(M);
  10815. }, sizer: function sizer() {
  10816. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10817. } }, search: function search(e) {
  10818. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10819. }, select: { firstUnfiltered: function firstUnfiltered() {
  10820. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10821. }, nextAvailable: function nextAvailable(e) {
  10822. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10823. n = e.prevAll(D.item).not(D.unselectable).eq(0);t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  10824. } }, setup: { api: function api() {
  10825. var e = { debug: k.debug, urlData: { value: S.get.value(), query: S.get.query() }, on: !1 };S.verbose("First request, initializing API"), M.api(e);
  10826. }, layout: function layout() {
  10827. 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();
  10828. }, select: function select() {
  10829. var t = S.get.selectValues();S.debug("Dropdown initialized on a select", t), M.is("select") && (U = M), U.parent(D.dropdown).length > 0 ? (S.debug("UI dropdown already exists. Creating dropdown menu only"), M = U.closest(D.dropdown), S.has.menu() || S.create.menu(), Q = M.children(D.menu), S.setup.menu(t)) : (S.debug("Creating entire dropdown from select"), M = e("<div />").attr("class", U.attr("class")).addClass(T.selection).addClass(T.dropdown).html(j.dropdown(t)).insertBefore(U), U.hasClass(T.multiple) && !1 === U.prop("multiple") && (S.error(q.missingMultiple), U.prop("multiple", !0)), U.is("[multiple]") && S.set.multiple(), U.prop("disabled") && (S.debug("Disabling dropdown"), M.addClass(T.disabled)), U.removeAttr("class").detach().prependTo(M)), S.refresh();
  10830. }, menu: function menu(e) {
  10831. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10832. }, reference: function reference() {
  10833. 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();
  10834. }, returnedObject: function returnedObject() {
  10835. var e = r.slice(0, p),
  10836. t = r.slice(p + 1);r = e.add(M).add(t);
  10837. } }, refresh: function refresh() {
  10838. S.refreshSelectors(), S.refreshData();
  10839. }, refreshItems: function refreshItems() {
  10840. X = Q.find(D.item);
  10841. }, refreshSelectors: function refreshSelectors() {
  10842. 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);
  10843. }, refreshData: function refreshData() {
  10844. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10845. }, clearData: function clearData() {
  10846. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10847. }, toggle: function toggle() {
  10848. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10849. }, show: function show(t) {
  10850. 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()) {
  10851. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;!1 !== k.onShow.call(K) && S.animate.show(function () {
  10852. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10853. });
  10854. }
  10855. }, hide: function hide(t) {
  10856. 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 () {
  10857. S.remove.visible(), t.call(K);
  10858. }));
  10859. }, hideOthers: function hideOthers() {
  10860. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10861. }, hideMenu: function hideMenu() {
  10862. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10863. }, hideSubMenus: function hideSubMenus() {
  10864. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10865. }, bind: { events: function events() {
  10866. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10867. }, touchEvents: function touchEvents() {
  10868. 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);
  10869. }, keyboardEvents: function keyboardEvents() {
  10870. 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);
  10871. }, inputEvents: function inputEvents() {
  10872. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10873. }, mouseEvents: function mouseEvents() {
  10874. 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);
  10875. }, intent: function intent() {
  10876. 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);
  10877. } }, unbind: { intent: function intent() {
  10878. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10879. } }, filter: function filter(e) {
  10880. var t = e !== i ? e : S.get.query(),
  10881. n = function n() {
  10882. 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();
  10883. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10884. k.filterRemoteData && S.filterItems(t), n();
  10885. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10886. }, queryRemote: function queryRemote(t, n) {
  10887. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10888. S.add.message(A.serverError), n();
  10889. }, onFailure: function onFailure() {
  10890. S.add.message(A.serverError), n();
  10891. }, onSuccess: function onSuccess(t) {
  10892. var i = t[R.remoteValues];e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({ values: t[R.remoteValues] })) : S.add.message(A.noResults), n();
  10893. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10894. }, filterItems: function filterItems(t) {
  10895. var n = t !== i ? t : S.get.query(),
  10896. o = null,
  10897. a = S.escape.string(n),
  10898. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10899. var t,
  10900. i,
  10901. a = e(this);if ("both" == k.match || "text" == k.match) {
  10902. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  10903. }if ("both" == k.match || "value" == k.match) {
  10904. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  10905. }
  10906. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10907. }, fuzzySearch: function fuzzySearch(e, t) {
  10908. var n = t.length,
  10909. i = e.length;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  10910. for (var r = e.charCodeAt(o); a < n;) {
  10911. if (t.charCodeAt(a++) === r) continue e;
  10912. }return !1;
  10913. }return !0;
  10914. }, exactSearch: function exactSearch(e, t) {
  10915. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10916. }, filterActive: function filterActive() {
  10917. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10918. }, focusSearch: function focusSearch(e) {
  10919. 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());
  10920. }, forceSelection: function forceSelection() {
  10921. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10922. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10923. n = e.length > 0 ? e : t;if (n.length > 0 && !S.is.multiple()) return S.debug("Forcing partial selection to selected item", n), void S.event.item.click.call(n, {}, !0);k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  10924. }, change: { values: function values(t) {
  10925. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10926. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10927. });
  10928. } }, event: { change: function change() {
  10929. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10930. }, focus: function focus() {
  10931. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10932. }, blur: function blur(e) {
  10933. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10934. }, mousedown: function mousedown() {
  10935. S.is.searchSelection() ? b = !0 : $ = !0;
  10936. }, mouseup: function mouseup() {
  10937. S.is.searchSelection() ? b = !1 : $ = !1;
  10938. }, click: function click(t) {
  10939. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10940. }, search: { focus: function focus() {
  10941. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10942. }, blur: function blur(e) {
  10943. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10944. } }, icon: { click: function click(e) {
  10945. S.toggle();
  10946. } }, text: { focus: function focus(e) {
  10947. $ = !0, S.focusSearch();
  10948. } }, input: function input(e) {
  10949. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10950. }, label: { click: function click(t) {
  10951. var n = e(this),
  10952. i = M.find(D.label),
  10953. o = i.filter("." + T.active),
  10954. a = n.nextAll("." + T.active),
  10955. r = n.prevAll("." + T.active),
  10956. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);t.shiftKey ? (o.removeClass(T.active), s.addClass(T.active)) : t.ctrlKey ? n.toggleClass(T.active) : (o.removeClass(T.active), n.addClass(T.active)), k.onLabelSelect.apply(this, i.filter("." + T.active));
  10957. } }, remove: { click: function click() {
  10958. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10959. } }, test: { toggle: function toggle(e) {
  10960. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10961. }, touch: function touch(e) {
  10962. S.determine.eventOnElement(e, function () {
  10963. "touchstart" == e.type ? S.timer = setTimeout(function () {
  10964. S.hide();
  10965. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  10966. }), e.stopPropagation();
  10967. }, hide: function hide(e) {
  10968. S.determine.eventInModule(e, S.hide);
  10969. } }, select: { mutation: function mutation(t) {
  10970. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  10971. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  10972. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  10973. } }, menu: { mutation: function mutation(t) {
  10974. var n = t[0],
  10975. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  10976. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  10977. a = i.add(o),
  10978. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  10979. s = a.is(D.message) || a.closest(D.message).length > 0;r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  10980. }, mousedown: function mousedown() {
  10981. Y = !0;
  10982. }, mouseup: function mouseup() {
  10983. Y = !1;
  10984. } }, item: { mouseenter: function mouseenter(t) {
  10985. var n = e(t.target),
  10986. i = e(this),
  10987. o = i.children(D.menu),
  10988. a = i.siblings(D.item).children(D.menu),
  10989. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10990. S.verbose("Showing sub-menu", o), e.each(a, function () {
  10991. S.animate.hide(!1, e(this));
  10992. }), S.animate.show(!1, o);
  10993. }, k.delay.show), t.preventDefault());
  10994. }, mouseleave: function mouseleave(t) {
  10995. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10996. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  10997. }, k.delay.hide));
  10998. }, click: function click(t, i) {
  10999. var o = e(this),
  11000. a = e(t ? t.target : ""),
  11001. r = o.find(D.menu),
  11002. s = S.get.choiceText(o),
  11003. l = S.get.choiceValue(o, s),
  11004. c = r.length > 0,
  11005. u = r.find(a).length > 0;S.has.menuSearch() && e(n.activeElement).blur(), u || c && !k.allowCategorySelection || (S.is.searchSelection() && (k.allowAdditions && S.remove.userAddition(), S.remove.searchTerm(), S.is.focusedOnSearch() || 1 == i || S.focusSearch(!0)), k.useLabels || (S.remove.filteredItem(), S.set.scrollPosition(o)), S.determine.selectAction.call(this, s, l));
  11006. } }, document: { keydown: function keydown(e) {
  11007. var t = e.which;if (S.is.inObject(t, P)) {
  11008. var n = M.find(D.label),
  11009. i = n.filter("." + T.active),
  11010. o = (i.data(E.value), n.index(i)),
  11011. a = n.length,
  11012. r = i.length > 0,
  11013. s = i.length > 1,
  11014. l = 0 === o,
  11015. c = o + 1 == a,
  11016. u = S.is.searchSelection(),
  11017. d = S.is.focusedOnSearch(),
  11018. f = S.is.focused(),
  11019. m = d && 0 === S.get.caretPosition();if (u && !r && !d) return;t == P.leftArrow ? !f && !m || r ? r && (e.shiftKey ? S.verbose("Adding previous label to selection") : (S.verbose("Selecting previous label"), n.removeClass(T.active)), l && !s ? i.addClass(T.active) : i.prev(D.siblingLabel).addClass(T.active).end(), e.preventDefault()) : (S.verbose("Selecting previous label"), n.last().addClass(T.active)) : t == P.rightArrow ? (f && !r && n.first().addClass(T.active), r && (e.shiftKey ? S.verbose("Adding next label to selection") : (S.verbose("Selecting next label"), n.removeClass(T.active)), c ? u ? d ? n.removeClass(T.active) : S.focusSearch() : s ? i.next(D.siblingLabel).addClass(T.active) : i.addClass(T.active) : i.next(D.siblingLabel).addClass(T.active), e.preventDefault())) : t == P.deleteKey || t == P.backspace ? r ? (S.verbose("Removing active labels"), c && u && !d && S.focusSearch(), i.last().next(D.siblingLabel).addClass(T.active), S.remove.activeLabels(i), e.preventDefault()) : m && !r && t == P.backspace && (S.verbose("Removing last label on input backspace"), i = n.last().addClass(T.active), S.remove.activeLabels(i)) : i.removeClass(T.active);
  11020. }
  11021. } }, keydown: function keydown(e) {
  11022. var t = e.which;if (S.is.inObject(t, P)) {
  11023. var n,
  11024. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  11025. o = Q.children("." + T.active).eq(0),
  11026. a = i.length > 0 ? i : o,
  11027. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  11028. s = a.children(D.menu),
  11029. l = a.closest(D.menu),
  11030. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  11031. u = s.length > 0,
  11032. d = a.length > 0,
  11033. f = a.not(D.unselectable).length > 0,
  11034. m = t == P.delimiter && k.allowAdditions && S.is.multiple();if (k.allowAdditions && k.hideAdditions && (t == P.enter || m) && f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), S.is.visible()) {
  11035. 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) {
  11036. if (n = d && c ? a.prevAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0), r.index(n) < 0) return S.verbose("Up key pressed but reached top of current menu"), void e.preventDefault();S.verbose("Up key pressed, changing active item"), a.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  11037. }if (t == P.downArrow) {
  11038. if (0 === (n = d && c ? n = a.nextAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0)).length) return S.verbose("Down key pressed but reached bottom of current menu"), void e.preventDefault();S.verbose("Down key pressed, changing active item"), X.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  11039. }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());
  11040. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  11041. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  11042. } }, trigger: { change: function change() {
  11043. var e = n.createEvent("HTMLEvents"),
  11044. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11045. } }, determine: { selectAction: function selectAction(t, n) {
  11046. 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);
  11047. }, eventInModule: function eventInModule(t, i) {
  11048. var o = e(t.target),
  11049. a = o.closest(n.documentElement).length > 0,
  11050. r = o.closest(M).length > 0;return i = e.isFunction(i) ? i : function () {}, a && !r ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown, canceling callback"), !1);
  11051. }, eventOnElement: function eventOnElement(t, i) {
  11052. var o = e(t.target),
  11053. a = o.closest(D.siblingLabel),
  11054. r = n.body.contains(t.target),
  11055. s = 0 === M.find(a).length,
  11056. l = 0 === o.closest(Q).length;return i = e.isFunction(i) ? i : function () {}, r && s && l ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown menu, canceling callback"), !1);
  11057. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  11058. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11059. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11060. }
  11061. }, select: function select(t, n, o) {
  11062. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11063. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11064. }
  11065. }, combo: function combo(t, n, o) {
  11066. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  11067. }, hide: function hide(e, t, n) {
  11068. S.set.value(t, e), S.hideAndClear();
  11069. } }, get: { id: function id() {
  11070. return x;
  11071. }, defaultText: function defaultText() {
  11072. return M.data(E.defaultText);
  11073. }, defaultValue: function defaultValue() {
  11074. return M.data(E.defaultValue);
  11075. }, placeholderText: function placeholderText() {
  11076. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  11077. }, text: function text() {
  11078. return V.text();
  11079. }, query: function query() {
  11080. return e.trim(N.val());
  11081. }, searchWidth: function searchWidth(e) {
  11082. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  11083. }, selectionCount: function selectionCount() {
  11084. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  11085. }, transition: function transition(e) {
  11086. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  11087. }, userValues: function userValues() {
  11088. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  11089. return !1 === S.get.item(e);
  11090. }));
  11091. }, uniqueArray: function uniqueArray(t) {
  11092. return e.grep(t, function (n, i) {
  11093. return e.inArray(n, t) === i;
  11094. });
  11095. }, caretPosition: function caretPosition() {
  11096. var e,
  11097. t,
  11098. i = N.get(0);return "selectionStart" in i ? i.selectionStart : n.selection ? (i.focus(), t = (e = n.selection.createRange()).text.length, e.moveStart("character", -i.value.length), e.text.length - t) : void 0;
  11099. }, value: function value() {
  11100. var t = U.length > 0 ? U.val() : M.data(E.value),
  11101. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  11102. }, values: function values() {
  11103. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  11104. }, remoteValues: function remoteValues() {
  11105. var t = S.get.values(),
  11106. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  11107. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  11108. })), n;
  11109. }, choiceText: function choiceText(t, n) {
  11110. 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());
  11111. }, choiceValue: function choiceValue(t, n) {
  11112. 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));
  11113. }, inputEvent: function inputEvent() {
  11114. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  11115. }, selectValues: function selectValues() {
  11116. var t = { values: [] };return M.find("option").each(function () {
  11117. var n = e(this),
  11118. o = n.html(),
  11119. a = n.attr("disabled"),
  11120. r = n.attr("value") !== i ? n.attr("value") : o;"auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({ name: o, value: r, disabled: a });
  11121. }), 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) {
  11122. return e.name > t.name ? 1 : -1;
  11123. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  11124. }, activeItem: function activeItem() {
  11125. return X.filter("." + T.active);
  11126. }, selectedItem: function selectedItem() {
  11127. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  11128. }, itemWithAdditions: function itemWithAdditions(e) {
  11129. var t = S.get.item(e),
  11130. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  11131. }, item: function item(t, n) {
  11132. var o,
  11133. a,
  11134. r = !1;return t = t !== i ? t : S.get.values() !== i ? S.get.values() : S.get.text(), o = a ? t.length > 0 : t !== i && null !== t, a = S.is.multiple() && e.isArray(t), n = "" === t || 0 === t || n || !1, o && X.each(function () {
  11135. var o = e(this),
  11136. s = S.get.choiceText(o),
  11137. l = S.get.choiceValue(o, s);if (null !== l && l !== i) if (a) -1 === e.inArray(String(l), t) && -1 === e.inArray(s, t) || (r = r ? r.add(o) : o);else if (n) {
  11138. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  11139. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  11140. }), r;
  11141. } }, check: { maxSelections: function maxSelections(e) {
  11142. 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));
  11143. } }, restore: { defaults: function defaults() {
  11144. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  11145. }, defaultText: function defaultText() {
  11146. var e = S.get.defaultText();e === S.get.placeholderText ? (S.debug("Restoring default placeholder text", e), S.set.placeholderText(e)) : (S.debug("Restoring default text", e), S.set.text(e));
  11147. }, placeholderText: function placeholderText() {
  11148. S.set.placeholderText();
  11149. }, defaultValue: function defaultValue() {
  11150. var e = S.get.defaultValue();e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  11151. }, labels: function labels() {
  11152. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11153. }, selected: function selected() {
  11154. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11155. }, values: function values() {
  11156. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11157. }, remoteValues: function remoteValues() {
  11158. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11159. S.set.text(t);
  11160. }) : e.each(t, function (e, t) {
  11161. S.add.label(e, t);
  11162. }));
  11163. } }, read: { remoteData: function remoteData(e) {
  11164. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11165. } }, save: { defaults: function defaults() {
  11166. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11167. }, defaultValue: function defaultValue() {
  11168. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11169. }, defaultText: function defaultText() {
  11170. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11171. }, placeholderText: function placeholderText() {
  11172. var e;!1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  11173. }, remoteData: function remoteData(e, n) {
  11174. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11175. } }, clear: function clear() {
  11176. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11177. }, clearValue: function clearValue() {
  11178. S.set.value("");
  11179. }, scrollPage: function scrollPage(e, t) {
  11180. var n,
  11181. i,
  11182. o = t || S.get.selectedItem(),
  11183. a = o.closest(D.menu),
  11184. r = a.outerHeight(),
  11185. s = a.scrollTop(),
  11186. l = X.eq(0).outerHeight(),
  11187. c = Math.floor(r / l),
  11188. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11189. d = X.not(D.unselectable);i = "up" == e ? d.index(o) - c : d.index(o) + c, (n = ("up" == e ? i >= 0 : i < d.length) ? d.eq(i) : "up" == e ? d.first() : d.last()).length > 0 && (S.debug("Scrolling page", e, n), o.removeClass(T.selected), n.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), a.scrollTop(u));
  11190. }, set: { filtered: function filtered() {
  11191. var e = S.is.multiple(),
  11192. t = S.is.searchSelection(),
  11193. n = e && t,
  11194. i = t ? S.get.query() : "",
  11195. o = "string" == typeof i && i.length > 0,
  11196. a = S.get.searchWidth(),
  11197. r = "" !== i;e && o && (S.verbose("Adjusting input width", a, k.glyphWidth), N.css("width", a)), o || n && r ? (S.verbose("Hiding placeholder text"), V.addClass(T.filtered)) : (!e || n && !r) && (S.verbose("Showing placeholder text"), V.removeClass(T.filtered));
  11198. }, empty: function empty() {
  11199. M.addClass(T.empty);
  11200. }, loading: function loading() {
  11201. M.addClass(T.loading);
  11202. }, placeholderText: function placeholderText(e) {
  11203. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11204. }, tabbable: function tabbable() {
  11205. 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)));
  11206. }, initialLoad: function initialLoad() {
  11207. S.verbose("Setting initial load"), h = !0;
  11208. }, activeItem: function activeItem(e) {
  11209. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11210. }, partialSearch: function partialSearch(e) {
  11211. var t = S.get.query().length;N.val(e.substr(0, t));
  11212. }, scrollPosition: function scrollPosition(e, t) {
  11213. var n, o, a, r, s, l;n = (e = e || S.get.selectedItem()).closest(D.menu), o = e && e.length > 0, t = t !== i && t, e && n.length > 0 && o && (e.position().top, n.addClass(T.loading), a = (r = n.scrollTop()) - n.offset().top + e.offset().top, t || (l = r + n.height() < a + 5, s = a - 5 < r), S.debug("Scrolling to active item", a), (t || s || l) && n.scrollTop(a), n.removeClass(T.loading));
  11214. }, text: function text(e) {
  11215. "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)));
  11216. }, selectedItem: function selectedItem(e) {
  11217. var t = S.get.choiceValue(e),
  11218. n = S.get.choiceText(e, !1),
  11219. i = S.get.choiceText(e, !0);S.debug("Setting user selection to item", e), S.remove.activeItem(), S.set.partialSearch(n), S.set.activeItem(e), S.set.selected(t, e), S.set.text(i);
  11220. }, selectedLetter: function selectedLetter(t) {
  11221. var n,
  11222. i = X.filter("." + T.selected),
  11223. o = !1;i.length > 0 && S.has.firstLetter(i, t) && (n = i.nextAll(X).eq(0), S.has.firstLetter(n, t) && (o = n)), o || X.each(function () {
  11224. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11225. }), 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));
  11226. }, direction: function direction(e) {
  11227. "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);
  11228. }, upward: function upward(e) {
  11229. (e || M).addClass(T.upward);
  11230. }, leftward: function leftward(e) {
  11231. (e || Q).addClass(T.leftward);
  11232. }, value: function value(e, t, n) {
  11233. var o = S.escape.value(e),
  11234. a = U.length > 0,
  11235. r = S.get.values(),
  11236. s = e !== i ? String(e) : e;if (a) {
  11237. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;S.is.single() && S.has.selectInput() && S.can.extendSelect() && (S.debug("Adding user option", e), S.add.optionValue(e)), S.debug("Updating input value", o, r), Z = !0, U.val(o), !1 === k.fireOnInit && S.is.initialLoad() ? S.debug("Input native change event ignored on initial load") : S.trigger.change(), Z = !1;
  11238. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);!1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  11239. }, active: function active() {
  11240. M.addClass(T.active);
  11241. }, multiple: function multiple() {
  11242. M.addClass(T.multiple);
  11243. }, visible: function visible() {
  11244. M.addClass(T.visible);
  11245. }, exactly: function exactly(e, t) {
  11246. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11247. }, selected: function selected(t, n) {
  11248. var i = S.is.multiple();(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t)) && (S.debug("Setting selected menu item to", n), S.is.multiple() && S.remove.searchWidth(), S.is.single() ? (S.remove.activeItem(), S.remove.selectedItem()) : k.useLabels && S.remove.selectedItem(), n.each(function () {
  11249. var t = e(this),
  11250. o = S.get.choiceText(t),
  11251. a = S.get.choiceValue(t, o),
  11252. r = t.hasClass(T.filtered),
  11253. s = t.hasClass(T.active),
  11254. l = t.hasClass(T.addition),
  11255. c = i && 1 == n.length;i ? !s || l ? (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), k.useLabels ? (S.add.label(a, o, c), S.add.value(a, o, t), S.set.activeItem(t), S.filterActive(), S.select.nextAvailable(n)) : (S.add.value(a, o, t), S.set.text(S.add.variables(A.count)), S.set.activeItem(t))) : r || (S.debug("Selected active value, removing label"), S.remove.selected(a)) : (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), S.set.text(o), S.set.value(a, o, t), t.addClass(T.active).addClass(T.selected));
  11256. }));
  11257. } }, add: { label: function label(t, n, i) {
  11258. var o,
  11259. a = S.is.searchSelection() ? N : V,
  11260. r = S.escape.value(t);k.ignoreCase && (r = r.toLowerCase()), o = e("<a />").addClass(T.label).attr("data-" + E.value, r).html(j.label(r, n)), o = k.onLabelCreate.call(o, r, n), S.has.label(t) ? S.debug("User selection already exists, skipping", r) : (k.label.variation && o.addClass(k.label.variation), !0 === i ? (S.debug("Animating in label", o), o.addClass(T.hidden).insertBefore(a).transition(k.label.transition, k.label.duration)) : (S.debug("Adding selection label", o), o.insertBefore(a)));
  11261. }, message: function message(t) {
  11262. var n = Q.children(D.message),
  11263. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11264. }, optionValue: function optionValue(t) {
  11265. var n = S.escape.value(t);U.find('option[value="' + S.escape.string(n) + '"]').length > 0 || (S.disconnect.selectObserver(), S.is.single() && (S.verbose("Removing previous user addition"), U.find("option." + T.addition).remove()), e("<option/>").prop("value", n).addClass(T.addition).html(t).appendTo(U), S.verbose("Adding user addition as an <option>", t), S.observe.select());
  11266. }, userSuggestion: function userSuggestion(e) {
  11267. var t,
  11268. n = Q.children(D.addition),
  11269. i = S.get.item(e),
  11270. o = i && i.not(D.addition).length,
  11271. a = n.length > 0;k.useLabels && S.has.maxSelections() || ("" === e || o ? n.remove() : (a ? (n.data(E.value, e).data(E.text, e).attr("data-" + E.value, e).attr("data-" + E.text, e).removeClass(T.filtered), k.hideAdditions || (t = k.templates.addition(S.add.variables(A.addResult, e)), n.html(t)), S.verbose("Replacing user suggestion with new value", n)) : ((n = S.create.userChoice(e)).prependTo(Q), S.verbose("Adding item choice to menu corresponding with user choice addition", n)), k.hideAdditions && !S.is.allFiltered() || n.addClass(T.selected).siblings().removeClass(T.selected), S.refreshItems()));
  11272. }, variables: function variables(e, t) {
  11273. var n,
  11274. i,
  11275. o = -1 !== e.search("{count}"),
  11276. a = -1 !== e.search("{maxCount}"),
  11277. r = -1 !== e.search("{term}");return S.verbose("Adding templated variables to message", e), o && (n = S.get.selectionCount(), e = e.replace("{count}", n)), a && (n = S.get.selectionCount(), e = e.replace("{maxCount}", k.maxSelections)), r && (i = t || S.get.query(), e = e.replace("{term}", i)), e;
  11278. }, value: function value(t, n, i) {
  11279. var o,
  11280. a = S.get.values();S.has.value(t) ? S.debug("Value already selected") : "" !== t ? (e.isArray(a) ? (o = a.concat([t]), o = S.get.uniqueArray(o)) : o = [t], S.has.selectInput() ? S.can.extendSelect() && (S.debug("Adding value to select", t, o, U), S.add.optionValue(t)) : (o = o.join(k.delimiter), S.debug("Setting hidden input to delimited value", o, U)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("Skipping onadd callback on initial load", k.onAdd) : k.onAdd.call(K, t, n, i), S.set.value(o, t, n, i), S.check.maxSelections()) : S.debug("Cannot select blank values from multiselect");
  11281. } }, remove: { active: function active() {
  11282. M.removeClass(T.active);
  11283. }, activeLabel: function activeLabel() {
  11284. M.find(D.label).removeClass(T.active);
  11285. }, empty: function empty() {
  11286. M.removeClass(T.empty);
  11287. }, loading: function loading() {
  11288. M.removeClass(T.loading);
  11289. }, initialLoad: function initialLoad() {
  11290. h = !1;
  11291. }, upward: function upward(e) {
  11292. (e || M).removeClass(T.upward);
  11293. }, leftward: function leftward(e) {
  11294. (e || Q).removeClass(T.leftward);
  11295. }, visible: function visible() {
  11296. M.removeClass(T.visible);
  11297. }, activeItem: function activeItem() {
  11298. X.removeClass(T.active);
  11299. }, filteredItem: function filteredItem() {
  11300. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11301. }, optionValue: function optionValue(e) {
  11302. var t = S.escape.value(e),
  11303. n = U.find('option[value="' + S.escape.string(t) + '"]');n.length > 0 && n.hasClass(T.addition) && (C && (C.disconnect(), S.verbose("Temporarily disconnecting mutation observer")), n.remove(), S.verbose("Removing user addition as an <option>", t), C && C.observe(U[0], { childList: !0, subtree: !0 }));
  11304. }, message: function message() {
  11305. Q.children(D.message).remove();
  11306. }, searchWidth: function searchWidth() {
  11307. N.css("width", "");
  11308. }, searchTerm: function searchTerm() {
  11309. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11310. }, userAddition: function userAddition() {
  11311. X.filter(D.addition).remove();
  11312. }, selected: function selected(t, n) {
  11313. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11314. var t = e(this),
  11315. n = S.get.choiceText(t),
  11316. i = S.get.choiceValue(t, n);S.is.multiple() ? k.useLabels ? (S.remove.value(i, n, t), S.remove.label(i)) : (S.remove.value(i, n, t), 0 === S.get.selectionCount() ? S.set.placeholderText() : S.set.text(S.add.variables(A.count))) : S.remove.value(i, n, t), t.removeClass(T.filtered).removeClass(T.active), k.useLabels && t.removeClass(T.selected);
  11317. });
  11318. }, selectedItem: function selectedItem() {
  11319. X.removeClass(T.selected);
  11320. }, value: function value(e, t, n) {
  11321. var i,
  11322. o = S.get.values();S.has.selectInput() ? (S.verbose("Input is <select> removing selected option", e), i = S.remove.arrayValue(e, o), S.remove.optionValue(e)) : (S.verbose("Removing from delimited values", e), i = (i = S.remove.arrayValue(e, o)).join(k.delimiter)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onRemove) : k.onRemove.call(K, e, t, n), S.set.value(i, t, n), S.check.maxSelections();
  11323. }, arrayValue: function arrayValue(t, n) {
  11324. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11325. return t != e;
  11326. }), S.verbose("Removed value from delimited string", t, n), n;
  11327. }, label: function label(e, t) {
  11328. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11329. }, activeLabels: function activeLabels(e) {
  11330. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11331. }, labels: function labels(t) {
  11332. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11333. var t = e(this),
  11334. n = t.data(E.value),
  11335. o = n !== i ? String(n) : n,
  11336. a = S.is.userValue(o);!1 !== k.onLabelRemove.call(t, n) ? (S.remove.message(), a ? (S.remove.value(o), S.remove.label(o)) : S.remove.selected(o)) : S.debug("Label remove callback cancelled removal");
  11337. });
  11338. }, tabbable: function tabbable() {
  11339. 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"));
  11340. } }, has: { menuSearch: function menuSearch() {
  11341. return S.has.search() && N.closest(Q).length > 0;
  11342. }, search: function search() {
  11343. return N.length > 0;
  11344. }, sizer: function sizer() {
  11345. return H.length > 0;
  11346. }, selectInput: function selectInput() {
  11347. return U.is("select");
  11348. }, minCharacters: function minCharacters(e) {
  11349. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11350. }, firstLetter: function firstLetter(e, t) {
  11351. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11352. }, input: function input() {
  11353. return U.length > 0;
  11354. }, items: function items() {
  11355. return X.length > 0;
  11356. }, menu: function menu() {
  11357. return Q.length > 0;
  11358. }, message: function message() {
  11359. return 0 !== Q.children(D.message).length;
  11360. }, label: function label(e) {
  11361. var t = S.escape.value(e),
  11362. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11363. }, maxSelections: function maxSelections() {
  11364. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11365. }, allResultsFiltered: function allResultsFiltered() {
  11366. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11367. }, userSuggestion: function userSuggestion() {
  11368. return Q.children(D.addition).length > 0;
  11369. }, query: function query() {
  11370. return "" !== S.get.query();
  11371. }, value: function value(e) {
  11372. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11373. }, valueMatchingCase: function valueMatchingCase(t) {
  11374. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11375. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11376. var n = S.get.values(),
  11377. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11378. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11379. }), i;
  11380. } }, is: { active: function active() {
  11381. return M.hasClass(T.active);
  11382. }, animatingInward: function animatingInward() {
  11383. return Q.transition("is inward");
  11384. }, animatingOutward: function animatingOutward() {
  11385. return Q.transition("is outward");
  11386. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11387. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11388. }, bubbledIconClick: function bubbledIconClick(t) {
  11389. return e(t.target).closest(W).length > 0;
  11390. }, alreadySetup: function alreadySetup() {
  11391. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11392. }, animating: function animating(e) {
  11393. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11394. }, leftward: function leftward(e) {
  11395. return (e || Q).hasClass(T.leftward);
  11396. }, disabled: function disabled() {
  11397. return M.hasClass(T.disabled);
  11398. }, focused: function focused() {
  11399. return n.activeElement === M[0];
  11400. }, focusedOnSearch: function focusedOnSearch() {
  11401. return n.activeElement === N[0];
  11402. }, allFiltered: function allFiltered() {
  11403. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11404. }, hidden: function hidden(e) {
  11405. return !S.is.visible(e);
  11406. }, initialLoad: function initialLoad() {
  11407. return h;
  11408. }, inObject: function inObject(t, n) {
  11409. var i = !1;return e.each(n, function (e, n) {
  11410. if (n == t) return i = !0, !0;
  11411. }), i;
  11412. }, multiple: function multiple() {
  11413. return M.hasClass(T.multiple);
  11414. }, remote: function remote() {
  11415. return k.apiSettings && S.can.useAPI();
  11416. }, single: function single() {
  11417. return !S.is.multiple();
  11418. }, selectMutation: function selectMutation(t) {
  11419. var n = !1;return e.each(t, function (t, i) {
  11420. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11421. }), n;
  11422. }, search: function search() {
  11423. return M.hasClass(T.search);
  11424. }, searchSelection: function searchSelection() {
  11425. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11426. }, selection: function selection() {
  11427. return M.hasClass(T.selection);
  11428. }, userValue: function userValue(t) {
  11429. return -1 !== e.inArray(t, S.get.userValues());
  11430. }, upward: function upward(e) {
  11431. return (e || M).hasClass(T.upward);
  11432. }, visible: function visible(e) {
  11433. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11434. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11435. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11436. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11437. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11438. } }, can: { activate: function activate(e) {
  11439. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11440. }, openDownward: function openDownward(e) {
  11441. var n,
  11442. i,
  11443. o = e || Q,
  11444. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollTop: L.scrollTop(), height: L.outerHeight() }, menu: { offset: o.offset(), height: o.outerHeight() } }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = { above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height, below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height }).below ? (S.verbose("Dropdown can fit in context downward", n), a = !0) : n.below || n.above ? (S.verbose("Dropdown cannot fit below, opening upward", n), a = !1) : (S.verbose("Dropdown cannot fit in either direction, favoring downward", n), a = !0), o.removeClass(T.loading), a;
  11445. }, openRightward: function openRightward(e) {
  11446. var n,
  11447. i,
  11448. o = e || Q,
  11449. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollLeft: L.scrollLeft(), width: L.outerWidth() }, menu: { offset: o.offset(), width: o.outerWidth() } }, S.is.horizontallyScrollableContext() && (i.menu.offset.left += i.context.scrollLeft), (n = i.menu.offset.left - i.context.offset.left + i.menu.width >= i.context.scrollLeft + i.context.width) && (S.verbose("Dropdown cannot fit in context rightward", n), a = !1), o.removeClass(T.loading), a;
  11450. }, click: function click() {
  11451. return c || "click" == k.on;
  11452. }, extendSelect: function extendSelect() {
  11453. return k.allowAdditions || k.apiSettings;
  11454. }, show: function show() {
  11455. return !S.is.disabled() && (S.has.items() || S.has.message());
  11456. }, useAPI: function useAPI() {
  11457. return e.fn.api !== i;
  11458. } }, animate: { show: function show(t, n) {
  11459. var o,
  11460. a = n || Q,
  11461. r = n ? function () {} : function () {
  11462. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11463. };t = e.isFunction(t) ? t : function () {}, S.verbose("Doing menu show animation", a), S.set.direction(n), o = S.get.transition(n), S.is.selection() && S.set.scrollPosition(S.get.selectedItem(), !0), (S.is.hidden(a) || S.is.animating(a)) && ("none" == o ? (r(), a.transition("show"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? a.transition({ animation: o + " in", debug: k.debug, verbose: k.verbose, duration: k.duration, queue: !0, onStart: r, onComplete: function onComplete() {
  11464. t.call(K);
  11465. } }) : S.error(q.noTransition, o));
  11466. }, hide: function hide(t, n) {
  11467. var o = n || Q,
  11468. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11469. S.can.click() && S.unbind.intent(), S.remove.active();
  11470. }),
  11471. r = S.get.transition(n);t = e.isFunction(t) ? t : function () {}, (S.is.visible(o) || S.is.animating(o)) && (S.verbose("Doing menu hide animation", o), "none" == r ? (a(), o.transition("hide"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? o.transition({ animation: r + " out", duration: k.duration, debug: k.debug, verbose: k.verbose, queue: !1, onStart: a, onComplete: function onComplete() {
  11472. t.call(K);
  11473. } }) : S.error(q.transition));
  11474. } }, hideAndClear: function hideAndClear() {
  11475. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11476. S.remove.filteredItem();
  11477. }) : S.hide());
  11478. }, delay: { show: function show() {
  11479. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11480. }, hide: function hide() {
  11481. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11482. } }, escape: { value: function value(t) {
  11483. var n = e.isArray(t),
  11484. i = "string" == typeof t,
  11485. o = !i && !n,
  11486. a = i && -1 !== t.search(O.quote),
  11487. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11488. r.push(t.replace(O.quote, "&quot;"));
  11489. }), r) : t.replace(O.quote, "&quot;"));
  11490. }, string: function string(e) {
  11491. return (e = String(e)).replace(O.escape, "\\$&");
  11492. } }, setting: function setting(t, n) {
  11493. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11494. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11495. }
  11496. }, internal: function internal(t, n) {
  11497. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11498. if (n === i) return S[t];S[t] = n;
  11499. }
  11500. }, debug: function debug() {
  11501. !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)));
  11502. }, verbose: function verbose() {
  11503. !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)));
  11504. }, error: function error() {
  11505. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11506. }, performance: { log: function log(e) {
  11507. var t, n;k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: K, "Execution Time": n })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  11508. }, display: function display() {
  11509. var t = k.name + ":",
  11510. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11511. n += t["Execution Time"];
  11512. }), 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) {
  11513. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11514. }), console.groupEnd()), d = [];
  11515. } }, invoke: function invoke(t, n, o) {
  11516. var r,
  11517. s,
  11518. l,
  11519. c = J;return n = n || g, o = K || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11520. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11521. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);c = c[o];
  11522. }
  11523. })), 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;
  11524. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11525. }), a !== i ? a : r;
  11526. }, e.fn.dropdown.settings = { silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", action: "activate", values: !1, apiSettings: !1, selectOnKeydown: !0, minCharacters: 0, filterRemoteData: !1, saveRemoteData: !0, throttle: 200, context: t, direction: "auto", keepOnScreen: !0, match: "both", fullTextSearch: !1, placeholder: "auto", preserveHTML: !0, sortSelect: !1, forceSelection: !0, allowAdditions: !1, ignoreCase: !1, hideAdditions: !0, maxSelections: !1, useLabels: !0, delimiter: ",", showOnFocus: !0, allowReselection: !1, allowTab: !0, allowCategorySelection: !1, fireOnInit: !1, transition: "auto", duration: 200, glyphWidth: 1.037, label: { transition: "scale", duration: 200, variation: !1 }, delay: { hide: 300, show: 200, search: 20, touch: 50 }, onChange: function onChange(e, t, n) {}, onAdd: function onAdd(e, t, n) {}, onRemove: function onRemove(e, t, n) {}, onLabelSelect: function onLabelSelect(e) {}, onLabelCreate: function onLabelCreate(t, n) {
  11527. return e(this);
  11528. }, onLabelRemove: function onLabelRemove(e) {
  11529. return !0;
  11530. }, onNoResults: function onNoResults(e) {
  11531. return !0;
  11532. }, onShow: function onShow() {}, onHide: function onHide() {}, name: "Dropdown", namespace: "dropdown", message: { addResult: "Add <b>{term}</b>", count: "{count} selected", maxSelections: "Max {maxCount} selections", noResults: "No results found.", serverError: "There was an error contacting the server" }, error: { action: "You called a dropdown action that was not defined", alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown", labels: "Allowing user additions currently requires the use of labels.", missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values", method: "The method you called is not defined.", noAPI: "The API module is required to load resources remotely", noStorage: "Saving remote data requires session storage", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>" }, regExp: { escape: /[-[\]{}()*+?.,\\^$|#\s]/g, quote: /"/g }, metadata: { defaultText: "defaultText", defaultValue: "defaultValue", placeholderText: "placeholder", text: "text", value: "value" }, fields: { remoteValues: "results", values: "values", disabled: "disabled", name: "name", value: "value", text: "text" }, keys: { backspace: 8, delimiter: 188, deleteKey: 46, enter: 13, escape: 27, pageUp: 33, pageDown: 34, leftArrow: 37, upArrow: 38, rightArrow: 39, downArrow: 40 }, selector: { addition: ".addition", dropdown: ".ui.dropdown", hidden: ".hidden", icon: "> .dropdown.icon", input: '> input[type="hidden"], > select', item: ".item", label: "> .label", remove: "> .label > .delete.icon", siblingLabel: ".label", menu: ".menu", message: ".message", menuIcon: ".dropdown.icon", search: "input.search, .menu > .search > input, .menu input.search", sizer: "> input.sizer", text: "> .text:not(.icon)", unselectable: ".disabled, .filtered" }, className: { active: "active", addition: "addition", animating: "animating", disabled: "disabled", empty: "empty", dropdown: "ui dropdown", filtered: "filtered", hidden: "hidden transition", item: "item", label: "ui label", loading: "loading", menu: "menu", message: "message", multiple: "multiple", placeholder: "default", sizer: "sizer", search: "search", selected: "selected", selection: "selection", upward: "upward", leftward: "left", visible: "visible" } }, e.fn.dropdown.settings.templates = { dropdown: function dropdown(t) {
  11533. var n = t.placeholder || !1,
  11534. i = (t.values, "");return i += '<i class="dropdown icon"></i>', t.placeholder ? i += '<div class="default text">' + n + "</div>" : i += '<div class="text"></div>', i += '<div class="menu">', e.each(t.values, function (e, t) {
  11535. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11536. }), i += "</div>";
  11537. }, menu: function menu(t, n) {
  11538. var i = t[n.values] || {},
  11539. o = "";return e.each(i, function (e, t) {
  11540. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11541. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11542. }), o;
  11543. }, label: function label(e, t) {
  11544. return t + '<i class="delete icon"></i>';
  11545. }, message: function message(e) {
  11546. return e;
  11547. }, addition: function addition(e) {
  11548. return e;
  11549. } };
  11550. }(jQuery, window, document), function (e, t, n, i) {
  11551. "use strict";
  11552. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11553. var o,
  11554. a = e(this),
  11555. r = a.selector || "",
  11556. s = new Date().getTime(),
  11557. l = [],
  11558. c = arguments[0],
  11559. u = "string" == typeof c,
  11560. d = [].slice.call(arguments, 1);return a.each(function () {
  11561. var f,
  11562. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11563. g = m.selector,
  11564. p = m.className,
  11565. h = m.sources,
  11566. v = m.error,
  11567. b = m.metadata,
  11568. y = m.namespace,
  11569. x = m.templates,
  11570. C = "." + y,
  11571. w = "module-" + y,
  11572. S = (e(t), e(this)),
  11573. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11574. T = this,
  11575. A = S.data(w);f = { initialize: function initialize() {
  11576. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11577. }, instantiate: function instantiate() {
  11578. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11579. }, destroy: function destroy() {
  11580. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11581. }, refresh: function refresh() {
  11582. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11583. }, bind: { events: function events() {
  11584. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11585. } }, create: function create() {
  11586. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11587. }, createPlaceholder: function createPlaceholder(e) {
  11588. var t = f.get.icon(),
  11589. n = f.get.url();f.generate.embed(n);e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  11590. }, createEmbed: function createEmbed(t) {
  11591. 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);
  11592. }, changeEmbed: function changeEmbed(e) {
  11593. k.html(f.generate.embed(e));
  11594. }, createAndShow: function createAndShow() {
  11595. f.createEmbed(), f.show();
  11596. }, change: function change(e, t, n) {
  11597. 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();
  11598. }, reset: function reset() {
  11599. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11600. }, show: function show() {
  11601. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11602. }, hide: function hide() {
  11603. f.debug("Hiding embed"), f.showPlaceholder();
  11604. }, showPlaceholder: function showPlaceholder() {
  11605. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11606. }, get: { id: function id() {
  11607. return m.id || S.data(b.id);
  11608. }, placeholder: function placeholder() {
  11609. return m.placeholder || S.data(b.placeholder);
  11610. }, icon: function icon() {
  11611. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11612. }, source: function source(e) {
  11613. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11614. }, type: function type() {
  11615. var e = f.get.source();return h[e] !== i && h[e].type;
  11616. }, url: function url() {
  11617. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11618. } }, determine: { autoplay: function autoplay() {
  11619. f.should.autoplay() && (m.autoplay = !0);
  11620. }, source: function source(t) {
  11621. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11622. if (-1 !== t.search(i.domain)) return n = e, !1;
  11623. }), n;
  11624. }, icon: function icon() {
  11625. var e = f.get.source();return h[e] !== i && h[e].icon;
  11626. }, url: function url() {
  11627. var e,
  11628. t = m.id || S.data(b.id),
  11629. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11630. } }, set: { active: function active() {
  11631. S.addClass(p.active);
  11632. } }, remove: { active: function active() {
  11633. S.removeClass(p.active);
  11634. }, embed: function embed() {
  11635. k.empty();
  11636. } }, encode: { parameters: function parameters(e) {
  11637. var t,
  11638. n = [];for (t in e) {
  11639. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11640. }return n.join("&amp;");
  11641. } }, generate: { embed: function embed(e) {
  11642. f.debug("Generating embed html");var t,
  11643. n,
  11644. i = f.get.source();return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  11645. }, parameters: function parameters(t, n) {
  11646. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  11647. } }, has: { embed: function embed() {
  11648. return k.length > 0;
  11649. }, placeholder: function placeholder() {
  11650. return m.placeholder || S.data(b.placeholder);
  11651. } }, should: { autoplay: function autoplay() {
  11652. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11653. } }, is: { video: function video() {
  11654. return "video" == f.get.type();
  11655. } }, setting: function setting(t, n) {
  11656. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11657. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11658. }
  11659. }, internal: function internal(t, n) {
  11660. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11661. if (n === i) return f[t];f[t] = n;
  11662. }
  11663. }, debug: function debug() {
  11664. !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)));
  11665. }, verbose: function verbose() {
  11666. !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)));
  11667. }, error: function error() {
  11668. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11669. }, performance: { log: function log(e) {
  11670. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: T, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11671. }, display: function display() {
  11672. var t = m.name + ":",
  11673. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11674. n += t["Execution Time"];
  11675. }), 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) {
  11676. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11677. }), console.groupEnd()), l = [];
  11678. } }, invoke: function invoke(t, n, a) {
  11679. var r,
  11680. s,
  11681. l,
  11682. c = A;return n = n || d, a = T || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11683. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11684. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  11685. }
  11686. })), 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;
  11687. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11688. }), o !== i ? o : this;
  11689. }, e.fn.embed.settings = { name: "Embed", namespace: "embed", silent: !1, debug: !1, verbose: !1, performance: !0, icon: !1, source: !1, url: !1, id: !1, autoplay: "auto", color: "#444444", hd: !0, brandedUI: !1, parameters: !1, onDisplay: function onDisplay() {}, onPlaceholderDisplay: function onPlaceholderDisplay() {}, onReset: function onReset() {}, onCreate: function onCreate(e) {}, onEmbed: function onEmbed(e) {
  11690. return e;
  11691. }, metadata: { id: "id", icon: "icon", placeholder: "placeholder", source: "source", url: "url" }, error: { noURL: "No URL specified", method: "The method you called is not defined" }, className: { active: "active", embed: "embed" }, selector: { embed: ".embed", placeholder: ".placeholder", icon: ".icon" }, sources: { youtube: { name: "youtube", type: "video", icon: "video play", domain: "youtube.com", url: "//www.youtube.com/embed/{id}", parameters: function parameters(e) {
  11692. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11693. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11694. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11695. } } }, templates: { iframe: function iframe(e, t) {
  11696. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11697. }, placeholder: function placeholder(e, t) {
  11698. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11699. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11700. }(jQuery, window, document), function (e, t, n, i) {
  11701. "use strict";
  11702. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11703. var a,
  11704. r = e(this),
  11705. s = e(t),
  11706. l = e(n),
  11707. c = e("body"),
  11708. u = r.selector || "",
  11709. d = new Date().getTime(),
  11710. f = [],
  11711. m = arguments[0],
  11712. g = "string" == typeof m,
  11713. p = [].slice.call(arguments, 1),
  11714. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11715. setTimeout(e, 0);
  11716. };return r.each(function () {
  11717. var r,
  11718. v,
  11719. b,
  11720. y,
  11721. x,
  11722. C,
  11723. w,
  11724. S,
  11725. k,
  11726. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11727. A = T.selector,
  11728. R = T.className,
  11729. P = T.namespace,
  11730. E = T.error,
  11731. F = "." + P,
  11732. O = "module-" + P,
  11733. D = e(this),
  11734. q = e(T.context),
  11735. j = D.find(A.close),
  11736. z = this,
  11737. I = D.data(O),
  11738. M = !1;k = { initialize: function initialize() {
  11739. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11740. }, instantiate: function instantiate() {
  11741. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11742. }, create: { dimmer: function dimmer() {
  11743. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11744. n = e.extend(!0, t, T.dimmerSettings);e.fn.dimmer !== i ? (k.debug("Creating dimmer"), y = q.dimmer(n), T.detachable ? (k.verbose("Modal is detachable, moving content into dimmer"), y.dimmer("add content", D)) : k.set.undetached(), x = y.dimmer("get dimmer")) : k.error(E.dimmer);
  11745. }, id: function id() {
  11746. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11747. } }, destroy: function destroy() {
  11748. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11749. }, observeChanges: function observeChanges() {
  11750. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11751. k.debug("DOM tree modified, refreshing"), k.refresh();
  11752. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11753. }, refresh: function refresh() {
  11754. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11755. }, refreshModals: function refreshModals() {
  11756. v = D.siblings(A.modal), r = v.add(D);
  11757. }, attachEvents: function attachEvents(t, n) {
  11758. var i = e(t);n = e.isFunction(k[n]) ? k[n] : k.toggle, i.length > 0 ? (k.debug("Attaching modal events to element", t, n), i.off(F).on("click" + F, n)) : k.error(E.notFound, t);
  11759. }, bind: { events: function events() {
  11760. 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);
  11761. } }, get: { id: function id() {
  11762. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11763. } }, event: { approve: function approve() {
  11764. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11765. M = !1;
  11766. }));
  11767. }, deny: function deny() {
  11768. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11769. M = !1;
  11770. }));
  11771. }, close: function close() {
  11772. k.hide();
  11773. }, click: function click(t) {
  11774. if (T.closable) {
  11775. var i = e(t.target).closest(A.modal).length > 0,
  11776. o = e.contains(n.documentElement, t.target);!i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  11777. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11778. }, debounce: function debounce(e, t) {
  11779. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11780. }, keyboard: function keyboard(e) {
  11781. 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());
  11782. }, resize: function resize() {
  11783. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11784. } }, toggle: function toggle() {
  11785. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11786. }, show: function show(t) {
  11787. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11788. }, hide: function hide(t) {
  11789. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11790. }, showModal: function showModal(t) {
  11791. t = e.isFunction(t) ? t : function () {}, k.is.animating() || !k.is.active() ? (k.showDimmer(), k.cacheSizes(), k.set.screenHeight(), k.set.type(), k.set.clickaway(), !T.allowMultiple && k.others.active() ? k.hideOthers(k.showModal) : (T.allowMultiple && T.detachable && D.detach().appendTo(x), T.onShow.call(z), T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.debug("Showing modal with css animations"), D.transition({ debug: T.debug, animation: T.transition + " in", queue: T.queue, duration: T.duration, useFailSafe: !0, onComplete: function onComplete() {
  11792. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11793. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11794. }, hideModal: function hideModal(t, n) {
  11795. t = e.isFunction(t) ? t : function () {}, k.debug("Hiding modal"), !1 !== T.onHide.call(z, e(this)) ? (k.is.animating() || k.is.active()) && (T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.remove.active(), D.transition({ debug: T.debug, animation: T.transition + " out", queue: T.queue, duration: T.duration, useFailSafe: !0, onStart: function onStart() {
  11796. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11797. }, onComplete: function onComplete() {
  11798. T.onHidden.call(z), k.restore.focus(), t();
  11799. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11800. }, showDimmer: function showDimmer() {
  11801. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11802. }, hideDimmer: function hideDimmer() {
  11803. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11804. k.remove.clickaway(), k.remove.screenHeight();
  11805. }) : k.debug("Dimmer is not visible cannot hide");
  11806. }, hideAll: function hideAll(t) {
  11807. var n = r.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  11808. }, hideOthers: function hideOthers(t) {
  11809. var n = v.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  11810. }, others: { active: function active() {
  11811. return v.filter("." + R.active).length > 0;
  11812. }, animating: function animating() {
  11813. return v.filter("." + R.animating).length > 0;
  11814. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11815. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11816. } }, save: { focus: function focus() {
  11817. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11818. } }, restore: { focus: function focus() {
  11819. b && b.length > 0 && b.focus();
  11820. } }, remove: { active: function active() {
  11821. D.removeClass(R.active);
  11822. }, clickaway: function clickaway() {
  11823. x.off("click" + C);
  11824. }, bodyStyle: function bodyStyle() {
  11825. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11826. }, screenHeight: function screenHeight() {
  11827. k.debug("Removing page height"), c.css("height", "");
  11828. }, keyboardShortcuts: function keyboardShortcuts() {
  11829. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11830. }, scrolling: function scrolling() {
  11831. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11832. } }, cacheSizes: function cacheSizes() {
  11833. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11834. a = D.outerHeight();k.cache !== i && 0 === a || (k.cache = { pageHeight: e(n).outerHeight(), height: a + T.offset, scrollHeight: o + T.offset, contextHeight: "body" == T.context ? e(t).height() : y.height() }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  11835. }, can: { fit: function fit() {
  11836. var e = k.cache.contextHeight,
  11837. t = k.cache.contextHeight / 2,
  11838. n = k.cache.topOffset,
  11839. i = k.cache.scrollHeight,
  11840. o = k.cache.height,
  11841. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11842. } }, is: { active: function active() {
  11843. return D.hasClass(R.active);
  11844. }, animating: function animating() {
  11845. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11846. }, scrolling: function scrolling() {
  11847. return y.hasClass(R.scrolling);
  11848. }, modernBrowser: function modernBrowser() {
  11849. return !(t.ActiveXObject || "ActiveXObject" in t);
  11850. } }, set: { autofocus: function autofocus() {
  11851. var e = D.find("[tabindex], :input").filter(":visible"),
  11852. t = e.filter("[autofocus]"),
  11853. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11854. }, clickaway: function clickaway() {
  11855. x.on("click" + C, k.event.click);
  11856. }, dimmerSettings: function dimmerSettings() {
  11857. if (e.fn.dimmer !== i) {
  11858. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11859. n = e.extend(!0, t, T.dimmerSettings);T.inverted ? (n.variation = n.variation !== i ? n.variation + " inverted" : "inverted", x.addClass(R.inverted)) : x.removeClass(R.inverted), T.blurring ? y.addClass(R.blurring) : y.removeClass(R.blurring), q.dimmer("setting", n);
  11860. } else k.error(E.dimmer);
  11861. }, screenHeight: function screenHeight() {
  11862. 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));
  11863. }, active: function active() {
  11864. D.addClass(R.active);
  11865. }, scrolling: function scrolling() {
  11866. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11867. }, type: function type() {
  11868. 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());
  11869. }, undetached: function undetached() {
  11870. y.addClass(R.undetached);
  11871. } }, setting: function setting(t, n) {
  11872. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11873. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11874. }
  11875. }, internal: function internal(t, n) {
  11876. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11877. if (n === i) return k[t];k[t] = n;
  11878. }
  11879. }, debug: function debug() {
  11880. !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)));
  11881. }, verbose: function verbose() {
  11882. !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)));
  11883. }, error: function error() {
  11884. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11885. }, performance: { log: function log(e) {
  11886. var t, n;T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  11887. }, display: function display() {
  11888. var t = T.name + ":",
  11889. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11890. n += t["Execution Time"];
  11891. }), 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) {
  11892. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11893. }), console.groupEnd()), f = [];
  11894. } }, invoke: function invoke(t, n, o) {
  11895. var r,
  11896. s,
  11897. l,
  11898. c = I;return n = n || p, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11899. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11900. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  11901. }
  11902. })), 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;
  11903. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11904. }), a !== i ? a : this;
  11905. }, e.fn.modal.settings = { name: "Modal", namespace: "modal", silent: !1, debug: !1, verbose: !1, performance: !0, observeChanges: !1, allowMultiple: !1, detachable: !0, closable: !0, autofocus: !0, inverted: !1, blurring: !1, centered: !0, dimmerSettings: { closable: !1, useCSS: !0 }, keyboardShortcuts: !0, context: "body", queue: !1, duration: 500, offset: 0, transition: "scale", padding: 50, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {
  11906. return !0;
  11907. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11908. return !0;
  11909. }, onDeny: function onDeny() {
  11910. return !0;
  11911. }, selector: { close: "> .close", approve: ".actions .positive, .actions .approve, .actions .ok", deny: ".actions .negative, .actions .deny, .actions .cancel", modal: ".ui.modal" }, error: { dimmer: "UI Dimmer, a required component is not included in this page", method: "The method you called is not defined.", notFound: "The element you specified could not be found" }, className: { active: "active", animating: "animating", blurring: "blurring", inverted: "inverted", loading: "loading", scrolling: "scrolling", undetached: "undetached" } };
  11912. }(jQuery, window, document), function (e, t, n, i) {
  11913. "use strict";
  11914. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11915. var o,
  11916. a = e(this),
  11917. r = a.selector || "",
  11918. s = new Date().getTime(),
  11919. l = [],
  11920. c = arguments[0],
  11921. u = "string" == typeof c,
  11922. d = [].slice.call(arguments, 1);return a.each(function () {
  11923. var a,
  11924. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11925. m = (f.className, f.selector),
  11926. g = f.error,
  11927. p = f.namespace,
  11928. h = "." + p,
  11929. v = p + "-module",
  11930. b = e(this),
  11931. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11932. x = this,
  11933. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11934. 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();
  11935. }, destroy: function destroy() {
  11936. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11937. }, show: function show() {
  11938. 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));
  11939. }, hide: function hide() {
  11940. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11941. }, onHide: function onHide() {
  11942. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11943. }, dismiss: function dismiss(e) {
  11944. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11945. }, should: { show: function show() {
  11946. 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);
  11947. } }, get: { storageOptions: function storageOptions() {
  11948. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11949. } }, clear: function clear() {
  11950. a.storage.remove(f.key);
  11951. }, storage: { set: function set(n, o) {
  11952. var r = a.get.storageOptions();if ("localstorage" == f.storageMethod && t.localStorage !== i) t.localStorage.setItem(n, o), a.debug("Value stored using local storage", n, o);else if ("sessionstorage" == f.storageMethod && t.sessionStorage !== i) t.sessionStorage.setItem(n, o), a.debug("Value stored using session storage", n, o);else {
  11953. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11954. }
  11955. }, get: function get(n, o) {
  11956. var r;return "localstorage" == f.storageMethod && t.localStorage !== i ? r = t.localStorage.getItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? r = t.sessionStorage.getItem(n) : e.cookie !== i ? r = e.cookie(n) : a.error(g.noCookieStorage), "undefined" != r && "null" != r && r !== i && null !== r || (r = i), r;
  11957. }, remove: function remove(n) {
  11958. var o = a.get.storageOptions();"localstorage" == f.storageMethod && t.localStorage !== i ? t.localStorage.removeItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? t.sessionStorage.removeItem(n) : e.cookie !== i ? e.removeCookie(n, o) : a.error(g.noStorage);
  11959. } }, setting: function setting(t, n) {
  11960. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11961. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11962. }
  11963. }, internal: function internal(t, n) {
  11964. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  11965. if (n === i) return a[t];a[t] = n;
  11966. }
  11967. }, debug: function debug() {
  11968. !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)));
  11969. }, verbose: function verbose() {
  11970. !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)));
  11971. }, error: function error() {
  11972. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  11973. }, performance: { log: function log(e) {
  11974. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  11975. }, display: function display() {
  11976. var t = f.name + ":",
  11977. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  11978. n += t["Execution Time"];
  11979. }), 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) {
  11980. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11981. }), console.groupEnd()), l = [];
  11982. } }, invoke: function invoke(t, n, r) {
  11983. var s,
  11984. l,
  11985. c,
  11986. u = C;return n = n || d, r = x || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  11987. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  11988. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  11989. }
  11990. })), 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;
  11991. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  11992. }), o !== i ? o : this;
  11993. }, e.fn.nag.settings = { name: "Nag", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "Nag", persist: !1, displayTime: 0, animation: { show: "slide", hide: "slide" }, context: !1, detachable: !1, expires: 30, domain: !1, path: "/", storageMethod: "cookie", key: "nag", value: "dismiss", error: { noCookieStorage: "$.cookie is not included. A storage solution is required.", noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state", method: "The method you called is not defined." }, className: { bottom: "bottom", fixed: "fixed" }, selector: { close: ".close.icon" }, speed: 500, easing: "easeOutQuad", onHide: function onHide() {} }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11994. return -i * (t /= o) * (t - 2) + n;
  11995. } });
  11996. }(jQuery, window, document), function (e, t, n, i) {
  11997. "use strict";
  11998. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  11999. var a,
  12000. r = e(this),
  12001. s = e(n),
  12002. l = e(t),
  12003. c = e("body"),
  12004. u = r.selector || "",
  12005. d = new Date().getTime(),
  12006. f = [],
  12007. m = arguments[0],
  12008. g = "string" == typeof m,
  12009. p = [].slice.call(arguments, 1);return r.each(function () {
  12010. var r,
  12011. h,
  12012. v,
  12013. b,
  12014. y,
  12015. x,
  12016. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  12017. w = C.selector,
  12018. S = C.className,
  12019. k = C.error,
  12020. T = C.metadata,
  12021. A = C.namespace,
  12022. R = "." + C.namespace,
  12023. P = "module-" + A,
  12024. E = e(this),
  12025. F = e(C.context),
  12026. O = e(C.scrollContext),
  12027. D = e(C.boundary),
  12028. q = C.target ? e(C.target) : E,
  12029. j = 0,
  12030. z = !1,
  12031. I = !1,
  12032. M = this,
  12033. L = E.data(P);x = { initialize: function initialize() {
  12034. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  12035. }, instantiate: function instantiate() {
  12036. x.verbose("Storing instance", x), L = x, E.data(P, L);
  12037. }, observeChanges: function observeChanges() {
  12038. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  12039. }, refresh: function refresh() {
  12040. 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();
  12041. }, reposition: function reposition() {
  12042. x.refresh(), x.set.position();
  12043. }, destroy: function destroy() {
  12044. 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);
  12045. }, event: { start: function start(t) {
  12046. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  12047. }, end: function end() {
  12048. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  12049. }, touchstart: function touchstart(e) {
  12050. I = !0, x.show();
  12051. }, resize: function resize() {
  12052. x.is.visible() && x.set.position();
  12053. }, documentChanged: function documentChanged(t) {
  12054. [].forEach.call(t, function (t) {
  12055. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  12056. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  12057. });
  12058. });
  12059. }, hideGracefully: function hideGracefully(t) {
  12060. var i = e(t.target),
  12061. o = e.contains(n.documentElement, t.target),
  12062. a = i.closest(w.popup).length > 0;t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  12063. } }, create: function create() {
  12064. var t = x.get.html(),
  12065. n = x.get.title(),
  12066. i = x.get.content();t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({ title: n, content: i })), r = e("<div/>").addClass(S.popup).data(T.activator, E).html(t), C.inline ? (x.verbose("Inserting popup element inline", r), r.insertAfter(E)) : (x.verbose("Appending popup element to body", r), r.appendTo(F)), x.refresh(), x.set.variation(), C.hoverable && x.bind.popup(), C.onCreate.call(r, M)) : 0 !== q.next(w.popup).length ? (x.verbose("Pre-existing popup found"), C.inline = !0, C.popup = q.next(w.popup).data(T.activator, E), x.refresh(), C.hoverable && x.bind.popup()) : C.popup ? (e(C.popup).data(T.activator, E), x.verbose("Used popup specified in settings"), x.refresh(), C.hoverable && x.bind.popup()) : x.debug("No content specified skipping display", M);
  12067. }, createID: function createID() {
  12068. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  12069. }, toggle: function toggle() {
  12070. 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());
  12071. }, show: function show(e) {
  12072. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  12073. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  12074. }
  12075. }, hide: function hide(e) {
  12076. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  12077. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  12078. }
  12079. }, hideAll: function hideAll() {
  12080. e(w.popup).filter("." + S.popupVisible).each(function () {
  12081. e(this).data(T.activator).popup("hide");
  12082. });
  12083. }, exists: function exists() {
  12084. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  12085. }, removePopup: function removePopup() {
  12086. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  12087. }, save: { conditions: function conditions() {
  12088. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  12089. } }, restore: { conditions: function conditions() {
  12090. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  12091. } }, supports: { svg: function svg() {
  12092. return "undefined" == typeof SVGGraphicsElement;
  12093. } }, animate: { show: function show(t) {
  12094. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({ animation: C.transition + " in", queue: !1, debug: C.debug, verbose: C.verbose, duration: C.duration, onComplete: function onComplete() {
  12095. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  12096. } })) : x.error(k.noTransition);
  12097. }, hide: function hide(t) {
  12098. t = e.isFunction(t) ? t : function () {}, x.debug("Hiding pop-up"), !1 !== C.onHide.call(r, M) ? C.transition && e.fn.transition !== i && E.transition("is supported") ? r.transition({ animation: C.transition + " out", queue: !1, duration: C.duration, debug: C.debug, verbose: C.verbose, onComplete: function onComplete() {
  12099. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  12100. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  12101. } }, change: { content: function content(e) {
  12102. r.html(e);
  12103. } }, get: { html: function html() {
  12104. return E.removeData(T.html), E.data(T.html) || C.html;
  12105. }, title: function title() {
  12106. return E.removeData(T.title), E.data(T.title) || C.title;
  12107. }, content: function content() {
  12108. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  12109. }, variation: function variation() {
  12110. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  12111. }, popup: function popup() {
  12112. return r;
  12113. }, popupOffset: function popupOffset() {
  12114. return r.offset();
  12115. }, calculations: function calculations() {
  12116. var e,
  12117. n = x.get.offsetParent(r),
  12118. i = q[0],
  12119. o = D[0] == t,
  12120. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  12121. s = o ? { top: 0, left: 0 } : D.offset(),
  12122. c = {},
  12123. u = o ? { top: l.scrollTop(), left: l.scrollLeft() } : { top: 0, left: 0 };if (c = { target: { element: q[0], width: q.outerWidth(), height: q.outerHeight(), top: a.top, left: a.left, margin: {} }, popup: { width: r.outerWidth(), height: r.outerHeight() }, parent: { width: h.outerWidth(), height: h.outerHeight() }, screen: { top: s.top, left: s.left, scroll: { top: u.top, left: u.left }, width: D.width(), height: D.height() } }, n.get(0) !== h.get(0)) {
  12124. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  12125. }return C.setFluidWidth && x.is.fluid() && (c.container = { width: r.parent().outerWidth() }, c.popup.width = c.container.width), c.target.margin.top = C.inline ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-top"), 10) : 0, c.target.margin.left = C.inline ? x.is.rtl() ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-right"), 10) : parseInt(t.getComputedStyle(i).getPropertyValue("margin-left"), 10) : 0, e = c.screen, c.boundary = { top: e.top + e.scroll.top, bottom: e.top + e.scroll.top + e.height, left: e.left + e.scroll.left, right: e.left + e.scroll.left + e.width }, c;
  12126. }, id: function id() {
  12127. return y;
  12128. }, startEvent: function startEvent() {
  12129. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  12130. }, scrollEvent: function scrollEvent() {
  12131. return "scroll";
  12132. }, endEvent: function endEvent() {
  12133. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  12134. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  12135. var n,
  12136. i,
  12137. o = {};return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = { top: e.top - i.top, left: e.left - i.left, right: i.right - (e.left + n.width), bottom: i.bottom - (e.top + n.height) }, x.verbose("Distance from boundaries determined", e, o)), o;
  12138. }, offsetParent: function offsetParent(t) {
  12139. var n = (t !== i ? t[0] : q[0]).parentNode,
  12140. o = e(n);if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  12141. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  12142. }return o && o.length > 0 ? o : e();
  12143. }, positions: function positions() {
  12144. return { "top left": !1, "top center": !1, "top right": !1, "bottom left": !1, "bottom center": !1, "bottom right": !1, "left center": !1, "right center": !1 };
  12145. }, nextPosition: function nextPosition(e) {
  12146. var t = e.split(" "),
  12147. n = t[0],
  12148. i = t[1],
  12149. o = "top" == n || "bottom" == n,
  12150. a = !1,
  12151. r = !1,
  12152. s = !1;return z || (x.verbose("All available positions available"), z = x.get.positions()), x.debug("Recording last position tried", e), z[e] = !0, "opposite" === C.prefer && (s = (s = [{ top: "bottom", bottom: "top", left: "right", right: "left" }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, { left: "center", center: "right", right: "left" }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = { "top left": "top center", "top center": "top right", "top right": "right center", "right center": "bottom right", "bottom right": "bottom center", "bottom center": "bottom left", "bottom left": "left center", "left center": "top left" }[e]), s;
  12153. } }, set: { position: function position(e, t) {
  12154. if (0 !== q.length && 0 !== r.length) {
  12155. var n, o, a, s, l, c, u, d;if (t = t || x.get.calculations(), e = e || E.data(T.position) || C.position, n = E.data(T.offset) || C.offset, o = C.distanceAway, a = t.target, s = t.popup, l = t.parent, x.should.centerArrow(t) && (x.verbose("Adjusting offset to center arrow on small target element"), "top left" != e && "bottom left" != e || (n += a.width / 2, n -= C.arrowPixelsFromEdge), "top right" != e && "bottom right" != e || (n -= a.width / 2, n += C.arrowPixelsFromEdge)), 0 === a.width && 0 === a.height && !x.is.svg(a.element)) return x.debug("Popup target is hidden, no action taken"), !1;switch (C.inline && (x.debug("Adding margin to calculation", a.margin), "left center" == e || "right center" == e ? (n += a.margin.top, o += -a.margin.left) : "top left" == e || "top center" == e || "top right" == e ? (n += a.margin.left, o -= a.margin.top) : (n += a.margin.left, o += a.margin.top)), x.debug("Determining popup position from calculations", e, t), x.is.rtl() && (e = e.replace(/left|right/g, function (e) {
  12156. return "left" == e ? "right" : "left";
  12157. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12158. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12159. c = { bottom: l.height - a.top + o, left: a.left + a.width / 2 - s.width / 2 + n, top: "auto", right: "auto" };break;case "top right":
  12160. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12161. c = { top: a.top + a.height / 2 - s.height / 2 + n, right: l.width - a.left + o, left: "auto", bottom: "auto" };break;case "right center":
  12162. c = { top: a.top + a.height / 2 - s.height / 2 + n, left: a.left + a.width + o, bottom: "auto", right: "auto" };break;case "bottom left":
  12163. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12164. c = { top: a.top + a.height + o, left: a.left + a.width / 2 - s.width / 2 + n, bottom: "auto", right: "auto" };break;case "bottom right":
  12165. c = { top: a.top + a.height + o, right: l.width - a.left - a.width - n, left: "auto", bottom: "auto" };}if (c === i && x.error(k.invalidPosition, e), x.debug("Calculated popup positioning values", c), r.css(c).removeClass(S.position).addClass(e).addClass(S.loading), u = x.get.popupOffset(), d = x.get.distanceFromBoundary(u, t), x.is.offstage(d, e)) {
  12166. if (x.debug("Position is outside viewport", e), j < C.maxSearchDepth) return j++, e = x.get.nextPosition(e), x.debug("Trying new position", e), !!r && x.set.position(e, t);if (!C.lastResort) return x.debug("Popup could not find a position to display", r), x.error(k.cannotPlace, M), x.remove.attempts(), x.remove.loading(), x.reset(), C.onUnplaceable.call(r, M), !1;x.debug("No position found, showing with last position");
  12167. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12168. }x.error(k.notFound);
  12169. }, fluidWidth: function fluidWidth(e) {
  12170. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12171. }, variation: function variation(e) {
  12172. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12173. }, visible: function visible() {
  12174. E.addClass(S.visible);
  12175. } }, remove: { loading: function loading() {
  12176. r.removeClass(S.loading);
  12177. }, variation: function variation(e) {
  12178. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12179. }, visible: function visible() {
  12180. E.removeClass(S.visible);
  12181. }, attempts: function attempts() {
  12182. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12183. } }, bind: { events: function events() {
  12184. 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);
  12185. }, popup: function popup() {
  12186. 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);
  12187. }, close: function close() {
  12188. (!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();
  12189. }, closeOnScroll: function closeOnScroll() {
  12190. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12191. }, touchClose: function touchClose() {
  12192. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12193. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12194. });
  12195. }, clickaway: function clickaway() {
  12196. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12197. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12198. });
  12199. } }, unbind: { events: function events() {
  12200. l.off(b), E.off(R);
  12201. }, close: function close() {
  12202. s.off(b), O.off(b);
  12203. } }, has: { popup: function popup() {
  12204. return r && r.length > 0;
  12205. } }, should: { centerArrow: function centerArrow(e) {
  12206. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12207. } }, is: { offstage: function offstage(t, n) {
  12208. var i = [];return e.each(t, function (e, t) {
  12209. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12210. }), i.length > 0;
  12211. }, svg: function svg(e) {
  12212. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12213. }, basic: function basic() {
  12214. return E.hasClass(S.basic);
  12215. }, active: function active() {
  12216. return E.hasClass(S.active);
  12217. }, animating: function animating() {
  12218. return r !== i && r.hasClass(S.animating);
  12219. }, fluid: function fluid() {
  12220. return r !== i && r.hasClass(S.fluid);
  12221. }, visible: function visible() {
  12222. return r !== i && r.hasClass(S.popupVisible);
  12223. }, dropdown: function dropdown() {
  12224. return E.hasClass(S.dropdown);
  12225. }, hidden: function hidden() {
  12226. return !x.is.visible();
  12227. }, rtl: function rtl() {
  12228. return "rtl" == E.css("direction");
  12229. } }, reset: function reset() {
  12230. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12231. }, setting: function setting(t, n) {
  12232. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12233. if (n === i) return C[t];C[t] = n;
  12234. }
  12235. }, internal: function internal(t, n) {
  12236. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12237. if (n === i) return x[t];x[t] = n;
  12238. }
  12239. }, debug: function debug() {
  12240. !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)));
  12241. }, verbose: function verbose() {
  12242. !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)));
  12243. }, error: function error() {
  12244. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12245. }, performance: { log: function log(e) {
  12246. var t, n;C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: M, "Execution Time": n })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  12247. }, display: function display() {
  12248. var t = C.name + ":",
  12249. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12250. n += t["Execution Time"];
  12251. }), 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) {
  12252. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12253. }), console.groupEnd()), f = [];
  12254. } }, invoke: function invoke(t, n, o) {
  12255. var r,
  12256. s,
  12257. l,
  12258. c = L;return n = n || p, o = M || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12259. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12260. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12261. }
  12262. })), 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;
  12263. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12264. }), a !== i ? a : this;
  12265. }, e.fn.popup.settings = { name: "Popup", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "popup", observeChanges: !0, onCreate: function onCreate() {}, onRemove: function onRemove() {}, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {}, onUnplaceable: function onUnplaceable() {}, onHidden: function onHidden() {}, on: "hover", boundary: t, addTouchEvents: !0, position: "top left", variation: "", movePopup: !0, target: !1, popup: !1, inline: !1, preserve: !1, hoverable: !1, content: !1, html: !1, title: !1, closable: !0, hideOnScroll: "auto", exclusive: !1, context: "body", scrollContext: t, prefer: "opposite", lastResort: !1, arrowPixelsFromEdge: 20, delay: { show: 50, hide: 70 }, setFluidWidth: !0, duration: 200, transition: "scale", distanceAway: 0, jitter: 2, offset: 0, maxSearchDepth: 15, error: { invalidPosition: "The position you specified is not a valid position", cannotPlace: "Popup does not fit within the boundaries of the viewport", method: "The method you called is not defined.", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>", notFound: "The target or popup you specified does not exist on the page" }, metadata: { activator: "activator", content: "content", html: "html", offset: "offset", position: "position", title: "title", variation: "variation" }, className: { active: "active", basic: "basic", animating: "animating", dropdown: "dropdown", fluid: "fluid", loading: "loading", popup: "ui popup", position: "top left center bottom right", visible: "visible", popupVisible: "visible" }, selector: { popup: ".ui.popup" }, templates: { escape: function escape(e) {
  12266. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12267. return t[e];
  12268. }) : e
  12269. );
  12270. }, popup: function popup(t) {
  12271. var n = "",
  12272. o = e.fn.popup.settings.templates.escape;return (typeof t === "undefined" ? "undefined" : _typeof(t)) !== i && (_typeof(t.title) !== i && t.title && (t.title = o(t.title), n += '<div class="header">' + t.title + "</div>"), _typeof(t.content) !== i && t.content && (t.content = o(t.content), n += '<div class="content">' + t.content + "</div>")), n;
  12273. } } };
  12274. }(jQuery, window, document), function (e, t, n, i) {
  12275. "use strict";
  12276. void 0 !== (t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")()) && t.Math == Math || ("undefined" != typeof self && self.Math == Math ? self : Function("return this")());e.fn.progress = function (t) {
  12277. var o,
  12278. a = e(this),
  12279. r = a.selector || "",
  12280. s = new Date().getTime(),
  12281. l = [],
  12282. c = arguments[0],
  12283. u = "string" == typeof c,
  12284. d = [].slice.call(arguments, 1);return a.each(function () {
  12285. var a,
  12286. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12287. m = f.className,
  12288. g = f.metadata,
  12289. p = f.namespace,
  12290. h = f.selector,
  12291. v = f.error,
  12292. b = "." + p,
  12293. y = "module-" + p,
  12294. x = e(this),
  12295. C = e(this).find(h.bar),
  12296. w = e(this).find(h.progress),
  12297. S = e(this).find(h.label),
  12298. k = this,
  12299. T = x.data(y),
  12300. A = !1;a = { initialize: function initialize() {
  12301. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12302. }, instantiate: function instantiate() {
  12303. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12304. }, destroy: function destroy() {
  12305. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12306. }, reset: function reset() {
  12307. a.remove.nextValue(), a.update.progress(0);
  12308. }, complete: function complete() {
  12309. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12310. }, read: { metadata: function metadata() {
  12311. var e = { percent: x.data(g.percent), total: x.data(g.total), value: x.data(g.value) };e.percent && (a.debug("Current percent value set from metadata", e.percent), a.set.percent(e.percent)), e.total && (a.debug("Total value set from metadata", e.total), a.set.total(e.total)), e.value && (a.debug("Current value set from metadata", e.value), a.set.value(e.value), a.set.progress(e.value));
  12312. }, settings: function settings() {
  12313. !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));
  12314. } }, bind: { transitionEnd: function transitionEnd(e) {
  12315. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12316. clearTimeout(a.failSafeTimer), e.call(this, t);
  12317. }), a.failSafeTimer = setTimeout(function () {
  12318. C.triggerHandler(t);
  12319. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12320. } }, increment: function increment(e) {
  12321. var t, n;a.has.total() ? n = (t = a.get.value()) + (e = e || 1) : (n = (t = a.get.percent()) + (e = e || a.get.randomValue()), 100, a.debug("Incrementing percentage by", t, n)), n = a.get.normalizedValue(n), a.set.progress(n);
  12322. }, decrement: function decrement(e) {
  12323. var t, n;a.get.total() ? (n = (t = a.get.value()) - (e = e || 1), a.debug("Decrementing value by", e, t)) : (n = (t = a.get.percent()) - (e = e || a.get.randomValue()), a.debug("Decrementing percentage by", e, t)), n = a.get.normalizedValue(n), a.set.progress(n);
  12324. }, has: { progressPoll: function progressPoll() {
  12325. return a.progressPoll;
  12326. }, total: function total() {
  12327. return !1 !== a.get.total();
  12328. } }, get: { text: function text(e) {
  12329. var t = a.value || 0,
  12330. n = a.total || 0,
  12331. i = A ? a.get.displayPercent() : a.percent || 0,
  12332. o = a.total > 0 ? n - t : 100 - i;return e = (e = e || "").replace("{value}", t).replace("{total}", n).replace("{left}", o).replace("{percent}", i), a.verbose("Adding variables to progress bar text", e), e;
  12333. }, normalizedValue: function normalizedValue(e) {
  12334. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12335. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12336. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12337. }, updateInterval: function updateInterval() {
  12338. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12339. }, randomValue: function randomValue() {
  12340. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12341. }, numericValue: function numericValue(e) {
  12342. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12343. }, transitionEnd: function transitionEnd() {
  12344. var e,
  12345. t = n.createElement("element"),
  12346. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12347. if (t.style[e] !== i) return o[e];
  12348. }
  12349. }, displayPercent: function displayPercent() {
  12350. var e = C.width(),
  12351. t = x.width(),
  12352. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  12353. }, percent: function percent() {
  12354. return a.percent || 0;
  12355. }, value: function value() {
  12356. return a.nextValue || a.value || 0;
  12357. }, total: function total() {
  12358. return a.total || !1;
  12359. } }, create: { progressPoll: function progressPoll() {
  12360. a.progressPoll = setTimeout(function () {
  12361. a.update.toNextValue(), a.remove.progressPoll();
  12362. }, a.get.updateInterval());
  12363. } }, is: { complete: function complete() {
  12364. return a.is.success() || a.is.warning() || a.is.error();
  12365. }, success: function success() {
  12366. return x.hasClass(m.success);
  12367. }, warning: function warning() {
  12368. return x.hasClass(m.warning);
  12369. }, error: function error() {
  12370. return x.hasClass(m.error);
  12371. }, active: function active() {
  12372. return x.hasClass(m.active);
  12373. }, visible: function visible() {
  12374. return x.is(":visible");
  12375. } }, remove: { progressPoll: function progressPoll() {
  12376. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12377. }, nextValue: function nextValue() {
  12378. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12379. }, state: function state() {
  12380. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12381. }, active: function active() {
  12382. a.verbose("Removing active state"), x.removeClass(m.active);
  12383. }, success: function success() {
  12384. a.verbose("Removing success state"), x.removeClass(m.success);
  12385. }, warning: function warning() {
  12386. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12387. }, error: function error() {
  12388. a.verbose("Removing error state"), x.removeClass(m.error);
  12389. } }, set: { barWidth: function barWidth(e) {
  12390. 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)));
  12391. }, duration: function duration(e) {
  12392. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12393. }, percent: function percent(e) {
  12394. 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);
  12395. }, labelInterval: function labelInterval() {
  12396. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12397. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12398. }), A = !0, a.interval = setInterval(function () {
  12399. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12400. }, f.framerate);
  12401. }, labels: function labels() {
  12402. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12403. }, label: function label(e) {
  12404. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12405. }, state: function state(e) {
  12406. 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));
  12407. }, barLabel: function barLabel(e) {
  12408. 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)));
  12409. }, active: function active(e) {
  12410. 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 () {
  12411. f.onActive.call(k, a.value, a.total);
  12412. });
  12413. }, success: function success(e) {
  12414. 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 () {
  12415. f.onSuccess.call(k, a.total);
  12416. });
  12417. }, warning: function warning(e) {
  12418. 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 () {
  12419. f.onWarning.call(k, a.value, a.total);
  12420. });
  12421. }, error: function error(e) {
  12422. 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 () {
  12423. f.onError.call(k, a.value, a.total);
  12424. });
  12425. }, transitionEvent: function transitionEvent() {
  12426. a.get.transitionEnd();
  12427. }, total: function total(e) {
  12428. a.total = e;
  12429. }, value: function value(e) {
  12430. a.value = e;
  12431. }, progress: function progress(e) {
  12432. 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());
  12433. }, nextValue: function nextValue(e) {
  12434. a.nextValue = e;
  12435. } }, update: { toNextValue: function toNextValue() {
  12436. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12437. }, progress: function progress(e) {
  12438. var t;!1 === (e = a.get.numericValue(e)) && a.error(v.nonNumeric, e), e = a.get.normalizedValue(e), a.has.total() ? (a.set.value(e), t = e / a.total * 100, a.debug("Calculating percent complete from total", t), a.set.percent(t)) : (t = e, a.debug("Setting value to exact percentage value", t), a.set.percent(t));
  12439. } }, setting: function setting(t, n) {
  12440. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12441. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12442. }
  12443. }, internal: function internal(t, n) {
  12444. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12445. if (n === i) return a[t];a[t] = n;
  12446. }
  12447. }, debug: function debug() {
  12448. !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)));
  12449. }, verbose: function verbose() {
  12450. !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)));
  12451. }, error: function error() {
  12452. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12453. }, performance: { log: function log(e) {
  12454. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  12455. }, display: function display() {
  12456. var t = f.name + ":",
  12457. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12458. n += t["Execution Time"];
  12459. }), 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) {
  12460. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12461. }), console.groupEnd()), l = [];
  12462. } }, invoke: function invoke(t, n, r) {
  12463. var s,
  12464. l,
  12465. c,
  12466. u = T;return n = n || d, r = k || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  12467. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  12468. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);u = u[o];
  12469. }
  12470. })), 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;
  12471. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12472. }), o !== i ? o : this;
  12473. }, e.fn.progress.settings = { name: "Progress", namespace: "progress", silent: !1, debug: !1, verbose: !1, performance: !0, random: { min: 2, max: 5 }, duration: 300, updateInterval: "auto", autoSuccess: !0, showActivity: !0, limitValues: !0, label: "percent", precision: 0, framerate: 1e3 / 30, percent: !1, total: !1, value: !1, failSafeDelay: 100, onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  12474. return t;
  12475. }, onChange: function onChange(e, t, n) {}, onSuccess: function onSuccess(e) {}, onActive: function onActive(e, t) {}, onError: function onError(e, t) {}, onWarning: function onWarning(e, t) {}, error: { method: "The method you called is not defined.", nonNumeric: "Progress value is non numeric", tooHigh: "Value specified is above 100%", tooLow: "Value specified is below 0%" }, regExp: { variable: /\{\$*[A-z0-9]+\}/g }, metadata: { percent: "percent", total: "total", value: "value" }, selector: { bar: "> .bar", label: "> .label", progress: ".bar > .progress" }, text: { active: !1, error: !1, success: !1, warning: !1, percent: "{percent}%", ratio: "{value} of {total}" }, className: { active: "active", error: "error", success: "success", warning: "warning" } };
  12476. }(jQuery, window, document), function (e, t, n, i) {
  12477. "use strict";
  12478. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12479. var n,
  12480. o = e(this),
  12481. a = o.selector || "",
  12482. r = new Date().getTime(),
  12483. s = [],
  12484. l = arguments[0],
  12485. c = "string" == typeof l,
  12486. u = [].slice.call(arguments, 1);return o.each(function () {
  12487. var d,
  12488. f,
  12489. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12490. g = m.namespace,
  12491. p = m.className,
  12492. h = m.metadata,
  12493. v = m.selector,
  12494. b = (m.error, "." + g),
  12495. y = "module-" + g,
  12496. x = this,
  12497. C = e(this).data(y),
  12498. w = e(this),
  12499. S = w.find(v.icon);f = { initialize: function initialize() {
  12500. 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();
  12501. }, instantiate: function instantiate() {
  12502. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12503. }, destroy: function destroy() {
  12504. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12505. }, refresh: function refresh() {
  12506. S = w.find(v.icon);
  12507. }, setup: { layout: function layout() {
  12508. var t = f.get.maxRating(),
  12509. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12510. } }, event: { mouseenter: function mouseenter() {
  12511. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12512. }, mouseleave: function mouseleave() {
  12513. w.removeClass(p.selected), S.removeClass(p.selected);
  12514. }, click: function click() {
  12515. var t = e(this),
  12516. n = f.get.rating(),
  12517. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12518. } }, clearRating: function clearRating() {
  12519. f.debug("Clearing current rating"), f.set.rating(0);
  12520. }, bind: { events: function events() {
  12521. 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);
  12522. } }, remove: { events: function events() {
  12523. f.verbose("Removing events"), w.off(b);
  12524. }, initialLoad: function initialLoad() {
  12525. d = !1;
  12526. } }, enable: function enable() {
  12527. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12528. }, disable: function disable() {
  12529. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12530. }, is: { initialLoad: function initialLoad() {
  12531. return d;
  12532. } }, get: { initialRating: function initialRating() {
  12533. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12534. }, maxRating: function maxRating() {
  12535. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12536. }, rating: function rating() {
  12537. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12538. } }, set: { rating: function rating(e) {
  12539. var t = e - 1 >= 0 ? e - 1 : 0,
  12540. n = S.eq(t);w.removeClass(p.selected), S.removeClass(p.selected).removeClass(p.active), e > 0 && (f.verbose("Setting current rating to", e), n.prevAll().addBack().addClass(p.active)), f.is.initialLoad() || m.onRate.call(x, e);
  12541. }, initialLoad: function initialLoad() {
  12542. d = !0;
  12543. } }, setting: function setting(t, n) {
  12544. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12545. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12546. }
  12547. }, internal: function internal(t, n) {
  12548. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12549. if (n === i) return f[t];f[t] = n;
  12550. }
  12551. }, debug: function debug() {
  12552. !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)));
  12553. }, verbose: function verbose() {
  12554. !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)));
  12555. }, error: function error() {
  12556. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12557. }, performance: { log: function log(e) {
  12558. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  12559. }, display: function display() {
  12560. var t = m.name + ":",
  12561. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12562. n += t["Execution Time"];
  12563. }), 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) {
  12564. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12565. }), console.groupEnd()), s = [];
  12566. } }, invoke: function invoke(t, o, a) {
  12567. var r,
  12568. s,
  12569. l,
  12570. c = C;return o = o || u, a = x || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12571. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12572. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12573. }
  12574. })), 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;
  12575. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12576. }), n !== i ? n : this;
  12577. }, e.fn.rating.settings = { name: "Rating", namespace: "rating", slent: !1, debug: !1, verbose: !1, performance: !0, initialRating: 0, interactive: !0, maxRating: 4, clearable: "auto", fireOnInit: !1, onRate: function onRate(e) {}, error: { method: "The method you called is not defined", noMaximum: "No maximum rating specified. Cannot generate HTML automatically" }, metadata: { rating: "rating", maxRating: "maxRating" }, className: { active: "active", disabled: "disabled", selected: "selected", loading: "loading" }, selector: { icon: ".icon" }, templates: { icon: function icon(e) {
  12578. for (var t = 1, n = ""; t <= e;) {
  12579. n += '<i class="icon"></i>', t++;
  12580. }return n;
  12581. } } };
  12582. }(jQuery, window, document), function (e, t, n, i) {
  12583. "use strict";
  12584. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12585. var a,
  12586. r = e(this),
  12587. s = r.selector || "",
  12588. l = new Date().getTime(),
  12589. c = [],
  12590. u = arguments[0],
  12591. d = "string" == typeof u,
  12592. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12593. var m,
  12594. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12595. p = g.className,
  12596. h = g.metadata,
  12597. v = g.regExp,
  12598. b = g.fields,
  12599. y = g.selector,
  12600. x = g.error,
  12601. C = g.namespace,
  12602. w = "." + C,
  12603. S = C + "-module",
  12604. k = e(this),
  12605. T = k.find(y.prompt),
  12606. A = k.find(y.searchButton),
  12607. R = k.find(y.results),
  12608. P = k.find(y.result),
  12609. E = (k.find(y.category), this),
  12610. F = k.data(S),
  12611. O = !1,
  12612. D = !1;m = { initialize: function initialize() {
  12613. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12614. }, instantiate: function instantiate() {
  12615. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12616. }, destroy: function destroy() {
  12617. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12618. }, refresh: function refresh() {
  12619. 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);
  12620. }, refreshResults: function refreshResults() {
  12621. R = k.find(y.results), P = k.find(y.result);
  12622. }, bind: { events: function events() {
  12623. 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);
  12624. } }, determine: { searchFields: function searchFields() {
  12625. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12626. } }, event: { input: function input() {
  12627. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12628. m.is.focused() && m.query();
  12629. }, g.searchDelay)) : m.query();
  12630. }, focus: function focus() {
  12631. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12632. m.can.show() && m.showResults();
  12633. });
  12634. }, blur: function blur(e) {
  12635. var t = function t() {
  12636. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12637. };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) {
  12638. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12639. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12640. }, result: { mousedown: function mousedown() {
  12641. m.resultsClicked = !0;
  12642. }, mouseup: function mouseup() {
  12643. m.resultsClicked = !1;
  12644. }, click: function click(n) {
  12645. m.debug("Search result selected");var i = e(this),
  12646. o = i.find(y.title).eq(0),
  12647. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12648. r = a.attr("href") || !1,
  12649. s = a.attr("target") || !1,
  12650. l = (o.html(), o.length > 0 && o.text()),
  12651. c = m.get.results(),
  12652. u = i.data(h.result) || m.get.result(l, c);if (e.isFunction(g.onSelect) && !1 === g.onSelect.call(E, u, c)) return m.debug("Custom onSelect callback cancelled default select action"), void (O = !0);m.hideResults(), l && m.set.value(l), r && (m.verbose("Opening search link found in result", a), "_blank" == s || n.ctrlKey ? t.open(r) : t.location.href = r);
  12653. } } }, handleKeyboard: function handleKeyboard(e) {
  12654. var t,
  12655. n = k.find(y.result),
  12656. i = k.find(y.category),
  12657. o = n.filter("." + p.active),
  12658. a = n.index(o),
  12659. r = n.length,
  12660. s = o.length > 0,
  12661. l = e.which,
  12662. c = 13,
  12663. u = 38,
  12664. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12665. if (l == c) {
  12666. 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;
  12667. } 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());
  12668. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12669. }, setup: { api: function api(t, n) {
  12670. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12671. m.parse.response.call(E, e, t), n();
  12672. }, onFailure: function onFailure() {
  12673. m.displayMessage(x.serverError), n();
  12674. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12675. } }, can: { useAPI: function useAPI() {
  12676. return e.fn.api !== i;
  12677. }, show: function show() {
  12678. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12679. }, transition: function transition() {
  12680. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12681. } }, is: { animating: function animating() {
  12682. return R.hasClass(p.animating);
  12683. }, hidden: function hidden() {
  12684. return R.hasClass(p.hidden);
  12685. }, inMessage: function inMessage(t) {
  12686. if (t.target) {
  12687. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12688. }
  12689. }, empty: function empty() {
  12690. return "" === R.html();
  12691. }, visible: function visible() {
  12692. return R.filter(":visible").length > 0;
  12693. }, focused: function focused() {
  12694. return T.filter(":focus").length > 0;
  12695. } }, get: { settings: function settings() {
  12696. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12697. }, inputEvent: function inputEvent() {
  12698. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12699. }, value: function value() {
  12700. return T.val();
  12701. }, results: function results() {
  12702. return k.data(h.results);
  12703. }, result: function result(t, n) {
  12704. var o = ["title", "id"],
  12705. a = !1;return t = t !== i ? t : m.get.value(), n = n !== i ? n : m.get.results(), "category" === g.type ? (m.debug("Finding result that matches", t), e.each(n, function (n, i) {
  12706. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12707. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12708. } }, select: { firstResult: function firstResult() {
  12709. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12710. } }, set: { focus: function focus() {
  12711. k.addClass(p.focus);
  12712. }, loading: function loading() {
  12713. k.addClass(p.loading);
  12714. }, value: function value(e) {
  12715. m.verbose("Setting search input value", e), T.val(e);
  12716. }, type: function type(e) {
  12717. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12718. }, buttonPressed: function buttonPressed() {
  12719. A.addClass(p.pressed);
  12720. } }, remove: { loading: function loading() {
  12721. k.removeClass(p.loading);
  12722. }, focus: function focus() {
  12723. k.removeClass(p.focus);
  12724. }, buttonPressed: function buttonPressed() {
  12725. A.removeClass(p.pressed);
  12726. } }, query: function query(t) {
  12727. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12728. i = m.read.cache(n);t = t || function () {}, m.has.minimumCharacters() ? (i ? (m.debug("Reading result from cache", n), m.save.results(i.results), m.addResults(i.html), m.inject.id(i.results), t()) : (m.debug("Querying for", n), e.isPlainObject(g.source) || e.isArray(g.source) ? (m.search.local(n), t()) : m.can.useAPI() ? m.search.remote(n, t) : (m.error(x.source), t())), g.onSearchQuery.call(E, n)) : m.hideResults();
  12729. }, search: { local: function local(e) {
  12730. var t,
  12731. n = m.search.object(e, g.content);m.set.loading(), m.save.results(n), m.debug("Returned full local search results", n), g.maxResults > 0 && (m.debug("Using specified max results", n), n = n.slice(0, g.maxResults)), "category" == g.type && (n = m.create.categoryResults(n)), t = m.generateResults({ results: n }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, { html: t, results: n });
  12732. }, remote: function remote(t, n) {
  12733. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12734. }, object: function object(t, n, o) {
  12735. var a = [],
  12736. r = [],
  12737. s = [],
  12738. l = t.toString().replace(v.escape, "\\$&"),
  12739. c = new RegExp(v.beginsWith + l, "i"),
  12740. u = function u(t, n) {
  12741. var i = -1 == e.inArray(n, a),
  12742. o = -1 == e.inArray(n, s),
  12743. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12744. };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) {
  12745. e.each(n, function (e, n) {
  12746. "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));
  12747. });
  12748. }), e.merge(r, s), e.merge(a, r), a);
  12749. } }, exactSearch: function exactSearch(e, t) {
  12750. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12751. }, fuzzySearch: function fuzzySearch(e, t) {
  12752. var n = t.length,
  12753. i = e.length;if ("string" != typeof e) return !1;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  12754. for (var r = e.charCodeAt(o); a < n;) {
  12755. if (t.charCodeAt(a++) === r) continue e;
  12756. }return !1;
  12757. }return !0;
  12758. }, parse: { response: function response(e, t) {
  12759. var n = m.generateResults(e);m.verbose("Parsing server response", e), e !== i && t !== i && e[b.results] !== i && (m.addResults(n), m.inject.id(e[b.results]), m.write.cache(t, { html: n, results: e[b.results] }), m.save.results(e[b.results]));
  12760. } }, cancel: { query: function query() {
  12761. m.can.useAPI() && k.api("abort");
  12762. } }, has: { minimumCharacters: function minimumCharacters() {
  12763. return m.get.value().length >= g.minCharacters;
  12764. }, results: function results() {
  12765. return 0 !== R.length && "" != R.html();
  12766. } }, clear: { cache: function cache(e) {
  12767. var t = k.data(h.cache);e ? e && t && t[e] && (m.debug("Removing value from cache", e), delete t[e], k.data(h.cache, t)) : (m.debug("Clearing cache", e), k.removeData(h.cache));
  12768. } }, read: { cache: function cache(e) {
  12769. var t = k.data(h.cache);return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) && t[e] !== i && t[e]);
  12770. } }, create: { categoryResults: function categoryResults(t) {
  12771. var n = {};return e.each(t, function (e, t) {
  12772. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = { name: t.category, results: [t] }) : n[t.category].results.push(t));
  12773. }), n;
  12774. }, id: function id(e, t) {
  12775. var n,
  12776. o = e + 1;return t !== i ? (n = String.fromCharCode(97 + t) + o, m.verbose("Creating category result id", n)) : (n = o, m.verbose("Creating result id", n)), n;
  12777. }, results: function results() {
  12778. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12779. } }, inject: { result: function result(e, t, n) {
  12780. m.verbose("Injecting result into results");var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);m.verbose("Injecting results metadata", o), o.data(h.result, e);
  12781. }, id: function id(t) {
  12782. m.debug("Injecting unique ids into results");var n = 0,
  12783. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12784. o = 0, e.each(a.results, function (e, t) {
  12785. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12786. }), n++;
  12787. }) : e.each(t, function (e, n) {
  12788. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12789. }), t;
  12790. } }, save: { results: function results(e) {
  12791. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12792. } }, write: { cache: function cache(e, t) {
  12793. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  12794. } }, addResults: function addResults(t) {
  12795. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  12796. R.empty();
  12797. });
  12798. }, showResults: function showResults(t) {
  12799. t = e.isFunction(t) ? t : function () {}, D || !m.is.visible() && m.has.results() && (m.can.transition() ? (m.debug("Showing results with css animations"), R.transition({ animation: g.transition + " in", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12800. t();
  12801. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12802. }, hideResults: function hideResults(t) {
  12803. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({ animation: g.transition + " out", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12804. t();
  12805. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12806. }, generateResults: function generateResults(t) {
  12807. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12808. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12809. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12810. a = "";return i || o ? (g.maxResults > 0 && (i ? "standard" == g.type && m.error(x.maxResults) : t[b.results] = t[b.results].slice(0, g.maxResults)), e.isFunction(n) ? a = n(t, b) : m.error(x.noTemplate, !1)) : g.showNoResults && (a = m.displayMessage(x.noResults, "empty")), g.onResults.call(E, t), a;
  12811. }, displayMessage: function displayMessage(e, t) {
  12812. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12813. }, setting: function setting(t, n) {
  12814. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12815. if (n === i) return g[t];g[t] = n;
  12816. }
  12817. }, internal: function internal(t, n) {
  12818. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12819. if (n === i) return m[t];m[t] = n;
  12820. }
  12821. }, debug: function debug() {
  12822. !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)));
  12823. }, verbose: function verbose() {
  12824. !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)));
  12825. }, error: function error() {
  12826. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12827. }, performance: { log: function log(e) {
  12828. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: E, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  12829. }, display: function display() {
  12830. var t = g.name + ":",
  12831. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12832. n += t["Execution Time"];
  12833. }), 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) {
  12834. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12835. }), console.groupEnd()), c = [];
  12836. } }, invoke: function invoke(t, n, o) {
  12837. var r,
  12838. s,
  12839. l,
  12840. c = F;return n = n || f, o = E || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12841. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12842. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12843. }
  12844. })), 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;
  12845. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12846. }), a !== i ? a : this;
  12847. }, e.fn.search.settings = { name: "Search", namespace: "search", silent: !1, debug: !1, verbose: !1, performance: !0, type: "standard", minCharacters: 1, selectFirstResult: !1, apiSettings: !1, source: !1, searchOnFocus: !0, searchFields: ["title", "description"], displayField: "", fullTextSearch: "exact", automatic: !0, hideDelay: 0, searchDelay: 200, maxResults: 7, cache: !0, showNoResults: !0, transition: "scale", duration: 200, easing: "easeOutExpo", onSelect: !1, onResultsAdd: !1, onSearchQuery: function onSearchQuery(e) {}, onResults: function onResults(e) {}, onResultsOpen: function onResultsOpen() {}, onResultsClose: function onResultsClose() {}, className: { animating: "animating", active: "active", empty: "empty", focus: "focus", hidden: "hidden", loading: "loading", results: "results", pressed: "down" }, error: { source: "Cannot search. No source used, and Semantic API module was not included", noResults: "Your search returned no results", logging: "Error in debug logging, exiting.", noEndpoint: "No search endpoint was specified", noTemplate: "A valid template name was not specified.", oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.", serverError: "There was an issue querying the server.", maxResults: "Results must be an array to use maxResults setting", method: "The method you called is not defined." }, metadata: { cache: "cache", results: "results", result: "result" }, regExp: { escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, beginsWith: "(?:s|^)" }, fields: { categories: "results", categoryName: "name", categoryResults: "results", description: "description", image: "image", price: "price", results: "results", title: "title", url: "url", action: "action", actionText: "text", actionURL: "url" }, selector: { prompt: ".prompt", searchButton: ".search.button", results: ".results", message: ".results > .message", category: ".category", result: ".result", title: ".title, .name" }, templates: { escape: function escape(e) {
  12848. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12849. return t[e];
  12850. }) : e
  12851. );
  12852. }, message: function message(e, t) {
  12853. var n = "";return e !== i && t !== i && (n += '<div class="message ' + t + '">', n += "empty" == t ? '<div class="header">No Results</div class="header"><div class="description">' + e + '</div class="description">' : ' <div class="description">' + e + "</div>", n += "</div>"), n;
  12854. }, category: function category(t, n) {
  12855. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12856. 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) {
  12857. 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>";
  12858. }), o += "</div>", o += "</div>");
  12859. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12860. }, standard: function standard(t, n) {
  12861. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12862. 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>";
  12863. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12864. } } };
  12865. }(jQuery, window, document), function (e, t, n, i) {
  12866. "use strict";
  12867. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12868. var a,
  12869. r = e(this),
  12870. s = (e("body"), new Date().getTime()),
  12871. l = [],
  12872. c = arguments[0],
  12873. u = "string" == typeof c,
  12874. d = [].slice.call(arguments, 1),
  12875. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12876. setTimeout(e, 0);
  12877. };return r.each(function () {
  12878. var t,
  12879. m,
  12880. g,
  12881. p = r.selector || "",
  12882. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12883. v = h.namespace,
  12884. b = h.selector,
  12885. y = h.error,
  12886. x = h.className,
  12887. C = "." + v,
  12888. w = "module-" + v,
  12889. S = e(this),
  12890. k = S.find(b.sides),
  12891. T = S.find(b.side),
  12892. A = !1,
  12893. R = this,
  12894. P = S.data(w);g = { initialize: function initialize() {
  12895. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12896. }, instantiate: function instantiate() {
  12897. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12898. }, destroy: function destroy() {
  12899. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12900. }, refresh: function refresh() {
  12901. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12902. }, repaint: function repaint() {
  12903. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12904. }, animate: function animate(e, n) {
  12905. g.verbose("Animating box with properties", e), n = n || function (e) {
  12906. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12907. }, 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 () {
  12908. S.addClass(x.animating), t.addClass(x.hidden);
  12909. })) : n();
  12910. }, queue: function queue(e) {
  12911. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12912. g.debug("Executing queued animation"), setTimeout(function () {
  12913. S.shape(e);
  12914. }, 0);
  12915. });
  12916. }, reset: function reset() {
  12917. 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");
  12918. }, is: { complete: function complete() {
  12919. return T.filter("." + x.active)[0] == m[0];
  12920. }, animating: function animating() {
  12921. return S.hasClass(x.animating);
  12922. } }, set: { defaultSide: function defaultSide() {
  12923. 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);
  12924. }, duration: function duration(e) {
  12925. e = "number" == typeof (e = e || h.duration) ? e + "ms" : e, g.verbose("Setting animation duration", e), (h.duration || 0 === h.duration) && k.add(T).css({ "-webkit-transition-duration": e, "-moz-transition-duration": e, "-ms-transition-duration": e, "-o-transition-duration": e, "transition-duration": e });
  12926. }, currentStageSize: function currentStageSize() {
  12927. var e = S.find("." + h.className.active),
  12928. t = e.outerWidth(!0),
  12929. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12930. }, stageSize: function stageSize() {
  12931. var e = S.clone().addClass(x.loading),
  12932. t = e.find("." + h.className.active),
  12933. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12934. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12935. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;t.removeClass(x.active), n.addClass(x.active), e.insertAfter(S), e.remove(), "auto" != h.width && (S.css("width", i + h.jitter), g.verbose("Specifying width during animation", i)), "auto" != h.height && (S.css("height", o + h.jitter), g.verbose("Specifying height during animation", o));
  12936. }, nextSide: function nextSide(e) {
  12937. 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);
  12938. }, active: function active() {
  12939. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12940. } }, flip: { up: function up() {
  12941. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12942. if (g.is.animating()) g.queue("flip up");else {
  12943. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12944. }
  12945. } else g.debug("Side already visible", m);
  12946. }, down: function down() {
  12947. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12948. if (g.is.animating()) g.queue("flip down");else {
  12949. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12950. }
  12951. } else g.debug("Side already visible", m);
  12952. }, left: function left() {
  12953. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12954. if (g.is.animating()) g.queue("flip left");else {
  12955. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12956. }
  12957. } else g.debug("Side already visible", m);
  12958. }, right: function right() {
  12959. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12960. if (g.is.animating()) g.queue("flip right");else {
  12961. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12962. }
  12963. } else g.debug("Side already visible", m);
  12964. }, over: function over() {
  12965. !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);
  12966. }, back: function back() {
  12967. !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);
  12968. } }, get: { transform: { up: function up() {
  12969. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  12970. }, down: function down() {
  12971. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  12972. }, left: function left() {
  12973. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  12974. }, right: function right() {
  12975. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  12976. }, over: function over() {
  12977. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  12978. }, back: function back() {
  12979. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  12980. } }, transitionEvent: function transitionEvent() {
  12981. var e,
  12982. t = n.createElement("element"),
  12983. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12984. if (t.style[e] !== i) return o[e];
  12985. }
  12986. }, nextSide: function nextSide() {
  12987. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  12988. } }, stage: { above: function above() {
  12989. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as above", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)" });
  12990. }, below: function below() {
  12991. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as below", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)" });
  12992. }, left: function left() {
  12993. var e = t.outerWidth(!0),
  12994. n = m.outerWidth(!0),
  12995. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)" });
  12996. }, right: function right() {
  12997. var e = t.outerWidth(!0),
  12998. n = m.outerWidth(!0),
  12999. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)" });
  13000. }, behind: function behind() {
  13001. var e = t.outerWidth(!0),
  13002. n = m.outerWidth(!0),
  13003. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as behind", m, i), t.css({ transform: "rotateY(0deg)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-180deg)" });
  13004. } }, setting: function setting(t, n) {
  13005. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  13006. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  13007. }
  13008. }, internal: function internal(t, n) {
  13009. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  13010. if (n === i) return g[t];g[t] = n;
  13011. }
  13012. }, debug: function debug() {
  13013. !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)));
  13014. }, verbose: function verbose() {
  13015. !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)));
  13016. }, error: function error() {
  13017. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  13018. }, performance: { log: function log(e) {
  13019. var t, n;h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: R, "Execution Time": n })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  13020. }, display: function display() {
  13021. var t = h.name + ":",
  13022. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  13023. n += t["Execution Time"];
  13024. }), 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) {
  13025. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13026. }), console.groupEnd()), l = [];
  13027. } }, invoke: function invoke(t, n, o) {
  13028. var r,
  13029. s,
  13030. l,
  13031. c = P;return n = n || d, o = R || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13032. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13033. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13034. }
  13035. })), 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;
  13036. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  13037. }), a !== i ? a : this;
  13038. }, e.fn.shape.settings = { name: "Shape", silent: !1, debug: !1, verbose: !1, jitter: 0, performance: !0, namespace: "shape", width: "initial", height: "initial", beforeChange: function beforeChange() {}, onChange: function onChange() {}, allowRepeats: !1, duration: !1, error: { side: "You tried to switch to a side that does not exist.", method: "The method you called is not defined" }, className: { animating: "animating", hidden: "hidden", loading: "loading", active: "active" }, selector: { sides: ".sides", side: ".side" } };
  13039. }(jQuery, window, document), function (e, t, n, i) {
  13040. "use strict";
  13041. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  13042. var a,
  13043. r = e(this),
  13044. s = e(t),
  13045. l = e(n),
  13046. c = e("html"),
  13047. u = e("head"),
  13048. d = r.selector || "",
  13049. f = new Date().getTime(),
  13050. m = [],
  13051. g = arguments[0],
  13052. p = "string" == typeof g,
  13053. h = [].slice.call(arguments, 1),
  13054. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13055. setTimeout(e, 0);
  13056. };return r.each(function () {
  13057. var r,
  13058. b,
  13059. y,
  13060. x,
  13061. C,
  13062. w,
  13063. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  13064. k = S.selector,
  13065. T = S.className,
  13066. A = S.namespace,
  13067. R = S.regExp,
  13068. P = S.error,
  13069. E = "." + A,
  13070. F = "module-" + A,
  13071. O = e(this),
  13072. D = e(S.context),
  13073. q = O.children(k.sidebar),
  13074. j = (D.children(k.fixed), D.children(k.pusher)),
  13075. z = this,
  13076. I = O.data(F);w = { initialize: function initialize() {
  13077. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  13078. w.setup.cache();
  13079. }), w.instantiate();
  13080. }, instantiate: function instantiate() {
  13081. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  13082. }, create: { id: function id() {
  13083. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  13084. } }, destroy: function destroy() {
  13085. 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);
  13086. }, event: { clickaway: function clickaway(e) {
  13087. var t = j.find(e.target).length > 0 || j.is(e.target),
  13088. n = D.is(e.target);t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  13089. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  13090. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  13091. }, scroll: function scroll(t) {
  13092. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  13093. } }, bind: { clickaway: function clickaway() {
  13094. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  13095. }, scrollLock: function scrollLock() {
  13096. 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);
  13097. } }, unbind: { clickaway: function clickaway() {
  13098. w.verbose("Removing clickaway events from context", D), D.off(b);
  13099. }, scrollLock: function scrollLock() {
  13100. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  13101. } }, add: { inlineCSS: function inlineCSS() {
  13102. var t,
  13103. n = w.cache.width || O.outerWidth(),
  13104. i = w.cache.height || O.outerHeight(),
  13105. o = w.is.rtl(),
  13106. a = w.get.direction(),
  13107. s = { left: n, right: -n, top: i, bottom: -i };o && (w.verbose("RTL detected, flipping widths"), s.left = -n, s.right = n), t = "<style>", "left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), w.is.ie() && ("left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), t += " body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); }"), r = e(t += "</style>").appendTo(u), w.debug("Adding sizing css to head", r);
  13108. } }, refresh: function refresh() {
  13109. 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();
  13110. }, refreshSidebars: function refreshSidebars() {
  13111. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  13112. }, repaint: function repaint() {
  13113. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  13114. }, setup: { cache: function cache() {
  13115. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  13116. }, layout: function layout() {
  13117. 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();
  13118. } }, attachEvents: function attachEvents(t, n) {
  13119. var i = e(t);n = e.isFunction(w[n]) ? w[n] : w.toggle, i.length > 0 ? (w.debug("Attaching sidebar events to element", t, n), i.on("click" + E, n)) : w.error(P.notFound, t);
  13120. }, show: function show(t) {
  13121. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  13122. 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) {
  13123. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  13124. } else S.transition = "overlay";w.pushPage(function () {
  13125. t.call(z), S.onShow.call(z);
  13126. }), S.onChange.call(z), S.onVisible.call(z);
  13127. } else w.debug("Sidebar is already visible");
  13128. }, hide: function hide(t) {
  13129. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  13130. t.call(z), S.onHidden.call(z);
  13131. }), S.onChange.call(z), S.onHide.call(z));
  13132. }, othersAnimating: function othersAnimating() {
  13133. return q.not(O).filter("." + T.animating).length > 0;
  13134. }, othersVisible: function othersVisible() {
  13135. return q.not(O).filter("." + T.visible).length > 0;
  13136. }, othersActive: function othersActive() {
  13137. return w.othersVisible() || w.othersAnimating();
  13138. }, hideOthers: function hideOthers(e) {
  13139. var t = q.not(O).filter("." + T.visible),
  13140. n = t.length,
  13141. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  13142. ++i == n && e();
  13143. });
  13144. }, toggle: function toggle() {
  13145. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  13146. }, pushPage: function pushPage(t) {
  13147. var n,
  13148. i,
  13149. _o,
  13150. a = w.get.transition(),
  13151. r = "overlay" === a || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  13152. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13153. }, i = function i() {
  13154. w.set.dimmed();
  13155. }, _o = function o(e) {
  13156. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13157. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13158. }, pullPage: function pullPage(t) {
  13159. var n,
  13160. _i,
  13161. o = w.get.transition(),
  13162. a = "overlay" == o || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  13163. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13164. }, _i = function i(e) {
  13165. 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));
  13166. }, a.off(C + b), a.on(C + b, _i), v(n);
  13167. }, scrollToTop: function scrollToTop() {
  13168. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13169. }, scrollBack: function scrollBack() {
  13170. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13171. }, clear: { cache: function cache() {
  13172. w.verbose("Clearing cached dimensions"), w.cache = {};
  13173. } }, set: { ios: function ios() {
  13174. c.addClass(T.ios);
  13175. }, pushed: function pushed() {
  13176. D.addClass(T.pushed);
  13177. }, pushable: function pushable() {
  13178. D.addClass(T.pushable);
  13179. }, dimmed: function dimmed() {
  13180. j.addClass(T.dimmed);
  13181. }, active: function active() {
  13182. O.addClass(T.active);
  13183. }, animating: function animating() {
  13184. O.addClass(T.animating);
  13185. }, transition: function transition(e) {
  13186. e = e || w.get.transition(), O.addClass(e);
  13187. }, direction: function direction(e) {
  13188. e = e || w.get.direction(), O.addClass(T[e]);
  13189. }, visible: function visible() {
  13190. O.addClass(T.visible);
  13191. }, overlay: function overlay() {
  13192. O.addClass(T.overlay);
  13193. } }, remove: { inlineCSS: function inlineCSS() {
  13194. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13195. }, ios: function ios() {
  13196. c.removeClass(T.ios);
  13197. }, pushed: function pushed() {
  13198. D.removeClass(T.pushed);
  13199. }, pushable: function pushable() {
  13200. D.removeClass(T.pushable);
  13201. }, active: function active() {
  13202. O.removeClass(T.active);
  13203. }, animating: function animating() {
  13204. O.removeClass(T.animating);
  13205. }, transition: function transition(e) {
  13206. e = e || w.get.transition(), O.removeClass(e);
  13207. }, direction: function direction(e) {
  13208. e = e || w.get.direction(), O.removeClass(T[e]);
  13209. }, visible: function visible() {
  13210. O.removeClass(T.visible);
  13211. }, overlay: function overlay() {
  13212. O.removeClass(T.overlay);
  13213. } }, get: { direction: function direction() {
  13214. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13215. }, transition: function transition() {
  13216. var e,
  13217. t = w.get.direction();return e = w.is.mobile() ? "auto" == S.mobileTransition ? S.defaultTransition.mobile[t] : S.mobileTransition : "auto" == S.transition ? S.defaultTransition.computer[t] : S.transition, w.verbose("Determined transition", e), e;
  13218. }, transitionEvent: function transitionEvent() {
  13219. var e,
  13220. t = n.createElement("element"),
  13221. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13222. if (t.style[e] !== i) return o[e];
  13223. }
  13224. } }, is: { ie: function ie() {
  13225. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13226. }, ios: function ios() {
  13227. var e = navigator.userAgent,
  13228. t = e.match(R.ios),
  13229. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13230. }, mobile: function mobile() {
  13231. var e = navigator.userAgent;return e.match(R.mobile) ? (w.verbose("Browser was found to be mobile", e), !0) : (w.verbose("Browser is not mobile, using regular transition", e), !1);
  13232. }, hidden: function hidden() {
  13233. return !w.is.visible();
  13234. }, visible: function visible() {
  13235. return O.hasClass(T.visible);
  13236. }, open: function open() {
  13237. return w.is.visible();
  13238. }, closed: function closed() {
  13239. return w.is.hidden();
  13240. }, vertical: function vertical() {
  13241. return O.hasClass(T.top);
  13242. }, animating: function animating() {
  13243. return D.hasClass(T.animating);
  13244. }, rtl: function rtl() {
  13245. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13246. } }, setting: function setting(t, n) {
  13247. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13248. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13249. }
  13250. }, internal: function internal(t, n) {
  13251. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13252. if (n === i) return w[t];w[t] = n;
  13253. }
  13254. }, debug: function debug() {
  13255. !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)));
  13256. }, verbose: function verbose() {
  13257. !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)));
  13258. }, error: function error() {
  13259. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13260. }, performance: { log: function log(e) {
  13261. var t, n;S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  13262. }, display: function display() {
  13263. var t = S.name + ":",
  13264. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13265. n += t["Execution Time"];
  13266. }), 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) {
  13267. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13268. }), console.groupEnd()), m = [];
  13269. } }, invoke: function invoke(t, n, o) {
  13270. var r,
  13271. s,
  13272. l,
  13273. c = I;return n = n || h, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13274. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13275. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);c = c[o];
  13276. }
  13277. })), 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;
  13278. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13279. }), a !== i ? a : this;
  13280. }, e.fn.sidebar.settings = { name: "Sidebar", namespace: "sidebar", silent: !1, debug: !1, verbose: !1, performance: !0, transition: "auto", mobileTransition: "auto", defaultTransition: { computer: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" }, mobile: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" } }, context: "body", exclusive: !1, closable: !0, dimPage: !0, scrollLock: !1, returnScroll: !1, delaySetup: !1, duration: 500, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, onHidden: function onHidden() {}, onVisible: function onVisible() {}, className: { active: "active", animating: "animating", dimmed: "dimmed", ios: "ios", pushable: "pushable", pushed: "pushed", right: "right", top: "top", left: "left", bottom: "bottom", visible: "visible" }, selector: { fixed: ".fixed", omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed", pusher: ".pusher", sidebar: ".ui.sidebar" }, regExp: { ios: /(iPad|iPhone|iPod)/g, mobileChrome: /(CriOS)/g, mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g }, error: { method: "The method you called is not defined.", pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element", movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag", overlay: "The overlay setting is no longer supported, use animation: overlay", notFound: "There were no elements that matched the specified selector" } };
  13281. }(jQuery, window, document), function (e, t, n, i) {
  13282. "use strict";
  13283. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13284. var a,
  13285. r = e(this),
  13286. s = r.selector || "",
  13287. l = new Date().getTime(),
  13288. c = [],
  13289. u = arguments[0],
  13290. d = "string" == typeof u,
  13291. f = [].slice.call(arguments, 1);return r.each(function () {
  13292. var r,
  13293. m,
  13294. g,
  13295. p,
  13296. h,
  13297. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13298. b = v.className,
  13299. y = v.namespace,
  13300. x = v.error,
  13301. C = "." + y,
  13302. w = "module-" + y,
  13303. S = e(this),
  13304. k = e(t),
  13305. T = e(v.scrollContext),
  13306. A = (S.selector, S.data(w)),
  13307. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13308. setTimeout(e, 0);
  13309. },
  13310. P = this;h = { initialize: function initialize() {
  13311. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13312. }, instantiate: function instantiate() {
  13313. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13314. }, destroy: function destroy() {
  13315. 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);
  13316. }, observeChanges: function observeChanges() {
  13317. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, { childList: !0, subtree: !0 }), p.observe(P, { childList: !0, subtree: !0 }), p.observe(m[0], { childList: !0, subtree: !0 }), h.debug("Setting up mutation observer", p));
  13318. }, determineContainer: function determineContainer() {
  13319. r = v.container ? e(v.container) : S.offsetParent();
  13320. }, determineContext: function determineContext() {
  13321. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13322. }, checkErrors: function checkErrors() {
  13323. 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);
  13324. }, bind: { events: function events() {
  13325. 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);
  13326. } }, event: { changed: function changed(e) {
  13327. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13328. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13329. }, 100);
  13330. }, documentChanged: function documentChanged(t) {
  13331. [].forEach.call(t, function (t) {
  13332. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13333. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13334. });
  13335. });
  13336. }, load: function load() {
  13337. h.verbose("Page contents finished loading"), R(h.refresh);
  13338. }, resize: function resize() {
  13339. h.verbose("Window resized"), R(h.refresh);
  13340. }, scroll: function scroll() {
  13341. R(function () {
  13342. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13343. });
  13344. }, scrollchange: function scrollchange(e, t) {
  13345. h.stick(t), v.onScroll.call(P);
  13346. } }, refresh: function refresh(e) {
  13347. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13348. }, supports: { sticky: function sticky() {
  13349. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13350. } }, save: { lastScroll: function lastScroll(e) {
  13351. h.lastScroll = e;
  13352. }, elementScroll: function elementScroll(e) {
  13353. h.elementScroll = e;
  13354. }, positions: function positions() {
  13355. var e = { height: T.height() },
  13356. t = { margin: { top: parseInt(S.css("margin-top"), 10), bottom: parseInt(S.css("margin-bottom"), 10) }, offset: S.offset(), width: S.outerWidth(), height: S.outerHeight() },
  13357. n = { offset: m.offset(), height: m.outerHeight() };r.outerHeight();h.is.standardScroll() || (h.debug("Non-standard scroll. Removing scroll offset from element offset"), e.top = T.scrollTop(), e.left = T.scrollLeft(), t.offset.top += e.top, n.offset.top += e.top, t.offset.left += e.left, n.offset.left += e.left), h.cache = { fits: t.height + v.offset <= e.height, sameHeight: t.height == n.height, scrollContext: { height: e.height }, element: { margin: t.margin, top: t.offset.top - t.margin.top, left: t.offset.left, width: t.width, height: t.height, bottom: t.offset.top + t.height }, context: { top: n.offset.top, height: n.height, bottom: n.offset.top + n.height } }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  13358. } }, get: { direction: function direction(e) {
  13359. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13360. }, scrollChange: function scrollChange(e) {
  13361. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13362. }, currentElementScroll: function currentElementScroll() {
  13363. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13364. }, elementScroll: function elementScroll(e) {
  13365. e = e || T.scrollTop();var t = h.cache.element,
  13366. n = h.cache.scrollContext,
  13367. i = h.get.scrollChange(e),
  13368. o = t.height - n.height + v.offset,
  13369. a = h.get.currentElementScroll(),
  13370. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13371. } }, remove: { lastScroll: function lastScroll() {
  13372. delete h.lastScroll;
  13373. }, elementScroll: function elementScroll(e) {
  13374. delete h.elementScroll;
  13375. }, minimumSize: function minimumSize() {
  13376. r.css("min-height", "");
  13377. }, offset: function offset() {
  13378. S.css("margin-top", "");
  13379. } }, set: { offset: function offset() {
  13380. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13381. }, containerSize: function containerSize() {
  13382. var e = r.get(0).tagName;"HTML" === e || "body" == e ? h.determineContainer() : Math.abs(r.outerHeight() - h.cache.context.height) > v.jitter && (h.debug("Context has padding, specifying exact height for container", h.cache.context.height), r.css({ height: h.cache.context.height }));
  13383. }, minimumSize: function minimumSize() {
  13384. var e = h.cache.element;r.css("min-height", e.height);
  13385. }, scroll: function scroll(e) {
  13386. 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));
  13387. }, size: function size() {
  13388. 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"));
  13389. } }, is: { standardScroll: function standardScroll() {
  13390. return T[0] == t;
  13391. }, top: function top() {
  13392. return S.hasClass(b.top);
  13393. }, bottom: function bottom() {
  13394. return S.hasClass(b.bottom);
  13395. }, initialPosition: function initialPosition() {
  13396. return !h.is.fixed() && !h.is.bound();
  13397. }, hidden: function hidden() {
  13398. return !S.is(":visible");
  13399. }, bound: function bound() {
  13400. return S.hasClass(b.bound);
  13401. }, fixed: function fixed() {
  13402. return S.hasClass(b.fixed);
  13403. } }, stick: function stick(e) {
  13404. var t = e || T.scrollTop(),
  13405. n = h.cache,
  13406. i = n.fits,
  13407. o = n.sameHeight,
  13408. a = n.element,
  13409. r = n.scrollContext,
  13410. s = n.context,
  13411. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13412. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13413. u = !i;0 !== a.height && !o && (h.is.initialPosition() ? e.top >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : e.top > a.top && (a.height + e.top - c >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : (h.debug("Initial element position is fixed"), h.fixTop())) : h.is.fixed() ? h.is.top() ? e.top <= a.top ? (h.debug("Fixed element reached top of container"), h.setInitialPosition()) : a.height + e.top - c >= s.bottom ? (h.debug("Fixed element reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c)) : h.is.bottom() && (e.bottom - a.height <= a.top ? (h.debug("Bottom fixed rail has reached top of container"), h.setInitialPosition()) : e.bottom >= s.bottom ? (h.debug("Bottom fixed rail has reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c))) : h.is.bottom() && (e.top <= a.top ? (h.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"), h.setInitialPosition()) : v.pushing ? h.is.bound() && e.bottom <= s.bottom && (h.debug("Fixing bottom attached element to bottom of browser."), h.fixBottom()) : h.is.bound() && e.top <= s.bottom - a.height && (h.debug("Fixing bottom attached element to top of browser."), h.fixTop())));
  13414. }, bindTop: function bindTop() {
  13415. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({ left: "", top: "", marginBottom: "" }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  13416. }, bindBottom: function bindBottom() {
  13417. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({ left: "", top: "" }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  13418. }, setInitialPosition: function setInitialPosition() {
  13419. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13420. }, fixTop: function fixTop() {
  13421. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  13422. }, fixBottom: function fixBottom() {
  13423. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  13424. }, unbind: function unbind() {
  13425. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13426. }, unfix: function unfix() {
  13427. 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));
  13428. }, reset: function reset() {
  13429. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13430. }, resetCSS: function resetCSS() {
  13431. S.css({ width: "", height: "" }), r.css({ height: "" });
  13432. }, setting: function setting(t, n) {
  13433. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13434. if (n === i) return v[t];v[t] = n;
  13435. }
  13436. }, internal: function internal(t, n) {
  13437. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13438. if (n === i) return h[t];h[t] = n;
  13439. }
  13440. }, debug: function debug() {
  13441. !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)));
  13442. }, verbose: function verbose() {
  13443. !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)));
  13444. }, error: function error() {
  13445. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13446. }, performance: { log: function log(e) {
  13447. var t, n;v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  13448. }, display: function display() {
  13449. var t = v.name + ":",
  13450. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13451. n += t["Execution Time"];
  13452. }), 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) {
  13453. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13454. }), console.groupEnd()), c = [];
  13455. } }, invoke: function invoke(t, n, o) {
  13456. var r,
  13457. s,
  13458. l,
  13459. c = A;return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13460. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13461. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13462. }
  13463. })), 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;
  13464. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13465. }), a !== i ? a : this;
  13466. }, e.fn.sticky.settings = { name: "Sticky", namespace: "sticky", silent: !1, debug: !1, verbose: !0, performance: !0, pushing: !1, context: !1, container: !1, scrollContext: t, offset: 0, bottomOffset: 0, jitter: 5, setSize: !0, observeChanges: !1, onReposition: function onReposition() {}, onScroll: function onScroll() {}, onStick: function onStick() {}, onUnstick: function onUnstick() {}, onTop: function onTop() {}, onBottom: function onBottom() {}, error: { container: "Sticky element must be inside a relative container", visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.", method: "The method you called is not defined.", invalidContext: "Context specified does not exist", elementSize: "Sticky element is larger than its container, cannot create sticky." }, className: { bound: "bound", fixed: "fixed", supported: "native", top: "top", bottom: "bottom" } };
  13467. }(jQuery, window, document), function (e, t, n, i) {
  13468. "use strict";
  13469. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13470. var a,
  13471. r = e.isFunction(this) ? e(t) : e(this),
  13472. s = r.selector || "",
  13473. l = new Date().getTime(),
  13474. c = [],
  13475. u = arguments[0],
  13476. d = "string" == typeof u,
  13477. f = [].slice.call(arguments, 1),
  13478. m = !1;return r.each(function () {
  13479. var g,
  13480. p,
  13481. h,
  13482. v,
  13483. b,
  13484. y,
  13485. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13486. C = x.className,
  13487. w = x.metadata,
  13488. S = x.selector,
  13489. k = x.error,
  13490. T = "." + x.namespace,
  13491. A = "module-" + x.namespace,
  13492. R = e(this),
  13493. P = {},
  13494. E = !0,
  13495. F = 0,
  13496. O = this,
  13497. D = R.data(A);b = { initialize: function initialize() {
  13498. 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();
  13499. }, instantiate: function instantiate() {
  13500. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13501. }, destroy: function destroy() {
  13502. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13503. }, bind: { events: function events() {
  13504. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13505. } }, determineTabs: function determineTabs() {
  13506. var t;"parent" === x.context ? (R.closest(S.ui).length > 0 ? (t = R.closest(S.ui), b.verbose("Using closest UI element as parent", t)) : t = R, g = t.parent(), b.verbose("Determined parent element for creating context", g)) : x.context ? (g = e(x.context), b.verbose("Using selector for tab context", x.context, g)) : g = e("body"), x.childrenOnly ? (p = g.children(S.tabs), b.debug("Searching tab context children for tabs", g, p)) : (p = g.find(S.tabs), b.debug("Searching tab context for tabs", g, p));
  13507. }, fix: { callbacks: function callbacks() {
  13508. 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));
  13509. } }, initializeHistory: function initializeHistory() {
  13510. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13511. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13512. }e.address.bind("change", b.event.history.change);
  13513. }, event: { click: function click(t) {
  13514. var n = e(this).data(w.tab);n !== i ? (x.history ? (b.verbose("Updating page state", t), e.address.value(n)) : (b.verbose("Changing tab", t), b.changeTab(n)), t.preventDefault()) : b.debug("No tab specified");
  13515. }, history: { change: function change(t) {
  13516. var n = t.pathNames.join("/") || b.get.initialPath(),
  13517. o = x.templates.determineTitle(n) || !1;b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  13518. } } }, refresh: function refresh() {
  13519. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13520. }, cache: { read: function read(e) {
  13521. return e !== i && P[e];
  13522. }, add: function add(e, t) {
  13523. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13524. }, remove: function remove(e) {
  13525. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13526. } }, set: { auto: function auto() {
  13527. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = { url: t };
  13528. }, loading: function loading(e) {
  13529. var t = b.get.tabElement(e);t.hasClass(C.loading) || (b.verbose("Setting loading state for", t), t.addClass(C.loading).siblings(p).removeClass(C.active + " " + C.loading), t.length > 0 && x.onRequest.call(t[0], e));
  13530. }, state: function state(t) {
  13531. e.address.value(t);
  13532. } }, changeTab: function changeTab(n) {
  13533. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13534. o = x.auto || e.isPlainObject(x.apiSettings),
  13535. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13536. var s,
  13537. l,
  13538. c,
  13539. u,
  13540. d = a.slice(0, t + 1),
  13541. f = b.utilities.arrayToPath(d),
  13542. m = b.is.tab(f),
  13543. p = t + 1 == a.length,
  13544. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13545. if (b.verbose("Tab was found", r), h = f, v = b.utilities.filterArray(a, d), p ? u = !0 : (l = a.slice(0, t + 2), c = b.utilities.arrayToPath(l), (u = !b.is.tab(c)) && b.verbose("Tab parameters found", l)), u && o) return i ? (b.debug("Ignoring remote content on first tab load", f), E = !1, b.cache.add(n, S.html()), b.activate.all(f), x.onFirstLoad.call(S[0], f, v, y), x.onLoad.call(S[0], f, v, y)) : (b.activate.navigation(f), b.fetch.content(f, n)), !1;b.debug("Opened local tab", f), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y);
  13546. } else {
  13547. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;if (f = (s = e("#" + n + ', a[name="' + n + '"]')).closest("[data-tab]").data(w.tab), S = b.get.tabElement(f), s && s.length > 0 && f) return b.debug("Anchor link used, opening parent tab", S, s), S.hasClass(C.active) || setTimeout(function () {
  13548. b.scrollTo(s);
  13549. }, 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;
  13550. }
  13551. });
  13552. }, scrollTo: function scrollTo(t) {
  13553. var i = !!(t && t.length > 0) && t.offset().top;!1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  13554. }, update: { content: function content(t, n, o) {
  13555. var a = b.get.tabElement(t),
  13556. r = a[0];o = o !== i ? o : x.evaluateScripts, "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && "string" != typeof n ? a.empty().append(e(n).clone(!0)) : o ? (b.debug("Updating HTML and evaluating inline scripts", t, n), a.html(n)) : (b.debug("Updating HTML", t, n), r.innerHTML = n);
  13557. } }, fetch: { content: function content(t, n) {
  13558. var o,
  13559. a,
  13560. r = b.get.tabElement(t),
  13561. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13562. "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 () {
  13563. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13564. }, 0) : b.cache.add(n, r.html());
  13565. }, urlData: { tab: n } },
  13566. l = r.api("get request") || !1,
  13567. c = l && "pending" === l.state();n = n || t, a = b.cache.read(n), x.cache && a ? (b.activate.tab(t), b.debug("Adding cached content", n), x.loadOnce || ("once" == x.evaluateScripts ? b.update.content(t, a, !1) : b.update.content(t, a)), x.onLoad.call(r[0], t, v, y)) : c ? (b.set.loading(t), b.debug("Content is already loading", n)) : e.api !== i ? (o = e.extend(!0, {}, x.apiSettings, s), b.debug("Retrieving remote content", n, o), b.set.loading(t), r.api(o)) : b.error(k.api);
  13568. } }, activate: { all: function all(e) {
  13569. b.activate.tab(e), b.activate.navigation(e);
  13570. }, tab: function tab(e) {
  13571. var t = b.get.tabElement(e),
  13572. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13573. i = t.hasClass(C.active);b.verbose("Showing tab content for", t), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading), t.length > 0 && x.onVisible.call(t[0], e));
  13574. }, navigation: function navigation(e) {
  13575. var t = b.get.navElement(e),
  13576. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13577. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13578. } }, deactivate: { all: function all() {
  13579. b.deactivate.navigation(), b.deactivate.tabs();
  13580. }, navigation: function navigation() {
  13581. r.removeClass(C.active);
  13582. }, tabs: function tabs() {
  13583. p.removeClass(C.active + " " + C.loading);
  13584. } }, is: { tab: function tab(e) {
  13585. return e !== i && b.get.tabElement(e).length > 0;
  13586. } }, get: { initialPath: function initialPath() {
  13587. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13588. }, path: function path() {
  13589. return e.address.value();
  13590. }, defaultPathArray: function defaultPathArray(e) {
  13591. return b.utilities.pathToArray(b.get.defaultPath(e));
  13592. }, defaultPath: function defaultPath(e) {
  13593. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13594. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13595. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13596. }, navElement: function navElement(e) {
  13597. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13598. }, tabElement: function tabElement(e) {
  13599. var t, n, i, o;return e = e || h, i = b.utilities.pathToArray(e), o = b.utilities.last(i), t = p.filter("[data-" + w.tab + '="' + e + '"]'), n = p.filter("[data-" + w.tab + '="' + o + '"]'), t.length > 0 ? t : n;
  13600. }, tab: function tab() {
  13601. return h;
  13602. } }, utilities: { filterArray: function filterArray(t, n) {
  13603. return e.grep(t, function (t) {
  13604. return -1 == e.inArray(t, n);
  13605. });
  13606. }, last: function last(t) {
  13607. return !!e.isArray(t) && t[t.length - 1];
  13608. }, pathToArray: function pathToArray(e) {
  13609. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13610. }, arrayToPath: function arrayToPath(t) {
  13611. return !!e.isArray(t) && t.join("/");
  13612. } }, setting: function setting(t, n) {
  13613. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13614. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13615. }
  13616. }, internal: function internal(t, n) {
  13617. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13618. if (n === i) return b[t];b[t] = n;
  13619. }
  13620. }, debug: function debug() {
  13621. !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)));
  13622. }, verbose: function verbose() {
  13623. !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)));
  13624. }, error: function error() {
  13625. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13626. }, performance: { log: function log(e) {
  13627. var t, n;x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: O, "Execution Time": n })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  13628. }, display: function display() {
  13629. var t = x.name + ":",
  13630. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13631. n += t["Execution Time"];
  13632. }), 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) {
  13633. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13634. }), console.groupEnd()), c = [];
  13635. } }, invoke: function invoke(t, n, o) {
  13636. var r,
  13637. s,
  13638. l,
  13639. c = D;return n = n || f, o = O || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13640. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13641. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);c = c[o];
  13642. }
  13643. })), 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;
  13644. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13645. }), a !== i ? a : this;
  13646. }, e.tab = function () {
  13647. e(t).tab.apply(this, arguments);
  13648. }, e.fn.tab.settings = { name: "Tab", namespace: "tab", silent: !1, debug: !1, verbose: !1, performance: !0, auto: !1, history: !1, historyType: "hash", path: !1, context: !1, childrenOnly: !1, maxDepth: 25, deactivate: "siblings", alwaysRefresh: !1, cache: !0, loadOnce: !1, cacheType: "response", ignoreFirstLoad: !1, apiSettings: !1, evaluateScripts: "once", onFirstLoad: function onFirstLoad(e, t, n) {}, onLoad: function onLoad(e, t, n) {}, onVisible: function onVisible(e, t, n) {}, onRequest: function onRequest(e, t, n) {}, templates: { determineTitle: function determineTitle(e) {} }, error: { api: "You attempted to load content without API module", method: "The method you called is not defined", missingTab: "Activated tab cannot be found. Tabs are case-sensitive.", noContent: "The tab you specified is missing a content url.", path: "History enabled, but no path was specified", recursion: "Max recursive depth reached", legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.", legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code", state: "History requires Asual's Address library <https://github.com/asual/jquery-address>" }, metadata: { tab: "tab", loaded: "loaded", promise: "promise" }, className: { loading: "loading", active: "active" }, selector: { tabs: ".ui.tab", ui: ".ui" } };
  13649. }(jQuery, window, document), function (e, t, n, i) {
  13650. "use strict";
  13651. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  13652. var o,
  13653. a = e(this),
  13654. r = a.selector || "",
  13655. s = new Date().getTime(),
  13656. l = [],
  13657. c = arguments,
  13658. u = c[0],
  13659. d = [].slice.call(arguments, 1),
  13660. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13661. var m,
  13662. g,
  13663. p,
  13664. h,
  13665. v,
  13666. b,
  13667. y,
  13668. x,
  13669. C,
  13670. w = e(this),
  13671. S = this;(C = { initialize: function initialize() {
  13672. 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());
  13673. }, instantiate: function instantiate() {
  13674. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13675. }, destroy: function destroy() {
  13676. C.verbose("Destroying previous module for", S), w.removeData(y);
  13677. }, refresh: function refresh() {
  13678. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13679. }, forceRepaint: function forceRepaint() {
  13680. C.verbose("Forcing element repaint");var e = w.parent(),
  13681. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13682. }, repaint: function repaint() {
  13683. C.verbose("Repainting element");S.offsetWidth;
  13684. }, delay: function delay(e) {
  13685. var n,
  13686. o = C.get.animationDirection();o || (o = C.can.transition() ? C.get.direction() : "static"), e = e !== i ? e : m.interval, n = "auto" == m.reverse && o == h.outward || 1 == m.reverse ? (a.length - t) * m.interval : t * m.interval, C.debug("Delaying animation by", n), setTimeout(C.animate, n);
  13687. }, animate: function animate(e) {
  13688. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13689. if (m.queue) return !m.allowRepeats && C.has.direction() && C.is.occurring() && !0 !== C.queuing ? C.debug("Animation is currently occurring, preventing queueing same animation", m.animation) : C.queue(m.animation), !1;if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;C.debug("New animation started, completing previous early", m.animation), g.complete();
  13690. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13691. }, reset: function reset() {
  13692. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13693. }, queue: function queue(e) {
  13694. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13695. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13696. });
  13697. }, complete: function complete(e) {
  13698. 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)));
  13699. }, force: { visible: function visible() {
  13700. var e = w.attr("style"),
  13701. t = C.get.userStyle(),
  13702. n = C.get.displayType(),
  13703. o = t + "display: " + n + " !important;",
  13704. a = w.css("display"),
  13705. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13706. }, hidden: function hidden() {
  13707. var e = w.attr("style"),
  13708. t = w.css("display"),
  13709. n = e === i || "" === e;"none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  13710. } }, has: { direction: function direction(t) {
  13711. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13712. t !== h.inward && t !== h.outward || (n = !0);
  13713. })), n;
  13714. }, inlineDisplay: function inlineDisplay() {
  13715. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13716. } }, set: { animating: function animating(e) {
  13717. var t;C.remove.completeCallback(), e = e || m.animation, t = C.get.animationClass(e), C.save.animation(t), C.force.visible(), C.remove.hidden(), C.remove.direction(), C.start.animation(t);
  13718. }, duration: function duration(e, t) {
  13719. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13720. }, direction: function direction(e) {
  13721. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13722. }, looping: function looping() {
  13723. C.debug("Transition set to loop"), w.addClass(h.looping);
  13724. }, hidden: function hidden() {
  13725. w.addClass(h.transition).addClass(h.hidden);
  13726. }, inward: function inward() {
  13727. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13728. }, outward: function outward() {
  13729. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13730. }, visible: function visible() {
  13731. w.addClass(h.transition).addClass(h.visible);
  13732. } }, start: { animation: function animation(e) {
  13733. 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);
  13734. } }, save: { animation: function animation(e) {
  13735. C.cache || (C.cache = {}), C.cache.animation = e;
  13736. }, displayType: function displayType(e) {
  13737. "none" !== e && w.data(v.displayType, e);
  13738. }, transitionExists: function transitionExists(t, n) {
  13739. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13740. } }, restore: { conditions: function conditions() {
  13741. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13742. } }, add: { failSafe: function failSafe() {
  13743. var e = C.get.duration();C.timer = setTimeout(function () {
  13744. w.triggerHandler(b);
  13745. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13746. } }, remove: { animating: function animating() {
  13747. w.removeClass(h.animating);
  13748. }, animationCallbacks: function animationCallbacks() {
  13749. C.remove.queueCallback(), C.remove.completeCallback();
  13750. }, queueCallback: function queueCallback() {
  13751. w.off(".queue" + x);
  13752. }, completeCallback: function completeCallback() {
  13753. w.off(".complete" + x);
  13754. }, display: function display() {
  13755. w.css("display", "");
  13756. }, direction: function direction() {
  13757. w.removeClass(h.inward).removeClass(h.outward);
  13758. }, duration: function duration() {
  13759. w.css("animation-duration", "");
  13760. }, failSafe: function failSafe() {
  13761. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13762. }, hidden: function hidden() {
  13763. w.removeClass(h.hidden);
  13764. }, visible: function visible() {
  13765. w.removeClass(h.visible);
  13766. }, looping: function looping() {
  13767. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13768. }, transition: function transition() {
  13769. w.removeClass(h.visible).removeClass(h.hidden);
  13770. } }, get: { settings: function settings(t, n, i) {
  13771. return "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: i, duration: n }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, duration: n }) : "object" == (typeof n === "undefined" ? "undefined" : _typeof(n)) ? e.extend({}, e.fn.transition.settings, n, { animation: t }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: n }) : e.extend({}, e.fn.transition.settings, { animation: t });
  13772. }, animationClass: function animationClass(e) {
  13773. var t = e || m.animation,
  13774. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13775. }, currentAnimation: function currentAnimation() {
  13776. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13777. }, currentDirection: function currentDirection() {
  13778. return C.is.inward() ? h.inward : h.outward;
  13779. }, direction: function direction() {
  13780. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13781. }, animationDirection: function animationDirection(t) {
  13782. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13783. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13784. })), n || !1;
  13785. }, duration: function duration(e) {
  13786. 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;
  13787. }, displayType: function displayType(e) {
  13788. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13789. }, userStyle: function userStyle(e) {
  13790. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13791. }, transitionExists: function transitionExists(t) {
  13792. return e.fn.transition.exists[t];
  13793. }, animationStartEvent: function animationStartEvent() {
  13794. var e,
  13795. t = n.createElement("div"),
  13796. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13797. if (t.style[e] !== i) return o[e];
  13798. }return !1;
  13799. }, animationEndEvent: function animationEndEvent() {
  13800. var e,
  13801. t = n.createElement("div"),
  13802. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13803. if (t.style[e] !== i) return o[e];
  13804. }return !1;
  13805. } }, can: { transition: function transition(t) {
  13806. var n,
  13807. o,
  13808. a,
  13809. r,
  13810. s,
  13811. l,
  13812. c = m.animation,
  13813. u = C.get.transitionExists(c),
  13814. d = C.get.displayType(!1);if (u === i || t) {
  13815. 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 {
  13816. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13817. }C.save.transitionExists(c, l);
  13818. }return u !== i ? u : l;
  13819. }, animate: function animate() {
  13820. return C.can.transition() !== i;
  13821. } }, is: { animating: function animating() {
  13822. return w.hasClass(h.animating);
  13823. }, inward: function inward() {
  13824. return w.hasClass(h.inward);
  13825. }, outward: function outward() {
  13826. return w.hasClass(h.outward);
  13827. }, looping: function looping() {
  13828. return w.hasClass(h.looping);
  13829. }, occurring: function occurring(e) {
  13830. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13831. }, visible: function visible() {
  13832. return w.is(":visible");
  13833. }, hidden: function hidden() {
  13834. return "hidden" === w.css("visibility");
  13835. }, supported: function supported() {
  13836. return !1 !== b;
  13837. } }, hide: function hide() {
  13838. 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);
  13839. }, show: function show(e) {
  13840. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13841. }, toggle: function toggle() {
  13842. C.is.visible() ? C.hide() : C.show();
  13843. }, stop: function stop() {
  13844. C.debug("Stopping current animation"), w.triggerHandler(b);
  13845. }, stopAll: function stopAll() {
  13846. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13847. }, clear: { queue: function queue() {
  13848. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13849. } }, enable: function enable() {
  13850. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13851. }, disable: function disable() {
  13852. C.debug("Stopping animation"), w.addClass(h.disabled);
  13853. }, setting: function setting(t, n) {
  13854. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13855. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13856. }
  13857. }, internal: function internal(t, n) {
  13858. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13859. if (n === i) return C[t];C[t] = n;
  13860. }
  13861. }, debug: function debug() {
  13862. !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)));
  13863. }, verbose: function verbose() {
  13864. !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)));
  13865. }, error: function error() {
  13866. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13867. }, performance: { log: function log(e) {
  13868. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: S, "Execution Time": n })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  13869. }, display: function display() {
  13870. var t = m.name + ":",
  13871. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13872. n += t["Execution Time"];
  13873. }), 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) {
  13874. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13875. }), console.groupEnd()), l = [];
  13876. } }, invoke: function invoke(t, n, a) {
  13877. var r,
  13878. s,
  13879. l,
  13880. c = g;return n = n || d, a = S || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13881. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13882. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13883. }
  13884. })), 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;
  13885. } }).initialize();
  13886. }), o !== i ? o : this;
  13887. }, e.fn.transition.exists = {}, e.fn.transition.settings = { name: "Transition", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "transition", interval: 0, reverse: "auto", onStart: function onStart() {}, onComplete: function onComplete() {}, onShow: function onShow() {}, onHide: function onHide() {}, useFailSafe: !0, failSafeDelay: 100, allowRepeats: !1, displayType: !1, animation: "fade", duration: !1, queue: !0, metadata: { displayType: "display" }, className: { animating: "animating", disabled: "disabled", hidden: "hidden", inward: "in", loading: "loading", looping: "looping", outward: "out", transition: "transition", visible: "visible" }, error: { noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.", repeated: "That animation is already occurring, cancelling repeated animation", method: "The method you called is not defined", support: "This browser does not support CSS animations" } };
  13888. }(jQuery, window, document), function (e, t, n, i) {
  13889. "use strict";
  13890. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();e.api = e.fn.api = function (n) {
  13891. var o,
  13892. a = e.isFunction(this) ? e(t) : e(this),
  13893. r = a.selector || "",
  13894. s = new Date().getTime(),
  13895. l = [],
  13896. c = arguments[0],
  13897. u = "string" == typeof c,
  13898. d = [].slice.call(arguments, 1);return a.each(function () {
  13899. var a,
  13900. f,
  13901. m,
  13902. g,
  13903. p,
  13904. h,
  13905. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13906. b = v.namespace,
  13907. y = v.metadata,
  13908. x = v.selector,
  13909. C = v.error,
  13910. w = v.className,
  13911. S = "." + b,
  13912. k = "module-" + b,
  13913. T = e(this),
  13914. A = T.closest(x.form),
  13915. R = v.stateContext ? e(v.stateContext) : T,
  13916. P = this,
  13917. E = R[0],
  13918. F = T.data(k);h = { initialize: function initialize() {
  13919. u || h.bind.events(), h.instantiate();
  13920. }, instantiate: function instantiate() {
  13921. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13922. }, destroy: function destroy() {
  13923. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13924. }, bind: { events: function events() {
  13925. var e = h.get.event();e ? (h.verbose("Attaching API events to element", e), T.on(e + S, h.event.trigger)) : "now" == v.on && (h.debug("Querying API endpoint immediately"), h.query());
  13926. } }, decode: { json: function json(e) {
  13927. if (e !== i && "string" == typeof e) try {
  13928. e = JSON.parse(e);
  13929. } catch (e) {}return e;
  13930. } }, read: { cachedResponse: function cachedResponse(e) {
  13931. var n;if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);h.error(C.noStorage);
  13932. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13933. 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);
  13934. } }, query: function query() {
  13935. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13936. if (h.is.loading()) {
  13937. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13938. }if (v.defaultData && e.extend(!0, v.urlData, h.get.defaultData()), v.serializeForm && (v.data = h.add.formData(v.data)), !1 === (f = h.get.settings())) return h.cancelled = !0, void h.error(C.beforeSend);if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  13939. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13940. if (f.url = v.base + m, a = e.extend(!0, {}, v, { type: v.method || v.type, data: g, url: v.base + m, beforeSend: v.beforeXHR, success: function success() {}, failure: function failure() {}, complete: function complete() {} }), h.debug("Querying URL", a.url), h.verbose("Using AJAX settings", a), "local" === v.cache && h.read.cachedResponse(m)) return h.debug("Response returned from local cache"), h.request = h.create.request(), void h.request.resolveWith(E, [h.read.cachedResponse(m)]);v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  13941. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13942. }, 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());
  13943. }
  13944. } else h.error(C.missingURL);
  13945. }
  13946. }, should: { removeError: function removeError() {
  13947. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13948. } }, is: { disabled: function disabled() {
  13949. return T.filter(x.disabled).length > 0;
  13950. }, expectingJSON: function expectingJSON() {
  13951. return "json" === v.dataType || "jsonp" === v.dataType;
  13952. }, form: function form() {
  13953. return T.is("form") || R.is("form");
  13954. }, mocked: function mocked() {
  13955. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13956. }, input: function input() {
  13957. return T.is("input");
  13958. }, loading: function loading() {
  13959. return !!h.request && "pending" == h.request.state();
  13960. }, abortedRequest: function abortedRequest(e) {
  13961. 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);
  13962. }, validResponse: function validResponse(t) {
  13963. 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);
  13964. } }, was: { cancelled: function cancelled() {
  13965. return h.cancelled || !1;
  13966. }, succesful: function succesful() {
  13967. return h.request && "resolved" == h.request.state();
  13968. }, failure: function failure() {
  13969. return h.request && "rejected" == h.request.state();
  13970. }, complete: function complete() {
  13971. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  13972. } }, add: { urlData: function urlData(t, n) {
  13973. var o, a;return t && (o = t.match(v.regExp.required), a = t.match(v.regExp.optional), n = n || v.urlData, o && (h.debug("Looking for required URL variables", o), e.each(o, function (o, a) {
  13974. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  13975. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  13976. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  13977. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  13978. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];s !== i ? (h.verbose("Optional variable Found", r, s), t = t.replace(a, s)) : (h.verbose("Optional variable not found", r), t = -1 !== t.indexOf("/" + a) ? t.replace("/" + a, "") : t.replace(a, ""));
  13979. }))), t;
  13980. }, formData: function formData(t) {
  13981. var n = e.fn.serializeObject !== i,
  13982. o = n ? A.serializeObject() : A.serialize();return t = t || v.data, e.isPlainObject(t) ? n ? (h.debug("Extending existing data with form data", t, o), t = e.extend(!0, {}, t, o)) : (h.error(C.missingSerialize), h.debug("Cant extend data. Replacing data with form data", t, o), t = o) : (h.debug("Adding form data", o), t = o), t;
  13983. } }, send: { request: function request() {
  13984. 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);
  13985. } }, event: { trigger: function trigger(e) {
  13986. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  13987. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  13988. var o = this,
  13989. a = new Date().getTime() - p,
  13990. r = v.loadingDuration - a,
  13991. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));r = r > 0 ? r : 0, s && (h.debug("Modified API response in onResponse callback", v.onResponse, s, t), t = s), r > 0 && h.debug("Response completed early delaying state change by", r), setTimeout(function () {
  13992. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  13993. }, r);
  13994. }, fail: function fail(e, t, n) {
  13995. var i = this,
  13996. o = new Date().getTime() - p,
  13997. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  13998. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  13999. }, a);
  14000. } }, request: { done: function done(e, t) {
  14001. 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);
  14002. }, complete: function complete(e, t) {
  14003. var n, i;h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  14004. }, fail: function fail(e, t, n) {
  14005. var o = h.get.responseFromXHR(e),
  14006. r = h.get.errorFromRequest(o, t, n);if ("aborted" == t) return h.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)", t, n), v.onAbort.call(E, t, T, e), !0;"invalid" == t ? h.debug("JSON did not pass success test. A server-side error has most likely occurred", o) : "error" == t && e !== i && (h.debug("XHR produced a server error", t, n), 200 != e.status && n !== i && "" !== n && h.error(C.statusMessage + n, a.url), v.onError.call(E, r, T, e)), v.errorDuration && "aborted" !== t && (h.debug("Adding error state"), h.set.error(), h.should.removeError() && setTimeout(h.remove.error, v.errorDuration)), h.debug("API Request failed", r, e), v.onFailure.call(E, o, T, e);
  14007. } } }, create: { request: function request() {
  14008. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  14009. }, mockedXHR: function mockedXHR() {
  14010. var t,
  14011. n,
  14012. i,
  14013. o = v.mockResponse || v.response,
  14014. a = v.mockResponseAsync || v.responseAsync;return i = e.Deferred().always(h.event.xhr.complete).done(h.event.xhr.done).fail(h.event.xhr.fail), o ? (e.isFunction(o) ? (h.debug("Using specified synchronous callback", o), n = o.call(E, f)) : (h.debug("Using settings specified response", o), n = o), i.resolveWith(E, [n, !1, { responseText: n }])) : e.isFunction(a) && (t = function t(e) {
  14015. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  14016. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  14017. }, xhr: function xhr() {
  14018. var t;return t = e.ajax(a).always(h.event.xhr.always).done(h.event.xhr.done).fail(h.event.xhr.fail), h.verbose("Created server request", t, a), t;
  14019. } }, set: { error: function error() {
  14020. h.verbose("Adding error state to element", R), R.addClass(w.error);
  14021. }, loading: function loading() {
  14022. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  14023. } }, remove: { error: function error() {
  14024. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  14025. }, loading: function loading() {
  14026. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  14027. } }, get: { responseFromXHR: function responseFromXHR(t) {
  14028. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  14029. }, errorFromRequest: function errorFromRequest(t, n, o) {
  14030. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  14031. }, request: function request() {
  14032. return h.request || !1;
  14033. }, xhr: function xhr() {
  14034. return h.xhr || !1;
  14035. }, settings: function settings() {
  14036. var t;return (t = v.beforeSend.call(E, v)) && (t.success !== i && (h.debug("Legacy success callback detected", t), h.error(C.legacyParameters, t.success), t.onSuccess = t.success), t.failure !== i && (h.debug("Legacy failure callback detected", t), h.error(C.legacyParameters, t.failure), t.onFailure = t.failure), t.complete !== i && (h.debug("Legacy complete callback detected", t), h.error(C.legacyParameters, t.complete), t.onComplete = t.complete)), t === i && h.error(C.noReturnedValue), !1 === t ? t : t !== i ? e.extend(!0, {}, t) : e.extend(!0, {}, v);
  14037. }, urlEncodedValue: function urlEncodedValue(e) {
  14038. var n = t.decodeURIComponent(e),
  14039. i = t.encodeURIComponent(e);return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  14040. }, defaultData: function defaultData() {
  14041. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  14042. }, event: function event() {
  14043. 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;
  14044. }, templatedURL: function templatedURL(e) {
  14045. if (e = e || T.data(y.action) || v.action || !1, m = T.data(y.url) || v.url || !1) return h.debug("Using specified url", m), m;if (e) {
  14046. if (h.debug("Looking up url for action", e, v.api), v.api[e] === i && !h.is.mocked()) return void h.error(C.missingAction, v.action, v.api);m = v.api[e];
  14047. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));return m;
  14048. } }, abort: function abort() {
  14049. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  14050. }, reset: function reset() {
  14051. h.remove.error(), h.remove.loading();
  14052. }, setting: function setting(t, n) {
  14053. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  14054. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  14055. }
  14056. }, internal: function internal(t, n) {
  14057. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  14058. if (n === i) return h[t];h[t] = n;
  14059. }
  14060. }, debug: function debug() {
  14061. !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)));
  14062. }, verbose: function verbose() {
  14063. !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)));
  14064. }, error: function error() {
  14065. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  14066. }, performance: { log: function log(e) {
  14067. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  14068. }, display: function display() {
  14069. var t = v.name + ":",
  14070. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  14071. n += t["Execution Time"];
  14072. }), 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) {
  14073. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14074. }), console.groupEnd()), l = [];
  14075. } }, invoke: function invoke(t, n, a) {
  14076. var r,
  14077. s,
  14078. l,
  14079. c = F;return n = n || d, a = P || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  14080. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14081. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);c = c[o];
  14082. }
  14083. })), 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;
  14084. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  14085. }), o !== i ? o : this;
  14086. }, e.api.settings = { name: "API", namespace: "api", debug: !1, verbose: !1, performance: !0, api: {}, cache: !0, interruptRequests: !0, on: "auto", stateContext: !1, loadingDuration: 0, hideError: "auto", errorDuration: 2e3, encodeParameters: !0, action: !1, url: !1, base: "", urlData: {}, defaultData: !0, serializeForm: !1, throttle: 0, throttleFirstRequest: !0, method: "get", data: {}, dataType: "json", mockResponse: !1, mockResponseAsync: !1, response: !1, responseAsync: !1, beforeSend: function beforeSend(e) {
  14087. return e;
  14088. }, beforeXHR: function beforeXHR(e) {}, onRequest: function onRequest(e, t) {}, onResponse: !1, onSuccess: function onSuccess(e, t) {}, onComplete: function onComplete(e, t) {}, onFailure: function onFailure(e, t) {}, onError: function onError(e, t) {}, onAbort: function onAbort(e, t) {}, successTest: !1, error: { beforeSend: "The before send function has aborted the request", error: "There was an error with your request", exitConditions: "API Request Aborted. Exit conditions met", JSONParse: "JSON could not be parsed during error handling", legacyParameters: "You are using legacy API success callback names", method: "The method you called is not defined", missingAction: "API action used but no url was defined", missingSerialize: "jquery-serialize-object is required to add form data to an existing data object", missingURL: "No URL specified for api event", noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.", noStorage: "Caching responses locally requires session storage", parseError: "There was an error parsing your request", requiredParameter: "Missing a required URL parameter: ", statusMessage: "Server gave an error: ", timeout: "Your request timed out" }, regExp: { required: /\{\$*[A-z0-9]+\}/g, optional: /\{\/\$*[A-z0-9]+\}/g }, className: { loading: "loading", error: "error" }, selector: { disabled: ".disabled", form: "form" }, metadata: { action: "action", url: "url" } };
  14089. }(jQuery, window, document), function (e, t, n, i) {
  14090. "use strict";
  14091. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  14092. var a,
  14093. r = e(this),
  14094. s = r.selector || "",
  14095. l = new Date().getTime(),
  14096. c = [],
  14097. u = arguments[0],
  14098. d = "string" == typeof u,
  14099. f = [].slice.call(arguments, 1),
  14100. m = r.length,
  14101. g = 0;return r.each(function () {
  14102. var r,
  14103. p,
  14104. h,
  14105. v,
  14106. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  14107. y = b.className,
  14108. x = b.namespace,
  14109. C = b.error,
  14110. w = b.metadata,
  14111. S = "." + x,
  14112. k = "module-" + x,
  14113. T = e(t),
  14114. A = e(this),
  14115. R = e(b.context),
  14116. P = (A.selector, A.data(k)),
  14117. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  14118. setTimeout(e, 0);
  14119. },
  14120. F = this,
  14121. O = !1;v = { initialize: function initialize() {
  14122. 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();
  14123. }, instantiate: function instantiate() {
  14124. v.debug("Storing instance", v), A.data(k, v), P = v;
  14125. }, destroy: function destroy() {
  14126. 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);
  14127. }, observeChanges: function observeChanges() {
  14128. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, { childList: !0, subtree: !0 }), h.observe(F, { childList: !0, subtree: !0 }), v.debug("Setting up mutation observer", h));
  14129. }, bind: { events: function events() {
  14130. 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);
  14131. } }, event: { changed: function changed(e) {
  14132. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  14133. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  14134. }, 100);
  14135. }, contextChanged: function contextChanged(t) {
  14136. [].forEach.call(t, function (t) {
  14137. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14138. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  14139. });
  14140. });
  14141. }, resize: function resize() {
  14142. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  14143. }, load: function load() {
  14144. v.debug("Page finished loading"), E(v.refresh);
  14145. }, scroll: function scroll() {
  14146. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14147. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14148. }, b.throttle)) : E(function () {
  14149. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14150. });
  14151. }, scrollchange: function scrollchange(e, t) {
  14152. v.checkVisibility(t);
  14153. } }, precache: function precache(t, i) {
  14154. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14155. ++a >= t.length && e.isFunction(i) && i();
  14156. }; o--;) {
  14157. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14158. }
  14159. }, enableCallbacks: function enableCallbacks() {
  14160. v.debug("Allowing callbacks to occur"), O = !1;
  14161. }, disableCallbacks: function disableCallbacks() {
  14162. v.debug("Disabling all callbacks temporarily"), O = !0;
  14163. }, should: { trackChanges: function trackChanges() {
  14164. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14165. } }, setup: { cache: function cache() {
  14166. v.cache = { occurred: {}, screen: {}, element: {} };
  14167. }, image: function image() {
  14168. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14169. v.debug("Image on screen", F), v.precache(e, function () {
  14170. v.set.image(e, function () {
  14171. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14172. });
  14173. });
  14174. });
  14175. }, fixed: function fixed() {
  14176. 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 () {
  14177. 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);
  14178. }, b.onTopPassedReverse = function () {
  14179. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14180. };
  14181. } }, create: { placeholder: function placeholder() {
  14182. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14183. } }, show: { placeholder: function placeholder() {
  14184. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14185. } }, hide: { placeholder: function placeholder() {
  14186. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14187. } }, set: { fixed: function fixed() {
  14188. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({ position: "fixed", top: b.offset + "px", left: "auto", zIndex: b.zIndex }), b.onFixed.call(F);
  14189. }, image: function image(t, n) {
  14190. if (A.attr("src", t), b.transition) {
  14191. if (e.fn.transition !== i) {
  14192. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14193. } else A.fadeIn(b.duration, n);
  14194. } else A.show();
  14195. } }, is: { onScreen: function onScreen() {
  14196. return v.get.elementCalculations().onScreen;
  14197. }, offScreen: function offScreen() {
  14198. return v.get.elementCalculations().offScreen;
  14199. }, visible: function visible() {
  14200. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14201. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14202. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14203. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14204. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14205. } }, refresh: function refresh() {
  14206. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14207. }, resetFixed: function resetFixed() {
  14208. v.remove.fixed(), v.remove.occurred();
  14209. }, reset: function reset() {
  14210. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14211. }, checkVisibility: function checkVisibility(e) {
  14212. 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()));
  14213. }, passed: function passed(t, n) {
  14214. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14215. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14216. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14217. });
  14218. }
  14219. }, onScreen: function onScreen(e) {
  14220. var t = v.get.elementCalculations(),
  14221. n = e || b.onOnScreen,
  14222. o = "onScreen";if (e && (v.debug("Adding callback for onScreen", e), b.onOnScreen = e), t.onScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOnScreen;
  14223. }, offScreen: function offScreen(e) {
  14224. var t = v.get.elementCalculations(),
  14225. n = e || b.onOffScreen,
  14226. o = "offScreen";if (e && (v.debug("Adding callback for offScreen", e), b.onOffScreen = e), t.offScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOffScreen;
  14227. }, passing: function passing(e) {
  14228. var t = v.get.elementCalculations(),
  14229. n = e || b.onPassing,
  14230. o = "passing";if (e && (v.debug("Adding callback for passing", e), b.onPassing = e), t.passing ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.passing;
  14231. }, topVisible: function topVisible(e) {
  14232. var t = v.get.elementCalculations(),
  14233. n = e || b.onTopVisible,
  14234. o = "topVisible";if (e && (v.debug("Adding callback for top visible", e), b.onTopVisible = e), t.topVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topVisible;
  14235. }, bottomVisible: function bottomVisible(e) {
  14236. var t = v.get.elementCalculations(),
  14237. n = e || b.onBottomVisible,
  14238. o = "bottomVisible";if (e && (v.debug("Adding callback for bottom visible", e), b.onBottomVisible = e), t.bottomVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomVisible;
  14239. }, topPassed: function topPassed(e) {
  14240. var t = v.get.elementCalculations(),
  14241. n = e || b.onTopPassed,
  14242. o = "topPassed";if (e && (v.debug("Adding callback for top passed", e), b.onTopPassed = e), t.topPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topPassed;
  14243. }, bottomPassed: function bottomPassed(e) {
  14244. var t = v.get.elementCalculations(),
  14245. n = e || b.onBottomPassed,
  14246. o = "bottomPassed";if (e && (v.debug("Adding callback for bottom passed", e), b.onBottomPassed = e), t.bottomPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomPassed;
  14247. }, passingReverse: function passingReverse(e) {
  14248. var t = v.get.elementCalculations(),
  14249. n = e || b.onPassingReverse,
  14250. o = "passingReverse";if (e && (v.debug("Adding callback for passing reverse", e), b.onPassingReverse = e), t.passing ? b.once || v.remove.occurred(o) : v.get.occurred("passing") && v.execute(n, o), e !== i) return !t.passing;
  14251. }, topVisibleReverse: function topVisibleReverse(e) {
  14252. var t = v.get.elementCalculations(),
  14253. n = e || b.onTopVisibleReverse,
  14254. o = "topVisibleReverse";if (e && (v.debug("Adding callback for top visible reverse", e), b.onTopVisibleReverse = e), t.topVisible ? b.once || v.remove.occurred(o) : v.get.occurred("topVisible") && v.execute(n, o), e === i) return !t.topVisible;
  14255. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14256. var t = v.get.elementCalculations(),
  14257. n = e || b.onBottomVisibleReverse,
  14258. o = "bottomVisibleReverse";if (e && (v.debug("Adding callback for bottom visible reverse", e), b.onBottomVisibleReverse = e), t.bottomVisible ? b.once || v.remove.occurred(o) : v.get.occurred("bottomVisible") && v.execute(n, o), e === i) return !t.bottomVisible;
  14259. }, topPassedReverse: function topPassedReverse(e) {
  14260. var t = v.get.elementCalculations(),
  14261. n = e || b.onTopPassedReverse,
  14262. o = "topPassedReverse";if (e && (v.debug("Adding callback for top passed reverse", e), b.onTopPassedReverse = e), t.topPassed ? b.once || v.remove.occurred(o) : v.get.occurred("topPassed") && v.execute(n, o), e === i) return !t.onTopPassed;
  14263. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14264. var t = v.get.elementCalculations(),
  14265. n = e || b.onBottomPassedReverse,
  14266. o = "bottomPassedReverse";if (e && (v.debug("Adding callback for bottom passed reverse", e), b.onBottomPassedReverse = e), t.bottomPassed ? b.once || v.remove.occurred(o) : v.get.occurred("bottomPassed") && v.execute(n, o), e === i) return !t.bottomPassed;
  14267. }, execute: function execute(e, t) {
  14268. var n = v.get.elementCalculations(),
  14269. i = v.get.screenCalculations();(e = e || !1) && (b.continuous ? (v.debug("Callback being called continuously", t, n), e.call(F, n, i)) : v.get.occurred(t) || (v.debug("Conditions met", t, n), e.call(F, n, i))), v.save.occurred(t);
  14270. }, remove: { fixed: function fixed() {
  14271. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14272. }, placeholder: function placeholder() {
  14273. v.debug("Removing placeholder content"), r && r.remove();
  14274. }, occurred: function occurred(e) {
  14275. if (e) {
  14276. var t = v.cache.occurred;t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  14277. } else v.cache.occurred = {};
  14278. } }, save: { calculations: function calculations() {
  14279. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14280. }, occurred: function occurred(e) {
  14281. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14282. }, scroll: function scroll(e) {
  14283. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14284. }, direction: function direction() {
  14285. var e,
  14286. t = v.get.scroll(),
  14287. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14288. }, elementPosition: function elementPosition() {
  14289. var e = v.cache.element,
  14290. t = v.get.screenSize();return v.verbose("Saving element position"), e.fits = e.height < t.height, e.offset = A.offset(), e.width = A.outerWidth(), e.height = A.outerHeight(), v.is.verticallyScrollableContext() && (e.offset.top += R.scrollTop() - R.offset().top), v.is.horizontallyScrollableContext() && (e.offset.left += R.scrollLeft - R.offset().left), v.cache.element = e, e;
  14291. }, elementCalculations: function elementCalculations() {
  14292. var e = v.get.screenCalculations(),
  14293. t = v.get.elementPosition();return b.includeMargin ? (t.margin = {}, t.margin.top = parseInt(A.css("margin-top"), 10), t.margin.bottom = parseInt(A.css("margin-bottom"), 10), t.top = t.offset.top - t.margin.top, t.bottom = t.offset.top + t.height + t.margin.bottom) : (t.top = t.offset.top, t.bottom = t.offset.top + t.height), t.topPassed = e.top >= t.top, t.bottomPassed = e.top >= t.bottom, t.topVisible = e.bottom >= t.top && !t.topPassed, t.bottomVisible = e.bottom >= t.bottom && !t.bottomPassed, t.pixelsPassed = 0, t.percentagePassed = 0, t.onScreen = (t.topVisible || t.passing) && !t.bottomPassed, t.passing = t.topPassed && !t.bottomPassed, t.offScreen = !t.onScreen, t.passing && (t.pixelsPassed = e.top - t.top, t.percentagePassed = (e.top - t.top) / t.height), v.cache.element = t, v.verbose("Updated element calculations", t), t;
  14294. }, screenCalculations: function screenCalculations() {
  14295. var e = v.get.scroll();return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  14296. }, screenSize: function screenSize() {
  14297. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14298. }, position: function position() {
  14299. v.save.screenSize(), v.save.elementPosition();
  14300. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14301. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14302. }, occurred: function occurred(e) {
  14303. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14304. }, direction: function direction() {
  14305. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14306. }, elementPosition: function elementPosition() {
  14307. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14308. }, elementCalculations: function elementCalculations() {
  14309. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14310. }, screenCalculations: function screenCalculations() {
  14311. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14312. }, screenSize: function screenSize() {
  14313. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14314. }, scroll: function scroll() {
  14315. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14316. }, lastScroll: function lastScroll() {
  14317. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14318. } }, setting: function setting(t, n) {
  14319. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14320. if (n === i) return b[t];b[t] = n;
  14321. }
  14322. }, internal: function internal(t, n) {
  14323. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14324. if (n === i) return v[t];v[t] = n;
  14325. }
  14326. }, debug: function debug() {
  14327. !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)));
  14328. }, verbose: function verbose() {
  14329. !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)));
  14330. }, error: function error() {
  14331. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14332. }, performance: { log: function log(e) {
  14333. var t, n;b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  14334. }, display: function display() {
  14335. var t = b.name + ":",
  14336. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14337. n += t["Execution Time"];
  14338. }), 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) {
  14339. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14340. }), console.groupEnd()), c = [];
  14341. } }, invoke: function invoke(t, n, o) {
  14342. var r,
  14343. s,
  14344. l,
  14345. c = P;return n = n || f, o = F || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  14346. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14347. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);c = c[o];
  14348. }
  14349. })), 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;
  14350. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14351. }), a !== i ? a : this;
  14352. }, e.fn.visibility.settings = { name: "Visibility", namespace: "visibility", debug: !1, verbose: !1, performance: !0, observeChanges: !0, initialCheck: !0, refreshOnLoad: !0, refreshOnResize: !0, checkOnRefresh: !0, once: !0, continuous: !1, offset: 0, includeMargin: !1, context: t, throttle: !1, type: !1, zIndex: "10", transition: "fade in", duration: 1e3, onPassed: {}, onOnScreen: !1, onOffScreen: !1, onPassing: !1, onTopVisible: !1, onBottomVisible: !1, onTopPassed: !1, onBottomPassed: !1, onPassingReverse: !1, onTopVisibleReverse: !1, onBottomVisibleReverse: !1, onTopPassedReverse: !1, onBottomPassedReverse: !1, onLoad: function onLoad() {}, onAllLoaded: function onAllLoaded() {}, onFixed: function onFixed() {}, onUnfixed: function onUnfixed() {}, onUpdate: !1, onRefresh: function onRefresh() {}, metadata: { src: "src" }, className: { fixed: "fixed", placeholder: "placeholder", visible: "visible" }, error: { method: "The method you called is not defined.", visible: "Element is hidden, you must call refresh after element becomes visible" } };
  14353. }(jQuery, window, document);
  14354. /***/ }),
  14355. /***/ "./js/services/i18nHelper.js":
  14356. /*!***********************************!*\
  14357. !*** ./js/services/i18nHelper.js ***!
  14358. \***********************************/
  14359. /*! no static exports found */
  14360. /***/ (function(module, exports, __webpack_require__) {
  14361. "use strict";
  14362. Object.defineProperty(exports, "__esModule", {
  14363. value: true
  14364. });
  14365. exports.i18nHelper = undefined;
  14366. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14367. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14368. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  14369. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14370. var StringTypes = _lineI18n2.default.StringTypes;
  14371. var i18nHelper = exports.i18nHelper = Object.freeze({
  14372. i18n: function i18n(identifier) {
  14373. var opts = identifier.split(':');
  14374. var type = opts[0].toLowerCase();
  14375. var id = opts[1];
  14376. if (StringTypes.ERROR === type) {
  14377. return _localizedStringsService.LocalizedStrings.getError(id);
  14378. } else if (StringTypes.MESSAGE === type) {
  14379. return _localizedStringsService.LocalizedStrings.getMessage(id);
  14380. } else if (StringTypes.UI === type) {
  14381. return _localizedStringsService.LocalizedStrings.getUI(id);
  14382. } else {
  14383. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  14384. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  14385. }
  14386. }
  14387. });
  14388. /***/ }),
  14389. /***/ "./js/services/languageService.js":
  14390. /*!****************************************!*\
  14391. !*** ./js/services/languageService.js ***!
  14392. \****************************************/
  14393. /*! no static exports found */
  14394. /***/ (function(module, exports, __webpack_require__) {
  14395. "use strict";
  14396. Object.defineProperty(exports, "__esModule", {
  14397. value: true
  14398. });
  14399. exports.LanguageService = undefined;
  14400. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14401. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14402. var _grammar2 = _interopRequireDefault(_grammar);
  14403. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14404. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14405. var _config = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  14406. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14407. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14408. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14409. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14410. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14411. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14412. function LanguageServiceExtended() {
  14413. _classCallCheck(this, LanguageServiceExtended);
  14414. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, typeof iLMparameters === 'undefined' ? _config.Config.default_lang : iLMparameters.lang));
  14415. }
  14416. _createClass(LanguageServiceExtended, [{
  14417. key: 'getCurrentLexer',
  14418. value: function getCurrentLexer() {
  14419. var langInfo = _grammar2.default[this.getLang()];
  14420. if (langInfo === null || langInfo === undefined) {
  14421. return _grammar2.default[this.getDefaultLang()].lexer;
  14422. } else {
  14423. return langInfo.lexer;
  14424. }
  14425. }
  14426. }, {
  14427. key: 'getCurrentLangFuncs',
  14428. value: function getCurrentLangFuncs() {
  14429. var langInfo = _grammar2.default[this.getLang()];
  14430. if (langInfo === null || langInfo === undefined) {
  14431. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14432. } else {
  14433. return langInfo.langFuncs;
  14434. }
  14435. }
  14436. }, {
  14437. key: 'getCurrentLangLibs',
  14438. value: function getCurrentLangLibs() {
  14439. var langInfo = _grammar2.default[this.getLang()];
  14440. if (langInfo === null || langInfo === undefined) {
  14441. return _grammar2.default[this.getDefaultLang()].langLibs;
  14442. }
  14443. return langInfo.langLibs;
  14444. }
  14445. }]);
  14446. return LanguageServiceExtended;
  14447. }(_lineI18n2.default.LanguageServiceNoLS);
  14448. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14449. /***/ }),
  14450. /***/ "./js/services/localizedStringsService.js":
  14451. /*!************************************************!*\
  14452. !*** ./js/services/localizedStringsService.js ***!
  14453. \************************************************/
  14454. /*! no static exports found */
  14455. /***/ (function(module, exports, __webpack_require__) {
  14456. "use strict";
  14457. Object.defineProperty(exports, "__esModule", {
  14458. value: true
  14459. });
  14460. exports.LocalizedStrings = undefined;
  14461. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14462. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14463. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14464. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14465. var _i18n2 = _interopRequireDefault(_i18n);
  14466. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14467. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14468. /***/ }),
  14469. /***/ "./js/typeSystem/baseTypes.js":
  14470. /*!************************************!*\
  14471. !*** ./js/typeSystem/baseTypes.js ***!
  14472. \************************************/
  14473. /*! no static exports found */
  14474. /***/ (function(module, exports, __webpack_require__) {
  14475. "use strict";
  14476. Object.defineProperty(exports, "__esModule", {
  14477. value: true
  14478. });
  14479. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14480. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14481. var BaseType = function () {
  14482. function BaseType(name, ord) {
  14483. _classCallCheck(this, BaseType);
  14484. this.name = name;
  14485. this.ord = ord;
  14486. }
  14487. _createClass(BaseType, [{
  14488. key: "isCompatible",
  14489. value: function isCompatible(another) {
  14490. if (another instanceof BaseType) {
  14491. return this.name === another.name && this.ord === another.ord;
  14492. }
  14493. return false;
  14494. }
  14495. }, {
  14496. key: "value",
  14497. get: function get() {
  14498. return this.name;
  14499. }
  14500. }]);
  14501. return BaseType;
  14502. }();
  14503. // Base types names are the same as i18n ui type keys
  14504. var BaseTypes = exports.BaseTypes = Object.freeze({
  14505. INTEGER: new BaseType("integer", 0),
  14506. REAL: new BaseType("real", 1),
  14507. STRING: new BaseType("text", 2),
  14508. BOOLEAN: new BaseType("boolean", 3),
  14509. VOID: new BaseType("void", 4),
  14510. UNDEFINED: new BaseType("undefined", 5)
  14511. });
  14512. /***/ }),
  14513. /***/ "./js/typeSystem/compoundType.js":
  14514. /*!***************************************!*\
  14515. !*** ./js/typeSystem/compoundType.js ***!
  14516. \***************************************/
  14517. /*! no static exports found */
  14518. /***/ (function(module, exports, __webpack_require__) {
  14519. "use strict";
  14520. Object.defineProperty(exports, "__esModule", {
  14521. value: true
  14522. });
  14523. exports.CompoundType = undefined;
  14524. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14525. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14526. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14527. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14528. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14529. var CompoundType = exports.CompoundType = function (_Type) {
  14530. _inherits(CompoundType, _Type);
  14531. function CompoundType(type, dimensions) {
  14532. _classCallCheck(this, CompoundType);
  14533. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14534. _this.innerType = type;
  14535. _this.dimensions = dimensions;
  14536. return _this;
  14537. }
  14538. _createClass(CompoundType, [{
  14539. key: "isCompatible",
  14540. value: function isCompatible(another) {
  14541. if (another instanceof CompoundType) {
  14542. if (this.dimensions !== another.dimensions) {
  14543. return false;
  14544. }
  14545. return this.innerType.isCompatible(another.innerType);
  14546. }
  14547. return false;
  14548. }
  14549. }, {
  14550. key: "stringInfo",
  14551. value: function stringInfo() {
  14552. var _this2 = this;
  14553. var list = this.innerType.stringInfo();
  14554. list.forEach(function (v) {
  14555. v.dim = _this2.dimensions;
  14556. });
  14557. return list;
  14558. }
  14559. }, {
  14560. key: "canAccept",
  14561. value: function canAccept(another) {
  14562. if (another instanceof CompoundType) {
  14563. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14564. } else {
  14565. return this.innerType.isCompatible(another);
  14566. }
  14567. }
  14568. }]);
  14569. return CompoundType;
  14570. }(_type.Type);
  14571. /***/ }),
  14572. /***/ "./js/typeSystem/multiType.js":
  14573. /*!************************************!*\
  14574. !*** ./js/typeSystem/multiType.js ***!
  14575. \************************************/
  14576. /*! no static exports found */
  14577. /***/ (function(module, exports, __webpack_require__) {
  14578. "use strict";
  14579. Object.defineProperty(exports, "__esModule", {
  14580. value: true
  14581. });
  14582. exports.MultiType = undefined;
  14583. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14584. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14585. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14586. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14587. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14588. var MultiType = exports.MultiType = function (_Type) {
  14589. _inherits(MultiType, _Type);
  14590. function MultiType(types) {
  14591. _classCallCheck(this, MultiType);
  14592. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14593. _this.types = types;
  14594. return _this;
  14595. }
  14596. _createClass(MultiType, [{
  14597. key: "stringInfo",
  14598. value: function stringInfo() {
  14599. var list = [];
  14600. for (var i = 0; i < this.types.length; i++) {
  14601. var t = this.types[i];
  14602. list = list.concat(t.stringInfo());
  14603. }
  14604. return list;
  14605. }
  14606. }, {
  14607. key: "isCompatible",
  14608. value: function isCompatible(another) {
  14609. if (another instanceof _type.Type) {
  14610. for (var i = 0; i < this.types.length; i++) {
  14611. var t = this.types[i];
  14612. if (another.isCompatible(t)) {
  14613. return true;
  14614. }
  14615. }
  14616. }
  14617. return false;
  14618. }
  14619. }, {
  14620. key: "value",
  14621. get: function get() {
  14622. return null;
  14623. }
  14624. }, {
  14625. key: "ord",
  14626. get: function get() {
  14627. return null;
  14628. }
  14629. }]);
  14630. return MultiType;
  14631. }(_type.Type);
  14632. /***/ }),
  14633. /***/ "./js/typeSystem/parsers.js":
  14634. /*!**********************************!*\
  14635. !*** ./js/typeSystem/parsers.js ***!
  14636. \**********************************/
  14637. /*! no static exports found */
  14638. /***/ (function(module, exports, __webpack_require__) {
  14639. "use strict";
  14640. Object.defineProperty(exports, "__esModule", {
  14641. value: true
  14642. });
  14643. exports.toInt = toInt;
  14644. exports.toString = toString;
  14645. exports.toReal = toReal;
  14646. exports.toBool = toBool;
  14647. exports.convertToString = convertToString;
  14648. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14649. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14650. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14651. var _decimal2 = _interopRequireDefault(_decimal);
  14652. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14653. function toInt(str) {
  14654. return new _decimal2.default(str);
  14655. }
  14656. function toString(str) {
  14657. var value = str.replace(/^"/, '');
  14658. value = value.replace(/"$/, '');
  14659. value = value.replace(/\\b/g, "\b");
  14660. value = value.replace(/\\t/g, "\t");
  14661. value = value.replace(/\\n/g, "\n");
  14662. value = value.replace(/\\r/g, "\r");
  14663. value = value.replace(/\\\"/g, "\"");
  14664. value = value.replace(/\\\'/g, "\'");
  14665. value = value.replace(/\\\\/g, "\\");
  14666. return value;
  14667. }
  14668. function toReal(value) {
  14669. return new _decimal2.default(value);
  14670. }
  14671. function toBool(str) {
  14672. var val = "'" + str + "'";
  14673. var lexer = _languageService.LanguageService.getCurrentLexer();
  14674. var instance = new lexer(null);
  14675. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14676. return true;
  14677. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14678. return false;
  14679. } else {
  14680. // TODO: better error message
  14681. throw new Error(str + "not a valid boolean");
  14682. }
  14683. }
  14684. function convertBoolToString(bool) {
  14685. var lexer = _languageService.LanguageService.getCurrentLexer();
  14686. var instance = new lexer(null);
  14687. if (bool) {
  14688. return instance.literalNames[lexer.RK_TRUE];
  14689. } else {
  14690. return instance.literalNames[lexer.RK_FALSE];
  14691. }
  14692. }
  14693. function convertToString(value, type) {
  14694. switch (type.ord) {
  14695. case _types.Types.INTEGER.ord:
  14696. return value.toString();
  14697. case _types.Types.REAL.ord:
  14698. {
  14699. if (value.dp() <= 0) {
  14700. return value.toFixed(1);
  14701. } else {
  14702. return value.toNumber();
  14703. }
  14704. }
  14705. case _types.Types.BOOLEAN.ord:
  14706. return convertBoolToString(value);
  14707. default:
  14708. return value;
  14709. }
  14710. }
  14711. /***/ }),
  14712. /***/ "./js/typeSystem/type.js":
  14713. /*!*******************************!*\
  14714. !*** ./js/typeSystem/type.js ***!
  14715. \*******************************/
  14716. /*! no static exports found */
  14717. /***/ (function(module, exports, __webpack_require__) {
  14718. "use strict";
  14719. Object.defineProperty(exports, "__esModule", {
  14720. value: true
  14721. });
  14722. exports.Type = undefined;
  14723. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14724. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  14725. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14726. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14727. var Type = exports.Type = function () {
  14728. function Type(baseType) {
  14729. _classCallCheck(this, Type);
  14730. this.baseType = baseType;
  14731. }
  14732. _createClass(Type, [{
  14733. key: "stringInfo",
  14734. value: function stringInfo() {
  14735. return [{ type: this.baseType.name, dim: 0 }];
  14736. }
  14737. }, {
  14738. key: "isCompatible",
  14739. value: function isCompatible(another) {
  14740. if (another instanceof Type) {
  14741. return this.baseType.isCompatible(another.baseType);
  14742. }
  14743. return false;
  14744. }
  14745. }, {
  14746. key: "value",
  14747. get: function get() {
  14748. return this.baseType.value;
  14749. }
  14750. }, {
  14751. key: "ord",
  14752. get: function get() {
  14753. return this.baseType.ord;
  14754. }
  14755. }]);
  14756. return Type;
  14757. }();
  14758. /***/ }),
  14759. /***/ "./js/typeSystem/types.js":
  14760. /*!********************************!*\
  14761. !*** ./js/typeSystem/types.js ***!
  14762. \********************************/
  14763. /*! no static exports found */
  14764. /***/ (function(module, exports, __webpack_require__) {
  14765. "use strict";
  14766. Object.defineProperty(exports, "__esModule", {
  14767. value: true
  14768. });
  14769. exports.Types = undefined;
  14770. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14771. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14772. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14773. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14774. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14775. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14776. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14777. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14778. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14779. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14780. var Types = exports.Types = Object.freeze({
  14781. INTEGER: INTEGER,
  14782. REAL: REAL,
  14783. STRING: STRING,
  14784. BOOLEAN: BOOLEAN,
  14785. VOID: VOID,
  14786. UNDEFINED: UNDEFINED,
  14787. ALL: ALL
  14788. });
  14789. /***/ }),
  14790. /***/ "./js/util/config.js":
  14791. /*!***************************!*\
  14792. !*** ./js/util/config.js ***!
  14793. \***************************/
  14794. /*! no static exports found */
  14795. /***/ (function(module, exports, __webpack_require__) {
  14796. "use strict";
  14797. Object.defineProperty(exports, "__esModule", {
  14798. value: true
  14799. });
  14800. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14801. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14802. var ConfigObject = function () {
  14803. function ConfigObject() {
  14804. _classCallCheck(this, ConfigObject);
  14805. this.loopTimeout = 5000;
  14806. this.decimalPlaces = 5;
  14807. this.intConvertRoundMode = 2;
  14808. this.default_lang = 'pt';
  14809. this.enable_type_casting = true;
  14810. }
  14811. _createClass(ConfigObject, [{
  14812. key: 'setConfig',
  14813. value: function setConfig(opts) {
  14814. for (var key in opts) {
  14815. if (this.hasOwnProperty(key)) {
  14816. this[key] = opts[key];
  14817. }
  14818. }
  14819. }
  14820. }]);
  14821. return ConfigObject;
  14822. }();
  14823. var config = new ConfigObject();
  14824. var Config = exports.Config = config;
  14825. /***/ }),
  14826. /***/ "./js/util/inputTest.js":
  14827. /*!******************************!*\
  14828. !*** ./js/util/inputTest.js ***!
  14829. \******************************/
  14830. /*! no static exports found */
  14831. /***/ (function(module, exports, __webpack_require__) {
  14832. "use strict";
  14833. Object.defineProperty(exports, "__esModule", {
  14834. value: true
  14835. });
  14836. exports.InputTest = undefined;
  14837. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14838. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14839. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14840. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14841. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14842. var InputTest = exports.InputTest = function (_Input) {
  14843. _inherits(InputTest, _Input);
  14844. function InputTest(inputList) {
  14845. _classCallCheck(this, InputTest);
  14846. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14847. _this.index = 0;
  14848. _this.inputList = inputList;
  14849. return _this;
  14850. }
  14851. _createClass(InputTest, [{
  14852. key: 'requestInput',
  14853. value: function requestInput(callback) {
  14854. if (this.index < this.inputList.length) {
  14855. callback(this.inputList[this.index]);
  14856. this.index++;
  14857. } else {
  14858. throw new Error('The amount of requests exceeded the amount of available inputs');
  14859. }
  14860. }
  14861. }]);
  14862. return InputTest;
  14863. }(_input.Input);
  14864. /***/ }),
  14865. /***/ "./js/util/outputTest.js":
  14866. /*!*******************************!*\
  14867. !*** ./js/util/outputTest.js ***!
  14868. \*******************************/
  14869. /*! no static exports found */
  14870. /***/ (function(module, exports, __webpack_require__) {
  14871. "use strict";
  14872. Object.defineProperty(exports, "__esModule", {
  14873. value: true
  14874. });
  14875. exports.OutputTest = undefined;
  14876. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14877. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14878. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14879. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14880. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14881. var OutputTest = exports.OutputTest = function (_Output) {
  14882. _inherits(OutputTest, _Output);
  14883. function OutputTest() {
  14884. _classCallCheck(this, OutputTest);
  14885. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14886. _this.list = [];
  14887. return _this;
  14888. }
  14889. _createClass(OutputTest, [{
  14890. key: 'sendOutput',
  14891. value: function sendOutput(text) {
  14892. this.list.push(text);
  14893. }
  14894. }]);
  14895. return OutputTest;
  14896. }(_output.Output);
  14897. /***/ }),
  14898. /***/ "./js/visualUI/algorithm.js":
  14899. /*!**********************************!*\
  14900. !*** ./js/visualUI/algorithm.js ***!
  14901. \**********************************/
  14902. /*! no static exports found */
  14903. /***/ (function(module, exports, __webpack_require__) {
  14904. "use strict";
  14905. Object.defineProperty(exports, "__esModule", {
  14906. value: true
  14907. });
  14908. exports.renderAlgorithm = renderAlgorithm;
  14909. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14910. var _jquery2 = _interopRequireDefault(_jquery);
  14911. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14912. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14913. var Models = _interopRequireWildcard(_ivprog_elements);
  14914. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14915. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14916. var GlobalsManagement = _interopRequireWildcard(_globals);
  14917. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14918. var VariablesManagement = _interopRequireWildcard(_variables);
  14919. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14920. var CommandsManagement = _interopRequireWildcard(_commands);
  14921. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14922. var CodeManagement = _interopRequireWildcard(_code_generator);
  14923. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14924. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14925. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  14926. var FunctionsManagement = _interopRequireWildcard(_functions);
  14927. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14928. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14929. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14930. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14931. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14932. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14933. window.block_render = false;
  14934. function renderAlgorithm() {
  14935. if (window.block_render) {
  14936. return;
  14937. }
  14938. window.block_render = true;
  14939. (0, _jquery2.default)('.all_functions').children().off();
  14940. (0, _jquery2.default)('.all_functions').empty();
  14941. (0, _jquery2.default)('.list_globals').children().off();
  14942. (0, _jquery2.default)('.list_globals').empty();
  14943. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14944. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14945. }
  14946. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14947. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14948. }
  14949. setTimeout(function () {
  14950. window.block_render = false;
  14951. }, 500);
  14952. }
  14953. /***/ }),
  14954. /***/ "./js/visualUI/code_generator.js":
  14955. /*!***************************************!*\
  14956. !*** ./js/visualUI/code_generator.js ***!
  14957. \***************************************/
  14958. /*! no static exports found */
  14959. /***/ (function(module, exports, __webpack_require__) {
  14960. "use strict";
  14961. Object.defineProperty(exports, "__esModule", {
  14962. value: true
  14963. });
  14964. exports.generate = generate;
  14965. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14966. var _jquery2 = _interopRequireDefault(_jquery);
  14967. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14968. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14969. var Models = _interopRequireWildcard(_ivprog_elements);
  14970. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14971. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14972. var GlobalsManagement = _interopRequireWildcard(_globals);
  14973. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14974. var VariablesManagement = _interopRequireWildcard(_variables);
  14975. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14976. var CommandsManagement = _interopRequireWildcard(_commands);
  14977. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  14978. var Utils = _interopRequireWildcard(_utils);
  14979. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14980. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14981. function generate() {
  14982. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  14983. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  14984. code += globalsCode();
  14985. code += '\n';
  14986. var has_error = false;
  14987. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14988. var n_code = functionsCode(window.program_obj.functions[i]);
  14989. if (n_code == null) {
  14990. has_error = true;
  14991. }
  14992. code += n_code;
  14993. code += '\n';
  14994. }
  14995. code += '\n}';
  14996. if (has_error) {
  14997. return null;
  14998. } else {
  14999. return code;
  15000. }
  15001. }
  15002. function functionsCode(function_obj) {
  15003. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  15004. var has_error = false;
  15005. switch (function_obj.return_type) {
  15006. case _types.Types.INTEGER:
  15007. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15008. break;
  15009. case _types.Types.REAL:
  15010. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15011. break;
  15012. case _types.Types.TEXT:
  15013. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15014. break;
  15015. case _types.Types.BOOLEAN:
  15016. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15017. break;
  15018. case _types.Types.VOID:
  15019. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  15020. break;
  15021. }
  15022. ret += ' ';
  15023. if (function_obj.return_dimensions == 1) {
  15024. ret += '[] ';
  15025. } else if (function_obj.return_dimensions == 2) {
  15026. ret += '[][] ';
  15027. }
  15028. ret += function_obj.name + ' ( ';
  15029. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  15030. ret += parametersCode(function_obj.parameters_list[j]);
  15031. if (j + 1 < function_obj.parameters_list.length) {
  15032. ret += ',';
  15033. }
  15034. }
  15035. ret += ' ) {';
  15036. for (var j = 0; j < function_obj.variables_list.length; j++) {
  15037. ret += variablesCode(function_obj.variables_list[j]);
  15038. }
  15039. for (var j = 0; j < function_obj.commands.length; j++) {
  15040. try {
  15041. ret += commandsCode(function_obj.commands[j]);
  15042. } catch (err) {
  15043. has_error = true;
  15044. console.error(err.message);
  15045. var todos = (0, _jquery2.default)('body').find('.command_container');
  15046. for (var i = 0; i < todos.length; i++) {
  15047. if ((0, _jquery2.default)(todos[i]).data('command') == function_obj.commands[j]) {
  15048. (0, _jquery2.default)(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  15049. break;
  15050. }
  15051. }
  15052. }
  15053. }
  15054. ret += '\n\t}';
  15055. if (has_error) {
  15056. return null;
  15057. } else {
  15058. return ret;
  15059. }
  15060. }
  15061. function commandsCode(command_obj) {
  15062. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  15063. switch (command_obj.type) {
  15064. case Models.COMMAND_TYPES.break:
  15065. return breaksCode(command_obj, indentation);
  15066. case Models.COMMAND_TYPES.comment:
  15067. return commentsCode(command_obj, indentation);
  15068. case Models.COMMAND_TYPES.reader:
  15069. return readersCode(command_obj, indentation);
  15070. case Models.COMMAND_TYPES.writer:
  15071. return writersCode(command_obj, indentation);
  15072. case Models.COMMAND_TYPES.functioncall:
  15073. return functioncallsCode(command_obj, indentation);
  15074. case Models.COMMAND_TYPES.attribution:
  15075. return attributionsCode(command_obj, indentation);
  15076. case Models.COMMAND_TYPES.whiletrue:
  15077. return whiletruesCode(command_obj, indentation);
  15078. case Models.COMMAND_TYPES.dowhiletrue:
  15079. return doWhilesCode(command_obj, indentation);
  15080. case Models.COMMAND_TYPES.iftrue:
  15081. return iftruesCode(command_obj, indentation);
  15082. case Models.COMMAND_TYPES.repeatNtimes:
  15083. return repeatNtimesCode(command_obj, indentation);
  15084. case Models.COMMAND_TYPES.switch:
  15085. return switchsCode(command_obj, indentation);
  15086. case Models.COMMAND_TYPES.return:
  15087. return returnsCode(command_obj, indentation);
  15088. }
  15089. }
  15090. function returnsCode(command_obj, indentation) {
  15091. var ret = '\n';
  15092. for (var i = 0; i < indentation; i++) {
  15093. ret += '\t';
  15094. }
  15095. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  15096. if (command_obj.variable_value_menu) {
  15097. try {
  15098. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  15099. } catch (err) {}
  15100. }
  15101. return ret;
  15102. }
  15103. function breaksCode(command_obj, indentation) {
  15104. var ret = '\n';
  15105. for (var i = 0; i < indentation; i++) {
  15106. ret += '\t';
  15107. }
  15108. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  15109. return ret;
  15110. }
  15111. function switchsCode(command_obj, indentation) {
  15112. var ret = '\n';
  15113. for (var i = 0; i < indentation; i++) {
  15114. ret += '\t';
  15115. }
  15116. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  15117. ret += variableValueMenuCode(command_obj.variable);
  15118. ret += ' ) { ';
  15119. if (command_obj.cases) {
  15120. for (var i = 0; i < command_obj.cases.length; i++) {
  15121. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  15122. }
  15123. }
  15124. ret += '\n';
  15125. for (var i = 0; i < indentation; i++) {
  15126. ret += '\t';
  15127. }
  15128. ret += '} ';
  15129. return ret;
  15130. }
  15131. function switchcasesCode(switchcase, indentation) {
  15132. var ret = '\n';
  15133. for (var i = 0; i < indentation; i++) {
  15134. ret += '\t';
  15135. }
  15136. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  15137. ret += variableValueMenuCode(switchcase.variable_value_menu);
  15138. ret += ' :';
  15139. if (switchcase.commands_block) {
  15140. for (var i = 0; i < switchcase.commands_block.length; i++) {
  15141. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  15142. }
  15143. }
  15144. return ret;
  15145. }
  15146. function repeatNtimesCode(command_obj, indentation) {
  15147. var ret = '\n';
  15148. for (var i = 0; i < indentation; i++) {
  15149. ret += '\t';
  15150. }
  15151. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  15152. if (command_obj.var_attribution) {
  15153. ret += variableValueMenuCode(command_obj.var_attribution);
  15154. ret += ' = ';
  15155. ret += variableValueMenuCode(command_obj.expression1);
  15156. }
  15157. ret += ' ; ';
  15158. if (command_obj.expression2) {
  15159. switch (command_obj.expression2.expression.type) {
  15160. case Models.EXPRESSION_TYPES.exp_logic:
  15161. ret += logicExpressionCode(command_obj.expression2.expression);
  15162. break;
  15163. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15164. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15165. break;
  15166. }
  15167. }
  15168. ret += ' ; ';
  15169. if (command_obj.var_incrementation) {
  15170. ret += variableValueMenuCode(command_obj.var_incrementation);
  15171. ret += ' = ';
  15172. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15173. switch (command_obj.expression3.itens[1]) {
  15174. case Models.ARITHMETIC_TYPES.plus:
  15175. ret += ' + ';
  15176. break;
  15177. case Models.ARITHMETIC_TYPES.minus:
  15178. ret += ' - ';
  15179. break;
  15180. case Models.ARITHMETIC_TYPES.multiplication:
  15181. ret += ' * ';
  15182. break;
  15183. case Models.ARITHMETIC_TYPES.division:
  15184. ret += ' / ';
  15185. break;
  15186. case Models.ARITHMETIC_TYPES.module:
  15187. ret += ' % ';
  15188. break;
  15189. }
  15190. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15191. }
  15192. ret += ' ) { ';
  15193. if (command_obj.commands_block) {
  15194. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15195. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15196. }
  15197. }
  15198. ret += '\n';
  15199. for (var i = 0; i < indentation; i++) {
  15200. ret += '\t';
  15201. }
  15202. ret += '}';
  15203. return ret;
  15204. }
  15205. function iftruesCode(command_obj, indentation) {
  15206. var ret = '\n';
  15207. for (var i = 0; i < indentation; i++) {
  15208. ret += '\t';
  15209. }
  15210. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15211. if (!command_obj.expression.expression) {
  15212. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15213. }
  15214. switch (command_obj.expression.expression.type) {
  15215. case Models.EXPRESSION_TYPES.exp_logic:
  15216. ret += logicExpressionCode(command_obj.expression.expression);
  15217. break;
  15218. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15219. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15220. break;
  15221. }
  15222. ret += ' { ';
  15223. if (command_obj.commands_block) {
  15224. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15225. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15226. }
  15227. }
  15228. ret += '\n';
  15229. for (var i = 0; i < indentation; i++) {
  15230. ret += '\t';
  15231. }
  15232. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15233. if (command_obj.commands_else) {
  15234. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15235. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15236. }
  15237. }
  15238. ret += '\n';
  15239. for (var i = 0; i < indentation; i++) {
  15240. ret += '\t';
  15241. }
  15242. ret += '}';
  15243. return ret;
  15244. }
  15245. function doWhilesCode(command_obj, indentation) {
  15246. var ret = '\n';
  15247. for (var i = 0; i < indentation; i++) {
  15248. ret += '\t';
  15249. }
  15250. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15251. if (command_obj.commands_block) {
  15252. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15253. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15254. }
  15255. }
  15256. ret += '\n';
  15257. for (var i = 0; i < indentation; i++) {
  15258. ret += '\t';
  15259. }
  15260. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15261. if (!command_obj.expression.expression) {
  15262. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15263. }
  15264. switch (command_obj.expression.expression.type) {
  15265. case Models.EXPRESSION_TYPES.exp_logic:
  15266. ret += logicExpressionCode(command_obj.expression.expression);
  15267. break;
  15268. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15269. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15270. break;
  15271. }
  15272. return ret;
  15273. }
  15274. function whiletruesCode(command_obj, indentation) {
  15275. var ret = '\n';
  15276. for (var i = 0; i < indentation; i++) {
  15277. ret += '\t';
  15278. }
  15279. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15280. if (!command_obj.expression.expression) {
  15281. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15282. }
  15283. switch (command_obj.expression.expression.type) {
  15284. case Models.EXPRESSION_TYPES.exp_logic:
  15285. ret += logicExpressionCode(command_obj.expression.expression);
  15286. break;
  15287. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15288. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15289. break;
  15290. }
  15291. ret += ' { ';
  15292. if (command_obj.commands_block) {
  15293. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15294. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15295. }
  15296. }
  15297. ret += '\n';
  15298. for (var i = 0; i < indentation; i++) {
  15299. ret += '\t';
  15300. }
  15301. ret += '}';
  15302. return ret;
  15303. }
  15304. function logicExpressionCode(expression) {
  15305. var ret = ' ( ';
  15306. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15307. ret += logicExpressionCode(expression.first_operand);
  15308. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15309. ret += arithmeticExpressionCode(expression.first_operand);
  15310. } else {
  15311. ret += variableValueMenuCode(expression.first_operand);
  15312. }
  15313. if (expression.operator) {
  15314. switch (expression.operator) {
  15315. case Models.LOGIC_COMPARISON.equals_to:
  15316. ret += ' == ';
  15317. break;
  15318. case Models.LOGIC_COMPARISON.not_equals_to:
  15319. ret += ' != ';
  15320. break;
  15321. case Models.LOGIC_COMPARISON.and:
  15322. ret += ' && ';
  15323. break;
  15324. case Models.LOGIC_COMPARISON.or:
  15325. ret += ' || ';
  15326. break;
  15327. }
  15328. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15329. ret += logicExpressionCode(expression.second_operand);
  15330. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15331. ret += arithmeticExpressionCode(expression.second_operand);
  15332. } else {
  15333. ret += variableValueMenuCode(expression.second_operand);
  15334. }
  15335. }
  15336. ret += ' ) ';
  15337. return ret;
  15338. }
  15339. function arithmeticExpressionCode(expression) {
  15340. var ret = ' ( ';
  15341. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15342. ret += logicExpressionCode(expression.first_operand);
  15343. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15344. ret += arithmeticExpressionCode(expression.first_operand);
  15345. } else {
  15346. ret += variableValueMenuCode(expression.first_operand);
  15347. }
  15348. switch (expression.operator) {
  15349. case Models.ARITHMETIC_COMPARISON.greater_than:
  15350. ret += ' > ';
  15351. break;
  15352. case Models.ARITHMETIC_COMPARISON.less_than:
  15353. ret += ' < ';
  15354. break;
  15355. case Models.ARITHMETIC_COMPARISON.equals_to:
  15356. ret += ' == ';
  15357. break;
  15358. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15359. ret += ' != ';
  15360. break;
  15361. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15362. ret += ' >= ';
  15363. break;
  15364. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15365. ret += ' <= ';
  15366. break;
  15367. }
  15368. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15369. ret += logicExpressionCode(expression.second_operand);
  15370. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15371. ret += arithmeticExpressionCode(expression.second_operand);
  15372. } else {
  15373. ret += variableValueMenuCode(expression.second_operand);
  15374. }
  15375. ret += ' ) ';
  15376. return ret;
  15377. }
  15378. function attributionsCode(command_obj, indentation) {
  15379. var ret = '\n';
  15380. for (var i = 0; i < indentation; i++) {
  15381. ret += '\t';
  15382. }
  15383. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15384. for (var i = 0; i < command_obj.expression.length; i++) {
  15385. ret += elementExpressionCode(command_obj.expression[i]);
  15386. }
  15387. return ret;
  15388. }
  15389. function elementExpressionCode(expression_obj) {
  15390. var ret = '';
  15391. for (var i = 0; i < expression_obj.itens.length; i++) {
  15392. if (expression_obj.itens[i].type) {
  15393. ret += variableValueMenuCode(expression_obj.itens[i]);
  15394. } else if (expression_obj.itens[i].type_exp) {
  15395. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15396. ret += ' ( ';
  15397. }
  15398. ret += elementExpressionCode(expression_obj.itens[i]);
  15399. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15400. ret += ' ) ';
  15401. }
  15402. } else {
  15403. switch (expression_obj.itens[i]) {
  15404. case Models.ARITHMETIC_TYPES.plus:
  15405. ret += ' + ';
  15406. break;
  15407. case Models.ARITHMETIC_TYPES.minus:
  15408. ret += ' - ';
  15409. break;
  15410. case Models.ARITHMETIC_TYPES.multiplication:
  15411. ret += ' * ';
  15412. break;
  15413. case Models.ARITHMETIC_TYPES.division:
  15414. ret += ' / ';
  15415. break;
  15416. case Models.ARITHMETIC_TYPES.module:
  15417. ret += ' % ';
  15418. break;
  15419. }
  15420. }
  15421. }
  15422. return ret;
  15423. }
  15424. function functioncallsCode(command_obj, indentation) {
  15425. var ret = '\n';
  15426. for (var i = 0; i < indentation; i++) {
  15427. ret += '\t';
  15428. }
  15429. ret += variableValueMenuCode(command_obj.function_called);
  15430. return ret;
  15431. }
  15432. function readersCode(command_obj, indentation) {
  15433. var ret = '\n';
  15434. for (var i = 0; i < indentation; i++) {
  15435. ret += '\t';
  15436. }
  15437. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15438. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15439. ret += ' ) ';
  15440. return ret;
  15441. }
  15442. function variableValueMenuCode(variable_obj) {
  15443. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  15444. var ret = '';
  15445. try {
  15446. if (variable_obj.function_called) {
  15447. if (variable_obj.function_called.name) {
  15448. ret += variable_obj.function_called.name + ' ( ';
  15449. } else {
  15450. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15451. }
  15452. if (variable_obj.parameters_list) {
  15453. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15454. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15455. if (i + 1 < variable_obj.parameters_list.length) {
  15456. ret += ', ';
  15457. }
  15458. }
  15459. }
  15460. ret += ' )';
  15461. } else if (variable_obj.content.type) {
  15462. ret += variable_obj.content.name;
  15463. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  15464. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15465. }
  15466. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  15467. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15468. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15469. }
  15470. } else {
  15471. if (isNaN(variable_obj.content)) {
  15472. ret += '"' + variable_obj.content + '"';
  15473. } else {
  15474. ret += variable_obj.content;
  15475. }
  15476. }
  15477. } catch (err) {
  15478. if (!is_return) {
  15479. Utils.renderErrorMessage(variable_obj.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_content'));
  15480. throw err;
  15481. }
  15482. }
  15483. return ret;
  15484. }
  15485. function writersCode(command_obj, indentation) {
  15486. var ret = '\n';
  15487. for (var i = 0; i < indentation; i++) {
  15488. ret += '\t';
  15489. }
  15490. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15491. for (var i = 0; i < command_obj.content.length; i++) {
  15492. ret += variableValueMenuCode(command_obj.content[i]);
  15493. if (i + 1 < command_obj.content.length) {
  15494. ret += ' + ';
  15495. }
  15496. }
  15497. ret += ' ) ';
  15498. return ret;
  15499. }
  15500. function commentsCode(command_obj, indentation) {
  15501. var ret = '\n';
  15502. for (var i = 0; i < indentation; i++) {
  15503. ret += '\t';
  15504. }
  15505. ret += '// ';
  15506. ret += command_obj.comment_text.content;
  15507. return ret;
  15508. }
  15509. function parametersCode(parameter_obj) {
  15510. var ret = '';
  15511. switch (parameter_obj.type) {
  15512. case _types.Types.INTEGER:
  15513. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15514. break;
  15515. case _types.Types.REAL:
  15516. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15517. break;
  15518. case _types.Types.TEXT:
  15519. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15520. break;
  15521. case _types.Types.BOOLEAN:
  15522. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15523. break;
  15524. }
  15525. ret += parameter_obj.name + '';
  15526. if (parameter_obj.dimensions == 1) {
  15527. ret += ' []';
  15528. } else if (parameter_obj.dimensions == 2) {
  15529. ret += ' [][]';
  15530. }
  15531. return ret;
  15532. }
  15533. function variablesCode(variable_obj) {
  15534. var ret = '';
  15535. var temp = variable_obj;
  15536. ret += '\n\t\t';
  15537. if (temp.is_constant) {
  15538. ret += 'const ';
  15539. }
  15540. switch (temp.type) {
  15541. case _types.Types.INTEGER:
  15542. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15543. break;
  15544. case _types.Types.REAL:
  15545. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15546. break;
  15547. case _types.Types.TEXT:
  15548. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15549. break;
  15550. case _types.Types.BOOLEAN:
  15551. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15552. break;
  15553. }
  15554. ret += temp.name + ' ';
  15555. if (temp.dimensions == 1) {
  15556. ret += '[' + temp.columns + '] ';
  15557. switch (temp.type) {
  15558. case _types.Types.INTEGER:
  15559. ret += '= {' + temp.value + '}';
  15560. break;
  15561. case _types.Types.REAL:
  15562. ret += '= {' + temp.value.toFixed(2) + '}';
  15563. break;
  15564. case _types.Types.TEXT:
  15565. ret += '= {';
  15566. for (var j = 0; j < temp.value.length; j++) {
  15567. ret += '"' + temp.value[j] + '"';
  15568. if (j + 1 < temp.value.length) {
  15569. ret += ',';
  15570. }
  15571. }
  15572. ret += '}';
  15573. break;
  15574. case _types.Types.BOOLEAN:
  15575. ret += '= {';
  15576. for (var j = 0; j < temp.value.length; j++) {
  15577. if (temp.value[j]) {
  15578. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15579. } else {
  15580. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15581. }
  15582. if (j + 1 < temp.value.length) {
  15583. ret += ',';
  15584. }
  15585. }
  15586. ret += '}';
  15587. break;
  15588. }
  15589. } else if (temp.dimensions == 2) {
  15590. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15591. switch (temp.type) {
  15592. case _types.Types.INTEGER:
  15593. ret += '= {';
  15594. for (var j = 0; j < temp.rows; j++) {
  15595. ret += '{' + temp.value[j] + '}';
  15596. if (j + 1 < temp.rows) {
  15597. ret += ',';
  15598. }
  15599. }
  15600. ret += '}';
  15601. break;
  15602. case _types.Types.REAL:
  15603. ret += '= {';
  15604. for (var j = 0; j < temp.rows; j++) {
  15605. ret += '{' + temp.value[j].toFixed(2) + '}';
  15606. if (j + 1 < temp.rows) {
  15607. ret += ',';
  15608. }
  15609. }
  15610. ret += '}';
  15611. break;
  15612. case _types.Types.TEXT:
  15613. ret += '= {';
  15614. for (var j = 0; j < temp.rows; j++) {
  15615. ret += '{';
  15616. for (var k = 0; k < temp.columns; k++) {
  15617. ret += '"' + temp.value[j][k] + '"';
  15618. if (k + 1 < temp.columns) {
  15619. ret += ',';
  15620. }
  15621. }
  15622. ret += '}';
  15623. if (j + 1 < temp.rows) {
  15624. ret += ',';
  15625. }
  15626. }
  15627. ret += '}';
  15628. break;
  15629. case _types.Types.BOOLEAN:
  15630. ret += '= {';
  15631. for (var j = 0; j < temp.rows; j++) {
  15632. ret += '{';
  15633. for (var k = 0; k < temp.columns; k++) {
  15634. if (temp.value[j][k]) {
  15635. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15636. } else {
  15637. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15638. }
  15639. if (k + 1 < temp.columns) {
  15640. ret += ',';
  15641. }
  15642. }
  15643. ret += '}';
  15644. if (j + 1 < temp.rows) {
  15645. ret += ',';
  15646. }
  15647. }
  15648. ret += '}';
  15649. break;
  15650. }
  15651. } else {
  15652. switch (temp.type) {
  15653. case _types.Types.INTEGER:
  15654. ret += '= ' + temp.value;
  15655. break;
  15656. case _types.Types.REAL:
  15657. ret += '= ' + temp.value.toFixed(2);
  15658. break;
  15659. case _types.Types.TEXT:
  15660. ret += '= "' + temp.value + '"';
  15661. break;
  15662. case _types.Types.BOOLEAN:
  15663. ret += '= ';
  15664. if (temp.value) {
  15665. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15666. } else {
  15667. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15668. }
  15669. break;
  15670. }
  15671. }
  15672. return ret;
  15673. }
  15674. function globalsCode() {
  15675. var ret = '';
  15676. if (window.program_obj.globals) {
  15677. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15678. var temp = window.program_obj.globals[i];
  15679. ret += '\n\t';
  15680. if (temp.is_constant) {
  15681. ret += 'const ';
  15682. }
  15683. switch (temp.type) {
  15684. case _types.Types.INTEGER:
  15685. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15686. break;
  15687. case _types.Types.REAL:
  15688. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15689. break;
  15690. case _types.Types.TEXT:
  15691. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15692. break;
  15693. case _types.Types.BOOLEAN:
  15694. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15695. break;
  15696. }
  15697. ret += ' ' + temp.name + ' ';
  15698. if (temp.dimensions == 1) {
  15699. ret += '[' + temp.columns + '] ';
  15700. switch (temp.type) {
  15701. case _types.Types.INTEGER:
  15702. ret += '= {' + temp.value + '}';
  15703. break;
  15704. case _types.Types.REAL:
  15705. ret += '= {';
  15706. for (var j = 0; j < temp.value.length; j++) {
  15707. ret += temp.value[j].toFixed(2);
  15708. if (j + 1 < temp.value.length) {
  15709. ret += ',';
  15710. }
  15711. }
  15712. ret += '}';
  15713. break;
  15714. case _types.Types.TEXT:
  15715. ret += '= {';
  15716. for (var j = 0; j < temp.value.length; j++) {
  15717. ret += '"' + temp.value[j] + '"';
  15718. if (j + 1 < temp.value.length) {
  15719. ret += ',';
  15720. }
  15721. }
  15722. ret += '}';
  15723. break;
  15724. case _types.Types.BOOLEAN:
  15725. ret += '= {';
  15726. for (var j = 0; j < temp.value.length; j++) {
  15727. if (temp.value[j]) {
  15728. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15729. } else {
  15730. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15731. }
  15732. if (j + 1 < temp.value.length) {
  15733. ret += ',';
  15734. }
  15735. }
  15736. ret += '}';
  15737. break;
  15738. }
  15739. } else if (temp.dimensions == 2) {
  15740. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15741. switch (temp.type) {
  15742. case _types.Types.INTEGER:
  15743. ret += '= {';
  15744. for (var j = 0; j < temp.rows; j++) {
  15745. ret += '{' + temp.value[j] + '}';
  15746. if (j + 1 < temp.rows) {
  15747. ret += ',';
  15748. }
  15749. }
  15750. ret += '}';
  15751. break;
  15752. case _types.Types.REAL:
  15753. ret += '= {';
  15754. for (var j = 0; j < temp.rows; j++) {
  15755. ret += '{';
  15756. for (var k = 0; k < temp.columns; k++) {
  15757. ret += temp.value[j][k].toFixed(2);
  15758. if (k + 1 < temp.columns) {
  15759. ret += ',';
  15760. }
  15761. }
  15762. ret += '}';
  15763. if (j + 1 < temp.rows) {
  15764. ret += ',';
  15765. }
  15766. }
  15767. ret += '}';
  15768. break;
  15769. case _types.Types.TEXT:
  15770. ret += '= {';
  15771. for (var j = 0; j < temp.rows; j++) {
  15772. ret += '{';
  15773. for (var k = 0; k < temp.columns; k++) {
  15774. ret += '"' + temp.value[j][k] + '"';
  15775. if (k + 1 < temp.columns) {
  15776. ret += ',';
  15777. }
  15778. }
  15779. ret += '}';
  15780. if (j + 1 < temp.rows) {
  15781. ret += ',';
  15782. }
  15783. }
  15784. ret += '}';
  15785. break;
  15786. case _types.Types.BOOLEAN:
  15787. ret += '= {';
  15788. for (var j = 0; j < temp.rows; j++) {
  15789. ret += '{';
  15790. for (var k = 0; k < temp.columns; k++) {
  15791. if (temp.value[j][k]) {
  15792. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15793. } else {
  15794. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15795. }
  15796. if (k + 1 < temp.columns) {
  15797. ret += ',';
  15798. }
  15799. }
  15800. ret += '}';
  15801. if (j + 1 < temp.rows) {
  15802. ret += ',';
  15803. }
  15804. }
  15805. ret += '}';
  15806. break;
  15807. }
  15808. } else {
  15809. switch (temp.type) {
  15810. case _types.Types.INTEGER:
  15811. ret += '= ' + temp.value;
  15812. break;
  15813. case _types.Types.REAL:
  15814. ret += '= ' + temp.value.toFixed(2);
  15815. break;
  15816. case _types.Types.TEXT:
  15817. ret += '= "' + temp.value + '"';
  15818. break;
  15819. case _types.Types.BOOLEAN:
  15820. ret += '= ';
  15821. if (temp.value) {
  15822. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15823. } else {
  15824. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15825. }
  15826. break;
  15827. }
  15828. }
  15829. }
  15830. }
  15831. return ret;
  15832. }
  15833. /***/ }),
  15834. /***/ "./js/visualUI/commands.js":
  15835. /*!*********************************!*\
  15836. !*** ./js/visualUI/commands.js ***!
  15837. \*********************************/
  15838. /*! no static exports found */
  15839. /***/ (function(module, exports, __webpack_require__) {
  15840. "use strict";
  15841. Object.defineProperty(exports, "__esModule", {
  15842. value: true
  15843. });
  15844. exports.removeCommand = removeCommand;
  15845. exports.createFloatingCommand = createFloatingCommand;
  15846. exports.renderCommand = renderCommand;
  15847. exports.genericCreateCommand = genericCreateCommand;
  15848. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15849. var _jquery2 = _interopRequireDefault(_jquery);
  15850. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15851. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15852. var Models = _interopRequireWildcard(_ivprog_elements);
  15853. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15854. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15855. var GlobalsManagement = _interopRequireWildcard(_globals);
  15856. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15857. var VariablesManagement = _interopRequireWildcard(_variables);
  15858. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15859. var CommentsManagement = _interopRequireWildcard(_comment);
  15860. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15861. var ReadersManagement = _interopRequireWildcard(_reader);
  15862. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15863. var WritersManagement = _interopRequireWildcard(_writer);
  15864. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15865. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15866. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15867. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15868. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15869. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15870. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15871. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15872. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15873. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15874. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15875. var SwitchesManagement = _interopRequireWildcard(_switch);
  15876. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15877. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15878. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15879. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15880. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15881. var BreaksManagement = _interopRequireWildcard(_break);
  15882. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15883. var ReturnsManagement = _interopRequireWildcard(_return);
  15884. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15885. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15886. var has_element_created_draged = false;
  15887. var which_element_is_draged = null;
  15888. function removeCommand(command, function_obj, dom_obj) {
  15889. if (function_obj.commands.indexOf(command) > -1) {
  15890. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15891. return true;
  15892. }
  15893. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15894. try {
  15895. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15896. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15897. return true;
  15898. }
  15899. } catch (err) {}
  15900. try {
  15901. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15902. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15903. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15904. return true;
  15905. }
  15906. }
  15907. } catch (err) {}
  15908. if (dom_obj.parent().data('switchcase')) {
  15909. console.log("o que encontrei: ");
  15910. console.log(dom_obj.parent().data('switchcase'));
  15911. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15912. return true;
  15913. }
  15914. return false;
  15915. }
  15916. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15917. var floatingObject;
  15918. switch (command_type) {
  15919. case Models.COMMAND_TYPES.break:
  15920. floatingObject = BreaksManagement.createFloatingCommand();
  15921. break;
  15922. case Models.COMMAND_TYPES.comment:
  15923. floatingObject = CommentsManagement.createFloatingCommand();
  15924. break;
  15925. case Models.COMMAND_TYPES.reader:
  15926. floatingObject = ReadersManagement.createFloatingCommand();
  15927. break;
  15928. case Models.COMMAND_TYPES.writer:
  15929. floatingObject = WritersManagement.createFloatingCommand();
  15930. break;
  15931. case Models.COMMAND_TYPES.attribution:
  15932. floatingObject = AttributionsManagement.createFloatingCommand();
  15933. break;
  15934. case Models.COMMAND_TYPES.iftrue:
  15935. floatingObject = IftruesManagement.createFloatingCommand();
  15936. break;
  15937. case Models.COMMAND_TYPES.repeatNtimes:
  15938. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15939. break;
  15940. case Models.COMMAND_TYPES.whiletrue:
  15941. floatingObject = WhiletruesManagement.createFloatingCommand();
  15942. break;
  15943. case Models.COMMAND_TYPES.dowhiletrue:
  15944. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15945. break;
  15946. case Models.COMMAND_TYPES.switch:
  15947. floatingObject = SwitchesManagement.createFloatingCommand();
  15948. break;
  15949. case Models.COMMAND_TYPES.functioncall:
  15950. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15951. break;
  15952. case Models.COMMAND_TYPES.return:
  15953. floatingObject = ReturnsManagement.createFloatingCommand();
  15954. break;
  15955. }
  15956. floatingObject.draggable({
  15957. drag: function drag(evt) {
  15958. borderMouseDragCommand(function_obj, function_container, evt);
  15959. },
  15960. stop: function stop(evt) {
  15961. function_container.find('.over_command_drag').each(function (index) {
  15962. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15963. });
  15964. }
  15965. }).appendTo("body");
  15966. floatingObject.mouseup(function (evt) {
  15967. manageCommand(function_obj, function_container, evt, command_type);
  15968. });
  15969. floatingObject.css("position", "absolute");
  15970. mouse_event.type = "mousedown.draggable";
  15971. mouse_event.target = floatingObject[0];
  15972. floatingObject.css("left", mouse_event.pageX - 15);
  15973. floatingObject.css("top", mouse_event.pageY - 15);
  15974. floatingObject.trigger(mouse_event);
  15975. }
  15976. function borderMouseDragCommand(function_obj, function_container, evt) {
  15977. function_container.find('.over_command_drag').each(function (index) {
  15978. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15979. });
  15980. var prev = null;
  15981. function_container.find('.commands_list_div').each(function (index) {
  15982. prev = (0, _jquery2.default)(this);
  15983. if (prev) {
  15984. var objLeft = prev.offset().left;
  15985. var objTop = prev.offset().top;
  15986. var objRight = objLeft + prev.width();
  15987. var objBottom = objTop + prev.height();
  15988. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15989. prev.addClass("over_command_drag");
  15990. }
  15991. }
  15992. });
  15993. function_container.find('.command_container').each(function (index) {
  15994. var obj = (0, _jquery2.default)(this);
  15995. var objLeft = obj.offset().left;
  15996. var objTop = obj.offset().top;
  15997. var objRight = objLeft + obj.width();
  15998. var objBottom = objTop + obj.height();
  15999. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  16000. if (prev) {
  16001. prev.removeClass('over_command_drag');
  16002. }
  16003. obj.addClass("over_command_drag");
  16004. return;
  16005. }
  16006. });
  16007. }
  16008. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  16009. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  16010. var createdElement;
  16011. switch (command.type) {
  16012. case Models.COMMAND_TYPES.comment:
  16013. createdElement = CommentsManagement.renderCommand(command, function_obj);
  16014. break;
  16015. case Models.COMMAND_TYPES.break:
  16016. createdElement = BreaksManagement.renderCommand(command, function_obj);
  16017. break;
  16018. case Models.COMMAND_TYPES.reader:
  16019. createdElement = ReadersManagement.renderCommand(command, function_obj);
  16020. break;
  16021. case Models.COMMAND_TYPES.writer:
  16022. createdElement = WritersManagement.renderCommand(command, function_obj);
  16023. break;
  16024. case Models.COMMAND_TYPES.attribution:
  16025. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  16026. break;
  16027. case Models.COMMAND_TYPES.functioncall:
  16028. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  16029. break;
  16030. case Models.COMMAND_TYPES.iftrue:
  16031. createdElement = IftruesManagement.renderCommand(command, function_obj);
  16032. break;
  16033. case Models.COMMAND_TYPES.repeatNtimes:
  16034. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  16035. break;
  16036. case Models.COMMAND_TYPES.whiletrue:
  16037. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  16038. break;
  16039. case Models.COMMAND_TYPES.dowhiletrue:
  16040. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  16041. break;
  16042. case Models.COMMAND_TYPES.switch:
  16043. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  16044. break;
  16045. case Models.COMMAND_TYPES.return:
  16046. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  16047. break;
  16048. }
  16049. switch (before_after_inside) {
  16050. case 1:
  16051. createdElement.insertBefore(element_reference);
  16052. break;
  16053. case 2:
  16054. createdElement.insertAfter(element_reference);
  16055. break;
  16056. case 3:
  16057. element_reference.append(createdElement);
  16058. break;
  16059. }
  16060. createdElement.find('.button_remove_command').mouseover(function () {
  16061. createdElement.css({ 'opacity': '.8' });
  16062. });
  16063. createdElement.find('.button_remove_command').mouseout(function () {
  16064. createdElement.css({ 'opacity': '1' });
  16065. });
  16066. }
  16067. function genericCreateCommand(command_type) {
  16068. switch (command_type) {
  16069. case Models.COMMAND_TYPES.break:
  16070. return new Models.Break();
  16071. case Models.COMMAND_TYPES.comment:
  16072. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  16073. case Models.COMMAND_TYPES.reader:
  16074. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  16075. case Models.COMMAND_TYPES.writer:
  16076. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16077. case Models.COMMAND_TYPES.attribution:
  16078. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  16079. case Models.COMMAND_TYPES.functioncall:
  16080. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  16081. case Models.COMMAND_TYPES.iftrue:
  16082. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  16083. case Models.COMMAND_TYPES.repeatNtimes:
  16084. return new Models.RepeatNTimes(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), null, new Models.ConditionalExpression(null), null, null);
  16085. case Models.COMMAND_TYPES.whiletrue:
  16086. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  16087. case Models.COMMAND_TYPES.dowhiletrue:
  16088. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  16089. case Models.COMMAND_TYPES.switch:
  16090. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  16091. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  16092. case Models.COMMAND_TYPES.return:
  16093. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16094. }
  16095. }
  16096. function dragTrash(event) {
  16097. var trash = (0, _jquery2.default)('<i class="ui icon trash alternate outline"></i>');
  16098. (0, _jquery2.default)('body').append(trash);
  16099. trash.css('position', 'absolute');
  16100. trash.css('top', event.clientY);
  16101. trash.css('left', event.clientX - 20);
  16102. trash.css('font-size', '3em');
  16103. trash.css('display', 'none');
  16104. trash.fadeIn(200, function () {
  16105. trash.fadeOut(200, function () {
  16106. trash.remove();
  16107. });
  16108. });
  16109. }
  16110. function manageCommand(function_obj, function_container, event, command_type) {
  16111. (0, _jquery2.default)(".created_element").each(function (index) {
  16112. (0, _jquery2.default)(this).remove();
  16113. });
  16114. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16115. console.log('soltou no: ');
  16116. console.log(el);
  16117. console.log(el.data('fun'));
  16118. // Primeiro verificar se ele soltou no espaço da função correta:
  16119. var hier = el.parentsUntil(".all_functions");
  16120. var esta_correto = false;
  16121. var esta_na_div_correta = false;
  16122. if (el.hasClass("commands_list_div")) {
  16123. esta_na_div_correta = true;
  16124. }
  16125. for (var i = 0; i < hier.length; i++) {
  16126. var temp = (0, _jquery2.default)(hier[i]);
  16127. if (temp.hasClass("commands_list_div")) {
  16128. esta_na_div_correta = true;
  16129. }
  16130. if (temp.data('fun') == function_obj) {
  16131. esta_correto = true;
  16132. break;
  16133. }
  16134. }
  16135. if (!esta_correto) {
  16136. has_element_created_draged = false;
  16137. which_element_is_draged = null;
  16138. dragTrash(event);
  16139. return;
  16140. } else {
  16141. if (!esta_na_div_correta) {
  16142. has_element_created_draged = false;
  16143. which_element_is_draged = null;
  16144. dragTrash(event);
  16145. return;
  16146. }
  16147. }
  16148. // Agora é descobrir qual o escopo para adicionar o comando:
  16149. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  16150. if (typeof el.data('fun') !== 'undefined') {
  16151. // Se a lista de comandos estiver vazia, então é o primeiro.
  16152. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  16153. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  16154. // pode adicionar
  16155. el.data('fun').commands = [];
  16156. var new_cmd = genericCreateCommand(command_type);
  16157. el.data('fun').commands.push(new_cmd);
  16158. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  16159. } else {
  16160. // Entra nesse else, caso já existam outros comandos no bloco:
  16161. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  16162. }
  16163. } else {
  16164. console.log("soltou em um comando");
  16165. // descobrir em qual comando ele soltou:
  16166. var hier_find = el.parentsUntil(".commands_list_div");
  16167. var hierarquia_bottom_up = [];
  16168. if (typeof el.data('command') !== 'undefined') {
  16169. hierarquia_bottom_up.push(el.data('command'));
  16170. }
  16171. for (var i = 0; i < hier_find.length; i++) {
  16172. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16173. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  16174. }
  16175. }
  16176. console.log("comando em que soltou: ");
  16177. console.log(hierarquia_bottom_up[0]);
  16178. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  16179. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16180. console.log(hierarquia_bottom_up[i]);
  16181. }
  16182. // Se for do tipo break, verificar se está no contexto correto:
  16183. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  16184. var is_correct_context = false;
  16185. if (command_type == Models.COMMAND_TYPES.break) {
  16186. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16187. if (hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.repeatNtimes || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.whiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.dowhiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.switch) {
  16188. is_correct_context = true;
  16189. break;
  16190. }
  16191. }
  16192. if (!is_correct_context) {
  16193. console.error("Context not allowed to insert BREAK COMMAND!");
  16194. return;
  16195. }
  16196. }
  16197. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  16198. if (hierarquia_bottom_up.length == 1) {
  16199. console.log('QQ1');
  16200. var sub_elemento = false;
  16201. for (var i = 0; i < hier_find.length; i++) {
  16202. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16203. console.log('QQ2');
  16204. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  16205. sub_elemento = true;
  16206. break;
  16207. }
  16208. }
  16209. if (!sub_elemento) {
  16210. console.log('QQ3');
  16211. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  16212. }
  16213. } else {
  16214. console.log('QQ4');
  16215. // caso exista mais de um elemento na hierarquia:
  16216. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  16217. console.log('QQ5');
  16218. console.log("PPP1");
  16219. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16220. } else {
  16221. console.log('QQ6');
  16222. var sub_elemento = false;
  16223. for (var i = 0; i < hier_find.length; i++) {
  16224. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16225. console.log('QQ7');
  16226. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16227. sub_elemento = true;
  16228. break;
  16229. }
  16230. }
  16231. }
  16232. }
  16233. }
  16234. has_element_created_draged = false;
  16235. which_element_is_draged = null;
  16236. }
  16237. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16238. var el_jq = (0, _jquery2.default)(el);
  16239. var command_parent = el_jq.data('command');
  16240. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.switch) {
  16241. console.log('QQ17');
  16242. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16243. console.log('QQ18');
  16244. // Se não tiver outro comando ainda no bloco, só adiciona:
  16245. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16246. command_parent.commands_block = [];
  16247. var recentComand = genericCreateCommand(command_type);
  16248. command_parent.commands_block.push(recentComand);
  16249. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16250. } else {
  16251. // Se já tem algum comando no bloco:
  16252. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16253. }
  16254. } else {
  16255. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16256. addCommandToSwitchCase(event, function_obj, command_type);
  16257. }
  16258. } else {
  16259. console.log('QQ19');
  16260. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16261. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16262. }
  16263. }
  16264. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16265. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16266. var menor_distancia = 999999999;
  16267. var elemento_menor_distancia = null;
  16268. var antes = true;
  16269. var t_bot;
  16270. var t_top;
  16271. // Descobrindo o elemento mais próximo:
  16272. for (var i = 0; i < all_sub.length; i++) {
  16273. t_top = all_sub[i].getBoundingClientRect().top;
  16274. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16275. if (t_top - event.clientY < menor_distancia) {
  16276. menor_distancia = event.clientY - t_top;
  16277. elemento_menor_distancia = all_sub[i];
  16278. }
  16279. }
  16280. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16281. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16282. if (borda_inferior - event.clientY < menor_distancia) {
  16283. var recentComand = genericCreateCommand(command_type);
  16284. command_parent.commands_block.push(recentComand);
  16285. //
  16286. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16287. } else {
  16288. var recentComand = genericCreateCommand(command_type);
  16289. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16290. if (index > -1) {
  16291. command_parent.commands_block.splice(index, 0, recentComand);
  16292. }
  16293. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16294. }
  16295. }
  16296. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16297. var el_jq = (0, _jquery2.default)(el);
  16298. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16299. var command_target = el_jq.data('command');
  16300. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16301. var is_in_else = false;
  16302. if (!command_parent) {
  16303. command_parent = el_jq.data('command');
  16304. temp_parent = el_jq;
  16305. var hier = el_jq.parentsUntil(".command_container");
  16306. for (var i = 0; i < hier.length; i++) {
  16307. var temp = (0, _jquery2.default)(hier[i]);
  16308. if (typeof temp.data('else') != 'undefined') {
  16309. is_in_else = true;
  16310. }
  16311. if (typeof temp.data('command') != 'undefined') {
  16312. command_parent = temp.data('command');
  16313. temp_parent = temp;
  16314. }
  16315. }
  16316. }
  16317. var hier = el_jq.parentsUntil(".command_container");
  16318. for (var i = 0; i < hier.length; i++) {
  16319. var temp = (0, _jquery2.default)(hier[i]);
  16320. if (typeof temp.data('else') != 'undefined') {
  16321. is_in_else = true;
  16322. }
  16323. }
  16324. if (command_parent == command_target) {
  16325. var hier = el_jq.parentsUntil(".command_container");
  16326. for (var i = 0; i < hier.length; i++) {
  16327. var temp = (0, _jquery2.default)(hier[i]);
  16328. if (typeof temp.data('else') !== 'undefined') {
  16329. is_in_else = true;
  16330. break;
  16331. }
  16332. }
  16333. }
  16334. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16335. var hier = temp_parent.parentsUntil(".all_cases_div");
  16336. console.log("vou procurar!!");
  16337. for (var i = 0; i < hier.length; i++) {
  16338. console.log("estou vasculhando...");
  16339. var temp = (0, _jquery2.default)(hier[i]);
  16340. if (typeof temp.data('switchcase') !== 'undefined') {
  16341. console.log("encontrei");
  16342. command_parent = temp.data('switchcase');
  16343. is_in_else = false;
  16344. break;
  16345. }
  16346. }
  16347. }
  16348. console.log('debugging:');
  16349. console.log('el_jq');
  16350. console.log(el_jq);
  16351. console.log('command_parent');
  16352. console.log(command_parent);
  16353. console.log('command_target');
  16354. console.log(command_target);
  16355. var menor_distancia = 999999999;
  16356. var antes = true;
  16357. var t_bot;
  16358. var t_top;
  16359. t_top = el.getBoundingClientRect().top;
  16360. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16361. var d_top = event.clientY - t_top; // distancia topo
  16362. var d_bot = t_bot - event.clientY; // distancia baixo
  16363. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16364. if (d_top < d_bot) {
  16365. var recentComand = genericCreateCommand(command_type);
  16366. console.log('MMM1');
  16367. if (is_in_else) {
  16368. console.log('MMM2');
  16369. if (command_parent == command_target) {
  16370. console.log('MMM3');
  16371. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16372. command_parent.commands_else = [];
  16373. var recentComand = genericCreateCommand(command_type);
  16374. command_parent.commands_else.push(recentComand);
  16375. renderCommand(recentComand, el_jq, 3, function_obj);
  16376. } else {
  16377. // Se já tem algum comando no bloco:
  16378. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16379. }
  16380. return;
  16381. }
  16382. console.log('MMM7');
  16383. var index = command_parent.commands_else.indexOf(command_target);
  16384. if (index > -1) {
  16385. command_parent.commands_else.splice(index, 0, recentComand);
  16386. }
  16387. renderCommand(recentComand, el, 1, function_obj);
  16388. } else {
  16389. console.log('MMM4');
  16390. if (command_parent == command_target) {
  16391. console.log('Nxxxx5');
  16392. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16393. command_parent.commands_block = [];
  16394. console.log('SSS4');
  16395. var recentComand = genericCreateCommand(command_type);
  16396. command_parent.commands_block.push(recentComand);
  16397. renderCommand(recentComand, el_jq, 3, function_obj);
  16398. } else {
  16399. console.log('SSS5');
  16400. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16401. }
  16402. return;
  16403. }
  16404. console.log('MMM6');
  16405. var index = command_parent.commands_block.indexOf(command_target);
  16406. if (index > -1) {
  16407. command_parent.commands_block.splice(index, 0, recentComand);
  16408. }
  16409. renderCommand(recentComand, el, 1, function_obj);
  16410. }
  16411. } else {
  16412. console.log('XXX1');
  16413. var recentComand = genericCreateCommand(command_type);
  16414. if (is_in_else) {
  16415. if (command_parent == command_target) {
  16416. console.log('MMM3');
  16417. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16418. command_parent.commands_else = [];
  16419. console.log('SSS1');
  16420. var recentComand = genericCreateCommand(command_type);
  16421. command_parent.commands_else.push(recentComand);
  16422. renderCommand(recentComand, el_jq, 3, function_obj);
  16423. } else {
  16424. // Se já tem algum comando no bloco:
  16425. console.log('SSS2');
  16426. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16427. }
  16428. return;
  16429. }
  16430. console.log('XXX2');
  16431. var index = command_parent.commands_else.indexOf(command_target);
  16432. if (index > -1) {
  16433. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16434. }
  16435. renderCommand(recentComand, el, 2, function_obj);
  16436. } else {
  16437. if (command_parent == command_target) {
  16438. console.log('Nxxxx78');
  16439. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16440. command_parent.commands_block = [];
  16441. var recentComand = genericCreateCommand(command_type);
  16442. command_parent.commands_block.push(recentComand);
  16443. console.log('SSS6');
  16444. renderCommand(recentComand, el_jq, 3, function_obj);
  16445. } else {
  16446. console.log('SSS7');
  16447. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16448. }
  16449. return;
  16450. }
  16451. console.log('XXX3');
  16452. var index = command_parent.commands_block.indexOf(command_target);
  16453. if (index > -1) {
  16454. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16455. }
  16456. renderCommand(recentComand, el, 2, function_obj);
  16457. }
  16458. }
  16459. }
  16460. function insertCommandInBlock(el, event, function_obj, command_type) {
  16461. var el_jq = (0, _jquery2.default)(el);
  16462. var command_parent = el_jq.data('command');
  16463. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16464. // Se não tiver outro comando ainda no bloco, só adiciona:
  16465. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16466. command_parent.commands_block = [];
  16467. var recentComand = genericCreateCommand(command_type);
  16468. command_parent.commands_block.push(recentComand);
  16469. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16470. } else {
  16471. // Se já tem algum comando no bloco:
  16472. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16473. }
  16474. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16475. console.log('QQ9');
  16476. // no if ou no else?
  16477. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16478. var is_in_if = true;
  16479. if (correct_div.data('if')) {
  16480. is_in_if = true;
  16481. } else if (correct_div.data('else')) {
  16482. is_in_if = false;
  16483. } else {
  16484. var hier = correct_div.parentsUntil(".command_container");
  16485. for (var i = 0; i < hier.length; i++) {
  16486. var temp = (0, _jquery2.default)(hier[i]);
  16487. if (typeof temp.data('if') !== 'undefined') {
  16488. is_in_if = true;
  16489. break;
  16490. }
  16491. if (typeof temp.data('else') !== 'undefined') {
  16492. is_in_if = false;
  16493. break;
  16494. }
  16495. }
  16496. }
  16497. if (is_in_if) {
  16498. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16499. command_parent.commands_block = [];
  16500. var recentComand = genericCreateCommand(command_type);
  16501. command_parent.commands_block.push(recentComand);
  16502. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16503. } else {
  16504. // Se já tem algum comando no bloco:
  16505. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16506. }
  16507. } else {
  16508. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16509. command_parent.commands_else = [];
  16510. var recentComand = genericCreateCommand(command_type);
  16511. command_parent.commands_else.push(recentComand);
  16512. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16513. } else {
  16514. // Se já tem algum comando no bloco:
  16515. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16516. }
  16517. }
  16518. } else {
  16519. // é do tipo switch
  16520. console.log("está tentando inserir em um switch que está na raiz!");
  16521. addCommandToSwitchCase(event, function_obj, command_type);
  16522. }
  16523. }
  16524. function addCommandToSwitchCase(event, function_obj, command_type) {
  16525. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16526. var which_case = el.data('switchcase');
  16527. var case_div = el;
  16528. if (!which_case) {
  16529. var hier_find = el.parentsUntil(".all_cases_div");
  16530. for (var i = 0; i < hier_find.length; i++) {
  16531. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16532. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16533. case_div = (0, _jquery2.default)(hier_find[i]);
  16534. break;
  16535. }
  16536. }
  16537. }
  16538. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16539. which_case.commands_block = [];
  16540. var recentComand = genericCreateCommand(command_type);
  16541. which_case.commands_block.push(recentComand);
  16542. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16543. } else {
  16544. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16545. }
  16546. }
  16547. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16548. var all_sub = case_div.find('div.command_container');
  16549. var menor_distancia = 999999999;
  16550. var elemento_menor_distancia = null;
  16551. var antes = true;
  16552. var t_bot;
  16553. var t_top;
  16554. // Descobrindo o elemento mais próximo:
  16555. for (var i = 0; i < all_sub.length; i++) {
  16556. t_top = all_sub[i].getBoundingClientRect().top;
  16557. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16558. if (t_top - event.clientY < menor_distancia) {
  16559. menor_distancia = event.clientY - t_top;
  16560. elemento_menor_distancia = all_sub[i];
  16561. }
  16562. }
  16563. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16564. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16565. if (borda_inferior - event.clientY < menor_distancia) {
  16566. var recentComand = genericCreateCommand(command_type);
  16567. which_case.commands_block.push(recentComand);
  16568. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16569. } else {
  16570. var recentComand = genericCreateCommand(command_type);
  16571. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16572. if (index > -1) {
  16573. which_case.commands_block.splice(index, 0, recentComand);
  16574. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16575. }
  16576. }
  16577. }
  16578. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16579. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16580. var el_jq = (0, _jquery2.default)(el);
  16581. var all_sub = el_jq.find('div.command_container');
  16582. var menor_distancia = 999999999;
  16583. var elemento_menor_distancia = null;
  16584. var antes = true;
  16585. var t_bot;
  16586. var t_top;
  16587. // Descobrindo o elemento mais próximo:
  16588. for (var i = 0; i < all_sub.length; i++) {
  16589. t_top = all_sub[i].getBoundingClientRect().top;
  16590. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16591. if (t_top - event.clientY < menor_distancia) {
  16592. menor_distancia = event.clientY - t_top;
  16593. elemento_menor_distancia = all_sub[i];
  16594. }
  16595. }
  16596. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16597. console.log("menor_distancia: ");
  16598. console.log(elemento_menor_distancia);
  16599. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16600. if (borda_inferior - event.clientY < menor_distancia) {
  16601. console.log('QQ11');
  16602. var recentComand = genericCreateCommand(command_type);
  16603. var command_parent = el_jq.data('command');
  16604. if (is_in_else) {
  16605. console.log('QQ15');
  16606. command_parent.commands_else.push(recentComand);
  16607. console.log('el_jq');
  16608. console.log(el_jq);
  16609. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16610. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16611. renderCommand(recentComand, el_jq, 3, function_obj);
  16612. } else {
  16613. console.log('QQ16');
  16614. command_parent.commands_block.push(recentComand);
  16615. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16616. }
  16617. } else {
  16618. console.log('QQ12');
  16619. var recentComand = genericCreateCommand(command_type);
  16620. var command_parent = el_jq.data('command');
  16621. if (is_in_else) {
  16622. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16623. if (index > -1) {
  16624. command_parent.commands_else.splice(index, 0, recentComand);
  16625. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16626. }
  16627. } else {
  16628. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16629. if (index > -1) {
  16630. command_parent.commands_block.splice(index, 0, recentComand);
  16631. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16632. }
  16633. }
  16634. }
  16635. }
  16636. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16637. switch ((0, _jquery2.default)(el).data('command').type) {
  16638. case Models.COMMAND_TYPES.iftrue:
  16639. case Models.COMMAND_TYPES.switch:
  16640. case Models.COMMAND_TYPES.repeatNtimes:
  16641. case Models.COMMAND_TYPES.whiletrue:
  16642. case Models.COMMAND_TYPES.dowhiletrue:
  16643. insertCommandInBlock(el, event, function_obj, command_type);
  16644. return;
  16645. }
  16646. var menor_distancia = 999999999;
  16647. var antes = true;
  16648. var t_bot;
  16649. var t_top;
  16650. t_top = el.getBoundingClientRect().top;
  16651. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16652. var d_top = event.clientY - t_top; // distancia topo
  16653. var d_bot = t_bot - event.clientY; // distancia baixo
  16654. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16655. if (d_top < d_bot) {
  16656. var recentComand = genericCreateCommand(command_type);
  16657. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16658. if (index > -1) {
  16659. function_obj.commands.splice(index, 0, recentComand);
  16660. }
  16661. renderCommand(recentComand, el, 1, function_obj);
  16662. } else {
  16663. var recentComand = genericCreateCommand(command_type);
  16664. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16665. if (index > -1) {
  16666. function_obj.commands.splice(index + 1, 0, recentComand);
  16667. }
  16668. renderCommand(recentComand, el, 2, function_obj);
  16669. }
  16670. }
  16671. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16672. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16673. var menor_distancia = 999999999;
  16674. var elemento_menor_distancia = null;
  16675. var antes = true;
  16676. var t_bot;
  16677. var t_top;
  16678. // Descobrindo o elemento mais próximo:
  16679. for (var i = 0; i < all_sub.length; i++) {
  16680. t_top = all_sub[i].getBoundingClientRect().top;
  16681. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16682. if (t_top - event.clientY < menor_distancia) {
  16683. menor_distancia = event.clientY - t_top;
  16684. elemento_menor_distancia = all_sub[i];
  16685. }
  16686. }
  16687. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16688. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16689. if (borda_inferior - event.clientY < menor_distancia) {
  16690. var recentComand = genericCreateCommand(command_type);
  16691. function_obj.commands.push(recentComand);
  16692. //
  16693. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16694. } else {
  16695. var recentComand = genericCreateCommand(command_type);
  16696. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16697. if (index > -1) {
  16698. function_obj.commands.splice(index, 0, recentComand);
  16699. }
  16700. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16701. }
  16702. }
  16703. /***/ }),
  16704. /***/ "./js/visualUI/commands/attribution.js":
  16705. /*!*********************************************!*\
  16706. !*** ./js/visualUI/commands/attribution.js ***!
  16707. \*********************************************/
  16708. /*! no static exports found */
  16709. /***/ (function(module, exports, __webpack_require__) {
  16710. "use strict";
  16711. Object.defineProperty(exports, "__esModule", {
  16712. value: true
  16713. });
  16714. exports.createFloatingCommand = createFloatingCommand;
  16715. exports.renderCommand = renderCommand;
  16716. exports.manageExpressionElements = manageExpressionElements;
  16717. exports.renderMenuOperations = renderMenuOperations;
  16718. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16719. var _jquery2 = _interopRequireDefault(_jquery);
  16720. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16721. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16722. var Models = _interopRequireWildcard(_ivprog_elements);
  16723. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16724. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16725. var GlobalsManagement = _interopRequireWildcard(_globals);
  16726. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16727. var VariablesManagement = _interopRequireWildcard(_variables);
  16728. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16729. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16730. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16731. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16732. var CommandsManagement = _interopRequireWildcard(_commands);
  16733. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16734. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16735. function createFloatingCommand() {
  16736. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16737. }
  16738. function renderCommand(command, function_obj) {
  16739. var el = (0, _jquery2.default)('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  16740. el.data('command', command);
  16741. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16742. if (!command.expression || command.expression.length < 1) {
  16743. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16744. command.expression.push(exp);
  16745. }
  16746. addHandlers(command, function_obj, el);
  16747. renderExpressionElements(command, function_obj, el);
  16748. return el;
  16749. }
  16750. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16751. var index_to_move = expression_element.itens.indexOf(ref_object);
  16752. switch (selectedItem.data('exp')) {
  16753. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16754. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move], Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16755. expression_element.itens[index_to_move] = exp;
  16756. break;
  16757. case Models.EXPRESSION_ELEMENTS.op_exp:
  16758. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16759. expression_element.itens[index_to_move] = exp;
  16760. break;
  16761. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16762. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16763. expression_element.itens[index_to_move] = exp;
  16764. break;
  16765. }
  16766. renderExpressionElements(command, function_obj, dom_object);
  16767. }
  16768. function renderExpressionElements(command, function_obj, el) {
  16769. var expression_div = el.find('.expression_elements');
  16770. var command_container;
  16771. if (el.hasClass("command_container") == false) {
  16772. var hier = el.parentsUntil(".command_container");
  16773. for (var i = 0; i < hier.length; i++) {
  16774. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16775. command_container = (0, _jquery2.default)(hier[i]);
  16776. break;
  16777. }
  16778. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16779. expression_div = (0, _jquery2.default)(hier[i]);
  16780. break;
  16781. }
  16782. }
  16783. }
  16784. if (command_container) {
  16785. expression_div = command_container.find('.expression_elements');
  16786. }
  16787. expression_div.text('');
  16788. for (var i = 0; i < command.expression.length; i++) {
  16789. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16790. temp.data('ref_element', command.expression[i]);
  16791. temp.data('ref_index', i);
  16792. expression_div.append(temp);
  16793. renderElement(command, function_obj, temp, command.expression[i]);
  16794. }
  16795. }
  16796. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16797. var context_menu = '<div class="ui dropdown"><div class="text">';
  16798. switch (expression_element.itens[index_op]) {
  16799. case Models.ARITHMETIC_TYPES.plus:
  16800. context_menu += '+';
  16801. break;
  16802. case Models.ARITHMETIC_TYPES.minus:
  16803. context_menu += '-';
  16804. break;
  16805. case Models.ARITHMETIC_TYPES.multiplication:
  16806. context_menu += '*';
  16807. break;
  16808. case Models.ARITHMETIC_TYPES.division:
  16809. context_menu += '/';
  16810. break;
  16811. case Models.ARITHMETIC_TYPES.module:
  16812. context_menu += '%';
  16813. break;
  16814. case Models.ARITHMETIC_TYPES.none:
  16815. context_menu += '...';
  16816. break;
  16817. }
  16818. context_menu += '</div><div class="menu">';
  16819. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16820. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16821. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16822. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16823. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16824. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16825. context_menu += '</div></div>';
  16826. context_menu = (0, _jquery2.default)(context_menu);
  16827. temp_op.append(context_menu);
  16828. context_menu.dropdown({
  16829. onChange: function onChange(value, text, $selectedItem) {
  16830. expression_element.itens[index_op] = value;
  16831. }
  16832. });
  16833. }
  16834. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16835. if (el.hasClass("command_container") == false) {
  16836. var hier = el.parentsUntil(".commands_list_div");
  16837. for (var i = 0; i < hier.length; i++) {
  16838. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16839. el = (0, _jquery2.default)(hier[i]);
  16840. break;
  16841. }
  16842. }
  16843. }
  16844. if (dom_append_menu.hasClass("expression_elements") == false) {
  16845. var hier = el.parentsUntil(".commands_list_div");
  16846. for (var i = 0; i < hier.length; i++) {
  16847. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16848. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16849. break;
  16850. }
  16851. }
  16852. }
  16853. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16854. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16855. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16856. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16857. context_menu += '</div></div>';
  16858. context_menu = (0, _jquery2.default)(context_menu);
  16859. dom_append_menu.append(context_menu);
  16860. context_menu.dropdown({
  16861. onChange: function onChange(value, text, $selectedItem) {
  16862. switch (value) {
  16863. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16864. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16865. expression_append_new_expression.push(exp);
  16866. break;
  16867. case Models.EXPRESSION_ELEMENTS.op_exp:
  16868. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16869. expression_append_new_expression.push(exp);
  16870. break;
  16871. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16872. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16873. expression_append_new_expression.push(exp);
  16874. break;
  16875. }
  16876. renderExpressionElements(command, function_obj, el);
  16877. }
  16878. });
  16879. }
  16880. function renderElement(command, function_obj, el, expression_element) {
  16881. switch (expression_element.type_exp) {
  16882. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16883. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16884. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16885. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16886. el.append(temp_exp_1);
  16887. el.append(temp_op);
  16888. el.append(temp_exp_2);
  16889. if (expression_element.itens[0].type) {
  16890. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16891. } else {
  16892. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16893. }
  16894. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16895. if (expression_element.itens[2].type) {
  16896. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16897. } else {
  16898. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16899. }
  16900. break;
  16901. case Models.EXPRESSION_ELEMENTS.op_exp:
  16902. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16903. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16904. el.append(temp_op);
  16905. el.append(temp_exp);
  16906. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16907. if (expression_element.itens[1].type) {
  16908. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16909. } else {
  16910. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16911. }
  16912. break;
  16913. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16914. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16915. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16916. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16917. el.append(temp_par_1);
  16918. el.append(temp_exp);
  16919. for (var j = 0; j < expression_element.itens.length; j++) {
  16920. if (expression_element.itens[j].type) {
  16921. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16922. } else {
  16923. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16924. }
  16925. }
  16926. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16927. el.append(temp_par_2);
  16928. break;
  16929. }
  16930. }
  16931. function renderExpression(command, function_obj, el) {
  16932. var expression_div = el.find('.expression_elements');
  16933. expression_div.text('');
  16934. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16935. menu_add_item.data('index_add', 0);
  16936. expression_div.append(menu_add_item);
  16937. for (var i = 0; i < command.expression.length; i++) {
  16938. if (command.expression[i].type) {
  16939. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16940. temp.data('ref_element', command.expression[i]);
  16941. temp.data('ref_index', i);
  16942. expression_div.append(temp);
  16943. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16944. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16945. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16946. temp.data('ref_element', command.expression[i]);
  16947. temp.data('ref_index', i);
  16948. expression_div.append(temp);
  16949. } else {
  16950. var temp = '<div class="expression_element">';
  16951. switch (command.expression[i]) {
  16952. case Models.ARITHMETIC_TYPES.plus:
  16953. temp += '+';
  16954. break;
  16955. case Models.ARITHMETIC_TYPES.minus:
  16956. temp += '-';
  16957. break;
  16958. case Models.ARITHMETIC_TYPES.multiplication:
  16959. temp += '*';
  16960. break;
  16961. case Models.ARITHMETIC_TYPES.division:
  16962. temp += '/';
  16963. break;
  16964. case Models.ARITHMETIC_TYPES.module:
  16965. temp += '%';
  16966. break;
  16967. }
  16968. temp += '</div>';
  16969. temp = (0, _jquery2.default)(temp);
  16970. temp.data('ref_element', command.expression[i]);
  16971. temp.data('ref_index', i);
  16972. expression_div.append(temp);
  16973. }
  16974. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16975. var index_temp = i + 1;
  16976. menu_add_item_seq.data('index_add', index_temp);
  16977. expression_div.append(menu_add_item_seq);
  16978. }
  16979. addMenuItens(command, function_obj, el);
  16980. }
  16981. function addMenuItens(command, function_obj, expression_div) {
  16982. var divs_expression = expression_div.find('.menu_add_item');
  16983. for (var i = 0; i < divs_expression.length; i++) {
  16984. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16985. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16986. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16987. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16988. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16989. context_menu += '</div></div>';
  16990. context_menu = (0, _jquery2.default)(context_menu);
  16991. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16992. context_menu.dropdown({
  16993. on: 'hover',
  16994. onChange: function onChange(value, text, $selectedItem) {
  16995. switch ($selectedItem.data('option')) {
  16996. case "value":
  16997. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16998. renderExpression(command, function_obj, expression_div);
  16999. break;
  17000. case "operator":
  17001. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  17002. renderExpression(command, function_obj, expression_div);
  17003. break;
  17004. case "parentheses":
  17005. command.expression.splice($selectedItem.data('index'), 0, "(");
  17006. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17007. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  17008. renderExpression(command, function_obj, expression_div);
  17009. break;
  17010. }
  17011. }
  17012. });
  17013. }
  17014. }
  17015. function addHandlers(command, function_obj, attribution_dom) {
  17016. attribution_dom.find('.button_remove_command').on('click', function () {
  17017. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  17018. attribution_dom.fadeOut();
  17019. }
  17020. });
  17021. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  17022. renderExpressionElements(command, function_obj, attribution_dom);
  17023. });
  17024. }
  17025. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  17026. /*console.log("recebido o seguinte DOM: ");
  17027. console.log(dom_object);
  17028. if (dom_object.hasClass('var_attributed')) {
  17029. return;
  17030. } else {
  17031. var hier = dom_object.parentsUntil(".command_container");
  17032. for (var i = 0; i < hier.length; i++) {
  17033. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  17034. return;
  17035. }
  17036. }
  17037. }
  17038. dom_object.find('.context_menu_clear').remove();
  17039. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17040. for (var tm in Models.ARITHMETIC_TYPES) {
  17041. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  17042. }
  17043. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  17044. menu_operations += '</div></div>';
  17045. menu_operations = $(menu_operations);
  17046. dom_object.append(menu_operations);
  17047. menu_operations.dropdown({
  17048. onChange: function(value, text, $selectedItem) {
  17049. switch ($($selectedItem).data('option')) {
  17050. case "clear":
  17051. $(dom_object).text('');
  17052. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  17053. break;
  17054. default:
  17055. createExpressionAround(command, ref_object, dom_object, function_obj);
  17056. menu_operations.find('.text').text('');
  17057. }
  17058. }
  17059. });*/
  17060. }
  17061. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  17062. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  17063. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  17064. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  17065. }
  17066. /***/ }),
  17067. /***/ "./js/visualUI/commands/break.js":
  17068. /*!***************************************!*\
  17069. !*** ./js/visualUI/commands/break.js ***!
  17070. \***************************************/
  17071. /*! no static exports found */
  17072. /***/ (function(module, exports, __webpack_require__) {
  17073. "use strict";
  17074. Object.defineProperty(exports, "__esModule", {
  17075. value: true
  17076. });
  17077. exports.createFloatingCommand = createFloatingCommand;
  17078. exports.renderCommand = renderCommand;
  17079. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17080. var _jquery2 = _interopRequireDefault(_jquery);
  17081. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17082. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17083. var Models = _interopRequireWildcard(_ivprog_elements);
  17084. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17085. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17086. var CommandsManagement = _interopRequireWildcard(_commands);
  17087. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17088. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17089. function createFloatingCommand() {
  17090. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_break') + ' </span></div>');
  17091. }
  17092. function renderCommand(command, function_obj) {
  17093. var el = (0, _jquery2.default)('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _localizedStringsService.LocalizedStrings.getUI('text_break') + '</span> </div>');
  17094. el.data('command', command);
  17095. addHandlers(command, function_obj, el);
  17096. return el;
  17097. }
  17098. function addHandlers(command, function_obj, break_dom) {
  17099. break_dom.find('.button_remove_command').on('click', function () {
  17100. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  17101. break_dom.fadeOut();
  17102. }
  17103. });
  17104. }
  17105. /***/ }),
  17106. /***/ "./js/visualUI/commands/comment.js":
  17107. /*!*****************************************!*\
  17108. !*** ./js/visualUI/commands/comment.js ***!
  17109. \*****************************************/
  17110. /*! no static exports found */
  17111. /***/ (function(module, exports, __webpack_require__) {
  17112. "use strict";
  17113. Object.defineProperty(exports, "__esModule", {
  17114. value: true
  17115. });
  17116. exports.createFloatingCommand = createFloatingCommand;
  17117. exports.renderCommand = renderCommand;
  17118. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17119. var _jquery2 = _interopRequireDefault(_jquery);
  17120. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17121. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17122. var Models = _interopRequireWildcard(_ivprog_elements);
  17123. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17124. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17125. var GlobalsManagement = _interopRequireWildcard(_globals);
  17126. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17127. var VariablesManagement = _interopRequireWildcard(_variables);
  17128. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17129. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17130. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17131. var CommandsManagement = _interopRequireWildcard(_commands);
  17132. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17133. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17134. function createFloatingCommand() {
  17135. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + ' </span></div>');
  17136. }
  17137. function renderCommand(command, function_obj) {
  17138. var el = (0, _jquery2.default)('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  17139. el.data('command', command);
  17140. addHandlers(command, function_obj, el);
  17141. renderTextComment(command, function_obj, el);
  17142. return el;
  17143. }
  17144. function renderTextComment(command, function_obj, el) {
  17145. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  17146. }
  17147. function addHandlers(command, function_obj, comment_dom) {
  17148. comment_dom.find('.button_remove_command').on('click', function () {
  17149. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  17150. comment_dom.fadeOut();
  17151. }
  17152. });
  17153. }
  17154. /***/ }),
  17155. /***/ "./js/visualUI/commands/conditional_expression.js":
  17156. /*!********************************************************!*\
  17157. !*** ./js/visualUI/commands/conditional_expression.js ***!
  17158. \********************************************************/
  17159. /*! no static exports found */
  17160. /***/ (function(module, exports, __webpack_require__) {
  17161. "use strict";
  17162. Object.defineProperty(exports, "__esModule", {
  17163. value: true
  17164. });
  17165. exports.renderExpression = renderExpression;
  17166. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17167. var _jquery2 = _interopRequireDefault(_jquery);
  17168. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17169. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17170. var Models = _interopRequireWildcard(_ivprog_elements);
  17171. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17172. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17173. var GlobalsManagement = _interopRequireWildcard(_globals);
  17174. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17175. var VariablesManagement = _interopRequireWildcard(_variables);
  17176. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17177. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17178. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17179. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17180. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  17181. expression.dom_object = initial_el_to_render;
  17182. if (expression.expression == null || expression.expression.length < 1) {
  17183. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  17184. } else {
  17185. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  17186. switch (expression.expression.type) {
  17187. case Models.EXPRESSION_TYPES.exp_logic:
  17188. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  17189. break;
  17190. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17191. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  17192. break;
  17193. }
  17194. initial_el_to_render.append(main_div);
  17195. var restartMenu = (0, _jquery2.default)('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  17196. initial_el_to_render.append(restartMenu);
  17197. restartMenu.on('click', function (e) {
  17198. expression.expression = null;
  17199. initial_el_to_render.empty();
  17200. renderExpression(command, expression, function_obj, initial_el_to_render);
  17201. });
  17202. }
  17203. }
  17204. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  17205. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17206. menu_operator.dropdown({
  17207. values: [{
  17208. name: '>',
  17209. value: Models.ARITHMETIC_COMPARISON.greater_than,
  17210. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  17211. }, {
  17212. name: '<',
  17213. value: Models.ARITHMETIC_COMPARISON.less_than,
  17214. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  17215. }, {
  17216. name: '==',
  17217. value: Models.ARITHMETIC_COMPARISON.equals_to,
  17218. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  17219. }, {
  17220. name: '!=',
  17221. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  17222. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  17223. }, {
  17224. name: '>=',
  17225. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  17226. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  17227. }, {
  17228. name: '<=',
  17229. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  17230. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  17231. }],
  17232. onChange: function onChange(value, text, $selectedItem) {
  17233. expression_arithmetic.operator = value;
  17234. }
  17235. });
  17236. element_to_append.append(menu_operator);
  17237. }
  17238. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17239. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17240. menu_operator.dropdown({
  17241. values: [{
  17242. name: '==',
  17243. value: Models.LOGIC_COMPARISON.equals_to,
  17244. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17245. }, {
  17246. name: '!=',
  17247. value: Models.LOGIC_COMPARISON.not_equals_to,
  17248. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17249. }, {
  17250. name: '&&',
  17251. value: Models.LOGIC_COMPARISON.and,
  17252. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17253. }, {
  17254. name: '||',
  17255. value: Models.LOGIC_COMPARISON.or,
  17256. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17257. }],
  17258. onChange: function onChange(value, text, $selectedItem) {
  17259. if ($selectedItem) {
  17260. expression_logic.operator = value;
  17261. if (expression_logic.second_operand == null) {
  17262. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17263. initial_el_to_render.empty();
  17264. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17265. }
  17266. }
  17267. }
  17268. });
  17269. element_to_append.append(menu_operator);
  17270. }
  17271. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17272. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17273. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17274. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17275. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17276. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17277. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17278. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17279. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17280. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17281. } else {
  17282. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17283. }
  17284. element_to_append.append(exp_el_par_1);
  17285. element_to_append.append(exp_el_expr_el_1);
  17286. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17287. element_to_append.append(exp_el_expr_operand);
  17288. if (expression_logic.second_operand) {
  17289. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17290. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17291. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17292. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17293. } else {
  17294. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17295. }
  17296. element_to_append.append(exp_el_expr_el_2);
  17297. }
  17298. element_to_append.append(exp_el_par_2);
  17299. }
  17300. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17301. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17302. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17303. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17304. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17305. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17306. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17307. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17308. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17309. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17310. } else {
  17311. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17312. }
  17313. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17314. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17315. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17316. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17317. } else {
  17318. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17319. }
  17320. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17321. element_to_append.append(exp_el_par_1);
  17322. element_to_append.append(exp_el_expr_el_1);
  17323. element_to_append.append(exp_el_expr_operand);
  17324. element_to_append.append(exp_el_expr_el_2);
  17325. element_to_append.append(exp_el_par_2);
  17326. }
  17327. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17328. var start_menu = '';
  17329. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _localizedStringsService.LocalizedStrings.getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  17330. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  17331. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  17332. start_menu += '</div></div>';
  17333. start_menu = (0, _jquery2.default)(start_menu);
  17334. start_menu.dropdown({
  17335. onChange: function onChange(value, text, $selectedItem) {
  17336. switch ($selectedItem.data('exp')) {
  17337. case Models.EXPRESSION_TYPES.exp_logic:
  17338. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17339. break;
  17340. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17341. expression.expression = new Models.ArithmeticExpression(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17342. break;
  17343. }
  17344. initial_el_to_render.html('');
  17345. renderExpression(command, expression, function_obj, initial_el_to_render);
  17346. },
  17347. selectOnKeydown: false
  17348. });
  17349. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17350. initial_el_to_render.append(start_menu);
  17351. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17352. }
  17353. /***/ }),
  17354. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17355. /*!*****************************************************!*\
  17356. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17357. \*****************************************************/
  17358. /*! no static exports found */
  17359. /***/ (function(module, exports, __webpack_require__) {
  17360. "use strict";
  17361. Object.defineProperty(exports, "__esModule", {
  17362. value: true
  17363. });
  17364. exports.renderMenu = renderMenu;
  17365. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17366. var _jquery2 = _interopRequireDefault(_jquery);
  17367. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17368. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17369. var Models = _interopRequireWildcard(_ivprog_elements);
  17370. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17371. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17372. var CommandsManagement = _interopRequireWildcard(_commands);
  17373. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17374. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17375. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17376. var SwitchManagement = _interopRequireWildcard(_switch);
  17377. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17378. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17379. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17380. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17381. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17382. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17383. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17384. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17385. } else {
  17386. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17387. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17388. }
  17389. menu_div += '</div></div>';
  17390. menu_div = (0, _jquery2.default)(menu_div);
  17391. dom_where_render.append(menu_div);
  17392. addHandlers(command, dom_where_render, function_obj, dom_command);
  17393. }
  17394. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17395. console.log('command, dom_where_render, function_obj, dom_command');
  17396. console.log(command, dom_where_render, function_obj, dom_command);
  17397. console.log(dom_where_render.parents());
  17398. dom_where_render.find('.menu_commands').dropdown({
  17399. on: 'hover'
  17400. });
  17401. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17402. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17403. if (command.commands_block == null || command.commands_block.length == 0) {
  17404. command.commands_block = [];
  17405. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17406. command.commands_block.push(new_cmd);
  17407. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17408. } else {
  17409. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17410. }
  17411. } else {
  17412. switch ((0, _jquery2.default)(this).data('command')) {
  17413. case Models.COMMAND_TYPES.break:
  17414. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17415. break;
  17416. case Models.COMMAND_TYPES.switchcase:
  17417. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17418. break;
  17419. }
  17420. }
  17421. });
  17422. }
  17423. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17424. if (command.cases == null) {
  17425. command.cases = [];
  17426. }
  17427. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17428. command.cases.push(sc);
  17429. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17430. }
  17431. /***/ }),
  17432. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17433. /*!*********************************************!*\
  17434. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17435. \*********************************************/
  17436. /*! no static exports found */
  17437. /***/ (function(module, exports, __webpack_require__) {
  17438. "use strict";
  17439. Object.defineProperty(exports, "__esModule", {
  17440. value: true
  17441. });
  17442. exports.createFloatingCommand = createFloatingCommand;
  17443. exports.renderCommand = renderCommand;
  17444. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17445. var _jquery2 = _interopRequireDefault(_jquery);
  17446. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17447. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17448. var Models = _interopRequireWildcard(_ivprog_elements);
  17449. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17450. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17451. var GlobalsManagement = _interopRequireWildcard(_globals);
  17452. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17453. var VariablesManagement = _interopRequireWildcard(_variables);
  17454. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17455. var CommandsManagement = _interopRequireWildcard(_commands);
  17456. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17457. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17458. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17459. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17460. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17461. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17462. function createFloatingCommand() {
  17463. return (0, _jquery2.default)('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' {<br>} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + '(x < 10) </span></div>');
  17464. }
  17465. function renderCommand(command, function_obj) {
  17466. var ret = '';
  17467. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' </span>';
  17468. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17469. ret += '</div>';
  17470. ret += ' <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17471. ret += '</div>';
  17472. var el = (0, _jquery2.default)(ret);
  17473. el.data('command', command);
  17474. addHandlers(command, function_obj, el);
  17475. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17476. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17477. if (command.commands_block) {
  17478. for (var j = 0; j < command.commands_block.length; j++) {
  17479. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17480. }
  17481. }
  17482. return el;
  17483. }
  17484. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17485. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17486. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17487. dowhiletrue_dom.fadeOut();
  17488. }
  17489. });
  17490. }
  17491. /***/ }),
  17492. /***/ "./js/visualUI/commands/functioncall.js":
  17493. /*!**********************************************!*\
  17494. !*** ./js/visualUI/commands/functioncall.js ***!
  17495. \**********************************************/
  17496. /*! no static exports found */
  17497. /***/ (function(module, exports, __webpack_require__) {
  17498. "use strict";
  17499. Object.defineProperty(exports, "__esModule", {
  17500. value: true
  17501. });
  17502. exports.createFloatingCommand = createFloatingCommand;
  17503. exports.renderCommand = renderCommand;
  17504. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17505. var _jquery2 = _interopRequireDefault(_jquery);
  17506. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17507. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17508. var Models = _interopRequireWildcard(_ivprog_elements);
  17509. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17510. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17511. var GlobalsManagement = _interopRequireWildcard(_globals);
  17512. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17513. var VariablesManagement = _interopRequireWildcard(_variables);
  17514. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17515. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17516. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17517. var CommandsManagement = _interopRequireWildcard(_commands);
  17518. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17519. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17520. function createFloatingCommand() {
  17521. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17522. }
  17523. function renderCommand(command, function_obj) {
  17524. var el = (0, _jquery2.default)('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  17525. el.data('command', command);
  17526. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17527. addHandlers(command, function_obj, el);
  17528. return el;
  17529. }
  17530. function addHandlers(command, function_obj, functioncall_dom) {
  17531. functioncall_dom.find('.button_remove_command').on('click', function () {
  17532. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17533. functioncall_dom.fadeOut();
  17534. }
  17535. });
  17536. }
  17537. /***/ }),
  17538. /***/ "./js/visualUI/commands/iftrue.js":
  17539. /*!****************************************!*\
  17540. !*** ./js/visualUI/commands/iftrue.js ***!
  17541. \****************************************/
  17542. /*! no static exports found */
  17543. /***/ (function(module, exports, __webpack_require__) {
  17544. "use strict";
  17545. Object.defineProperty(exports, "__esModule", {
  17546. value: true
  17547. });
  17548. exports.createFloatingCommand = createFloatingCommand;
  17549. exports.renderCommand = renderCommand;
  17550. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17551. var _jquery2 = _interopRequireDefault(_jquery);
  17552. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17553. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17554. var Models = _interopRequireWildcard(_ivprog_elements);
  17555. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17556. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17557. var GlobalsManagement = _interopRequireWildcard(_globals);
  17558. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17559. var VariablesManagement = _interopRequireWildcard(_variables);
  17560. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17561. var CommandsManagement = _interopRequireWildcard(_commands);
  17562. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17563. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17564. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17565. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17566. function createFloatingCommand() {
  17567. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17568. }
  17569. function renderCommand(command, function_obj) {
  17570. var ret = '';
  17571. 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>';
  17572. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17573. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17574. ret += '<span> </span> ';
  17575. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17576. ret += '</div></div>';
  17577. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17578. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17579. ret += '</div>';
  17580. ret += '<span></span></div>';
  17581. ret += '</div>';
  17582. var el = (0, _jquery2.default)(ret);
  17583. el.data('command', command);
  17584. el.find('.block_commands').data('command', command);
  17585. el.find('.data_block_if').data('command', command);
  17586. el.find('.data_block_else').data('command', command);
  17587. addHandlers(command, function_obj, el);
  17588. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17589. if (command.commands_block) {
  17590. for (var j = 0; j < command.commands_block.length; j++) {
  17591. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17592. }
  17593. }
  17594. if (command.commands_else) {
  17595. for (var j = 0; j < command.commands_else.length; j++) {
  17596. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17597. }
  17598. }
  17599. return el;
  17600. }
  17601. function addHandlers(command, function_obj, iftrue_dom) {
  17602. iftrue_dom.find('.button_remove_command').on('click', function () {
  17603. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17604. iftrue_dom.fadeOut();
  17605. }
  17606. });
  17607. }
  17608. /***/ }),
  17609. /***/ "./js/visualUI/commands/reader.js":
  17610. /*!****************************************!*\
  17611. !*** ./js/visualUI/commands/reader.js ***!
  17612. \****************************************/
  17613. /*! no static exports found */
  17614. /***/ (function(module, exports, __webpack_require__) {
  17615. "use strict";
  17616. Object.defineProperty(exports, "__esModule", {
  17617. value: true
  17618. });
  17619. exports.createFloatingCommand = createFloatingCommand;
  17620. exports.renderCommand = renderCommand;
  17621. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17622. var _jquery2 = _interopRequireDefault(_jquery);
  17623. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17624. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17625. var Models = _interopRequireWildcard(_ivprog_elements);
  17626. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17627. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17628. var GlobalsManagement = _interopRequireWildcard(_globals);
  17629. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17630. var VariablesManagement = _interopRequireWildcard(_variables);
  17631. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17632. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17633. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17634. var CommandsManagement = _interopRequireWildcard(_commands);
  17635. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17636. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17637. function createFloatingCommand() {
  17638. return (0, _jquery2.default)('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' var </span></div>');
  17639. }
  17640. function renderCommand(command, function_obj) {
  17641. var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  17642. el = (0, _jquery2.default)(el);
  17643. el.data('command', command);
  17644. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17645. addHandlers(command, function_obj, el);
  17646. return el;
  17647. }
  17648. function addHandlers(command, function_obj, reader_dom) {
  17649. reader_dom.find('.button_remove_command').on('click', function () {
  17650. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17651. reader_dom.fadeOut();
  17652. }
  17653. });
  17654. }
  17655. /***/ }),
  17656. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17657. /*!**********************************************!*\
  17658. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17659. \**********************************************/
  17660. /*! no static exports found */
  17661. /***/ (function(module, exports, __webpack_require__) {
  17662. "use strict";
  17663. Object.defineProperty(exports, "__esModule", {
  17664. value: true
  17665. });
  17666. exports.createFloatingCommand = createFloatingCommand;
  17667. exports.renderCommand = renderCommand;
  17668. exports.manageExpressionElements = manageExpressionElements;
  17669. exports.manageClearExpressionElements = manageClearExpressionElements;
  17670. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17671. var _jquery2 = _interopRequireDefault(_jquery);
  17672. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17673. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17674. var Models = _interopRequireWildcard(_ivprog_elements);
  17675. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17676. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17677. var GlobalsManagement = _interopRequireWildcard(_globals);
  17678. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17679. var VariablesManagement = _interopRequireWildcard(_variables);
  17680. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17681. var CommandsManagement = _interopRequireWildcard(_commands);
  17682. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17683. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17684. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17685. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17686. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17687. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17688. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17689. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17690. function createFloatingCommand() {
  17691. return (0, _jquery2.default)('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) { } </span></div>');
  17692. }
  17693. function renderCommand(command, function_obj) {
  17694. var ret = '<div class="ui repeatNtimes command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( </span> <div class="ui attribution_expression"><div class="ui variable_attribution"></div> <span class="text_receives span_command_spec"></span> <div class="ui var_value_expression div_expression_st"></div> </div> <span class="span_command_spec separator_character">;</span> <div class="conditional_expression"></div> <span class="span_command_spec separator_character">;</span> <div class="ui incrementation_field"><div class="ui incrementation_variable"></div> <span class="text_inc_receives span_command_spec"></span> <div class="ui first_operand"></div><div class="ui operator"></div><div class="ui second_operand"></div></div> <span class="span_command_spec"> ) </span>';
  17695. ret += '<div class="ui block_commands">';
  17696. ret += '</div>';
  17697. ret += '<span> </span>';
  17698. ret += '</div>';
  17699. var el = (0, _jquery2.default)(ret);
  17700. el.data('command', command);
  17701. addHandlers(command, function_obj, el);
  17702. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17703. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17704. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17705. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17706. if (command.expression1) {
  17707. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17708. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17709. }
  17710. if (command.expression3) {
  17711. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17712. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17713. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17714. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17715. }
  17716. if (command.commands_block) {
  17717. for (var j = 0; j < command.commands_block.length; j++) {
  17718. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17719. }
  17720. }
  17721. return el;
  17722. }
  17723. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17724. if (dom_object.hasClass('variable_attribution')) {
  17725. if (!command.expression3) {
  17726. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [command.var_attribution, Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17727. command.expression3 = exp;
  17728. command.var_incrementation = command.var_attribution;
  17729. var cond_exp = new Models.ArithmeticExpression(command.var_attribution, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17730. command.expression2.expression = cond_exp;
  17731. }
  17732. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17733. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17734. dom_object.parent().find('.var_value_expression').empty();
  17735. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17736. renderAlgorithm();
  17737. }
  17738. if (dom_object.hasClass('incrementation_variable')) {
  17739. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17740. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  17741. command.expression3 = exp;
  17742. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17743. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17744. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17745. }
  17746. }
  17747. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17748. if (dom_object.hasClass('variable_attribution')) {
  17749. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17750. command.expression1 = null;
  17751. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17752. }
  17753. if (dom_object.hasClass('incrementation_variable')) {
  17754. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17755. command.expression3 = null;
  17756. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17757. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17758. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17759. }
  17760. }
  17761. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17762. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17763. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17764. repeatNtimes_dom.fadeOut();
  17765. }
  17766. });
  17767. }
  17768. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17769. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17770. menu_operator.dropdown({
  17771. values: [{
  17772. name: '+',
  17773. value: Models.ARITHMETIC_TYPES.plus,
  17774. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17775. }, {
  17776. name: '-',
  17777. value: Models.ARITHMETIC_TYPES.minus,
  17778. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17779. }, {
  17780. name: '*',
  17781. value: Models.ARITHMETIC_TYPES.multiplication,
  17782. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17783. }, {
  17784. name: '/',
  17785. value: Models.ARITHMETIC_TYPES.division,
  17786. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17787. }, {
  17788. name: '%',
  17789. value: Models.ARITHMETIC_TYPES.module,
  17790. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17791. }],
  17792. onChange: function onChange(value, text, $selectedItem) {
  17793. expression_element.itens[index_op] = value;
  17794. }
  17795. });
  17796. temp_op.append(menu_operator);
  17797. }
  17798. /***/ }),
  17799. /***/ "./js/visualUI/commands/return.js":
  17800. /*!****************************************!*\
  17801. !*** ./js/visualUI/commands/return.js ***!
  17802. \****************************************/
  17803. /*! no static exports found */
  17804. /***/ (function(module, exports, __webpack_require__) {
  17805. "use strict";
  17806. Object.defineProperty(exports, "__esModule", {
  17807. value: true
  17808. });
  17809. exports.createFloatingCommand = createFloatingCommand;
  17810. exports.renderCommand = renderCommand;
  17811. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17812. var _jquery2 = _interopRequireDefault(_jquery);
  17813. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17814. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17815. var Models = _interopRequireWildcard(_ivprog_elements);
  17816. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17817. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17818. var GlobalsManagement = _interopRequireWildcard(_globals);
  17819. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17820. var VariablesManagement = _interopRequireWildcard(_variables);
  17821. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17822. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17823. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17824. var CommandsManagement = _interopRequireWildcard(_commands);
  17825. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17826. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17827. function createFloatingCommand() {
  17828. return (0, _jquery2.default)('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span></div>');
  17829. }
  17830. function renderCommand(command, function_obj) {
  17831. var el = (0, _jquery2.default)('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  17832. el.data('command', command);
  17833. addHandlers(command, function_obj, el);
  17834. if (function_obj.return_type != _types.Types.VOID) {
  17835. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17836. } else {
  17837. el.find('.var_value_menu_div').remove();
  17838. command.variable_value_menu = null;
  17839. }
  17840. return el;
  17841. }
  17842. function addHandlers(command, function_obj, return_dom) {
  17843. return_dom.find('.button_remove_command').on('click', function () {
  17844. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17845. return_dom.fadeOut();
  17846. }
  17847. });
  17848. }
  17849. /***/ }),
  17850. /***/ "./js/visualUI/commands/switch.js":
  17851. /*!****************************************!*\
  17852. !*** ./js/visualUI/commands/switch.js ***!
  17853. \****************************************/
  17854. /*! no static exports found */
  17855. /***/ (function(module, exports, __webpack_require__) {
  17856. "use strict";
  17857. Object.defineProperty(exports, "__esModule", {
  17858. value: true
  17859. });
  17860. exports.createFloatingCommand = createFloatingCommand;
  17861. exports.renderCommand = renderCommand;
  17862. exports.renderCase = renderCase;
  17863. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17864. var _jquery2 = _interopRequireDefault(_jquery);
  17865. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17866. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17867. var Models = _interopRequireWildcard(_ivprog_elements);
  17868. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17869. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17870. var GlobalsManagement = _interopRequireWildcard(_globals);
  17871. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17872. var VariablesManagement = _interopRequireWildcard(_variables);
  17873. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17874. var CommandsManagement = _interopRequireWildcard(_commands);
  17875. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17876. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17877. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17878. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17879. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17880. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17881. function createFloatingCommand() {
  17882. return (0, _jquery2.default)('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( x ) { <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 1: <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 2: <br> } </span></div>');
  17883. }
  17884. function renderCommand(command, function_obj) {
  17885. var ret = '';
  17886. ret += '<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  17887. ret += '</div>';
  17888. var el = (0, _jquery2.default)(ret);
  17889. el.data('command', command);
  17890. addHandlers(command, function_obj, el);
  17891. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17892. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17893. if (command.cases) {
  17894. for (var i = 0; i < command.cases.length; i++) {
  17895. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17896. }
  17897. }
  17898. return el;
  17899. }
  17900. function renderCase(switchcase, command, function_obj, el) {
  17901. var casediv = (0, _jquery2.default)('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  17902. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17903. casediv.data('switchcase', switchcase);
  17904. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17905. el.append(casediv);
  17906. if (switchcase.commands_block) {
  17907. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17908. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17909. }
  17910. }
  17911. casediv.find('.button_remove_command').on('click', function () {
  17912. for (var i = 0; i < command.cases.length; i++) {
  17913. if (switchcase == command.cases[i]) {
  17914. delete command.cases[i];
  17915. command.cases.splice(i, 1);
  17916. casediv.remove();
  17917. break;
  17918. }
  17919. }
  17920. });
  17921. }
  17922. function addHandlers(command, function_obj, switch_dom) {
  17923. switch_dom.find('.button_remove_command').on('click', function () {
  17924. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17925. switch_dom.fadeOut();
  17926. }
  17927. });
  17928. }
  17929. /***/ }),
  17930. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17931. /*!*****************************************************!*\
  17932. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17933. \*****************************************************/
  17934. /*! no static exports found */
  17935. /***/ (function(module, exports, __webpack_require__) {
  17936. "use strict";
  17937. Object.defineProperty(exports, "__esModule", {
  17938. value: true
  17939. });
  17940. exports.VAR_OR_VALUE_TYPES = undefined;
  17941. exports.renderMenu = renderMenu;
  17942. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17943. var _jquery2 = _interopRequireDefault(_jquery);
  17944. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17945. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17946. var Models = _interopRequireWildcard(_ivprog_elements);
  17947. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17948. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17949. var GlobalsManagement = _interopRequireWildcard(_globals);
  17950. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17951. var VariablesManagement = _interopRequireWildcard(_variables);
  17952. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17953. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17954. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17955. var WritersManagement = _interopRequireWildcard(_writer);
  17956. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17957. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17958. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17959. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17960. var VAR_OR_VALUE_TYPES = exports.VAR_OR_VALUE_TYPES = Object.freeze({ only_variable: 1, only_value: 2, only_function: 3, variable_and_function: 4, variable_and_value_opt: 5,
  17961. value_and_function: 6, all: 7 });
  17962. function renderMenu(command, ref_object, dom_object, function_obj) {
  17963. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17964. var expression_element = arguments[5];
  17965. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17966. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17967. if (ref_object.function_called) {
  17968. if (ref_object.function_called.parameters_list) {
  17969. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17970. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17971. ref_object.parameters_list.pop();
  17972. } else {
  17973. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17974. }
  17975. }
  17976. }
  17977. }
  17978. 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">';
  17979. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17980. 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">';
  17981. menu_var_or_value += '</div>';
  17982. }
  17983. 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) {
  17984. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17985. menu_var_or_value += '<div class="menu menu_only_vars">';
  17986. menu_var_or_value += '</div></div>';
  17987. }
  17988. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17989. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17990. }
  17991. 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) {
  17992. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17993. }
  17994. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17995. 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">';
  17996. menu_var_or_value += '</div>';
  17997. }
  17998. 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) {
  17999. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('btn_function');
  18000. menu_var_or_value += '<div class="menu menu_only_functions">';
  18001. menu_var_or_value += '</div></div>';
  18002. if (command.type == Models.COMMAND_TYPES.attribution) {
  18003. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18004. menu_var_or_value += '<div class="menu">';
  18005. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18006. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18007. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18008. menu_var_or_value += '</div></div>';
  18009. }
  18010. }
  18011. menu_var_or_value += '</div></div>';
  18012. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  18013. dom_object.append(menu_var_or_value);
  18014. ref_object.dom_object = menu_var_or_value;
  18015. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18016. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18017. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18018. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18019. if (ref_object.content || ref_object.function_called) {
  18020. if (ref_object.content) {
  18021. // Verificar se a variável ainda existe:
  18022. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  18023. if (variable_fun) {
  18024. ref_object.content = variable_fun;
  18025. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18026. } else {
  18027. if (ref_object.content && ref_object.content.type) {
  18028. ref_object.content = null;
  18029. appendSelectText(ref_object, menu_var_or_value);
  18030. } else {
  18031. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18032. }
  18033. }
  18034. } else if (ref_object.function_called) {
  18035. // Verificar se a função ainda existe:
  18036. var ret_function = isFunctionInProgram(ref_object.function_called);
  18037. if (ret_function) {
  18038. ref_object.function_called = ret_function;
  18039. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18040. } else {
  18041. ref_object.content = null;
  18042. ref_object.row = null;
  18043. ref_object.column = null;
  18044. delete ref_object.function_called;
  18045. delete ref_object.parameters_list;
  18046. appendSelectText(ref_object, menu_var_or_value);
  18047. }
  18048. }
  18049. } else {
  18050. appendSelectText(ref_object, menu_var_or_value);
  18051. }
  18052. }
  18053. function appendSelectText(ref_object, menu_var_or_value) {
  18054. switch (ref_object.variable_and_value) {
  18055. case VAR_OR_VALUE_TYPES.only_variable:
  18056. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  18057. break;
  18058. case VAR_OR_VALUE_TYPES.all:
  18059. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18060. break;
  18061. case VAR_OR_VALUE_TYPES.variable_and_function:
  18062. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18063. break;
  18064. case VAR_OR_VALUE_TYPES.only_function:
  18065. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  18066. break;
  18067. }
  18068. }
  18069. function isFunctionInProgram(function_called_obj) {
  18070. if (function_called_obj.name) {
  18071. if (window.program_obj.functions) {
  18072. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18073. if (window.program_obj.functions[i] == function_called_obj) {
  18074. return window.program_obj.functions[i];
  18075. }
  18076. }
  18077. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18078. if (window.program_obj.functions[i].name == function_called_obj.name) {
  18079. return window.program_obj.functions[i];
  18080. }
  18081. }
  18082. }
  18083. } else if (function_called_obj.identifier) {
  18084. for (var i = 0; i < window.system_functions.length; i++) {
  18085. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  18086. return window.system_functions[i];
  18087. }
  18088. }
  18089. }
  18090. return null;
  18091. }
  18092. function isVarInProgram(var_obj, function_obj) {
  18093. // Verify in locals:
  18094. if (function_obj.variables_list) {
  18095. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18096. if (function_obj.variables_list[i] == var_obj) {
  18097. return function_obj.variables_list[i];
  18098. }
  18099. }
  18100. }
  18101. // Verify in parameters:
  18102. if (function_obj.parameters_list) {
  18103. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18104. if (function_obj.parameters_list[i] == var_obj) {
  18105. return function_obj.parameters_list[i];
  18106. }
  18107. }
  18108. }
  18109. // Verify in globals:
  18110. if (window.program_obj.globals) {
  18111. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18112. if (window.program_obj.globals[i] == var_obj) {
  18113. return window.program_obj.globals[i];
  18114. }
  18115. }
  18116. }
  18117. // If not found, verify if the reference was lost
  18118. if (var_obj) {
  18119. if (function_obj.variables_list) {
  18120. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18121. if (function_obj.variables_list[i].name == var_obj.name) {
  18122. return function_obj.variables_list[i];
  18123. }
  18124. }
  18125. }
  18126. if (function_obj.parameters_list) {
  18127. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18128. if (function_obj.parameters_list[i].name == var_obj.name) {
  18129. return function_obj.parameters_list[i];
  18130. }
  18131. }
  18132. }
  18133. if (window.program_obj.globals) {
  18134. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18135. if (window.program_obj.globals[i].name == var_obj.name) {
  18136. return window.program_obj.globals[i];
  18137. }
  18138. }
  18139. }
  18140. }
  18141. return null;
  18142. }
  18143. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  18144. if (ref_object.function_called) {
  18145. menu_var_or_value.remove();
  18146. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18147. } else if (ref_object.content.type) {
  18148. menu_var_or_value.remove();
  18149. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18150. } else {
  18151. menu_var_or_value.remove();
  18152. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18153. }
  18154. }
  18155. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  18156. if (variable_obj.content || variable_obj.function_called) {
  18157. // Verificar se a variável ainda existe:
  18158. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  18159. if (var_fun) {
  18160. variable_obj.content = var_fun;
  18161. } else {
  18162. if (variable_obj.content && variable_obj.content.type) {
  18163. variable_obj.content = null;
  18164. appendSelectText(variable_obj, menu_var_or_value);
  18165. }
  18166. }
  18167. } else {
  18168. appendSelectText(variable_obj, menu_var_or_value);
  18169. }
  18170. if (variable_obj.content == null && variable_obj.function_called == null) {
  18171. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18172. return;
  18173. }
  18174. var ret = '';
  18175. if (variable_obj.function_called) {
  18176. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  18177. menu_var_or_value.find('.text').text(' ');
  18178. dom_object.find('.menu_var_or_value_dom').remove();
  18179. var parameters_menu;
  18180. if (variable_obj.function_called.name) {
  18181. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18182. } else {
  18183. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  18184. }
  18185. parameters_menu += '<span> ) </span></div>';
  18186. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18187. dom_object.append(parameters_menu);
  18188. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18189. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18190. if (command.type == Models.COMMAND_TYPES.attribution) {
  18191. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18192. context_menu += '<div class="menu">';
  18193. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18194. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18195. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18196. context_menu += '</div></div>';
  18197. }
  18198. context_menu += '</div></div>';
  18199. context_menu = (0, _jquery2.default)(context_menu);
  18200. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18201. context_menu.dropdown({
  18202. onChange: function onChange(value, text, $selectedItem) {
  18203. console.log('S1');
  18204. if ($selectedItem.data('clear')) {
  18205. console.log('PP1');
  18206. dom_object.text('');
  18207. variable_obj.content = null;
  18208. variable_obj.row = null;
  18209. variable_obj.column = null;
  18210. delete variable_obj.function_called;
  18211. delete variable_obj.parameters_list;
  18212. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18213. }
  18214. if ($selectedItem.data('exp')) {
  18215. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18216. }
  18217. },
  18218. selectOnKeydown: false
  18219. });
  18220. } else {
  18221. menu_var_or_value.find('.text').text(' ');
  18222. dom_object.find('.menu_var_or_value_dom').remove();
  18223. var parameters_menu;
  18224. if (variable_obj.function_called.name) {
  18225. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18226. } else {
  18227. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  18228. }
  18229. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18230. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18231. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18232. parameters_menu += ' , ';
  18233. }
  18234. }
  18235. parameters_menu += '<span> ) </span></div>';
  18236. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18237. dom_object.append(parameters_menu);
  18238. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18239. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18240. }
  18241. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18242. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18243. if (command.type == Models.COMMAND_TYPES.attribution) {
  18244. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18245. context_menu += '<div class="menu">';
  18246. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18247. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18248. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18249. context_menu += '</div></div>';
  18250. }
  18251. context_menu += '</div></div>';
  18252. context_menu = (0, _jquery2.default)(context_menu);
  18253. context_menu.insertAfter(parameters_menu);
  18254. context_menu.dropdown({
  18255. onChange: function onChange(value, text, $selectedItem) {
  18256. console.log('S2');
  18257. if ($selectedItem.data('clear')) {
  18258. console.log('PP2');
  18259. dom_object.text('');
  18260. variable_obj.content = null;
  18261. variable_obj.row = null;
  18262. variable_obj.column = null;
  18263. delete variable_obj.function_called;
  18264. delete variable_obj.parameters_list;
  18265. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18266. }
  18267. if ($selectedItem.data('exp')) {
  18268. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18269. }
  18270. },
  18271. selectOnKeydown: false
  18272. });
  18273. }
  18274. } else if (variable_obj.content.type) {
  18275. var variable_render = "";
  18276. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  18277. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18278. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18279. variable_render += '</div>';
  18280. variable_render = (0, _jquery2.default)(variable_render);
  18281. dom_object.append(variable_render);
  18282. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18283. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18284. if (command.type == Models.COMMAND_TYPES.attribution) {
  18285. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18286. context_menu += '<div class="menu">';
  18287. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18288. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18289. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18290. context_menu += '</div></div>';
  18291. }
  18292. context_menu += '</div></div>';
  18293. context_menu = (0, _jquery2.default)(context_menu);
  18294. variable_render.append(context_menu);
  18295. context_menu.dropdown({
  18296. onChange: function onChange(value, text, $selectedItem) {
  18297. console.log('S3');
  18298. if ($selectedItem.data('clear')) {
  18299. console.log('PP3');
  18300. dom_object.text('');
  18301. variable_obj.content = null;
  18302. variable_obj.row = null;
  18303. variable_obj.column = null;
  18304. delete variable_obj.function_called;
  18305. delete variable_obj.parameters_list;
  18306. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18307. }
  18308. if ($selectedItem.data('exp')) {
  18309. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18310. }
  18311. },
  18312. selectOnKeydown: false
  18313. });
  18314. if (!variable_obj.column) {
  18315. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18316. }
  18317. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18318. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  18319. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18320. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18321. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18322. variable_render += '</div>';
  18323. variable_render = (0, _jquery2.default)(variable_render);
  18324. dom_object.append(variable_render);
  18325. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18326. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18327. if (command.type == Models.COMMAND_TYPES.attribution) {
  18328. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18329. context_menu += '<div class="menu">';
  18330. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18331. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18332. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18333. context_menu += '</div></div>';
  18334. }
  18335. context_menu += '</div></div>';
  18336. context_menu = (0, _jquery2.default)(context_menu);
  18337. variable_render.append(context_menu);
  18338. context_menu.dropdown({
  18339. onChange: function onChange(value, text, $selectedItem) {
  18340. console.log('S4');
  18341. if ($selectedItem.data('clear')) {
  18342. console.log('PP4');
  18343. dom_object.text('');
  18344. variable_obj.content = null;
  18345. variable_obj.row = null;
  18346. variable_obj.column = null;
  18347. delete variable_obj.function_called;
  18348. delete variable_obj.parameters_list;
  18349. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18350. }
  18351. if ($selectedItem.data('exp')) {
  18352. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18353. }
  18354. },
  18355. selectOnKeydown: false
  18356. });
  18357. if (!variable_obj.column) {
  18358. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18359. }
  18360. if (!variable_obj.row) {
  18361. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18362. }
  18363. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18364. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18365. } else {
  18366. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18367. variable_render += '</div>';
  18368. variable_render = (0, _jquery2.default)(variable_render);
  18369. dom_object.append(variable_render);
  18370. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18371. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18372. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18373. console.log('dom_object6');
  18374. console.log(dom_object);
  18375. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18376. context_menu += '<div class="menu">';
  18377. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18378. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18379. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18380. context_menu += '</div></div>';
  18381. }
  18382. context_menu += '</div></div>';
  18383. context_menu = (0, _jquery2.default)(context_menu);
  18384. variable_render.append(context_menu);
  18385. context_menu.dropdown({
  18386. onChange: function onChange(value, text, $selectedItem) {
  18387. console.log('S5');
  18388. if ($selectedItem.data('clear')) {
  18389. console.log('PP5');
  18390. dom_object.text('');
  18391. variable_obj.content = null;
  18392. variable_obj.row = null;
  18393. variable_obj.column = null;
  18394. delete variable_obj.function_called;
  18395. delete variable_obj.parameters_list;
  18396. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18397. }
  18398. if ($selectedItem.data('exp')) {
  18399. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18400. }
  18401. },
  18402. selectOnKeydown: false
  18403. });
  18404. }
  18405. } else {
  18406. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18407. variable_render += '</div>';
  18408. variable_render = (0, _jquery2.default)(variable_render);
  18409. dom_object.append(variable_render);
  18410. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18411. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18412. if (command.type == Models.COMMAND_TYPES.attribution) {
  18413. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18414. context_menu += '<div class="menu">';
  18415. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18416. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18417. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18418. context_menu += '</div></div>';
  18419. }
  18420. context_menu += '</div></div>';
  18421. context_menu = (0, _jquery2.default)(context_menu);
  18422. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18423. context_menu.insertAfter(variable_render);
  18424. }
  18425. context_menu.dropdown({
  18426. onChange: function onChange(value, text, $selectedItem) {
  18427. console.log('S6');
  18428. if ($selectedItem.data('clear')) {
  18429. console.log('PP6');
  18430. dom_object.text('');
  18431. variable_obj.content = null;
  18432. variable_obj.row = null;
  18433. variable_obj.column = null;
  18434. delete variable_obj.function_called;
  18435. delete variable_obj.parameters_list;
  18436. dom_object.find('.value_rendered').remove();
  18437. dom_object.find('.context_menu_clear').remove();
  18438. dom_object.find('.width-dynamic-minus').remove();
  18439. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18440. }
  18441. if ($selectedItem.data('exp')) {
  18442. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18443. }
  18444. },
  18445. selectOnKeydown: false
  18446. });
  18447. variable_render.on('click', function (e) {
  18448. variable_render.remove();
  18449. variable_render.empty();
  18450. variable_render.remove();
  18451. dom_object.empty();
  18452. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18453. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18454. });
  18455. }
  18456. }
  18457. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18458. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18459. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18460. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  18461. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  18462. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  18463. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>');
  18464. // Insert Math functions:
  18465. for (var i = 0; i < window.system_functions.length; i++) {
  18466. var t = (0, _jquery2.default)('<div class="item"></div>');
  18467. t.data('function_reference', window.system_functions[i]);
  18468. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18469. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18470. switch (window.system_functions[i].category) {
  18471. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18472. sub_menu.find('.menu_math_functions').append(t);
  18473. break;
  18474. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18475. sub_menu.find('.menu_text_functions').append(t);
  18476. break;
  18477. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18478. sub_menu.find('.menu_arrangement_functions').append(t);
  18479. break;
  18480. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18481. sub_menu.find('.menu_conversion_functions').append(t);
  18482. break;
  18483. }
  18484. }
  18485. }
  18486. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18487. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18488. sub_menu.text('');
  18489. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18490. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18491. temp.data('function_reference', window.program_obj.functions[i]);
  18492. sub_menu.append(temp);
  18493. }
  18494. }
  18495. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18496. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18497. sub_menu.text('');
  18498. var is_there = false;
  18499. if (window.program_obj.globals) {
  18500. if (ref_object.include_constant) {
  18501. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18502. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18503. temp.data('variable_reference', window.program_obj.globals[i]);
  18504. sub_menu.append(temp);
  18505. is_there = true;
  18506. }
  18507. } else {
  18508. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18509. if (!window.program_obj.globals[i].is_constant) {
  18510. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18511. temp.data('variable_reference', window.program_obj.globals[i]);
  18512. sub_menu.append(temp);
  18513. is_there = true;
  18514. }
  18515. }
  18516. }
  18517. }
  18518. if (function_obj.parameters_list) {
  18519. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18520. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18521. temp.data('variable_reference', function_obj.parameters_list[i]);
  18522. sub_menu.append(temp);
  18523. is_there = true;
  18524. }
  18525. }
  18526. if (function_obj.variables_list) {
  18527. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18528. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18529. temp.data('variable_reference', function_obj.variables_list[i]);
  18530. sub_menu.append(temp);
  18531. is_there = true;
  18532. }
  18533. }
  18534. if (!is_there) {
  18535. sub_menu.append((0, _jquery2.default)('<div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable') + '</div>'));
  18536. sub_menu.append((0, _jquery2.default)('<div class="item disabled">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable_instruction') + '</div>'));
  18537. }
  18538. }
  18539. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18540. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18541. menu_var_or_value.dropdown({
  18542. onChange: function onChange(value, text, $selectedItem) {
  18543. console.log('S7');
  18544. dom_object.find('.var_name').remove();
  18545. switch ($selectedItem.data('option')) {
  18546. case VAR_OR_VALUE_TYPES.only_function:
  18547. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18548. break;
  18549. case VAR_OR_VALUE_TYPES.only_value:
  18550. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18551. break;
  18552. case VAR_OR_VALUE_TYPES.only_variable:
  18553. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18554. break;
  18555. }
  18556. if ($selectedItem.data('exp')) {
  18557. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18558. }
  18559. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18560. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18561. }
  18562. },
  18563. selectOnKeydown: false
  18564. });
  18565. }
  18566. dom_object.find('.width-dynamic').on('input', function () {
  18567. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18568. (0, _jquery2.default)(this).focus();
  18569. var tmpStr = (0, _jquery2.default)(this).val();
  18570. (0, _jquery2.default)(this).val('');
  18571. (0, _jquery2.default)(this).val(tmpStr);
  18572. (0, _jquery2.default)(this).css({
  18573. width: inputWidth
  18574. });
  18575. }).trigger('input');
  18576. if (command.type == Models.COMMAND_TYPES.comment) {
  18577. dom_object.parent().on('click', function (e) {
  18578. dom_object.find('.value_rendered').remove();
  18579. dom_object.find('.value_rendered').empty();
  18580. dom_object.find('.value_rendered').remove();
  18581. dom_object.empty();
  18582. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18583. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18584. });
  18585. }
  18586. }
  18587. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18588. ref_object.function_called = function_selected;
  18589. ref_object.parameters_list = [];
  18590. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18591. menu_var_or_value.find('.text').text(' ');
  18592. dom_object.find('.menu_var_or_value_dom').remove();
  18593. var parameters_menu;
  18594. if (function_selected.name) {
  18595. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18596. } else {
  18597. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18598. }
  18599. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18600. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18601. if (j + 1 != function_selected.parameters_list.length) {
  18602. parameters_menu += ' , ';
  18603. }
  18604. }
  18605. parameters_menu += '<span> ) </span></div>';
  18606. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18607. dom_object.append(parameters_menu);
  18608. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18609. var temp;
  18610. if (function_selected.parameters_list[j].dimensions > 0) {
  18611. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  18612. } else {
  18613. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18614. }
  18615. ref_object.parameters_list.push(temp);
  18616. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18617. }
  18618. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18619. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18620. if (command.type == Models.COMMAND_TYPES.attribution) {
  18621. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18622. context_menu += '<div class="menu">';
  18623. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18624. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18625. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18626. context_menu += '</div></div>';
  18627. }
  18628. context_menu += '</div></div>';
  18629. context_menu = (0, _jquery2.default)(context_menu);
  18630. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18631. context_menu.dropdown({
  18632. onChange: function onChange(value, text, $selectedItem) {
  18633. console.log('S8');
  18634. if ($selectedItem.data('clear')) {
  18635. console.log('PP7');
  18636. dom_object.text('');
  18637. ref_object.content = null;
  18638. ref_object.row = null;
  18639. ref_object.column = null;
  18640. delete ref_object.function_called;
  18641. delete ref_object.parameters_list;
  18642. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18643. }
  18644. if ($selectedItem.data('exp')) {
  18645. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18646. }
  18647. },
  18648. selectOnKeydown: false
  18649. });
  18650. } else {
  18651. menu_var_or_value.find('.text').text(' ');
  18652. dom_object.find('.menu_var_or_value_dom').remove();
  18653. var parameters_menu;
  18654. if (function_selected.name) {
  18655. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18656. } else {
  18657. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18658. }
  18659. parameters_menu += '<span> ) </span></div>';
  18660. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18661. dom_object.append(parameters_menu);
  18662. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18663. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18664. if (command.type == Models.COMMAND_TYPES.attribution) {
  18665. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18666. context_menu += '<div class="menu">';
  18667. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18668. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18669. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18670. context_menu += '</div></div>';
  18671. }
  18672. context_menu += '</div></div>';
  18673. context_menu = (0, _jquery2.default)(context_menu);
  18674. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18675. context_menu.dropdown({
  18676. onChange: function onChange(value, text, $selectedItem) {
  18677. console.log('S9');
  18678. if ($selectedItem.data('clear')) {
  18679. console.log('PP8');
  18680. dom_object.text('');
  18681. ref_object.content = null;
  18682. ref_object.row = null;
  18683. ref_object.column = null;
  18684. delete ref_object.function_called;
  18685. delete ref_object.parameters_list;
  18686. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18687. }
  18688. if ($selectedItem.data('exp')) {
  18689. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18690. }
  18691. },
  18692. selectOnKeydown: false
  18693. });
  18694. }
  18695. if (command.type == Models.COMMAND_TYPES.attribution) {
  18696. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18697. }
  18698. }
  18699. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18700. ref_object.content = variable_selected;
  18701. menu_var_or_value.find('.text').text(' ');
  18702. dom_object.find('.menu_var_or_value_dom').remove();
  18703. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18704. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18705. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18706. }
  18707. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18708. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18709. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18710. }
  18711. variable_render += '</div>';
  18712. variable_render = (0, _jquery2.default)(variable_render);
  18713. dom_object.append(variable_render);
  18714. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18715. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18716. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18717. }
  18718. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18719. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18720. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18721. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18722. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18723. }
  18724. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18725. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18726. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18727. console.log("dom_object 10: ");
  18728. console.log(dom_object);
  18729. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18730. context_menu += '<div class="menu">';
  18731. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18732. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18733. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18734. context_menu += '</div></div>';
  18735. }
  18736. context_menu += '</div></div>';
  18737. context_menu = (0, _jquery2.default)(context_menu);
  18738. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18739. context_menu.dropdown({
  18740. onChange: function onChange(value, text, $selectedItem) {
  18741. console.log('S10');
  18742. if ($selectedItem.data('clear')) {
  18743. console.log('PP9');
  18744. dom_object.text('');
  18745. ref_object.content = null;
  18746. ref_object.row = null;
  18747. ref_object.column = null;
  18748. delete ref_object.function_called;
  18749. delete ref_object.parameters_list;
  18750. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18751. }
  18752. if ($selectedItem.data('exp')) {
  18753. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18754. }
  18755. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18756. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18757. }
  18758. },
  18759. selectOnKeydown: false
  18760. });
  18761. if (command.type == Models.COMMAND_TYPES.attribution) {
  18762. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18763. }
  18764. }
  18765. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18766. if (ref_object.content == null) {
  18767. ref_object.content = "";
  18768. }
  18769. menu_var_or_value.find('.text').text(' ');
  18770. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18771. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18772. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18773. rendered.insertBefore(field);
  18774. field.focus();
  18775. field.val(ref_object.content);
  18776. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18777. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18778. if (command.type == Models.COMMAND_TYPES.attribution) {
  18779. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18780. context_menu += '<div class="menu">';
  18781. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18782. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18783. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18784. context_menu += '</div></div>';
  18785. }
  18786. context_menu += '</div></div>';
  18787. context_menu = (0, _jquery2.default)(context_menu);
  18788. dom_object.find('.menu_var_or_value_dom').remove();
  18789. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18790. context_menu.insertAfter(field);
  18791. }
  18792. context_menu.dropdown({
  18793. onChange: function onChange(value, text, $selectedItem) {
  18794. console.log('S11');
  18795. if ($selectedItem.data('clear')) {
  18796. console.log('PP10');
  18797. dom_object.text('');
  18798. dom_object.find('.value_rendered').remove();
  18799. dom_object.find('.context_menu_clear').remove();
  18800. dom_object.find('.width-dynamic-minus').remove();
  18801. ref_object.content = null;
  18802. ref_object.row = null;
  18803. ref_object.column = null;
  18804. delete ref_object.function_called;
  18805. delete ref_object.parameters_list;
  18806. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18807. }
  18808. if ($selectedItem.data('exp')) {
  18809. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18810. }
  18811. },
  18812. selectOnKeydown: false
  18813. });
  18814. dom_object.find('.width-dynamic-minus').focusout(function () {
  18815. if ((0, _jquery2.default)(this).val().trim()) {
  18816. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18817. }
  18818. rendered.text(ref_object.content);
  18819. (0, _jquery2.default)(this).remove();
  18820. });
  18821. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18822. var code = e.keyCode || e.which;
  18823. if (code == 13) {
  18824. if ((0, _jquery2.default)(this).val().trim()) {
  18825. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18826. }
  18827. rendered.text(ref_object.content);
  18828. (0, _jquery2.default)(this).remove();
  18829. }
  18830. if (code == 27) {
  18831. rendered.text(ref_object.content);
  18832. (0, _jquery2.default)(this).remove();
  18833. }
  18834. });
  18835. if (command.type == Models.COMMAND_TYPES.comment) {
  18836. /*rendered.parent().on('click', function(e) {
  18837. rendered.parent().off();
  18838. console.log("TTT14");
  18839. rendered.remove();
  18840. rendered.empty();
  18841. rendered.remove();
  18842. dom_object.empty();
  18843. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18844. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  18845. });*/
  18846. }
  18847. rendered.on('click', function (e) {
  18848. console.log("TTT2");
  18849. rendered.remove();
  18850. rendered.empty();
  18851. rendered.remove();
  18852. dom_object.empty();
  18853. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18854. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18855. });
  18856. if (command.type == Models.COMMAND_TYPES.attribution) {
  18857. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18858. }
  18859. }
  18860. _jquery2.default.fn.textWidth = function (text, font) {
  18861. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18862. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18863. return _jquery2.default.fn.textWidth.fakeEl.width();
  18864. };
  18865. /***/ }),
  18866. /***/ "./js/visualUI/commands/whiletrue.js":
  18867. /*!*******************************************!*\
  18868. !*** ./js/visualUI/commands/whiletrue.js ***!
  18869. \*******************************************/
  18870. /*! no static exports found */
  18871. /***/ (function(module, exports, __webpack_require__) {
  18872. "use strict";
  18873. Object.defineProperty(exports, "__esModule", {
  18874. value: true
  18875. });
  18876. exports.createFloatingCommand = createFloatingCommand;
  18877. exports.renderCommand = renderCommand;
  18878. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18879. var _jquery2 = _interopRequireDefault(_jquery);
  18880. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18881. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18882. var Models = _interopRequireWildcard(_ivprog_elements);
  18883. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18884. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18885. var GlobalsManagement = _interopRequireWildcard(_globals);
  18886. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18887. var VariablesManagement = _interopRequireWildcard(_variables);
  18888. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18889. var CommandsManagement = _interopRequireWildcard(_commands);
  18890. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18891. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18892. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18893. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18894. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18895. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18896. function createFloatingCommand() {
  18897. return (0, _jquery2.default)('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' ( x < 10 ) { } </span></div>');
  18898. }
  18899. function renderCommand(command, function_obj) {
  18900. var ret = '';
  18901. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span>';
  18902. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18903. ret += ' </span>';
  18904. ret += '<div class="ui block_commands">';
  18905. ret += '</div>';
  18906. ret += '<span> </span>';
  18907. ret += '</div>';
  18908. var el = (0, _jquery2.default)(ret);
  18909. el.data('command', command);
  18910. addHandlers(command, function_obj, el);
  18911. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18912. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18913. if (command.commands_block) {
  18914. for (var j = 0; j < command.commands_block.length; j++) {
  18915. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18916. }
  18917. }
  18918. return el;
  18919. }
  18920. function addHandlers(command, function_obj, whiletrue_dom) {
  18921. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18922. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18923. whiletrue_dom.fadeOut();
  18924. }
  18925. });
  18926. }
  18927. /***/ }),
  18928. /***/ "./js/visualUI/commands/writer.js":
  18929. /*!****************************************!*\
  18930. !*** ./js/visualUI/commands/writer.js ***!
  18931. \****************************************/
  18932. /*! no static exports found */
  18933. /***/ (function(module, exports, __webpack_require__) {
  18934. "use strict";
  18935. Object.defineProperty(exports, "__esModule", {
  18936. value: true
  18937. });
  18938. exports.createFloatingCommand = createFloatingCommand;
  18939. exports.renderCommand = renderCommand;
  18940. exports.addContent = addContent;
  18941. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18942. var _jquery2 = _interopRequireDefault(_jquery);
  18943. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18944. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18945. var Models = _interopRequireWildcard(_ivprog_elements);
  18946. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18947. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18948. var GlobalsManagement = _interopRequireWildcard(_globals);
  18949. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18950. var VariablesManagement = _interopRequireWildcard(_variables);
  18951. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18952. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18953. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18954. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18955. var CommandsManagement = _interopRequireWildcard(_commands);
  18956. __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  18957. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18958. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18959. function createFloatingCommand() {
  18960. return (0, _jquery2.default)('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' var </span></div>');
  18961. }
  18962. function renderCommand(command, function_obj) {
  18963. var ret = '';
  18964. ret += '<div class="ui writer command_container"> <i class="ui icon small upload command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  18965. var el = (0, _jquery2.default)(ret);
  18966. el.data('command', command);
  18967. for (var i = 0; i < command.content.length; i++) {
  18968. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18969. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  18970. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  18971. div_parent_with_handler.append(new_div_item);
  18972. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  18973. el.find('.all_elements_write').append(div_parent_with_handler);
  18974. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18975. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18976. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  18977. }
  18978. if (command.content.length == 0) {
  18979. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18980. }
  18981. addHandlers(command, function_obj, el);
  18982. return el;
  18983. }
  18984. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  18985. item_div.find('.times').on('click', function () {
  18986. for (var i = 0; i < command.content.length; i++) {
  18987. if (command.content[i] == content_element) {
  18988. delete command.content[i];
  18989. command.content.splice(i, 1);
  18990. item_div.children().off();
  18991. item_div.off();
  18992. item_div.fadeOut();
  18993. if (command.content.length > 0) {
  18994. item_div.next('.icon_add_item_to_writer').fadeOut();
  18995. }
  18996. break;
  18997. }
  18998. }
  18999. });
  19000. }
  19001. function addHandlers(command, function_obj, writer_dom) {
  19002. writer_dom.find('.button_remove_command').on('click', function () {
  19003. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  19004. writer_dom.fadeOut();
  19005. }
  19006. });
  19007. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  19008. handle: '.ellipsis',
  19009. animation: 100,
  19010. ghostClass: 'ghost',
  19011. group: 'writer_' + Math.floor(Math.random() * 10000000),
  19012. draggable: '.div_parent_handler',
  19013. onEnd: function onEnd(evt) {
  19014. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  19015. writer_dom.empty();
  19016. writer_dom.replaceWith(renderCommand(command, function_obj));
  19017. }
  19018. });
  19019. }
  19020. function addHandlerIconAdd(dom_object, command, function_obj) {
  19021. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  19022. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19023. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19024. if (!insert_after) {
  19025. dom_object.append(icon_add_item);
  19026. } else {
  19027. icon_add_item.insertAfter(after_which);
  19028. }
  19029. icon_add_item.on('click', function (e) {
  19030. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler" style="display:none;"></div>');
  19031. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  19032. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19033. div_parent_with_handler.append(new_div_item);
  19034. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19035. div_parent_with_handler.insertAfter(icon_add_item);
  19036. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19037. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19038. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  19039. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19040. var pos = 1;
  19041. dom_object.find('.icon_add_item_to_writer').each(function () {
  19042. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  19043. command.content.splice(pos, 0, new_related_menu);
  19044. } else {
  19045. pos++;
  19046. }
  19047. });
  19048. if (command.content.length == 1) {
  19049. icon_add_item.remove();
  19050. }
  19051. div_parent_with_handler.fadeIn();
  19052. });
  19053. }
  19054. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  19055. if (dom_object.hasClass('var_value_menu_div')) {
  19056. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19057. icon_add_item.insertAfter(dom_object);
  19058. icon_add_item.on('click', function (e) {
  19059. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  19060. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19061. div_parent_with_handler.append(new_div_item);
  19062. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19063. div_parent_with_handler.insertAfter(icon_add_item);
  19064. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19065. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19066. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19067. command.content.push(new_related_menu);
  19068. if (command.content.length == 1) {
  19069. icon_add_item.remove();
  19070. }
  19071. });
  19072. }
  19073. }
  19074. /***/ }),
  19075. /***/ "./js/visualUI/functions.js":
  19076. /*!**********************************!*\
  19077. !*** ./js/visualUI/functions.js ***!
  19078. \**********************************/
  19079. /*! no static exports found */
  19080. /***/ (function(module, exports, __webpack_require__) {
  19081. "use strict";
  19082. Object.defineProperty(exports, "__esModule", {
  19083. value: true
  19084. });
  19085. exports.renderFunction = renderFunction;
  19086. exports.initVisualUI = initVisualUI;
  19087. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19088. var _jquery2 = _interopRequireDefault(_jquery);
  19089. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19090. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19091. var Models = _interopRequireWildcard(_ivprog_elements);
  19092. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19093. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19094. var GlobalsManagement = _interopRequireWildcard(_globals);
  19095. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19096. var VariablesManagement = _interopRequireWildcard(_variables);
  19097. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19098. var CommandsManagement = _interopRequireWildcard(_commands);
  19099. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19100. var CodeManagement = _interopRequireWildcard(_code_generator);
  19101. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19102. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  19103. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19104. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  19105. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19106. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  19107. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  19108. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  19109. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  19110. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  19111. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  19112. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19113. var Utils = _interopRequireWildcard(_utils);
  19114. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  19115. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  19116. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19117. var counter_new_functions = 0;
  19118. var counter_new_parameters = 0;
  19119. var ivprog_version = '2019_01_13 Build 18_55';
  19120. var studentTemp = null;
  19121. var domConsole = null;
  19122. window.studentGrade = null;
  19123. window.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  19124. var program = new Models.Program();
  19125. window.system_functions = [];
  19126. // Adding math functions:
  19127. window.system_functions.push(new Models.SystemFunction('$sin', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19128. window.system_functions.push(new Models.SystemFunction('$cos', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19129. window.system_functions.push(new Models.SystemFunction('$tan', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19130. window.system_functions.push(new Models.SystemFunction('$sqrt', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19131. window.system_functions.push(new Models.SystemFunction('$pow', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19132. window.system_functions.push(new Models.SystemFunction('$log', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19133. window.system_functions.push(new Models.SystemFunction('$abs', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19134. window.system_functions.push(new Models.SystemFunction('$negate', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19135. window.system_functions.push(new Models.SystemFunction('$invert', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19136. window.system_functions.push(new Models.SystemFunction('$max', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19137. window.system_functions.push(new Models.SystemFunction('$min', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  19138. // Adding text functions:
  19139. window.system_functions.push(new Models.SystemFunction('$substring', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19140. window.system_functions.push(new Models.SystemFunction('$length', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19141. window.system_functions.push(new Models.SystemFunction('$uppercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19142. window.system_functions.push(new Models.SystemFunction('$lowercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19143. window.system_functions.push(new Models.SystemFunction('$charAt', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  19144. // Adding arrangement functions:
  19145. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 1)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19146. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19147. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19148. // Adding conversion functions:
  19149. window.system_functions.push(new Models.SystemFunction('$isReal', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19150. window.system_functions.push(new Models.SystemFunction('$isInt', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19151. window.system_functions.push(new Models.SystemFunction('$isBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19152. window.system_functions.push(new Models.SystemFunction('$castReal', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19153. window.system_functions.push(new Models.SystemFunction('$castInt', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19154. window.system_functions.push(new Models.SystemFunction('$castBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19155. window.system_functions.push(new Models.SystemFunction('$castString', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  19156. 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');
  19157. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  19158. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  19159. program.addFunction(mainFunction);
  19160. window.program_obj = program;
  19161. window.generator = CodeManagement.generate;
  19162. window.runCodeAssessment = runCodeAssessment;
  19163. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  19164. window.insertContext = false;
  19165. window.watchW = _melankeWatchjs2.default;
  19166. _melankeWatchjs2.default.watch(window.program_obj.globals, function () {
  19167. if (window.insertContext) {
  19168. setTimeout(function () {
  19169. AlgorithmManagement.renderAlgorithm();
  19170. }, 300);
  19171. window.insertContext = false;
  19172. } else {
  19173. AlgorithmManagement.renderAlgorithm();
  19174. }
  19175. }, 1);
  19176. _melankeWatchjs2.default.watch(window.program_obj.functions, function () {
  19177. if (window.insertContext) {
  19178. setTimeout(function () {
  19179. AlgorithmManagement.renderAlgorithm();
  19180. }, 300);
  19181. window.insertContext = false;
  19182. } else {
  19183. AlgorithmManagement.renderAlgorithm();
  19184. }
  19185. }, 1);
  19186. function addFunctionHandler() {
  19187. var new_function = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("new_function") + "_" + counter_new_functions, _types.Types.VOID, 0, [], false, false, [], new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_start')));
  19188. program.addFunction(new_function);
  19189. counter_new_functions++;
  19190. window.insertContext = true;
  19191. var newe = renderFunction(new_function);
  19192. newe.css('display', 'none');
  19193. newe.fadeIn();
  19194. }
  19195. function addParameter(function_obj, function_container) {
  19196. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19197. if (function_obj.parameters_list == null) {
  19198. function_obj.parameters_list = [];
  19199. }
  19200. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  19201. function_obj.parameters_list.push(new_parameter);
  19202. counter_new_parameters++;
  19203. var newe = renderParameter(function_obj, new_parameter, function_container);
  19204. if (is_from_click) {
  19205. newe.css('display', 'none');
  19206. newe.fadeIn();
  19207. }
  19208. }
  19209. function updateReturnType(function_obj, new_type) {
  19210. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19211. function_obj.return_type = new_type;
  19212. function_obj.return_dimensions = new_dimensions;
  19213. }
  19214. function removeFunction(function_obj) {
  19215. var index = program.functions.indexOf(function_obj);
  19216. if (index > -1) {
  19217. program.functions.splice(index, 1);
  19218. }
  19219. }
  19220. function minimizeFunction(function_obj) {
  19221. function_obj.is_hidden = !function_obj.is_hidden;
  19222. }
  19223. function addHandlers(function_obj, function_container) {
  19224. function_container.find('.ui.dropdown.function_return').dropdown({
  19225. onChange: function onChange(value, text, $selectedItem) {
  19226. if ($selectedItem.data('dimensions')) {
  19227. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19228. } else {
  19229. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  19230. }
  19231. },
  19232. selectOnKeydown: false
  19233. });
  19234. function_container.find(".name_function_updated").on('click', function (e) {
  19235. enableNameFunctionUpdate(function_obj, function_container);
  19236. });
  19237. function_container.find(".add_parameter_button").on('click', function (e) {
  19238. window.insertContext = true;
  19239. addParameter(function_obj, function_container, true);
  19240. });
  19241. function_container.find('.menu_commands').dropdown({
  19242. on: 'hover'
  19243. });
  19244. function_container.find('.menu_commands a').on('click', function (evt) {
  19245. if (function_obj.commands == null || function_obj.commands.length == 0) {
  19246. function_obj.commands = [];
  19247. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  19248. function_obj.commands.push(new_cmd);
  19249. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  19250. } else {
  19251. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  19252. }
  19253. });
  19254. function_container.find('.add_var_button_function').on('click', function (e) {
  19255. window.insertContext = true;
  19256. VariablesManagement.addVariable(function_obj, function_container, true);
  19257. });
  19258. function_container.find('.remove_function_button').on('click', function (e) {
  19259. removeFunction(function_obj);
  19260. function_container.fadeOut();
  19261. });
  19262. function_container.find('.minimize_function_button').on('click', function (e) {
  19263. minimizeFunction(function_obj);
  19264. if (function_obj.is_hidden) {
  19265. function_container.find(".add_var_button_function").toggle();
  19266. function_container.find(".inline_add_command").toggle();
  19267. function_container.find(".function_area").slideToggle();
  19268. } else {
  19269. function_container.find(".function_area").slideToggle(function () {
  19270. function_container.find(".add_var_button_function").toggle();
  19271. function_container.find(".inline_add_command").toggle();
  19272. });
  19273. }
  19274. });
  19275. }
  19276. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  19277. function renderFunctionReturn(function_obj, function_element) {
  19278. var ret = '<div class="ui dropdown function_return">';
  19279. if (function_obj.return_dimensions > 0) {
  19280. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  19281. if (function_obj.return_dimensions == 1) {
  19282. ret += ' [ ] ';
  19283. } else {
  19284. ret += ' [ ] [ ] ';
  19285. }
  19286. ret += '</div>';
  19287. } else {
  19288. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  19289. }
  19290. ret += '<div class="menu">';
  19291. for (var tm in _types.Types) {
  19292. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19293. }
  19294. for (var tm in _types.Types) {
  19295. if (tm == _types.Types.VOID.toUpperCase()) {
  19296. continue;
  19297. }
  19298. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  19299. }
  19300. ret += '</div></div>';
  19301. ret = (0, _jquery2.default)(ret);
  19302. function_element.find('.function_return').append(ret);
  19303. }
  19304. function renderFunction(function_obj) {
  19305. var appender = '<div class="ui secondary segment function_div list-group-item">';
  19306. if (function_obj.function_comment) {
  19307. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  19308. }
  19309. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  19310. 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>';
  19311. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  19312. if (function_obj.is_main) {
  19313. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _localizedStringsService.LocalizedStrings.getUI('void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
  19314. } else {
  19315. appender += '<div class="ui function_return"></div>';
  19316. 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">';
  19317. }
  19318. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  19319. 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>';
  19320. appender += '<div class="ui top attached segment variables_list_div"></div>';
  19321. appender += '<div class="ui inline_add_command"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" style="float: left;" ><i class="icon code"></i> <div class="menu"> ';
  19322. appender += '<a class="item" data-command="' + Models.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.switch + '"><i class="list icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_switch') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.return + '"><i class="reply icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_btn_return') + '</a>' + '</div></div></div>';
  19323. appender += '<div class="ui bottom attached segment commands_list_div"></div>';
  19324. appender += '</div></div>';
  19325. appender = (0, _jquery2.default)(appender);
  19326. (0, _jquery2.default)('.all_functions').append(appender);
  19327. appender.data('fun', function_obj);
  19328. appender.find('.commands_list_div').data('fun', function_obj);
  19329. renderFunctionReturn(function_obj, appender);
  19330. addHandlers(function_obj, appender);
  19331. // Rendering parameters:
  19332. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19333. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  19334. }
  19335. // Rendering variables:
  19336. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19337. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  19338. }
  19339. // Rendering commands:
  19340. for (var j = 0; j < function_obj.commands.length; j++) {
  19341. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  19342. }
  19343. (0, _jquery2.default)('.minimize_function_button').popup({
  19344. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  19345. delay: {
  19346. show: 750,
  19347. hide: 0
  19348. }
  19349. });
  19350. Sortable.create(appender.find(".variables_list_div")[0], {
  19351. handle: '.ellipsis',
  19352. animation: 100,
  19353. ghostClass: 'ghost',
  19354. group: 'local_vars_drag_' + program.functions.indexOf(function_obj),
  19355. onEnd: function onEnd(evt) {
  19356. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19357. }
  19358. });
  19359. /*Sortable.create(appender.find(".commands_list_div")[0], {
  19360. handle: '.command_drag',
  19361. animation: 100,
  19362. ghostClass: 'ghost',
  19363. group: 'commands_drag_' + program.functions.indexOf(function_obj),
  19364. onEnd: function (evt) {
  19365. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19366. }
  19367. });*/
  19368. if (!function_obj.is_main) {
  19369. Sortable.create(appender.find(".container_parameters_list")[0], {
  19370. handle: '.ellipsis',
  19371. animation: 100,
  19372. ghostClass: 'ghost',
  19373. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19374. onEnd: function onEnd(evt) {
  19375. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19376. }
  19377. });
  19378. }
  19379. return appender;
  19380. }
  19381. function initVisualUI() {
  19382. // MUST USE CONST, LET, OR VAR !!!!!!
  19383. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  19384. // fill mainDiv with functions and globals...
  19385. // renderAlgorithm()...
  19386. (0, _jquery2.default)('.add_function_button').on('click', function () {
  19387. addFunctionHandler();
  19388. });
  19389. (0, _jquery2.default)('.add_global_button').on('click', function () {
  19390. window.insertContext = true;
  19391. GlobalsManagement.addGlobal(program, true);
  19392. });
  19393. (0, _jquery2.default)('.run_button').on('click', function () {
  19394. runCode();
  19395. });
  19396. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  19397. toggleVisualCoding();
  19398. });
  19399. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  19400. toggleTextualCoding();
  19401. });
  19402. (0, _jquery2.default)('.assessment').on('click', function () {
  19403. runCodeAssessment();
  19404. is_iassign = true;
  19405. });
  19406. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19407. toggleConsole();
  19408. });
  19409. (0, _jquery2.default)('.expand_button').on('click', function () {
  19410. full_screen();
  19411. });
  19412. (0, _jquery2.default)('.main_title h2').prop('title', _localizedStringsService.LocalizedStrings.getUI('text_ivprog_description'));
  19413. }
  19414. var is_iassign = false;
  19415. (0, _jquery2.default)(document).ready(function () {
  19416. var time_show = 750;
  19417. (0, _jquery2.default)('.visual_coding_button').popup({
  19418. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19419. delay: {
  19420. show: time_show,
  19421. hide: 0
  19422. }
  19423. });
  19424. (0, _jquery2.default)('.textual_coding_button').popup({
  19425. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19426. delay: {
  19427. show: time_show,
  19428. hide: 0
  19429. }
  19430. });
  19431. (0, _jquery2.default)('.upload_file_button').popup({
  19432. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19433. delay: {
  19434. show: time_show,
  19435. hide: 0
  19436. }
  19437. });
  19438. (0, _jquery2.default)('.download_file_button').popup({
  19439. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19440. delay: {
  19441. show: time_show,
  19442. hide: 0
  19443. }
  19444. });
  19445. (0, _jquery2.default)('.undo_button').popup({
  19446. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19447. delay: {
  19448. show: time_show,
  19449. hide: 0
  19450. }
  19451. });
  19452. (0, _jquery2.default)('.redo_button').popup({
  19453. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19454. delay: {
  19455. show: time_show,
  19456. hide: 0
  19457. }
  19458. });
  19459. (0, _jquery2.default)('.run_button').popup({
  19460. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19461. delay: {
  19462. show: time_show,
  19463. hide: 0
  19464. }
  19465. });
  19466. (0, _jquery2.default)('.assessment_button').popup({
  19467. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19468. delay: {
  19469. show: time_show,
  19470. hide: 0
  19471. }
  19472. });
  19473. (0, _jquery2.default)('.help_button').popup({
  19474. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help") + ' - ' + _localizedStringsService.LocalizedStrings.getUI("text_ivprog_version") + ' ' + ivprog_version,
  19475. delay: {
  19476. show: time_show,
  19477. hide: 0
  19478. }
  19479. });
  19480. (0, _jquery2.default)('.add_global_button').popup({
  19481. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19482. delay: {
  19483. show: time_show,
  19484. hide: 0
  19485. }
  19486. });
  19487. (0, _jquery2.default)('.div_toggle_console').popup({
  19488. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19489. delay: {
  19490. show: time_show,
  19491. hide: 0
  19492. }
  19493. });
  19494. Sortable.create(listWithHandle, {
  19495. handle: '.glyphicon-move',
  19496. animation: 100,
  19497. ghostClass: 'ghost',
  19498. group: 'functions_divs_drag',
  19499. onEnd: function onEnd(evt) {
  19500. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19501. }
  19502. });
  19503. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  19504. Sortable.create(listGlobalsHandle, {
  19505. handle: '.ellipsis',
  19506. animation: 100,
  19507. ghostClass: 'ghost',
  19508. group: 'globals_divs_drag',
  19509. onEnd: function onEnd(evt) {
  19510. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  19511. }
  19512. });
  19513. });
  19514. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  19515. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  19516. }
  19517. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  19518. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  19519. }
  19520. function updateSequenceGlobals(oldIndex, newIndex) {
  19521. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  19522. }
  19523. function updateSequenceFunction(oldIndex, newIndex) {
  19524. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19525. }
  19526. function runCodeAssessment() {
  19527. window.studentGrade = null;
  19528. studentTemp = null;
  19529. var strCode = CodeManagement.generate();
  19530. if (strCode == null) {
  19531. return;
  19532. }
  19533. toggleConsole(true);
  19534. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19535. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19536. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19537. runner.runTest().then(function (grade) {
  19538. if (!is_iassign) {
  19539. parent.getEvaluationCallback(grade);
  19540. } else {
  19541. is_iassign = false;
  19542. }
  19543. }).catch(function (err) {
  19544. return console.log(err);
  19545. });
  19546. }
  19547. function runCode() {
  19548. var strCode = CodeManagement.generate();
  19549. if (strCode == null) {
  19550. return;
  19551. }
  19552. toggleConsole(true);
  19553. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19554. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19555. try {
  19556. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19557. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19558. var data = analyser.analyseTree();
  19559. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19560. proc.registerInput(domConsole);
  19561. proc.registerOutput(domConsole);
  19562. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19563. proc.interpretAST().then(function (_) {
  19564. domConsole.info("Programa executado com sucesso!");
  19565. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19566. }).catch(function (err) {
  19567. domConsole.err(err.message);
  19568. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19569. });
  19570. } catch (error) {
  19571. domConsole.err(error.message);
  19572. console.log(error);
  19573. }
  19574. }
  19575. function toggleConsole(is_running) {
  19576. if (is_running) {
  19577. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19578. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19579. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19580. return;
  19581. }
  19582. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19583. // esconder
  19584. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19585. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19586. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19587. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19588. } else {
  19589. // mostrar
  19590. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19591. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19592. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19593. }
  19594. }
  19595. function waitToCloseConsole() {
  19596. domConsole.info("Aperte qualquer tecla para fechar...");
  19597. var p = new Promise(function (resolve, _) {
  19598. domConsole.requestInput(resolve, true);
  19599. });
  19600. p.then(function (_) {
  19601. domConsole.dispose();
  19602. domConsole = null;
  19603. (0, _jquery2.default)("#ivprog-term").hide();
  19604. });
  19605. }
  19606. function toggleTextualCoding() {
  19607. var code = CodeManagement.generate();
  19608. if (code == null) {
  19609. return;
  19610. }
  19611. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19612. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19613. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19614. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19615. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19616. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19617. }
  19618. function toggleVisualCoding() {
  19619. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19620. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19621. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19622. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19623. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19624. }
  19625. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19626. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19627. if (index > -1) {
  19628. window.insertContext = true;
  19629. function_obj.parameters_list.splice(index, 1);
  19630. }
  19631. (0, _jquery2.default)(parameter_container).fadeOut();
  19632. }
  19633. function updateParameterType(parameter_obj, new_type) {
  19634. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19635. parameter_obj.type = new_type;
  19636. parameter_obj.dimensions = new_dimensions;
  19637. if (new_dimensions > 0) {
  19638. parameter_obj.rows = new_dimensions;
  19639. parameter_obj.columns = 2;
  19640. }
  19641. }
  19642. function renderParameter(function_obj, parameter_obj, function_container) {
  19643. var ret = "";
  19644. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  19645. ret += '<div class="ui dropdown parameter_type">';
  19646. if (parameter_obj.dimensions > 0) {
  19647. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19648. if (parameter_obj.dimensions == 1) {
  19649. ret += ' [ ] ';
  19650. } else {
  19651. ret += ' [ ] [ ] ';
  19652. }
  19653. ret += '</div>';
  19654. } else {
  19655. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19656. }
  19657. ret += '<div class="menu">';
  19658. for (var tm in _types.Types) {
  19659. if (tm == _types.Types.VOID.toUpperCase()) {
  19660. continue;
  19661. }
  19662. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19663. }
  19664. for (var tm in _types.Types) {
  19665. if (tm == _types.Types.VOID.toUpperCase()) {
  19666. continue;
  19667. }
  19668. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  19669. }
  19670. ret += '</div></div>';
  19671. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19672. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  19673. ret = (0, _jquery2.default)(ret);
  19674. function_container.find('.container_parameters_list').append(ret);
  19675. ret.find('.remove_parameter').on('click', function (e) {
  19676. removeParameter(function_obj, parameter_obj, ret);
  19677. });
  19678. ret.find('.ui.dropdown.parameter_type').dropdown({
  19679. onChange: function onChange(value, text, $selectedItem) {
  19680. if ($selectedItem.data('dimensions')) {
  19681. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19682. } else {
  19683. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19684. }
  19685. },
  19686. selectOnKeydown: false
  19687. });
  19688. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19689. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  19690. });
  19691. return ret;
  19692. }
  19693. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  19694. if (parameter_var.name == new_name) {
  19695. return;
  19696. }
  19697. if (isValidIdentifier(new_name)) {
  19698. if (variableNameAlreadyExists(new_name, function_obj)) {
  19699. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_variable_duplicated'));
  19700. } else {
  19701. parameter_var.name = new_name;
  19702. }
  19703. } else {
  19704. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  19705. }
  19706. }
  19707. function variableNameAlreadyExists(name_var, function_obj) {
  19708. if (function_obj.parameters_list) {
  19709. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  19710. if (function_obj.parameters_list[i].name == name_var) {
  19711. return true;
  19712. }
  19713. }
  19714. }
  19715. if (function_obj.variables_list) {
  19716. for (var i = 0; i < function_obj.variables_list.length; i++) {
  19717. if (function_obj.variables_list[i].name == name_var) {
  19718. return true;
  19719. }
  19720. }
  19721. }
  19722. return false;
  19723. }
  19724. function updateFunctionName(function_var, new_name, function_obj_dom) {
  19725. if (function_var.name == new_name) {
  19726. return;
  19727. }
  19728. if (isValidIdentifier(new_name)) {
  19729. if (functionNameAlreadyExists(new_name)) {
  19730. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name_duplicated'));
  19731. } else {
  19732. function_var.name = new_name;
  19733. }
  19734. } else {
  19735. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  19736. }
  19737. }
  19738. function functionNameAlreadyExists(function_name) {
  19739. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19740. if (window.program_obj.functions[i].name == function_name) {
  19741. return true;
  19742. }
  19743. }
  19744. return false;
  19745. }
  19746. function isValidIdentifier(identifier_str) {
  19747. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  19748. );
  19749. }
  19750. var opened_name_parameter = false;
  19751. var opened_input_parameter = null;
  19752. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  19753. if (opened_name_parameter) {
  19754. opened_input_parameter.focus();
  19755. return;
  19756. }
  19757. opened_name_parameter = true;
  19758. parent_node = (0, _jquery2.default)(parent_node);
  19759. var input_field;
  19760. parent_node.find('.span_name_parameter').text('');
  19761. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  19762. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  19763. input_field.on('input', function () {
  19764. var inputWidth = input_field.textWidth() + 10;
  19765. opened_input_parameter = input_field;
  19766. input_field.focus();
  19767. var tmpStr = input_field.val();
  19768. input_field.val('');
  19769. input_field.val(tmpStr);
  19770. input_field.css({
  19771. width: inputWidth
  19772. });
  19773. }).trigger('input');
  19774. input_field.focusout(function () {
  19775. /// update array:
  19776. if (input_field.val().trim()) {
  19777. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  19778. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19779. }
  19780. input_field.off();
  19781. input_field.remove();
  19782. /// update elements:
  19783. opened_name_parameter = false;
  19784. opened_input_parameter = false;
  19785. });
  19786. input_field.on('keydown', function (e) {
  19787. var code = e.keyCode || e.which;
  19788. if (code == 13) {
  19789. if (input_field.val().trim()) {
  19790. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  19791. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19792. }
  19793. input_field.off();
  19794. input_field.remove();
  19795. /// update elements:
  19796. opened_name_parameter = false;
  19797. opened_input_parameter = false;
  19798. }
  19799. if (code == 27) {
  19800. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19801. input_field.off();
  19802. input_field.remove();
  19803. /// update elements:
  19804. opened_name_parameter = false;
  19805. opened_input_parameter = false;
  19806. }
  19807. });
  19808. input_field.select();
  19809. }
  19810. var opened_name_function = false;
  19811. var opened_input = null;
  19812. var previousPadding = null;
  19813. function enableNameFunctionUpdate(function_obj, parent_node) {
  19814. if (opened_name_function) {
  19815. opened_input.focus();
  19816. return;
  19817. }
  19818. parent_node = (0, _jquery2.default)(parent_node);
  19819. parent_node.find('.span_name_function').text('');
  19820. var input_field;
  19821. if (!previousPadding) {
  19822. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  19823. }
  19824. parent_node.find('.span_name_function').css('padding-left', '0');
  19825. parent_node.find('.span_name_function').css('padding-right', '0');
  19826. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  19827. input_field.insertBefore(parent_node.find('.span_name_function'));
  19828. input_field.on('input', function () {
  19829. var inputWidth = input_field.textWidth() + 10;
  19830. opened_input = input_field;
  19831. input_field.focus();
  19832. var tmpStr = input_field.val();
  19833. input_field.val('');
  19834. input_field.val(tmpStr);
  19835. input_field.css({
  19836. width: inputWidth
  19837. });
  19838. }).trigger('input');
  19839. input_field.focusout(function () {
  19840. /// update array:
  19841. if (input_field.val().trim()) {
  19842. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  19843. }
  19844. input_field.off();
  19845. input_field.remove();
  19846. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19847. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19848. parent_node.find('.span_name_function').text(function_obj.name);
  19849. /// update elements:
  19850. opened_name_function = false;
  19851. opened_input = false;
  19852. });
  19853. input_field.on('keydown', function (e) {
  19854. var code = e.keyCode || e.which;
  19855. if (code == 13) {
  19856. if (input_field.val().trim()) {
  19857. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  19858. }
  19859. input_field.off();
  19860. input_field.remove();
  19861. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19862. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19863. parent_node.find('.span_name_function').text(function_obj.name);
  19864. /// update elements:
  19865. opened_name_function = false;
  19866. opened_input = false;
  19867. }
  19868. if (code == 27) {
  19869. input_field.off();
  19870. input_field.remove();
  19871. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19872. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19873. parent_node.find('.span_name_function').text(function_obj.name);
  19874. /// update elements:
  19875. opened_name_function = false;
  19876. opened_input = false;
  19877. }
  19878. });
  19879. input_field.select();
  19880. }
  19881. /***/ }),
  19882. /***/ "./js/visualUI/globals.js":
  19883. /*!********************************!*\
  19884. !*** ./js/visualUI/globals.js ***!
  19885. \********************************/
  19886. /*! no static exports found */
  19887. /***/ (function(module, exports, __webpack_require__) {
  19888. "use strict";
  19889. Object.defineProperty(exports, "__esModule", {
  19890. value: true
  19891. });
  19892. exports.addGlobal = addGlobal;
  19893. exports.renderGlobal = renderGlobal;
  19894. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19895. var _jquery2 = _interopRequireDefault(_jquery);
  19896. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19897. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19898. var Models = _interopRequireWildcard(_ivprog_elements);
  19899. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19900. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19901. var Utils = _interopRequireWildcard(_utils);
  19902. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  19903. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  19904. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19905. window.jQuery = _jquery2.default;
  19906. var counter_new_globals = 0;
  19907. function addGlobal(program) {
  19908. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  19909. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  19910. counter_new_globals++;
  19911. program.addGlobal(new_global);
  19912. var newe = renderGlobal(new_global);
  19913. if (is_from_click) {
  19914. newe.css('display', 'none');
  19915. newe.fadeIn();
  19916. }
  19917. }
  19918. function toggleConstant(global_var) {
  19919. global_var.is_constant = !global_var.is_constant;
  19920. }
  19921. function updateName(global_var, new_name, global_obj_dom) {
  19922. if (global_var.name == new_name) {
  19923. return;
  19924. }
  19925. if (isValidIdentifier(new_name)) {
  19926. if (globalNameAlreadyExists(new_name)) {
  19927. Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_global_duplicated'));
  19928. } else {
  19929. global_var.name = new_name;
  19930. }
  19931. } else {
  19932. Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  19933. }
  19934. }
  19935. function globalNameAlreadyExists(global_name) {
  19936. for (var i = 0; i < window.program_obj.globals.length; i++) {
  19937. if (window.program_obj.globals[i].name == global_name) {
  19938. return true;
  19939. }
  19940. }
  19941. return false;
  19942. }
  19943. function isValidIdentifier(identifier_str) {
  19944. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  19945. );
  19946. }
  19947. function updateType(global_var, new_type) {
  19948. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19949. global_var.type = new_type;
  19950. global_var.dimensions = new_dimensions;
  19951. if (new_dimensions > 0) {
  19952. global_var.rows = new_dimensions;
  19953. global_var.columns = 2;
  19954. }
  19955. updateInitialValues(global_var);
  19956. }
  19957. function removeGlobal(global_var, global_container) {
  19958. var index = window.program_obj.globals.indexOf(global_var);
  19959. if (index > -1) {
  19960. window.insertContext = true;
  19961. window.program_obj.globals.splice(index, 1);
  19962. }
  19963. global_container.children().off();
  19964. global_container.off();
  19965. global_container.fadeOut();
  19966. }
  19967. function updateInitialValues(global_var) {
  19968. if (global_var.type == _types.Types.INTEGER) {
  19969. if (global_var.dimensions == 0) {
  19970. global_var.value = 1;
  19971. }
  19972. if (global_var.dimensions == 1) {
  19973. global_var.value = [1, 1];
  19974. }
  19975. if (global_var.dimensions == 2) {
  19976. global_var.value = [[1, 1], [1, 1]];
  19977. }
  19978. }
  19979. if (global_var.type == _types.Types.REAL) {
  19980. if (global_var.dimensions == 0) {
  19981. global_var.value = 1.0;
  19982. }
  19983. if (global_var.dimensions == 1) {
  19984. global_var.value = [1.0, 1.0];
  19985. }
  19986. if (global_var.dimensions == 2) {
  19987. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  19988. }
  19989. }
  19990. if (global_var.type == _types.Types.TEXT) {
  19991. if (global_var.dimensions == 0) {
  19992. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  19993. }
  19994. if (global_var.dimensions == 1) {
  19995. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  19996. }
  19997. if (global_var.dimensions == 2) {
  19998. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  19999. }
  20000. }
  20001. if (global_var.type == _types.Types.BOOLEAN) {
  20002. if (global_var.dimensions == 0) {
  20003. global_var.value = true;
  20004. }
  20005. if (global_var.dimensions == 1) {
  20006. global_var.value = [true, true];
  20007. }
  20008. if (global_var.dimensions == 2) {
  20009. global_var.value = [[true, true], [true, true]];
  20010. }
  20011. }
  20012. }
  20013. function alternateBooleanGlobalValue(global_var, value_container) {
  20014. global_var.value = !global_var.value;
  20015. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  20016. }
  20017. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  20018. global_var.value[index] = !global_var.value[index];
  20019. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  20020. }
  20021. function removeGlobalColumnVector(global_var) {
  20022. if (global_var.columns == 0) {
  20023. return;
  20024. }
  20025. global_var.columns--;
  20026. global_var.value.splice(global_var.value.length - 1, 1);
  20027. }
  20028. function addGlobalColumnVector(global_var) {
  20029. global_var.columns++;
  20030. if (global_var.type == _types.Types.INTEGER) {
  20031. global_var.value.push(1);
  20032. }
  20033. if (global_var.type == _types.Types.REAL) {
  20034. global_var.value.push(1.0);
  20035. }
  20036. if (global_var.type == _types.Types.TEXT) {
  20037. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20038. }
  20039. if (global_var.type == _types.Types.BOOLEAN) {
  20040. global_var.value.push(true);
  20041. }
  20042. }
  20043. function removeColumnGlobalMatrix(global_var) {
  20044. if (global_var.columns == 0) {
  20045. return;
  20046. }
  20047. global_var.columns--;
  20048. for (var i = 0; i < global_var.rows; i++) {
  20049. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  20050. }
  20051. }
  20052. function addColumnGlobalMatrix(global_var) {
  20053. global_var.columns++;
  20054. if (global_var.type == _types.Types.INTEGER) {
  20055. for (var i = 0; i < global_var.rows; i++) {
  20056. global_var.value[i].push(1);
  20057. }
  20058. }
  20059. if (global_var.type == _types.Types.REAL) {
  20060. for (var i = 0; i < global_var.rows; i++) {
  20061. global_var.value[i].push(1.0);
  20062. }
  20063. }
  20064. if (global_var.type == _types.Types.TEXT) {
  20065. for (var i = 0; i < global_var.rows; i++) {
  20066. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20067. }
  20068. }
  20069. if (global_var.type == _types.Types.BOOLEAN) {
  20070. for (var i = 0; i < global_var.rows; i++) {
  20071. global_var.value[i].push(true);
  20072. }
  20073. }
  20074. }
  20075. function removeLineGlobalMatrix(global_var) {
  20076. if (global_var.rows == 0) {
  20077. return;
  20078. }
  20079. global_var.rows--;
  20080. global_var.value.splice(global_var.value.length - 1, 1);
  20081. }
  20082. function addLineGlobalMatrix(global_var) {
  20083. global_var.rows++;
  20084. if (global_var.type == _types.Types.INTEGER) {
  20085. var n_l = [];
  20086. for (var i = 0; i < global_var.columns; i++) {
  20087. n_l.push(1);
  20088. }
  20089. global_var.value.push(n_l);
  20090. }
  20091. if (global_var.type == _types.Types.REAL) {
  20092. var n_l = [];
  20093. for (i = 0; i < global_var.columns; i++) {
  20094. n_l.push(1.0);
  20095. }
  20096. global_var.value.push(n_l);
  20097. }
  20098. if (global_var.type == _types.Types.TEXT) {
  20099. var n_l = [];
  20100. for (i = 0; i < global_var.columns; i++) {
  20101. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20102. }
  20103. global_var.value.push(n_l);
  20104. }
  20105. if (global_var.type == _types.Types.BOOLEAN) {
  20106. var n_l = [];
  20107. for (i = 0; i < global_var.columns; i++) {
  20108. n_l.push(true);
  20109. }
  20110. global_var.value.push(n_l);
  20111. }
  20112. }
  20113. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  20114. global_var.value[row][index] = !global_var.value[row][index];
  20115. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  20116. }
  20117. function renderValues(global_var, global_container) {
  20118. var ret = "";
  20119. var j = 0;
  20120. if (global_var.dimensions == 0) {
  20121. if (global_var.type == _types.Types.REAL) {
  20122. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  20123. } else {
  20124. if (global_var.type == _types.Types.BOOLEAN) {
  20125. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  20126. } else {
  20127. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  20128. }
  20129. }
  20130. } else {
  20131. ret += '<table class="tabela_var">';
  20132. if (global_var.dimensions == 1) {
  20133. ret += '<tr>';
  20134. if (global_var.type == _types.Types.REAL) {
  20135. for (var k = 0; k < global_var.columns; k++) {
  20136. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  20137. }
  20138. } else {
  20139. for (var k = 0; k < global_var.columns; k++) {
  20140. if (global_var.type == _types.Types.BOOLEAN) {
  20141. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  20142. } else {
  20143. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  20144. }
  20145. }
  20146. }
  20147. ret += '</tr>';
  20148. ret += '</table>';
  20149. 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>';
  20150. }
  20151. if (global_var.dimensions == 2) {
  20152. if (global_var.type == _types.Types.REAL) {
  20153. for (var l = 0; l < global_var.rows; l++) {
  20154. ret += '<tr>';
  20155. for (var k = 0; k < global_var.columns; k++) {
  20156. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20157. }
  20158. ret += '</tr>';
  20159. }
  20160. } else {
  20161. for (var l = 0; l < global_var.rows; l++) {
  20162. ret += '<tr>';
  20163. for (var k = 0; k < global_var.columns; k++) {
  20164. if (global_var.type == _types.Types.BOOLEAN) {
  20165. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[l][k]) + '</span></td>';
  20166. } else {
  20167. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  20168. }
  20169. }
  20170. ret += '</tr>';
  20171. }
  20172. }
  20173. if (global_var.rows == 0) {
  20174. ret += '<tr><td></td></tr>';
  20175. }
  20176. 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>';
  20177. ret += '</table>';
  20178. 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>';
  20179. }
  20180. }
  20181. global_container.find(".div_valor_var").html('');
  20182. ret = (0, _jquery2.default)(ret);
  20183. ret.find('.span_value_variable').data('associatedOject', global_var);
  20184. ret.find(".boolean_simple_type").on('click', function (e) {
  20185. alternateBooleanGlobalValue(global_var, this.parentNode);
  20186. });
  20187. ret.find(".simple_var").on('click', function (e) {
  20188. enableGlobalValueUpdate(global_var, this.parentNode);
  20189. });
  20190. ret.find(".boolean_vector_var").on('click', function (e) {
  20191. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20192. });
  20193. ret.find(".vector_var").on('click', function (e) {
  20194. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20195. });
  20196. ret.find(".remove_global_vector_column").on('click', function (e) {
  20197. removeGlobalColumnVector(global_var);
  20198. global_container.find(".div_valor_var").html('');
  20199. renderValues(global_var, global_container);
  20200. });
  20201. ret.find(".add_global_vector_column").on('click', function (e) {
  20202. addGlobalColumnVector(global_var);
  20203. global_container.find(".div_valor_var").html('');
  20204. renderValues(global_var, global_container);
  20205. });
  20206. ret.find(".remove_global_matrix_column").on('click', function (e) {
  20207. removeColumnGlobalMatrix(global_var);
  20208. global_container.find(".div_valor_var").html('');
  20209. renderValues(global_var, global_container);
  20210. });
  20211. ret.find(".add_global_matrix_column").on('click', function (e) {
  20212. addColumnGlobalMatrix(global_var);
  20213. global_container.find(".div_valor_var").html('');
  20214. renderValues(global_var, global_container);
  20215. });
  20216. ret.find(".remove_global_matrix_line").on('click', function (e) {
  20217. removeLineGlobalMatrix(global_var);
  20218. global_container.find(".div_valor_var").html('');
  20219. renderValues(global_var, global_container);
  20220. });
  20221. ret.find(".add_global_matrix_line").on('click', function (e) {
  20222. addLineGlobalMatrix(global_var);
  20223. global_container.find(".div_valor_var").html('');
  20224. renderValues(global_var, global_container);
  20225. });
  20226. ret.find(".boolean_matrix_var").on('click', function (e) {
  20227. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20228. });
  20229. ret.find(".matrix_var").on('click', function (e) {
  20230. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20231. });
  20232. global_container.find(".div_valor_var").append(ret);
  20233. updateColumnsAndRowsText(global_container, global_var);
  20234. }
  20235. function addHandlers(global_container) {
  20236. var global_var = global_container.data('associatedOject');
  20237. // Manage constant option:
  20238. global_container.find(".alternate_constant").on('click', function (e) {
  20239. toggleConstant(global_var);
  20240. (0, _jquery2.default)(this).removeClass("on off");
  20241. if (global_var.is_constant) {
  20242. (0, _jquery2.default)(this).addClass("on");
  20243. } else {
  20244. (0, _jquery2.default)(this).addClass("off");
  20245. }
  20246. });
  20247. // Manage global name:
  20248. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  20249. enableNameUpdate(global_container);
  20250. });
  20251. // Menu to change type:
  20252. global_container.find('.ui.dropdown.global_type').dropdown({
  20253. onChange: function onChange(value, text, $selectedItem) {
  20254. if ($selectedItem.data('dimensions')) {
  20255. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20256. } else {
  20257. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  20258. }
  20259. renderValues(global_var, global_container);
  20260. },
  20261. selectOnKeydown: false
  20262. });
  20263. // Remove global:
  20264. global_container.find(".remove_global").on('click', function (e) {
  20265. removeGlobal(global_var, global_container);
  20266. });
  20267. }
  20268. function updateColumnsAndRowsText(global_container, global_var) {
  20269. var prev = global_container.find('.text').text().split('[');
  20270. if (prev.length == 2) {
  20271. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  20272. global_container.find('.text').empty();
  20273. global_container.find('.text').text(ff);
  20274. }
  20275. if (prev.length == 3) {
  20276. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  20277. global_container.find('.text').empty();
  20278. global_container.find('.text').text(ff);
  20279. }
  20280. }
  20281. function renderGlobal(global_var) {
  20282. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  20283. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  20284. element += '<div class="ui dropdown global_type">';
  20285. if (global_var.dimensions > 0) {
  20286. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  20287. for (var i = 0; i < global_var.dimensions; i++) {
  20288. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  20289. }
  20290. element += '</div>';
  20291. } else {
  20292. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  20293. }
  20294. element += '<div class="menu">';
  20295. for (var tm in _types.Types) {
  20296. if (tm == _types.Types.VOID.toUpperCase()) {
  20297. continue;
  20298. }
  20299. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20300. }
  20301. for (var tm in _types.Types) {
  20302. if (tm == _types.Types.VOID.toUpperCase()) {
  20303. continue;
  20304. }
  20305. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  20306. }
  20307. 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> ';
  20308. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  20309. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  20310. var complete_element = (0, _jquery2.default)(element);
  20311. complete_element.data('associatedOject', global_var);
  20312. (0, _jquery2.default)('.list_globals').append(complete_element);
  20313. addHandlers(complete_element);
  20314. renderValues(global_var, complete_element);
  20315. if (global_var.dimensions == 1) {
  20316. complete_element.find('.dimensions_0').text(global_var.columns);
  20317. }
  20318. if (global_var.dimensions == 2) {
  20319. complete_element.find('.dimensions_0').text(global_var.columns);
  20320. complete_element.find('.dimensions_1').text(global_var.rows);
  20321. }
  20322. return complete_element;
  20323. }
  20324. var opened_name_value_matrix_global_v = false;
  20325. var opened_input_value_matrix_global_v = null;
  20326. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  20327. if (opened_name_value_matrix_global_v) {
  20328. opened_input_value_matrix_global_v.focus();
  20329. return;
  20330. }
  20331. parent_node = (0, _jquery2.default)(parent_node);
  20332. opened_name_value_matrix_global_v = true;
  20333. parent_node.find('.span_value_variable').text('');
  20334. var input_field;
  20335. if (global_var.type == _types.Types.REAL) {
  20336. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index].toFixed(1) + "' />");
  20337. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20338. } else {
  20339. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  20340. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20341. }
  20342. input_field.on('input', function () {
  20343. var inputWidth = input_field.textWidth() + 10;
  20344. opened_input_value_matrix_global_v = input_field;
  20345. input_field.focus();
  20346. var tmpStr = input_field.val();
  20347. input_field.val('');
  20348. input_field.val(tmpStr);
  20349. input_field.css({
  20350. width: inputWidth
  20351. });
  20352. }).trigger('input');
  20353. input_field.focusout(function () {
  20354. /// update array:
  20355. if (input_field.val().trim()) {
  20356. if (global_var.type == _types.Types.REAL) {
  20357. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20358. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20359. } else {
  20360. if (global_var.type == _types.Types.INTEGER) {
  20361. global_var.value[row][index] = parseInt(input_field.val().trim());
  20362. } else {
  20363. global_var.value[row][index] = input_field.val().trim();
  20364. }
  20365. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20366. }
  20367. } else {
  20368. if (global_var.type == _types.Types.REAL) {
  20369. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20370. } else {
  20371. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20372. }
  20373. }
  20374. if (global_var.type == _types.Types.TEXT) {
  20375. global_var.value[row][index] = input_field.val();
  20376. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20377. }
  20378. input_field.off();
  20379. input_field.remove();
  20380. /// update elements:
  20381. opened_name_value_matrix_global_v = false;
  20382. opened_input_value_matrix_global_v = false;
  20383. });
  20384. input_field.on('keydown', function (e) {
  20385. var code = e.keyCode || e.which;
  20386. if (code == 13) {
  20387. if (input_field.val().trim()) {
  20388. if (global_var.type == _types.Types.REAL) {
  20389. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20390. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20391. } else {
  20392. if (global_var.type == _types.Types.INTEGER) {
  20393. global_var.value[row][index] = parseInt(input_field.val().trim());
  20394. } else {
  20395. global_var.value[row][index] = input_field.val().trim();
  20396. }
  20397. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20398. }
  20399. } else {
  20400. if (global_var.type == _types.Types.REAL) {
  20401. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20402. } else {
  20403. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20404. }
  20405. }
  20406. if (global_var.type == _types.Types.TEXT) {
  20407. global_var.value[row][index] = input_field.val();
  20408. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20409. }
  20410. input_field.off();
  20411. input_field.remove();
  20412. /// update elements:
  20413. opened_name_value_matrix_global_v = false;
  20414. opened_input_value_matrix_global_v = false;
  20415. }
  20416. if (code == 27) {
  20417. if (global_var.type == _types.Types.REAL) {
  20418. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20419. } else {
  20420. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20421. }
  20422. input_field.off();
  20423. input_field.remove();
  20424. /// update elements:
  20425. opened_name_value_matrix_global_v = false;
  20426. opened_input_value_matrix_global_v = false;
  20427. }
  20428. });
  20429. input_field.select();
  20430. }
  20431. var opened_name_value_global_var = false;
  20432. var opened_input_value_global_ar = null;
  20433. function enableGlobalValueUpdate(global_var, parent_node) {
  20434. if (opened_name_value_global_var) {
  20435. opened_input_value_global_ar.focus();
  20436. return;
  20437. }
  20438. parent_node = (0, _jquery2.default)(parent_node);
  20439. opened_name_value_global_var = true;
  20440. parent_node.find('.span_value_variable').text('');
  20441. var input_field;
  20442. if (global_var.type == _types.Types.REAL) {
  20443. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  20444. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20445. } else {
  20446. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  20447. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20448. }
  20449. input_field.on('input', function () {
  20450. var inputWidth = input_field.textWidth() + 10;
  20451. opened_input_value_global_ar = input_field;
  20452. input_field.focus();
  20453. var tmpStr = input_field.val();
  20454. input_field.val('');
  20455. input_field.val(tmpStr);
  20456. input_field.css({
  20457. width: inputWidth
  20458. });
  20459. }).trigger('input');
  20460. input_field.focusout(function () {
  20461. /// update array:
  20462. if (input_field.val().trim()) {
  20463. if (global_var.type == _types.Types.REAL) {
  20464. global_var.value = parseFloat(input_field.val().trim());
  20465. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20466. } else {
  20467. if (global_var.type == _types.Types.INTEGER) {
  20468. global_var.value = parseInt(input_field.val().trim());
  20469. } else {
  20470. global_var.value = input_field.val().trim();
  20471. }
  20472. parent_node.find('.span_value_variable').text(global_var.value);
  20473. }
  20474. } else {
  20475. if (global_var.type == _types.Types.REAL) {
  20476. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20477. } else {
  20478. parent_node.find('.span_value_variable').text(global_var.value);
  20479. }
  20480. }
  20481. if (global_var.type == _types.Types.TEXT) {
  20482. global_var.value = input_field.val();
  20483. parent_node.find('.span_value_variable').text(global_var.value);
  20484. }
  20485. input_field.off();
  20486. input_field.remove();
  20487. /// update elements:
  20488. opened_name_value_global_var = false;
  20489. opened_input_value_global_ar = false;
  20490. });
  20491. input_field.on('keydown', function (e) {
  20492. var code = e.keyCode || e.which;
  20493. if (code == 13) {
  20494. if (input_field.val().trim()) {
  20495. if (global_var.type == _types.Types.REAL) {
  20496. global_var.value = parseFloat(input_field.val().trim());
  20497. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20498. } else {
  20499. if (global_var.type == _types.Types.INTEGER) {
  20500. global_var.value = parseInt(input_field.val().trim());
  20501. } else {
  20502. global_var.value = input_field.val().trim();
  20503. }
  20504. parent_node.find('.span_value_variable').text(global_var.value);
  20505. }
  20506. } else {
  20507. if (global_var.type == _types.Types.REAL) {
  20508. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20509. } else {
  20510. parent_node.find('.span_value_variable').text(global_var.value);
  20511. }
  20512. }
  20513. if (global_var.type == _types.Types.TEXT) {
  20514. global_var.value = input_field.val();
  20515. parent_node.find('.span_value_variable').text(global_var.value);
  20516. }
  20517. input_field.off();
  20518. input_field.remove();
  20519. /// update elements:
  20520. opened_name_value_global_var = false;
  20521. opened_input_value_global_ar = false;
  20522. }
  20523. if (code == 27) {
  20524. if (global_var.type == _types.Types.REAL) {
  20525. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20526. } else {
  20527. parent_node.find('.span_value_variable').text(global_var.value);
  20528. }
  20529. input_field.off();
  20530. input_field.remove();
  20531. /// update elements:
  20532. opened_name_value_global_var = false;
  20533. opened_input_value_global_ar = false;
  20534. }
  20535. });
  20536. input_field.select();
  20537. }
  20538. var opened_name_global = false;
  20539. var opened_input_global = null;
  20540. function enableNameUpdate(global_container) {
  20541. var global_var = global_container.data('associatedOject');
  20542. if (opened_name_global) {
  20543. opened_input_global.focus();
  20544. return;
  20545. }
  20546. opened_name_global = true;
  20547. global_container.find('.span_name_variable').text('');
  20548. var input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  20549. input_name.insertBefore(global_container.find('.span_name_variable'));
  20550. input_name.on('input', function () {
  20551. var inputWidth = input_name.textWidth() + 10;
  20552. opened_input_global = input_name;
  20553. opened_input_global.focus();
  20554. opened_input_global.css({
  20555. width: inputWidth
  20556. });
  20557. }).trigger('input');
  20558. input_name.focusout(function () {
  20559. /// update array:
  20560. if (input_name.val().trim().length > 0) {
  20561. updateName(global_var, input_name.val().trim(), global_container);
  20562. global_container.find('.span_name_variable').text(global_var.name);
  20563. } else {
  20564. global_container.find('.span_name_variable').text(global_var.name);
  20565. }
  20566. input_name.off();
  20567. input_name.remove();
  20568. /// update elements:
  20569. opened_name_global = false;
  20570. opened_input_global = false;
  20571. });
  20572. input_name.on('keydown', function (e) {
  20573. var code = e.keyCode || e.which;
  20574. if (code == 13) {
  20575. if (input_name.val().trim()) {
  20576. updateName(global_var, input_name.val().trim(), global_container);
  20577. global_container.find('.span_name_variable').text(global_var.name);
  20578. } else {
  20579. global_container.find('.span_name_variable').text(global_var.name);
  20580. }
  20581. input_name.off();
  20582. input_name.remove();
  20583. /// update elements:
  20584. opened_name_global = false;
  20585. opened_input_global = false;
  20586. }
  20587. if (code == 27) {
  20588. global_container.find('.span_name_variable').text(global_var.name);
  20589. input_name.off();
  20590. input_name.remove();
  20591. /// update elements:
  20592. opened_name_global = false;
  20593. opened_input_global = false;
  20594. }
  20595. });
  20596. input_name.select();
  20597. }
  20598. var opened_name_value_vector_global_ = false;
  20599. var opened_input_value_vector_global_ = null;
  20600. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20601. if (opened_name_value_vector_global_) {
  20602. opened_input_value_vector_global_.focus();
  20603. return;
  20604. }
  20605. parent_node = (0, _jquery2.default)(parent_node);
  20606. opened_name_value_vector_global_ = true;
  20607. parent_node.find('.span_value_variable').text('');
  20608. var input_field;
  20609. if (global_var.type == _types.Types.REAL) {
  20610. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index].toFixed(1) + "' />");
  20611. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20612. } else {
  20613. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  20614. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20615. }
  20616. input_field.on('input', function () {
  20617. var inputWidth = input_field.textWidth() + 10;
  20618. opened_input_value_vector_global_ = input_field;
  20619. input_field.focus();
  20620. var tmpStr = input_field.val();
  20621. input_field.val('');
  20622. input_field.val(tmpStr);
  20623. input_field.css({
  20624. width: inputWidth
  20625. });
  20626. }).trigger('input');
  20627. input_field.focusout(function () {
  20628. /// update array:
  20629. if (input_field.val().trim()) {
  20630. if (global_var.type == _types.Types.REAL) {
  20631. global_var.value[index] = parseFloat(input_field.val().trim());
  20632. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20633. } else {
  20634. if (global_var.type == _types.Types.INTEGER) {
  20635. global_var.value[index] = parseInt(input_field.val().trim());
  20636. } else {
  20637. global_var.value[index] = input_field.val().trim();
  20638. }
  20639. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20640. }
  20641. } else {
  20642. if (global_var.type == _types.Types.REAL) {
  20643. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20644. } else {
  20645. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20646. }
  20647. }
  20648. if (global_var.type == _types.Types.TEXT) {
  20649. global_var.value[index] = input_field.val();
  20650. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20651. }
  20652. input_field.off();
  20653. input_field.remove();
  20654. /// update elements:
  20655. opened_name_value_vector_global_ = false;
  20656. opened_input_value_vector_global_ = false;
  20657. });
  20658. input_field.on('keydown', function (e) {
  20659. var code = e.keyCode || e.which;
  20660. if (code == 13) {
  20661. if (input_field.val().trim()) {
  20662. if (global_var.type == _types.Types.REAL) {
  20663. global_var.value[index] = parseFloat(input_field.val().trim());
  20664. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20665. } else {
  20666. if (global_var.type == _types.Types.INTEGER) {
  20667. global_var.value[index] = parseInt(input_field.val().trim());
  20668. } else {
  20669. global_var.value[index] = input_field.val().trim();
  20670. }
  20671. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20672. }
  20673. } else {
  20674. if (global_var.type == _types.Types.REAL) {
  20675. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20676. } else {
  20677. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20678. }
  20679. }
  20680. if (global_var.type == _types.Types.TEXT) {
  20681. global_var.value[index] = input_field.val();
  20682. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20683. }
  20684. input_field.off();
  20685. input_field.remove();
  20686. /// update elements:
  20687. opened_name_value_vector_global_ = false;
  20688. opened_input_value_vector_global_ = false;
  20689. }
  20690. if (code == 27) {
  20691. if (global_var.type == _types.Types.REAL) {
  20692. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20693. } else {
  20694. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20695. }
  20696. input_field.off();
  20697. input_field.remove();
  20698. /// update elements:
  20699. opened_name_value_vector_global_ = false;
  20700. opened_input_value_vector_global_ = false;
  20701. }
  20702. });
  20703. input_field.select();
  20704. }
  20705. _jquery2.default.fn.textWidth = function (text, font) {
  20706. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20707. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20708. return _jquery2.default.fn.textWidth.fakeEl.width();
  20709. };
  20710. /***/ }),
  20711. /***/ "./js/visualUI/ivprog_elements.js":
  20712. /*!****************************************!*\
  20713. !*** ./js/visualUI/ivprog_elements.js ***!
  20714. \****************************************/
  20715. /*! no static exports found */
  20716. /***/ (function(module, exports, __webpack_require__) {
  20717. "use strict";
  20718. Object.defineProperty(exports, "__esModule", {
  20719. value: true
  20720. });
  20721. exports.Program = exports.FunctionCallMenu = exports.VariableValueMenu = exports.FunctionCall = exports.SwitchCase = exports.Return = exports.Switch = exports.DoWhileTrue = exports.WhileTrue = exports.RepeatNTimes = exports.IfTrue = exports.ArithmeticExpression = exports.LogicExpression = exports.ConditionalExpression = exports.ExpressionElement = exports.Attribution = exports.Writer = exports.Reader = exports.Break = exports.Comment = exports.SystemFunction = exports.Function = exports.Variable = exports.SYSTEM_FUNCTIONS_CATEGORIES = exports.LOGIC_COMPARISON = exports.ARITHMETIC_COMPARISON = exports.EXPRESSION_TYPES = exports.EXPRESSION_ELEMENTS = exports.ARITHMETIC_TYPES = exports.COMMAND_TYPES = undefined;
  20722. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  20723. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20724. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  20725. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20726. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20727. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20728. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  20729. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  20730. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20731. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  20732. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20733. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  20734. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  20735. return: "return" });
  20736. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  20737. var EXPRESSION_ELEMENTS = exports.EXPRESSION_ELEMENTS = Object.freeze({ exp_op_exp: "exp_op_exp", op_exp: "op_exp", par_exp_par: "par_exp_par", start_point: "start_point" });
  20738. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  20739. var ARITHMETIC_COMPARISON = exports.ARITHMETIC_COMPARISON = Object.freeze({ greater_than: "greater_than", less_than: "less_than", equals_to: "equals_to", not_equals_to: "not_equals_to", greater_than_or_equals_to: "greater_than_or_equals_to", less_than_or_equals_to: "less_than_or_equals_to" });
  20740. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  20741. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  20742. var Variable = exports.Variable = function Variable(type, name, value) {
  20743. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20744. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20745. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20746. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  20747. _classCallCheck(this, Variable);
  20748. this.type = type;
  20749. this.name = name;
  20750. this.value = value;
  20751. this.dimensions = dimensions;
  20752. this.is_constant = is_constant;
  20753. this.rows = rows;
  20754. this.columns = columns;
  20755. };
  20756. var Function = exports.Function = function Function(name) {
  20757. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  20758. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20759. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  20760. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20761. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  20762. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  20763. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  20764. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  20765. _classCallCheck(this, Function);
  20766. this.type = COMMAND_TYPES.function;
  20767. this.name = name;
  20768. this.return_type = return_type;
  20769. this.return_dimensions = return_dimensions;
  20770. this.parameters_list = parameters_list;
  20771. this.is_main = is_main;
  20772. this.is_hidden = is_hidden;
  20773. this.variables_list = variables_list;
  20774. this.function_comment = function_comment;
  20775. this.commands = commands;
  20776. };
  20777. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  20778. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  20779. var category = arguments[5];
  20780. _classCallCheck(this, SystemFunction);
  20781. this.type = COMMAND_TYPES.function;
  20782. this.identifier = identifier;
  20783. this.return_type = return_type;
  20784. this.return_dimensions = return_dimensions;
  20785. this.parameters_list = parameters_list;
  20786. this.function_comment = function_comment;
  20787. this.category = category;
  20788. };
  20789. var Comment = exports.Comment = function Comment(comment_text) {
  20790. _classCallCheck(this, Comment);
  20791. this.type = COMMAND_TYPES.comment;
  20792. this.comment_text = comment_text;
  20793. };
  20794. var Break = exports.Break = function Break() {
  20795. _classCallCheck(this, Break);
  20796. this.type = COMMAND_TYPES.break;
  20797. };
  20798. var Reader = exports.Reader = function Reader() {
  20799. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  20800. _classCallCheck(this, Reader);
  20801. this.type = COMMAND_TYPES.reader;
  20802. this.variable_value_menu = variable_value_menu;
  20803. };
  20804. var Writer = exports.Writer = function Writer(content) {
  20805. _classCallCheck(this, Writer);
  20806. this.type = COMMAND_TYPES.writer;
  20807. this.content = content;
  20808. };
  20809. var Attribution = exports.Attribution = function Attribution(variable) {
  20810. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20811. _classCallCheck(this, Attribution);
  20812. this.type = COMMAND_TYPES.attribution;
  20813. this.variable = variable;
  20814. this.expression = expression;
  20815. };
  20816. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  20817. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20818. _classCallCheck(this, ExpressionElement);
  20819. this.type_exp = type_exp;
  20820. this.itens = itens;
  20821. };
  20822. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  20823. _classCallCheck(this, ConditionalExpression);
  20824. this.type = EXPRESSION_TYPES.exp_conditional;
  20825. this.expression = expression;
  20826. };
  20827. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  20828. _classCallCheck(this, LogicExpression);
  20829. this.type = EXPRESSION_TYPES.exp_logic;
  20830. this.has_neg = has_neg;
  20831. this.first_operand = first_operand;
  20832. this.second_operand = second_operand;
  20833. this.operator = operator;
  20834. };
  20835. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  20836. _classCallCheck(this, ArithmeticExpression);
  20837. this.type = EXPRESSION_TYPES.exp_arithmetic;
  20838. this.first_operand = first_operand;
  20839. this.second_operand = second_operand;
  20840. this.operator = operator;
  20841. };
  20842. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  20843. _classCallCheck(this, IfTrue);
  20844. this.type = COMMAND_TYPES.iftrue;
  20845. this.expression = expression;
  20846. this.commands_block = commands_block;
  20847. this.commands_else = commands_else;
  20848. };
  20849. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  20850. _classCallCheck(this, RepeatNTimes);
  20851. this.type = COMMAND_TYPES.repeatNtimes;
  20852. this.var_attribution = var_attribution;
  20853. this.var_incrementation = var_incrementation;
  20854. this.expression1 = expression1;
  20855. this.expression2 = expression2;
  20856. this.expression3 = expression3;
  20857. this.commands_block = commands_block;
  20858. };
  20859. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  20860. _classCallCheck(this, WhileTrue);
  20861. this.type = COMMAND_TYPES.whiletrue;
  20862. this.expression = expression;
  20863. this.commands_block = commands_block;
  20864. };
  20865. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  20866. _classCallCheck(this, DoWhileTrue);
  20867. this.type = COMMAND_TYPES.dowhiletrue;
  20868. this.expression = expression;
  20869. this.commands_block = commands_block;
  20870. };
  20871. var Switch = exports.Switch = function Switch(variable) {
  20872. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20873. _classCallCheck(this, Switch);
  20874. this.type = COMMAND_TYPES.switch;
  20875. this.variable = variable;
  20876. this.cases = cases;
  20877. };
  20878. var Return = exports.Return = function Return(variable_value_menu) {
  20879. _classCallCheck(this, Return);
  20880. this.type = COMMAND_TYPES.return;
  20881. this.variable_value_menu = variable_value_menu;
  20882. };
  20883. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  20884. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20885. _classCallCheck(this, SwitchCase);
  20886. this.type = COMMAND_TYPES.switchcase;
  20887. this.variable_value_menu = variable_value_menu;
  20888. this.commands_block = commands_block;
  20889. };
  20890. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  20891. _classCallCheck(this, FunctionCall);
  20892. this.type = COMMAND_TYPES.functioncall;
  20893. this.function_called = function_called;
  20894. this.parameters_list = parameters_list;
  20895. };
  20896. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  20897. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  20898. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  20899. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  20900. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  20901. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  20902. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20903. _classCallCheck(this, VariableValueMenu);
  20904. this.type = "var_value";
  20905. this.variable_and_value = variable_and_value;
  20906. this.content = content;
  20907. this.row = row;
  20908. this.column = column;
  20909. this.include_constant = include_constant;
  20910. this.dimensions = dimensions;
  20911. };
  20912. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  20913. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  20914. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20915. _classCallCheck(this, FunctionCallMenu);
  20916. this.type = "function_call";
  20917. this.function_called = function_called;
  20918. this.parameters_list = parameters_list;
  20919. };
  20920. var Program = exports.Program = function () {
  20921. function Program() {
  20922. _classCallCheck(this, Program);
  20923. this.functions = [];
  20924. this.globals = [];
  20925. }
  20926. _createClass(Program, [{
  20927. key: 'addFunction',
  20928. value: function addFunction(function_to_add) {
  20929. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  20930. if (window.insertContext) {
  20931. setTimeout(function () {
  20932. AlgorithmManagement.renderAlgorithm();
  20933. }, 300);
  20934. window.insertContext = false;
  20935. } else {
  20936. AlgorithmManagement.renderAlgorithm();
  20937. }
  20938. }, 1);
  20939. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  20940. if (window.insertContext) {
  20941. setTimeout(function () {
  20942. AlgorithmManagement.renderAlgorithm();
  20943. }, 300);
  20944. window.insertContext = false;
  20945. } else {
  20946. AlgorithmManagement.renderAlgorithm();
  20947. }
  20948. }, 1);
  20949. this.functions.push(function_to_add);
  20950. }
  20951. }, {
  20952. key: 'addVariable',
  20953. value: function addVariable(function_to_receive, variable) {
  20954. if (this.functions[function_to_receive].variable === null) {
  20955. this.functions[function_to_receive].variables_list = [];
  20956. }
  20957. this.functions[function_to_receive].variables_list.push(variable);
  20958. }
  20959. }, {
  20960. key: 'addGlobal',
  20961. value: function addGlobal(variable) {
  20962. this.globals.push(variable);
  20963. }
  20964. }]);
  20965. return Program;
  20966. }();
  20967. /***/ }),
  20968. /***/ "./js/visualUI/types.js":
  20969. /*!******************************!*\
  20970. !*** ./js/visualUI/types.js ***!
  20971. \******************************/
  20972. /*! no static exports found */
  20973. /***/ (function(module, exports, __webpack_require__) {
  20974. "use strict";
  20975. Object.defineProperty(exports, "__esModule", {
  20976. value: true
  20977. });
  20978. var Types = exports.Types = Object.freeze({
  20979. INTEGER: "integer",
  20980. REAL: "real",
  20981. TEXT: "text",
  20982. BOOLEAN: "boolean",
  20983. VOID: "void"
  20984. });
  20985. /***/ }),
  20986. /***/ "./js/visualUI/utils.js":
  20987. /*!******************************!*\
  20988. !*** ./js/visualUI/utils.js ***!
  20989. \******************************/
  20990. /*! no static exports found */
  20991. /***/ (function(module, exports, __webpack_require__) {
  20992. "use strict";
  20993. Object.defineProperty(exports, "__esModule", {
  20994. value: true
  20995. });
  20996. exports.renderErrorMessage = renderErrorMessage;
  20997. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20998. var _jquery2 = _interopRequireDefault(_jquery);
  20999. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21000. function renderErrorMessage(dom_obj_target, message_text) {
  21001. dom_obj_target.popup({
  21002. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  21003. transition: "fade up",
  21004. on: 'click',
  21005. closable: true,
  21006. movePopup: true,
  21007. boundary: window,
  21008. preserve: false,
  21009. target: false,
  21010. className: {
  21011. popup: 'ui popup invalid-identifier'
  21012. },
  21013. onHidden: function onHidden($module) {
  21014. dom_obj_target.popup('destroy');
  21015. }
  21016. }).popup('toggle');
  21017. }
  21018. /***/ }),
  21019. /***/ "./js/visualUI/variables.js":
  21020. /*!**********************************!*\
  21021. !*** ./js/visualUI/variables.js ***!
  21022. \**********************************/
  21023. /*! no static exports found */
  21024. /***/ (function(module, exports, __webpack_require__) {
  21025. "use strict";
  21026. Object.defineProperty(exports, "__esModule", {
  21027. value: true
  21028. });
  21029. exports.addVariable = addVariable;
  21030. exports.renderVariable = renderVariable;
  21031. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21032. var _jquery2 = _interopRequireDefault(_jquery);
  21033. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  21034. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21035. var Models = _interopRequireWildcard(_ivprog_elements);
  21036. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21037. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  21038. var Utils = _interopRequireWildcard(_utils);
  21039. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  21040. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  21041. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21042. window.jQuery = _jquery2.default;
  21043. var counter_new_variables = 0;
  21044. function addVariable(function_obj, function_container) {
  21045. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  21046. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  21047. if (function_obj.variables_list == null) {
  21048. function_obj.variables_list = [];
  21049. }
  21050. function_obj.variables_list.push(new_var);
  21051. counter_new_variables++;
  21052. var newe = renderVariable(function_container, new_var, function_obj);
  21053. if (is_in_click) {
  21054. newe.css('display', 'none');
  21055. newe.fadeIn();
  21056. }
  21057. }
  21058. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  21059. if (variable_obj.name == new_name) {
  21060. return;
  21061. }
  21062. if (isValidIdentifier(new_name)) {
  21063. if (variableNameAlreadyExists(new_name, function_obj)) {
  21064. Utils.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_variable_duplicated'));
  21065. } else {
  21066. variable_obj.name = new_name;
  21067. }
  21068. } else {
  21069. Utils.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  21070. }
  21071. }
  21072. function variableNameAlreadyExists(name_var, function_obj) {
  21073. if (function_obj.parameters_list) {
  21074. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  21075. if (function_obj.parameters_list[i].name == name_var) {
  21076. return true;
  21077. }
  21078. }
  21079. }
  21080. if (function_obj.variables_list) {
  21081. for (var i = 0; i < function_obj.variables_list.length; i++) {
  21082. if (function_obj.variables_list[i].name == name_var) {
  21083. return true;
  21084. }
  21085. }
  21086. }
  21087. return false;
  21088. }
  21089. function isValidIdentifier(identifier_str) {
  21090. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  21091. );
  21092. }
  21093. function removeVariable(variable_obj, variable_container) {
  21094. var function_associated = variable_container.data('associatedFunction');
  21095. var index = function_associated.variables_list.indexOf(variable_obj);
  21096. if (index > -1) {
  21097. window.insertContext = true;
  21098. delete function_associated.variables_list[index];
  21099. function_associated.variables_list.splice(index, 1);
  21100. }
  21101. variable_container.children().off();
  21102. variable_container.off();
  21103. variable_container.fadeOut();
  21104. }
  21105. function updateType(variable_obj, new_type) {
  21106. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  21107. variable_obj.type = new_type;
  21108. variable_obj.dimensions = new_dimensions;
  21109. if (new_dimensions > 0) {
  21110. variable_obj.rows = new_dimensions;
  21111. variable_obj.columns = 2;
  21112. }
  21113. updateInitialValues(variable_obj);
  21114. }
  21115. function addHandlers(variable_obj, variable_container, function_obj) {
  21116. // Manage variable name:
  21117. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  21118. enableNameUpdate(variable_obj, variable_container, function_obj);
  21119. });
  21120. // Menu to change type:
  21121. variable_container.find('.ui.dropdown.variable_type').dropdown({
  21122. onChange: function onChange(value, text, $selectedItem) {
  21123. if ($selectedItem.data('dimensions')) {
  21124. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  21125. } else {
  21126. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  21127. }
  21128. renderValues(variable_obj, variable_container);
  21129. },
  21130. selectOnKeydown: false
  21131. });
  21132. // Remove variable:
  21133. variable_container.find(".remove_variable").on('click', function (e) {
  21134. removeVariable(variable_obj, variable_container);
  21135. });
  21136. }
  21137. function renderVariable(function_container, new_var, function_obj) {
  21138. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  21139. element += '<div class="ui dropdown variable_type">';
  21140. if (new_var.dimensions > 0) {
  21141. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  21142. for (var i = 0; i < new_var.dimensions; i++) {
  21143. element += ' [ ] ';
  21144. }
  21145. element += '</div>';
  21146. } else {
  21147. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  21148. }
  21149. element += '<div class="menu">';
  21150. for (var tm in _types.Types) {
  21151. if (tm == _types.Types.VOID.toUpperCase()) {
  21152. continue;
  21153. }
  21154. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  21155. }
  21156. for (var tm in _types.Types) {
  21157. if (tm == _types.Types.VOID.toUpperCase()) {
  21158. continue;
  21159. }
  21160. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  21161. }
  21162. element += '</div></div> ';
  21163. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  21164. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  21165. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  21166. element = (0, _jquery2.default)(element);
  21167. element.data('associatedFunction', function_obj);
  21168. function_container.find('.variables_list_div').append(element);
  21169. addHandlers(new_var, element, function_obj);
  21170. renderValues(new_var, element);
  21171. return element;
  21172. }
  21173. function updateColumnsAndRowsText(variable_container, variable_var) {
  21174. var prev = variable_container.find('.text').text().split('[');
  21175. if (prev.length == 2) {
  21176. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  21177. variable_container.find('.text').empty();
  21178. variable_container.find('.text').text(ff);
  21179. }
  21180. if (prev.length == 3) {
  21181. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  21182. variable_container.find('.text').empty();
  21183. variable_container.find('.text').text(ff);
  21184. }
  21185. }
  21186. function renderValues(new_var, variable_container) {
  21187. var ret = "";
  21188. var j = 0;
  21189. if (new_var.dimensions == 0) {
  21190. if (new_var.type == _types.Types.REAL) {
  21191. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  21192. } else {
  21193. if (new_var.type == _types.Types.BOOLEAN) {
  21194. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  21195. } else {
  21196. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  21197. }
  21198. }
  21199. } else {
  21200. ret += '<table class="tabela_var">';
  21201. if (new_var.dimensions == 1) {
  21202. ret += '<tr>';
  21203. if (new_var.type == _types.Types.REAL) {
  21204. for (var k = 0; k < new_var.columns; k++) {
  21205. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  21206. }
  21207. } else {
  21208. for (var k = 0; k < new_var.columns; k++) {
  21209. if (new_var.type == _types.Types.BOOLEAN) {
  21210. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  21211. } else {
  21212. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  21213. }
  21214. }
  21215. }
  21216. ret += '</tr>';
  21217. ret += '</table>';
  21218. 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>';
  21219. }
  21220. if (new_var.dimensions == 2) {
  21221. if (new_var.type == _types.Types.REAL) {
  21222. for (var l = 0; l < new_var.rows; l++) {
  21223. ret += '<tr>';
  21224. for (var k = 0; k < new_var.columns; k++) {
  21225. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  21226. }
  21227. ret += '</tr>';
  21228. }
  21229. } else {
  21230. for (var l = 0; l < new_var.rows; l++) {
  21231. ret += '<tr>';
  21232. for (var k = 0; k < new_var.columns; k++) {
  21233. if (new_var.type == _types.Types.BOOLEAN) {
  21234. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[l][k]) + '</span></td>';
  21235. } else {
  21236. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  21237. }
  21238. }
  21239. ret += '</tr>';
  21240. }
  21241. }
  21242. if (new_var.rows == 0) {
  21243. ret += '<tr><td></td></tr>';
  21244. }
  21245. 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>';
  21246. ret += '</table>';
  21247. 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>';
  21248. }
  21249. }
  21250. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21251. ret = (0, _jquery2.default)(ret);
  21252. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  21253. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  21254. alternateBooleanValue(new_var, this.parentNode);
  21255. });
  21256. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  21257. enableValueUpdate(new_var, this.parentNode);
  21258. });
  21259. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  21260. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21261. });
  21262. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  21263. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21264. });
  21265. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  21266. removeColumnVector(new_var);
  21267. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21268. renderValues(new_var, variable_container);
  21269. });
  21270. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  21271. addColumnVector(new_var);
  21272. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21273. renderValues(new_var, variable_container);
  21274. });
  21275. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  21276. removeColumnMatrix(new_var);
  21277. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21278. renderValues(new_var, variable_container);
  21279. });
  21280. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  21281. addColumnMatrix(new_var);
  21282. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21283. renderValues(new_var, variable_container);
  21284. });
  21285. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  21286. removeLineMatrix(new_var);
  21287. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21288. renderValues(new_var, variable_container);
  21289. });
  21290. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  21291. addLineMatrix(new_var);
  21292. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21293. renderValues(new_var, variable_container);
  21294. });
  21295. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  21296. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21297. });
  21298. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  21299. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21300. });
  21301. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  21302. updateColumnsAndRowsText(variable_container, new_var);
  21303. }
  21304. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  21305. var_obj.value[row][index] = !var_obj.value[row][index];
  21306. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  21307. }
  21308. function addLineMatrix(var_obj) {
  21309. var_obj.rows++;
  21310. if (var_obj.type == _types.Types.INTEGER) {
  21311. var n_l = [];
  21312. for (var i = 0; i < var_obj.columns; i++) {
  21313. n_l.push(1);
  21314. }
  21315. var_obj.value.push(n_l);
  21316. }
  21317. if (var_obj.type == _types.Types.REAL) {
  21318. var n_l = [];
  21319. for (i = 0; i < var_obj.columns; i++) {
  21320. n_l.push(1.0);
  21321. }
  21322. var_obj.value.push(n_l);
  21323. }
  21324. if (var_obj.type == _types.Types.TEXT) {
  21325. var n_l = [];
  21326. for (i = 0; i < var_obj.columns; i++) {
  21327. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21328. }
  21329. var_obj.value.push(n_l);
  21330. }
  21331. if (var_obj.type == _types.Types.BOOLEAN) {
  21332. var n_l = [];
  21333. for (i = 0; i < var_obj.columns; i++) {
  21334. n_l.push(true);
  21335. }
  21336. var_obj.value.push(n_l);
  21337. }
  21338. }
  21339. function removeLineMatrix(var_obj) {
  21340. if (var_obj.rows == 0) {
  21341. return;
  21342. }
  21343. var_obj.rows--;
  21344. var_obj.value.splice(var_obj.value.length - 1, 1);
  21345. }
  21346. function addColumnMatrix(var_obj) {
  21347. var_obj.columns++;
  21348. if (var_obj.type == _types.Types.INTEGER) {
  21349. for (var i = 0; i < var_obj.rows; i++) {
  21350. var_obj.value[i].push(1);
  21351. }
  21352. }
  21353. if (var_obj.type == _types.Types.REAL) {
  21354. for (var i = 0; i < var_obj.rows; i++) {
  21355. var_obj.value[i].push(1.0);
  21356. }
  21357. }
  21358. if (var_obj.type == _types.Types.TEXT) {
  21359. for (var i = 0; i < var_obj.rows; i++) {
  21360. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21361. }
  21362. }
  21363. if (var_obj.type == _types.Types.BOOLEAN) {
  21364. for (var i = 0; i < var_obj.rows; i++) {
  21365. var_obj.value[i].push(true);
  21366. }
  21367. }
  21368. }
  21369. function removeColumnMatrix(var_obj) {
  21370. if (var_obj.columns == 0) {
  21371. return;
  21372. }
  21373. var_obj.columns--;
  21374. for (var i = 0; i < var_obj.rows; i++) {
  21375. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  21376. }
  21377. }
  21378. function addColumnVector(var_obj) {
  21379. var_obj.columns++;
  21380. if (var_obj.type == _types.Types.INTEGER) {
  21381. var_obj.value.push(1);
  21382. }
  21383. if (var_obj.type == _types.Types.REAL) {
  21384. var_obj.value.push(1.0);
  21385. }
  21386. if (var_obj.type == _types.Types.TEXT) {
  21387. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21388. }
  21389. if (var_obj.type == _types.Types.BOOLEAN) {
  21390. var_obj.value.push(true);
  21391. }
  21392. }
  21393. function removeColumnVector(var_obj) {
  21394. if (var_obj.columns == 0) {
  21395. return;
  21396. }
  21397. var_obj.columns--;
  21398. var_obj.value.splice(var_obj.value.length - 1, 1);
  21399. }
  21400. function alternateBooleanValue(var_obj, value_container) {
  21401. var_obj.value = !var_obj.value;
  21402. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  21403. }
  21404. function alternateBooleanVectorValue(var_obj, index, value_container) {
  21405. var_obj.value[index] = !var_obj.value[index];
  21406. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  21407. }
  21408. function updateInitialValues(variable_obj) {
  21409. if (variable_obj.type == _types.Types.INTEGER) {
  21410. if (variable_obj.dimensions == 0) {
  21411. variable_obj.value = 1;
  21412. }
  21413. if (variable_obj.dimensions == 1) {
  21414. variable_obj.value = [1, 1];
  21415. }
  21416. if (variable_obj.dimensions == 2) {
  21417. variable_obj.value = [[1, 1], [1, 1]];
  21418. }
  21419. }
  21420. if (variable_obj.type == _types.Types.REAL) {
  21421. if (variable_obj.dimensions == 0) {
  21422. variable_obj.value = 1.0;
  21423. }
  21424. if (variable_obj.dimensions == 1) {
  21425. variable_obj.value = [1.0, 1.0];
  21426. }
  21427. if (variable_obj.dimensions == 2) {
  21428. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  21429. }
  21430. }
  21431. if (variable_obj.type == _types.Types.TEXT) {
  21432. if (variable_obj.dimensions == 0) {
  21433. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  21434. }
  21435. if (variable_obj.dimensions == 1) {
  21436. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  21437. }
  21438. if (variable_obj.dimensions == 2) {
  21439. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  21440. }
  21441. }
  21442. if (variable_obj.type == _types.Types.BOOLEAN) {
  21443. if (variable_obj.dimensions == 0) {
  21444. variable_obj.value = true;
  21445. }
  21446. if (variable_obj.dimensions == 1) {
  21447. variable_obj.value = [true, true];
  21448. }
  21449. if (variable_obj.dimensions == 2) {
  21450. variable_obj.value = [[true, true], [true, true]];
  21451. }
  21452. }
  21453. }
  21454. var opened_name_value_vector_global_ = false;
  21455. var opened_input_value_vector_global_ = null;
  21456. function enableVectorValueUpdate(var_obj, index, parent_node) {
  21457. if (opened_name_value_vector_global_) {
  21458. opened_input_value_vector_global_.focus();
  21459. return;
  21460. }
  21461. parent_node = (0, _jquery2.default)(parent_node);
  21462. opened_name_value_vector_global_ = true;
  21463. parent_node.find('.span_value_variable').text('');
  21464. var input_field;
  21465. if (var_obj.type == _types.Types.REAL) {
  21466. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index].toFixed(1) + "' />");
  21467. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21468. } else {
  21469. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  21470. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21471. }
  21472. input_field.on('input', function () {
  21473. var inputWidth = input_field.textWidth() + 10;
  21474. opened_input_value_vector_global_ = input_field;
  21475. input_field.focus();
  21476. var tmpStr = input_field.val();
  21477. input_field.val('');
  21478. input_field.val(tmpStr);
  21479. input_field.css({
  21480. width: inputWidth
  21481. });
  21482. }).trigger('input');
  21483. input_field.focusout(function () {
  21484. /// update array:
  21485. if (input_field.val().trim()) {
  21486. if (var_obj.type == _types.Types.REAL) {
  21487. var_obj.value[index] = parseFloat(input_field.val().trim());
  21488. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21489. } else {
  21490. if (var_obj.type == _types.Types.INTEGER) {
  21491. var_obj.value[index] = parseInt(input_field.val().trim());
  21492. } else {
  21493. var_obj.value[index] = input_field.val().trim();
  21494. }
  21495. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21496. }
  21497. } else {
  21498. if (var_obj.type == _types.Types.REAL) {
  21499. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21500. } else {
  21501. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21502. }
  21503. }
  21504. if (var_obj.type == _types.Types.TEXT) {
  21505. var_obj.value[index] = input_field.val();
  21506. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21507. }
  21508. input_field.off();
  21509. input_field.remove();
  21510. /// update elements:
  21511. opened_name_value_vector_global_ = false;
  21512. opened_input_value_vector_global_ = false;
  21513. });
  21514. input_field.on('keydown', function (e) {
  21515. var code = e.keyCode || e.which;
  21516. if (code == 13) {
  21517. if (input_field.val().trim()) {
  21518. if (var_obj.type == _types.Types.REAL) {
  21519. var_obj.value[index] = parseFloat(input_field.val().trim());
  21520. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21521. } else {
  21522. if (var_obj.type == _types.Types.INTEGER) {
  21523. var_obj.value[index] = parseInt(input_field.val().trim());
  21524. } else {
  21525. var_obj.value[index] = input_field.val().trim();
  21526. }
  21527. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21528. }
  21529. } else {
  21530. if (var_obj.type == _types.Types.REAL) {
  21531. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21532. } else {
  21533. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21534. }
  21535. }
  21536. if (var_obj.type == _types.Types.TEXT) {
  21537. var_obj.value[index] = input_field.val();
  21538. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21539. }
  21540. input_field.off();
  21541. input_field.remove();
  21542. /// update elements:
  21543. opened_name_value_vector_global_ = false;
  21544. opened_input_value_vector_global_ = false;
  21545. }
  21546. if (code == 27) {
  21547. if (var_obj.type == _types.Types.REAL) {
  21548. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21549. } else {
  21550. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21551. }
  21552. input_field.off();
  21553. input_field.remove();
  21554. /// update elements:
  21555. opened_name_value_vector_global_ = false;
  21556. opened_input_value_vector_global_ = false;
  21557. }
  21558. });
  21559. input_field.select();
  21560. }
  21561. var opened_name_value_global_var = false;
  21562. var opened_input_value_global_ar = null;
  21563. function enableValueUpdate(var_obj, parent_node) {
  21564. if (opened_name_value_global_var) {
  21565. opened_input_value_global_ar.focus();
  21566. return;
  21567. }
  21568. parent_node = (0, _jquery2.default)(parent_node);
  21569. opened_name_value_global_var = true;
  21570. var input_field;
  21571. parent_node.find('.span_value_variable').text('');
  21572. if (var_obj.type == _types.Types.REAL) {
  21573. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  21574. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21575. } else {
  21576. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  21577. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21578. }
  21579. input_field.on('input', function () {
  21580. var inputWidth = input_field.textWidth() + 10;
  21581. opened_input_value_global_ar = input_field;
  21582. input_field.focus();
  21583. var tmpStr = input_field.val();
  21584. input_field.val('');
  21585. input_field.val(tmpStr);
  21586. input_field.css({
  21587. width: inputWidth
  21588. });
  21589. }).trigger('input');
  21590. input_field.focusout(function () {
  21591. /// update array:
  21592. if (input_field.val().trim()) {
  21593. if (var_obj.type == _types.Types.REAL) {
  21594. var_obj.value = parseFloat(input_field.val().trim());
  21595. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21596. } else {
  21597. if (var_obj.type == _types.Types.INTEGER) {
  21598. var_obj.value = parseInt(input_field.val().trim());
  21599. } else {
  21600. var_obj.value = input_field.val().trim();
  21601. }
  21602. parent_node.find('.span_value_variable').text(var_obj.value);
  21603. }
  21604. } else {
  21605. if (var_obj.type == _types.Types.REAL) {
  21606. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21607. } else {
  21608. parent_node.find('.span_value_variable').text(var_obj.value);
  21609. }
  21610. }
  21611. if (var_obj.type == _types.Types.TEXT) {
  21612. var_obj.value = input_field.val();
  21613. parent_node.find('.span_value_variable').text(var_obj.value);
  21614. }
  21615. input_field.off();
  21616. input_field.remove();
  21617. /// update elements:
  21618. opened_name_value_global_var = false;
  21619. opened_input_value_global_ar = false;
  21620. });
  21621. input_field.on('keydown', function (e) {
  21622. var code = e.keyCode || e.which;
  21623. if (code == 13) {
  21624. if (input_field.val().trim()) {
  21625. if (var_obj.type == _types.Types.REAL) {
  21626. var_obj.value = parseFloat(input_field.val().trim());
  21627. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21628. } else {
  21629. if (var_obj.type == _types.Types.INTEGER) {
  21630. var_obj.value = parseInt(input_field.val().trim());
  21631. } else {
  21632. var_obj.value = input_field.val().trim();
  21633. }
  21634. parent_node.find('.span_value_variable').text(var_obj.value);
  21635. }
  21636. } else {
  21637. if (var_obj.type == _types.Types.REAL) {
  21638. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21639. } else {
  21640. parent_node.find('.span_value_variable').text(var_obj.value);
  21641. }
  21642. }
  21643. if (var_obj.type == _types.Types.TEXT) {
  21644. var_obj.value = input_field.val();
  21645. parent_node.find('.span_value_variable').text(var_obj.value);
  21646. }
  21647. input_field.off();
  21648. input_field.remove();
  21649. /// update elements:
  21650. opened_name_value_global_var = false;
  21651. opened_input_value_global_ar = false;
  21652. }
  21653. if (code == 27) {
  21654. if (var_obj.type == _types.Types.REAL) {
  21655. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21656. } else {
  21657. parent_node.find('.span_value_variable').text(var_obj.value);
  21658. }
  21659. input_field.off();
  21660. input_field.remove();
  21661. /// update elements:
  21662. opened_name_value_global_var = false;
  21663. opened_input_value_global_ar = false;
  21664. }
  21665. });
  21666. input_field.select();
  21667. }
  21668. var opened_name_global = false;
  21669. var opened_input_global = null;
  21670. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  21671. if (opened_name_global) {
  21672. opened_input_global.focus();
  21673. return;
  21674. }
  21675. opened_name_global = true;
  21676. variable_container.find('.span_name_variable').text('');
  21677. var input_name;
  21678. input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  21679. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21680. input_name.on('input', function () {
  21681. var inputWidth = input_name.textWidth() + 10;
  21682. opened_input_global = input_name;
  21683. input_name.focus();
  21684. var tmpStr = input_name.val();
  21685. input_name.val('');
  21686. input_name.val(tmpStr);
  21687. input_name.css({
  21688. width: inputWidth
  21689. });
  21690. }).trigger('input');
  21691. input_name.focusout(function () {
  21692. /// update array:
  21693. if (input_name.val().trim().length > 0) {
  21694. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  21695. variable_container.find('.span_name_variable').text(variable_obj.name);
  21696. } else {
  21697. variable_container.find('.span_name_variable').text(variable_obj.name);
  21698. }
  21699. input_name.off();
  21700. input_name.remove();
  21701. /// update elements:
  21702. opened_name_global = false;
  21703. opened_input_global = false;
  21704. });
  21705. input_name.on('keydown', function (e) {
  21706. var code = e.keyCode || e.which;
  21707. if (code == 13) {
  21708. if (input_name.val().trim().length > 0) {
  21709. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  21710. variable_container.find('.span_name_variable').text(variable_obj.name);
  21711. } else {
  21712. variable_container.find('.span_name_variable').text(variable_obj.name);
  21713. }
  21714. input_name.off();
  21715. input_name.remove();
  21716. /// update elements:
  21717. opened_name_global = false;
  21718. opened_input_global = false;
  21719. }
  21720. if (code == 27) {
  21721. variable_container.find('.span_name_variable').text(variable_obj.name);
  21722. input_name.off();
  21723. input_name.remove();
  21724. /// update elements:
  21725. opened_name_global = false;
  21726. opened_input_global = false;
  21727. }
  21728. });
  21729. input_name.select();
  21730. }
  21731. var opened_name_value_matrix_global_v = false;
  21732. var opened_input_value_matrix_global_v = null;
  21733. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  21734. if (opened_name_value_matrix_global_v) {
  21735. opened_input_value_matrix_global_v.focus();
  21736. return;
  21737. }
  21738. parent_node = (0, _jquery2.default)(parent_node);
  21739. opened_name_value_matrix_global_v = true;
  21740. parent_node.find('.span_value_variable').text('');
  21741. var input_field;
  21742. if (var_obj.type == _types.Types.REAL) {
  21743. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index].toFixed(1) + "' />");
  21744. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21745. } else {
  21746. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  21747. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21748. }
  21749. input_field.on('input', function () {
  21750. var inputWidth = input_field.textWidth() + 10;
  21751. opened_input_value_matrix_global_v = input_field;
  21752. input_field.focus();
  21753. var tmpStr = input_field.val();
  21754. input_field.val('');
  21755. input_field.val(tmpStr);
  21756. input_field.css({
  21757. width: inputWidth
  21758. });
  21759. }).trigger('input');
  21760. input_field.focusout(function () {
  21761. /// update array:
  21762. if (input_field.val().trim()) {
  21763. if (var_obj.type == _types.Types.REAL) {
  21764. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21765. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21766. } else {
  21767. if (var_obj.type == _types.Types.INTEGER) {
  21768. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21769. } else {
  21770. var_obj.value[row][index] = input_field.val().trim();
  21771. }
  21772. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21773. }
  21774. } else {
  21775. if (var_obj.type == _types.Types.REAL) {
  21776. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21777. } else {
  21778. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21779. }
  21780. }
  21781. if (var_obj.type == _types.Types.TEXT) {
  21782. var_obj.value[row][index] = input_field.val();
  21783. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21784. }
  21785. input_field.off();
  21786. input_field.remove();
  21787. /// update elements:
  21788. opened_name_value_matrix_global_v = false;
  21789. opened_input_value_matrix_global_v = false;
  21790. });
  21791. input_field.on('keydown', function (e) {
  21792. var code = e.keyCode || e.which;
  21793. if (code == 13) {
  21794. if (input_field.val().trim()) {
  21795. if (var_obj.type == _types.Types.REAL) {
  21796. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21797. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21798. } else {
  21799. if (var_obj.type == _types.Types.INTEGER) {
  21800. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21801. } else {
  21802. var_obj.value[row][index] = input_field.val().trim();
  21803. }
  21804. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21805. }
  21806. } else {
  21807. if (var_obj.type == _types.Types.REAL) {
  21808. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21809. } else {
  21810. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21811. }
  21812. }
  21813. if (var_obj.type == _types.Types.TEXT) {
  21814. var_obj.value[row][index] = input_field.val();
  21815. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21816. }
  21817. input_field.off();
  21818. input_field.remove();
  21819. /// update elements:
  21820. opened_name_value_matrix_global_v = false;
  21821. opened_input_value_matrix_global_v = false;
  21822. }
  21823. if (code == 27) {
  21824. if (var_obj.type == _types.Types.REAL) {
  21825. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21826. } else {
  21827. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21828. }
  21829. input_field.off();
  21830. input_field.remove();
  21831. /// update elements:
  21832. opened_name_value_matrix_global_v = false;
  21833. opened_input_value_matrix_global_v = false;
  21834. }
  21835. });
  21836. input_field.select();
  21837. }
  21838. /***/ }),
  21839. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  21840. /*!****************************************************!*\
  21841. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  21842. \****************************************************/
  21843. /*! no static exports found */
  21844. /***/ (function(module, exports, __webpack_require__) {
  21845. "use strict";
  21846. //
  21847. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21848. * Use of this file is governed by the BSD 3-clause license that
  21849. * can be found in the LICENSE.txt file in the project root.
  21850. */
  21851. // This implementation of {@link TokenStream} loads tokens from a
  21852. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  21853. // access to any previous token by index.
  21854. //
  21855. // <p>
  21856. // This token stream ignores the value of {@link Token//getChannel}. If your
  21857. // parser requires the token stream filter tokens to only those on a particular
  21858. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  21859. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  21860. // {@link CommonTokenStream}.</p>
  21861. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21862. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  21863. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  21864. // this is just to keep meaningful parameter types to Parser
  21865. function TokenStream() {
  21866. return this;
  21867. }
  21868. function BufferedTokenStream(tokenSource) {
  21869. TokenStream.call(this);
  21870. // The {@link TokenSource} from which tokens for this stream are fetched.
  21871. this.tokenSource = tokenSource;
  21872. // A collection of all tokens fetched from the token source. The list is
  21873. // considered a complete view of the input once {@link //fetchedEOF} is set
  21874. // to {@code true}.
  21875. this.tokens = [];
  21876. // The index into {@link //tokens} of the current token (next token to
  21877. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  21878. // be
  21879. // {@link //LT LT(1)}.
  21880. //
  21881. // <p>This field is set to -1 when the stream is first constructed or when
  21882. // {@link //setTokenSource} is called, indicating that the first token has
  21883. // not yet been fetched from the token source. For additional information,
  21884. // see the documentation of {@link IntStream} for a description of
  21885. // Initializing Methods.</p>
  21886. this.index = -1;
  21887. // Indicates whether the {@link Token//EOF} token has been fetched from
  21888. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  21889. // performance for the following cases:
  21890. //
  21891. // <ul>
  21892. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  21893. // prevent
  21894. // consuming the EOF symbol is optimized by checking the values of
  21895. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  21896. // //LA}.</li>
  21897. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  21898. // into
  21899. // {@link //tokens} is trivial with this field.</li>
  21900. // <ul>
  21901. this.fetchedEOF = false;
  21902. return this;
  21903. }
  21904. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  21905. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  21906. BufferedTokenStream.prototype.mark = function () {
  21907. return 0;
  21908. };
  21909. BufferedTokenStream.prototype.release = function (marker) {
  21910. // no resources to release
  21911. };
  21912. BufferedTokenStream.prototype.reset = function () {
  21913. this.seek(0);
  21914. };
  21915. BufferedTokenStream.prototype.seek = function (index) {
  21916. this.lazyInit();
  21917. this.index = this.adjustSeekIndex(index);
  21918. };
  21919. BufferedTokenStream.prototype.get = function (index) {
  21920. this.lazyInit();
  21921. return this.tokens[index];
  21922. };
  21923. BufferedTokenStream.prototype.consume = function () {
  21924. var skipEofCheck = false;
  21925. if (this.index >= 0) {
  21926. if (this.fetchedEOF) {
  21927. // the last token in tokens is EOF. skip check if p indexes any
  21928. // fetched token except the last.
  21929. skipEofCheck = this.index < this.tokens.length - 1;
  21930. } else {
  21931. // no EOF token in tokens. skip check if p indexes a fetched token.
  21932. skipEofCheck = this.index < this.tokens.length;
  21933. }
  21934. } else {
  21935. // not yet initialized
  21936. skipEofCheck = false;
  21937. }
  21938. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  21939. throw "cannot consume EOF";
  21940. }
  21941. if (this.sync(this.index + 1)) {
  21942. this.index = this.adjustSeekIndex(this.index + 1);
  21943. }
  21944. };
  21945. // Make sure index {@code i} in tokens has a token.
  21946. //
  21947. // @return {@code true} if a token is located at index {@code i}, otherwise
  21948. // {@code false}.
  21949. // @see //get(int i)
  21950. // /
  21951. BufferedTokenStream.prototype.sync = function (i) {
  21952. var n = i - this.tokens.length + 1; // how many more elements we need?
  21953. if (n > 0) {
  21954. var fetched = this.fetch(n);
  21955. return fetched >= n;
  21956. }
  21957. return true;
  21958. };
  21959. // Add {@code n} elements to buffer.
  21960. //
  21961. // @return The actual number of elements added to the buffer.
  21962. // /
  21963. BufferedTokenStream.prototype.fetch = function (n) {
  21964. if (this.fetchedEOF) {
  21965. return 0;
  21966. }
  21967. for (var i = 0; i < n; i++) {
  21968. var t = this.tokenSource.nextToken();
  21969. t.tokenIndex = this.tokens.length;
  21970. this.tokens.push(t);
  21971. if (t.type === Token.EOF) {
  21972. this.fetchedEOF = true;
  21973. return i + 1;
  21974. }
  21975. }
  21976. return n;
  21977. };
  21978. // Get all tokens from start..stop inclusively///
  21979. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  21980. if (types === undefined) {
  21981. types = null;
  21982. }
  21983. if (start < 0 || stop < 0) {
  21984. return null;
  21985. }
  21986. this.lazyInit();
  21987. var subset = [];
  21988. if (stop >= this.tokens.length) {
  21989. stop = this.tokens.length - 1;
  21990. }
  21991. for (var i = start; i < stop; i++) {
  21992. var t = this.tokens[i];
  21993. if (t.type === Token.EOF) {
  21994. break;
  21995. }
  21996. if (types === null || types.contains(t.type)) {
  21997. subset.push(t);
  21998. }
  21999. }
  22000. return subset;
  22001. };
  22002. BufferedTokenStream.prototype.LA = function (i) {
  22003. return this.LT(i).type;
  22004. };
  22005. BufferedTokenStream.prototype.LB = function (k) {
  22006. if (this.index - k < 0) {
  22007. return null;
  22008. }
  22009. return this.tokens[this.index - k];
  22010. };
  22011. BufferedTokenStream.prototype.LT = function (k) {
  22012. this.lazyInit();
  22013. if (k === 0) {
  22014. return null;
  22015. }
  22016. if (k < 0) {
  22017. return this.LB(-k);
  22018. }
  22019. var i = this.index + k - 1;
  22020. this.sync(i);
  22021. if (i >= this.tokens.length) {
  22022. // return EOF token
  22023. // EOF must be last token
  22024. return this.tokens[this.tokens.length - 1];
  22025. }
  22026. return this.tokens[i];
  22027. };
  22028. // Allowed derived classes to modify the behavior of operations which change
  22029. // the current stream position by adjusting the target token index of a seek
  22030. // operation. The default implementation simply returns {@code i}. If an
  22031. // exception is thrown in this method, the current stream index should not be
  22032. // changed.
  22033. //
  22034. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  22035. // that
  22036. // the seek target is always an on-channel token.</p>
  22037. //
  22038. // @param i The target token index.
  22039. // @return The adjusted target token index.
  22040. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  22041. return i;
  22042. };
  22043. BufferedTokenStream.prototype.lazyInit = function () {
  22044. if (this.index === -1) {
  22045. this.setup();
  22046. }
  22047. };
  22048. BufferedTokenStream.prototype.setup = function () {
  22049. this.sync(0);
  22050. this.index = this.adjustSeekIndex(0);
  22051. };
  22052. // Reset this token stream by setting its token source.///
  22053. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  22054. this.tokenSource = tokenSource;
  22055. this.tokens = [];
  22056. this.index = -1;
  22057. this.fetchedEOF = false;
  22058. };
  22059. // Given a starting index, return the index of the next token on channel.
  22060. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  22061. // on channel between i and EOF.
  22062. // /
  22063. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  22064. this.sync(i);
  22065. if (i >= this.tokens.length) {
  22066. return -1;
  22067. }
  22068. var token = this.tokens[i];
  22069. while (token.channel !== this.channel) {
  22070. if (token.type === Token.EOF) {
  22071. return -1;
  22072. }
  22073. i += 1;
  22074. this.sync(i);
  22075. token = this.tokens[i];
  22076. }
  22077. return i;
  22078. };
  22079. // Given a starting index, return the index of the previous token on channel.
  22080. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  22081. // on channel between i and 0.
  22082. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  22083. while (i >= 0 && this.tokens[i].channel !== channel) {
  22084. i -= 1;
  22085. }
  22086. return i;
  22087. };
  22088. // Collect all tokens on specified channel to the right of
  22089. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  22090. // EOF. If channel is -1, find any non default channel token.
  22091. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  22092. if (channel === undefined) {
  22093. channel = -1;
  22094. }
  22095. this.lazyInit();
  22096. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  22097. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  22098. }
  22099. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  22100. var from_ = tokenIndex + 1;
  22101. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  22102. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  22103. return this.filterForChannel(from_, to, channel);
  22104. };
  22105. // Collect all tokens on specified channel to the left of
  22106. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  22107. // If channel is -1, find any non default channel token.
  22108. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  22109. if (channel === undefined) {
  22110. channel = -1;
  22111. }
  22112. this.lazyInit();
  22113. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  22114. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  22115. }
  22116. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  22117. if (prevOnChannel === tokenIndex - 1) {
  22118. return null;
  22119. }
  22120. // if none on channel to left, prevOnChannel=-1 then from=0
  22121. var from_ = prevOnChannel + 1;
  22122. var to = tokenIndex - 1;
  22123. return this.filterForChannel(from_, to, channel);
  22124. };
  22125. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  22126. var hidden = [];
  22127. for (var i = left; i < right + 1; i++) {
  22128. var t = this.tokens[i];
  22129. if (channel === -1) {
  22130. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  22131. hidden.push(t);
  22132. }
  22133. } else if (t.channel === channel) {
  22134. hidden.push(t);
  22135. }
  22136. }
  22137. if (hidden.length === 0) {
  22138. return null;
  22139. }
  22140. return hidden;
  22141. };
  22142. BufferedTokenStream.prototype.getSourceName = function () {
  22143. return this.tokenSource.getSourceName();
  22144. };
  22145. // Get the text of all tokens in this buffer.///
  22146. BufferedTokenStream.prototype.getText = function (interval) {
  22147. this.lazyInit();
  22148. this.fill();
  22149. if (interval === undefined || interval === null) {
  22150. interval = new Interval(0, this.tokens.length - 1);
  22151. }
  22152. var start = interval.start;
  22153. if (start instanceof Token) {
  22154. start = start.tokenIndex;
  22155. }
  22156. var stop = interval.stop;
  22157. if (stop instanceof Token) {
  22158. stop = stop.tokenIndex;
  22159. }
  22160. if (start === null || stop === null || start < 0 || stop < 0) {
  22161. return "";
  22162. }
  22163. if (stop >= this.tokens.length) {
  22164. stop = this.tokens.length - 1;
  22165. }
  22166. var s = "";
  22167. for (var i = start; i < stop + 1; i++) {
  22168. var t = this.tokens[i];
  22169. if (t.type === Token.EOF) {
  22170. break;
  22171. }
  22172. s = s + t.text;
  22173. }
  22174. return s;
  22175. };
  22176. // Get all tokens from lexer until EOF///
  22177. BufferedTokenStream.prototype.fill = function () {
  22178. this.lazyInit();
  22179. while (this.fetch(1000) === 1000) {
  22180. continue;
  22181. }
  22182. };
  22183. exports.BufferedTokenStream = BufferedTokenStream;
  22184. /***/ }),
  22185. /***/ "./node_modules/antlr4/CharStreams.js":
  22186. /*!********************************************!*\
  22187. !*** ./node_modules/antlr4/CharStreams.js ***!
  22188. \********************************************/
  22189. /*! no static exports found */
  22190. /***/ (function(module, exports, __webpack_require__) {
  22191. "use strict";
  22192. //
  22193. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22194. * Use of this file is governed by the BSD 3-clause license that
  22195. * can be found in the LICENSE.txt file in the project root.
  22196. */
  22197. //
  22198. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22199. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22200. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22201. // Utility functions to create InputStreams from various sources.
  22202. //
  22203. // All returned InputStreams support the full range of Unicode
  22204. // up to U+10FFFF (the default behavior of InputStream only supports
  22205. // code points up to U+FFFF).
  22206. var CharStreams = {
  22207. // Creates an InputStream from a string.
  22208. fromString: function fromString(str) {
  22209. return new InputStream(str, true);
  22210. },
  22211. // Asynchronously creates an InputStream from a blob given the
  22212. // encoding of the bytes in that blob (defaults to 'utf8' if
  22213. // encoding is null).
  22214. //
  22215. // Invokes onLoad(result) on success, onError(error) on
  22216. // failure.
  22217. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  22218. var reader = FileReader();
  22219. reader.onload = function (e) {
  22220. var is = new InputStream(e.target.result, true);
  22221. onLoad(is);
  22222. };
  22223. reader.onerror = onError;
  22224. reader.readAsText(blob, encoding);
  22225. },
  22226. // Creates an InputStream from a Buffer given the
  22227. // encoding of the bytes in that buffer (defaults to 'utf8' if
  22228. // encoding is null).
  22229. fromBuffer: function fromBuffer(buffer, encoding) {
  22230. return new InputStream(buffer.toString(encoding), true);
  22231. },
  22232. // Asynchronously creates an InputStream from a file on disk given
  22233. // the encoding of the bytes in that file (defaults to 'utf8' if
  22234. // encoding is null).
  22235. //
  22236. // Invokes callback(error, result) on completion.
  22237. fromPath: function fromPath(path, encoding, callback) {
  22238. fs.readFile(path, encoding, function (err, data) {
  22239. var is = null;
  22240. if (data !== null) {
  22241. is = new InputStream(data, true);
  22242. }
  22243. callback(err, is);
  22244. });
  22245. },
  22246. // Synchronously creates an InputStream given a path to a file
  22247. // on disk and the encoding of the bytes in that file (defaults to
  22248. // 'utf8' if encoding is null).
  22249. fromPathSync: function fromPathSync(path, encoding) {
  22250. var data = fs.readFileSync(path, encoding);
  22251. return new InputStream(data, true);
  22252. }
  22253. };
  22254. exports.CharStreams = CharStreams;
  22255. /***/ }),
  22256. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  22257. /*!***************************************************!*\
  22258. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  22259. \***************************************************/
  22260. /*! no static exports found */
  22261. /***/ (function(module, exports, __webpack_require__) {
  22262. "use strict";
  22263. //
  22264. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22265. * Use of this file is governed by the BSD 3-clause license that
  22266. * can be found in the LICENSE.txt file in the project root.
  22267. */
  22268. //
  22269. //
  22270. // This default implementation of {@link TokenFactory} creates
  22271. // {@link CommonToken} objects.
  22272. //
  22273. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  22274. function TokenFactory() {
  22275. return this;
  22276. }
  22277. function CommonTokenFactory(copyText) {
  22278. TokenFactory.call(this);
  22279. // Indicates whether {@link CommonToken//setText} should be called after
  22280. // constructing tokens to explicitly set the text. This is useful for cases
  22281. // where the input stream might not be able to provide arbitrary substrings
  22282. // of text from the input after the lexer creates a token (e.g. the
  22283. // implementation of {@link CharStream//getText} in
  22284. // {@link UnbufferedCharStream} throws an
  22285. // {@link UnsupportedOperationException}). Explicitly setting the token text
  22286. // allows {@link Token//getText} to be called at any time regardless of the
  22287. // input stream implementation.
  22288. //
  22289. // <p>
  22290. // The default value is {@code false} to avoid the performance and memory
  22291. // overhead of copying text for every token unless explicitly requested.</p>
  22292. //
  22293. this.copyText = copyText === undefined ? false : copyText;
  22294. return this;
  22295. }
  22296. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  22297. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  22298. //
  22299. // The default {@link CommonTokenFactory} instance.
  22300. //
  22301. // <p>
  22302. // This token factory does not explicitly copy token text when constructing
  22303. // tokens.</p>
  22304. //
  22305. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  22306. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  22307. var t = new CommonToken(source, type, channel, start, stop);
  22308. t.line = line;
  22309. t.column = column;
  22310. if (text !== null) {
  22311. t.text = text;
  22312. } else if (this.copyText && source[1] !== null) {
  22313. t.text = source[1].getText(start, stop);
  22314. }
  22315. return t;
  22316. };
  22317. CommonTokenFactory.prototype.createThin = function (type, text) {
  22318. var t = new CommonToken(null, type);
  22319. t.text = text;
  22320. return t;
  22321. };
  22322. exports.CommonTokenFactory = CommonTokenFactory;
  22323. /***/ }),
  22324. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  22325. /*!**************************************************!*\
  22326. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  22327. \**************************************************/
  22328. /*! no static exports found */
  22329. /***/ (function(module, exports, __webpack_require__) {
  22330. "use strict";
  22331. //
  22332. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22333. * Use of this file is governed by the BSD 3-clause license that
  22334. * can be found in the LICENSE.txt file in the project root.
  22335. */
  22336. ///
  22337. //
  22338. // This class extends {@link BufferedTokenStream} with functionality to filter
  22339. // token streams to tokens on a particular channel (tokens where
  22340. // {@link Token//getChannel} returns a particular value).
  22341. //
  22342. // <p>
  22343. // This token stream provides access to all tokens by index or when calling
  22344. // methods like {@link //getText}. The channel filtering is only used for code
  22345. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  22346. // {@link //LB}.</p>
  22347. //
  22348. // <p>
  22349. // By default, tokens are placed on the default channel
  22350. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  22351. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  22352. // call {@link Lexer//setChannel}.
  22353. // </p>
  22354. //
  22355. // <p>
  22356. // Note: lexer rules which use the {@code ->skip} lexer command or call
  22357. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  22358. // such a rule will not be available as part of the token stream, regardless of
  22359. // channel.</p>
  22360. ///
  22361. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22362. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  22363. function CommonTokenStream(lexer, channel) {
  22364. BufferedTokenStream.call(this, lexer);
  22365. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  22366. return this;
  22367. }
  22368. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  22369. CommonTokenStream.prototype.constructor = CommonTokenStream;
  22370. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  22371. return this.nextTokenOnChannel(i, this.channel);
  22372. };
  22373. CommonTokenStream.prototype.LB = function (k) {
  22374. if (k === 0 || this.index - k < 0) {
  22375. return null;
  22376. }
  22377. var i = this.index;
  22378. var n = 1;
  22379. // find k good tokens looking backwards
  22380. while (n <= k) {
  22381. // skip off-channel tokens
  22382. i = this.previousTokenOnChannel(i - 1, this.channel);
  22383. n += 1;
  22384. }
  22385. if (i < 0) {
  22386. return null;
  22387. }
  22388. return this.tokens[i];
  22389. };
  22390. CommonTokenStream.prototype.LT = function (k) {
  22391. this.lazyInit();
  22392. if (k === 0) {
  22393. return null;
  22394. }
  22395. if (k < 0) {
  22396. return this.LB(-k);
  22397. }
  22398. var i = this.index;
  22399. var n = 1; // we know tokens[pos] is a good one
  22400. // find k good tokens
  22401. while (n < k) {
  22402. // skip off-channel tokens, but make sure to not look past EOF
  22403. if (this.sync(i + 1)) {
  22404. i = this.nextTokenOnChannel(i + 1, this.channel);
  22405. }
  22406. n += 1;
  22407. }
  22408. return this.tokens[i];
  22409. };
  22410. // Count EOF just once.///
  22411. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  22412. var n = 0;
  22413. this.fill();
  22414. for (var i = 0; i < this.tokens.length; i++) {
  22415. var t = this.tokens[i];
  22416. if (t.channel === this.channel) {
  22417. n += 1;
  22418. }
  22419. if (t.type === Token.EOF) {
  22420. break;
  22421. }
  22422. }
  22423. return n;
  22424. };
  22425. exports.CommonTokenStream = CommonTokenStream;
  22426. /***/ }),
  22427. /***/ "./node_modules/antlr4/FileStream.js":
  22428. /*!*******************************************!*\
  22429. !*** ./node_modules/antlr4/FileStream.js ***!
  22430. \*******************************************/
  22431. /*! no static exports found */
  22432. /***/ (function(module, exports, __webpack_require__) {
  22433. "use strict";
  22434. //
  22435. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22436. * Use of this file is governed by the BSD 3-clause license that
  22437. * can be found in the LICENSE.txt file in the project root.
  22438. */
  22439. //
  22440. //
  22441. // This is an InputStream that is loaded from a file all at once
  22442. // when you construct the object.
  22443. //
  22444. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22445. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22446. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22447. function FileStream(fileName, decodeToUnicodeCodePoints) {
  22448. var data = fs.readFileSync(fileName, "utf8");
  22449. InputStream.call(this, data, decodeToUnicodeCodePoints);
  22450. this.fileName = fileName;
  22451. return this;
  22452. }
  22453. FileStream.prototype = Object.create(InputStream.prototype);
  22454. FileStream.prototype.constructor = FileStream;
  22455. exports.FileStream = FileStream;
  22456. /***/ }),
  22457. /***/ "./node_modules/antlr4/InputStream.js":
  22458. /*!********************************************!*\
  22459. !*** ./node_modules/antlr4/InputStream.js ***!
  22460. \********************************************/
  22461. /*! no static exports found */
  22462. /***/ (function(module, exports, __webpack_require__) {
  22463. "use strict";
  22464. //
  22465. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22466. * Use of this file is governed by the BSD 3-clause license that
  22467. * can be found in the LICENSE.txt file in the project root.
  22468. */
  22469. //
  22470. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22471. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  22472. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  22473. // Vacuum all input from a string and then treat it like a buffer.
  22474. function _loadString(stream, decodeToUnicodeCodePoints) {
  22475. stream._index = 0;
  22476. stream.data = [];
  22477. if (stream.decodeToUnicodeCodePoints) {
  22478. for (var i = 0; i < stream.strdata.length;) {
  22479. var codePoint = stream.strdata.codePointAt(i);
  22480. stream.data.push(codePoint);
  22481. i += codePoint <= 0xFFFF ? 1 : 2;
  22482. }
  22483. } else {
  22484. for (var i = 0; i < stream.strdata.length; i++) {
  22485. var codeUnit = stream.strdata.charCodeAt(i);
  22486. stream.data.push(codeUnit);
  22487. }
  22488. }
  22489. stream._size = stream.data.length;
  22490. }
  22491. // If decodeToUnicodeCodePoints is true, the input is treated
  22492. // as a series of Unicode code points.
  22493. //
  22494. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  22495. // units.
  22496. function InputStream(data, decodeToUnicodeCodePoints) {
  22497. this.name = "<empty>";
  22498. this.strdata = data;
  22499. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  22500. _loadString(this);
  22501. return this;
  22502. }
  22503. Object.defineProperty(InputStream.prototype, "index", {
  22504. get: function get() {
  22505. return this._index;
  22506. }
  22507. });
  22508. Object.defineProperty(InputStream.prototype, "size", {
  22509. get: function get() {
  22510. return this._size;
  22511. }
  22512. });
  22513. // Reset the stream so that it's in the same state it was
  22514. // when the object was created *except* the data array is not
  22515. // touched.
  22516. //
  22517. InputStream.prototype.reset = function () {
  22518. this._index = 0;
  22519. };
  22520. InputStream.prototype.consume = function () {
  22521. if (this._index >= this._size) {
  22522. // assert this.LA(1) == Token.EOF
  22523. throw "cannot consume EOF";
  22524. }
  22525. this._index += 1;
  22526. };
  22527. InputStream.prototype.LA = function (offset) {
  22528. if (offset === 0) {
  22529. return 0; // undefined
  22530. }
  22531. if (offset < 0) {
  22532. offset += 1; // e.g., translate LA(-1) to use offset=0
  22533. }
  22534. var pos = this._index + offset - 1;
  22535. if (pos < 0 || pos >= this._size) {
  22536. // invalid
  22537. return Token.EOF;
  22538. }
  22539. return this.data[pos];
  22540. };
  22541. InputStream.prototype.LT = function (offset) {
  22542. return this.LA(offset);
  22543. };
  22544. // mark/release do nothing; we have entire buffer
  22545. InputStream.prototype.mark = function () {
  22546. return -1;
  22547. };
  22548. InputStream.prototype.release = function (marker) {};
  22549. // consume() ahead until p==_index; can't just set p=_index as we must
  22550. // update line and column. If we seek backwards, just set p
  22551. //
  22552. InputStream.prototype.seek = function (_index) {
  22553. if (_index <= this._index) {
  22554. this._index = _index; // just jump; don't update stream state (line,
  22555. // ...)
  22556. return;
  22557. }
  22558. // seek forward
  22559. this._index = Math.min(_index, this._size);
  22560. };
  22561. InputStream.prototype.getText = function (start, stop) {
  22562. if (stop >= this._size) {
  22563. stop = this._size - 1;
  22564. }
  22565. if (start >= this._size) {
  22566. return "";
  22567. } else {
  22568. if (this.decodeToUnicodeCodePoints) {
  22569. var result = "";
  22570. for (var i = start; i <= stop; i++) {
  22571. result += String.fromCodePoint(this.data[i]);
  22572. }
  22573. return result;
  22574. } else {
  22575. return this.strdata.slice(start, stop + 1);
  22576. }
  22577. }
  22578. };
  22579. InputStream.prototype.toString = function () {
  22580. return this.strdata;
  22581. };
  22582. exports.InputStream = InputStream;
  22583. /***/ }),
  22584. /***/ "./node_modules/antlr4/IntervalSet.js":
  22585. /*!********************************************!*\
  22586. !*** ./node_modules/antlr4/IntervalSet.js ***!
  22587. \********************************************/
  22588. /*! no static exports found */
  22589. /***/ (function(module, exports, __webpack_require__) {
  22590. "use strict";
  22591. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22592. * Use of this file is governed by the BSD 3-clause license that
  22593. * can be found in the LICENSE.txt file in the project root.
  22594. */
  22595. /*jslint smarttabs:true */
  22596. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22597. /* stop is not included! */
  22598. function Interval(start, stop) {
  22599. this.start = start;
  22600. this.stop = stop;
  22601. return this;
  22602. }
  22603. Interval.prototype.contains = function (item) {
  22604. return item >= this.start && item < this.stop;
  22605. };
  22606. Interval.prototype.toString = function () {
  22607. if (this.start === this.stop - 1) {
  22608. return this.start.toString();
  22609. } else {
  22610. return this.start.toString() + ".." + (this.stop - 1).toString();
  22611. }
  22612. };
  22613. Object.defineProperty(Interval.prototype, "length", {
  22614. get: function get() {
  22615. return this.stop - this.start;
  22616. }
  22617. });
  22618. function IntervalSet() {
  22619. this.intervals = null;
  22620. this.readOnly = false;
  22621. }
  22622. IntervalSet.prototype.first = function (v) {
  22623. if (this.intervals === null || this.intervals.length === 0) {
  22624. return Token.INVALID_TYPE;
  22625. } else {
  22626. return this.intervals[0].start;
  22627. }
  22628. };
  22629. IntervalSet.prototype.addOne = function (v) {
  22630. this.addInterval(new Interval(v, v + 1));
  22631. };
  22632. IntervalSet.prototype.addRange = function (l, h) {
  22633. this.addInterval(new Interval(l, h + 1));
  22634. };
  22635. IntervalSet.prototype.addInterval = function (v) {
  22636. if (this.intervals === null) {
  22637. this.intervals = [];
  22638. this.intervals.push(v);
  22639. } else {
  22640. // find insert pos
  22641. for (var k = 0; k < this.intervals.length; k++) {
  22642. var i = this.intervals[k];
  22643. // distinct range -> insert
  22644. if (v.stop < i.start) {
  22645. this.intervals.splice(k, 0, v);
  22646. return;
  22647. }
  22648. // contiguous range -> adjust
  22649. else if (v.stop === i.start) {
  22650. this.intervals[k].start = v.start;
  22651. return;
  22652. }
  22653. // overlapping range -> adjust and reduce
  22654. else if (v.start <= i.stop) {
  22655. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22656. this.reduce(k);
  22657. return;
  22658. }
  22659. }
  22660. // greater than any existing
  22661. this.intervals.push(v);
  22662. }
  22663. };
  22664. IntervalSet.prototype.addSet = function (other) {
  22665. if (other.intervals !== null) {
  22666. for (var k = 0; k < other.intervals.length; k++) {
  22667. var i = other.intervals[k];
  22668. this.addInterval(new Interval(i.start, i.stop));
  22669. }
  22670. }
  22671. return this;
  22672. };
  22673. IntervalSet.prototype.reduce = function (k) {
  22674. // only need to reduce if k is not the last
  22675. if (k < this.intervalslength - 1) {
  22676. var l = this.intervals[k];
  22677. var r = this.intervals[k + 1];
  22678. // if r contained in l
  22679. if (l.stop >= r.stop) {
  22680. this.intervals.pop(k + 1);
  22681. this.reduce(k);
  22682. } else if (l.stop >= r.start) {
  22683. this.intervals[k] = new Interval(l.start, r.stop);
  22684. this.intervals.pop(k + 1);
  22685. }
  22686. }
  22687. };
  22688. IntervalSet.prototype.complement = function (start, stop) {
  22689. var result = new IntervalSet();
  22690. result.addInterval(new Interval(start, stop + 1));
  22691. for (var i = 0; i < this.intervals.length; i++) {
  22692. result.removeRange(this.intervals[i]);
  22693. }
  22694. return result;
  22695. };
  22696. IntervalSet.prototype.contains = function (item) {
  22697. if (this.intervals === null) {
  22698. return false;
  22699. } else {
  22700. for (var k = 0; k < this.intervals.length; k++) {
  22701. if (this.intervals[k].contains(item)) {
  22702. return true;
  22703. }
  22704. }
  22705. return false;
  22706. }
  22707. };
  22708. Object.defineProperty(IntervalSet.prototype, "length", {
  22709. get: function get() {
  22710. var len = 0;
  22711. this.intervals.map(function (i) {
  22712. len += i.length;
  22713. });
  22714. return len;
  22715. }
  22716. });
  22717. IntervalSet.prototype.removeRange = function (v) {
  22718. if (v.start === v.stop - 1) {
  22719. this.removeOne(v.start);
  22720. } else if (this.intervals !== null) {
  22721. var k = 0;
  22722. for (var n = 0; n < this.intervals.length; n++) {
  22723. var i = this.intervals[k];
  22724. // intervals are ordered
  22725. if (v.stop <= i.start) {
  22726. return;
  22727. }
  22728. // check for including range, split it
  22729. else if (v.start > i.start && v.stop < i.stop) {
  22730. this.intervals[k] = new Interval(i.start, v.start);
  22731. var x = new Interval(v.stop, i.stop);
  22732. this.intervals.splice(k, 0, x);
  22733. return;
  22734. }
  22735. // check for included range, remove it
  22736. else if (v.start <= i.start && v.stop >= i.stop) {
  22737. this.intervals.splice(k, 1);
  22738. k = k - 1; // need another pass
  22739. }
  22740. // check for lower boundary
  22741. else if (v.start < i.stop) {
  22742. this.intervals[k] = new Interval(i.start, v.start);
  22743. }
  22744. // check for upper boundary
  22745. else if (v.stop < i.stop) {
  22746. this.intervals[k] = new Interval(v.stop, i.stop);
  22747. }
  22748. k += 1;
  22749. }
  22750. }
  22751. };
  22752. IntervalSet.prototype.removeOne = function (v) {
  22753. if (this.intervals !== null) {
  22754. for (var k = 0; k < this.intervals.length; k++) {
  22755. var i = this.intervals[k];
  22756. // intervals is ordered
  22757. if (v < i.start) {
  22758. return;
  22759. }
  22760. // check for single value range
  22761. else if (v === i.start && v === i.stop - 1) {
  22762. this.intervals.splice(k, 1);
  22763. return;
  22764. }
  22765. // check for lower boundary
  22766. else if (v === i.start) {
  22767. this.intervals[k] = new Interval(i.start + 1, i.stop);
  22768. return;
  22769. }
  22770. // check for upper boundary
  22771. else if (v === i.stop - 1) {
  22772. this.intervals[k] = new Interval(i.start, i.stop - 1);
  22773. return;
  22774. }
  22775. // split existing range
  22776. else if (v < i.stop - 1) {
  22777. var x = new Interval(i.start, v);
  22778. i.start = v + 1;
  22779. this.intervals.splice(k, 0, x);
  22780. return;
  22781. }
  22782. }
  22783. }
  22784. };
  22785. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  22786. literalNames = literalNames || null;
  22787. symbolicNames = symbolicNames || null;
  22788. elemsAreChar = elemsAreChar || false;
  22789. if (this.intervals === null) {
  22790. return "{}";
  22791. } else if (literalNames !== null || symbolicNames !== null) {
  22792. return this.toTokenString(literalNames, symbolicNames);
  22793. } else if (elemsAreChar) {
  22794. return this.toCharString();
  22795. } else {
  22796. return this.toIndexString();
  22797. }
  22798. };
  22799. IntervalSet.prototype.toCharString = function () {
  22800. var names = [];
  22801. for (var i = 0; i < this.intervals.length; i++) {
  22802. var v = this.intervals[i];
  22803. if (v.stop === v.start + 1) {
  22804. if (v.start === Token.EOF) {
  22805. names.push("<EOF>");
  22806. } else {
  22807. names.push("'" + String.fromCharCode(v.start) + "'");
  22808. }
  22809. } else {
  22810. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  22811. }
  22812. }
  22813. if (names.length > 1) {
  22814. return "{" + names.join(", ") + "}";
  22815. } else {
  22816. return names[0];
  22817. }
  22818. };
  22819. IntervalSet.prototype.toIndexString = function () {
  22820. var names = [];
  22821. for (var i = 0; i < this.intervals.length; i++) {
  22822. var v = this.intervals[i];
  22823. if (v.stop === v.start + 1) {
  22824. if (v.start === Token.EOF) {
  22825. names.push("<EOF>");
  22826. } else {
  22827. names.push(v.start.toString());
  22828. }
  22829. } else {
  22830. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  22831. }
  22832. }
  22833. if (names.length > 1) {
  22834. return "{" + names.join(", ") + "}";
  22835. } else {
  22836. return names[0];
  22837. }
  22838. };
  22839. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  22840. var names = [];
  22841. for (var i = 0; i < this.intervals.length; i++) {
  22842. var v = this.intervals[i];
  22843. for (var j = v.start; j < v.stop; j++) {
  22844. names.push(this.elementName(literalNames, symbolicNames, j));
  22845. }
  22846. }
  22847. if (names.length > 1) {
  22848. return "{" + names.join(", ") + "}";
  22849. } else {
  22850. return names[0];
  22851. }
  22852. };
  22853. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  22854. if (a === Token.EOF) {
  22855. return "<EOF>";
  22856. } else if (a === Token.EPSILON) {
  22857. return "<EPSILON>";
  22858. } else {
  22859. return literalNames[a] || symbolicNames[a];
  22860. }
  22861. };
  22862. exports.Interval = Interval;
  22863. exports.IntervalSet = IntervalSet;
  22864. /***/ }),
  22865. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  22866. /*!********************************************!*\
  22867. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  22868. \********************************************/
  22869. /*! no static exports found */
  22870. /***/ (function(module, exports, __webpack_require__) {
  22871. "use strict";
  22872. //
  22873. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22874. * Use of this file is governed by the BSD 3-clause license that
  22875. * can be found in the LICENSE.txt file in the project root.
  22876. */
  22877. ///
  22878. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  22879. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  22880. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22881. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  22882. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22883. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22884. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  22885. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  22886. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  22887. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  22888. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  22889. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  22890. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  22891. var PredictionContext = pc.PredictionContext;
  22892. var SingletonPredictionContext = pc.SingletonPredictionContext;
  22893. function LL1Analyzer(atn) {
  22894. this.atn = atn;
  22895. }
  22896. //* Special value added to the lookahead sets to indicate that we hit
  22897. // a predicate during analysis if {@code seeThruPreds==false}.
  22898. ///
  22899. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  22900. //*
  22901. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  22902. // of an {@link ATNState}. The returned array has one element for each
  22903. // outgoing transition in {@code s}. If the closure from transition
  22904. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  22905. // element at index <em>i</em> of the result will be {@code null}.
  22906. //
  22907. // @param s the ATN state
  22908. // @return the expected symbols for each outgoing transition of {@code s}.
  22909. ///
  22910. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  22911. if (s === null) {
  22912. return null;
  22913. }
  22914. var count = s.transitions.length;
  22915. var look = [];
  22916. for (var alt = 0; alt < count; alt++) {
  22917. look[alt] = new IntervalSet();
  22918. var lookBusy = new Set();
  22919. var seeThruPreds = false; // fail to get lookahead upon pred
  22920. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  22921. // Wipe out lookahead for this alternative if we found nothing
  22922. // or we had a predicate when we !seeThruPreds
  22923. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  22924. look[alt] = null;
  22925. }
  22926. }
  22927. return look;
  22928. };
  22929. //*
  22930. // Compute set of tokens that can follow {@code s} in the ATN in the
  22931. // specified {@code ctx}.
  22932. //
  22933. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  22934. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  22935. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  22936. // reached, {@link Token//EOF} is added to the result set.</p>
  22937. //
  22938. // @param s the ATN state
  22939. // @param stopState the ATN state to stop at. This can be a
  22940. // {@link BlockEndState} to detect epsilon paths through a closure.
  22941. // @param ctx the complete parser context, or {@code null} if the context
  22942. // should be ignored
  22943. //
  22944. // @return The set of tokens that can follow {@code s} in the ATN in the
  22945. // specified {@code ctx}.
  22946. ///
  22947. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  22948. var r = new IntervalSet();
  22949. var seeThruPreds = true; // ignore preds; get all lookahead
  22950. ctx = ctx || null;
  22951. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  22952. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  22953. return r;
  22954. };
  22955. //*
  22956. // Compute set of tokens that can follow {@code s} in the ATN in the
  22957. // specified {@code ctx}.
  22958. //
  22959. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  22960. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  22961. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  22962. // {@code true} and {@code stopState} or the end of the outermost rule is
  22963. // reached, {@link Token//EOF} is added to the result set.</p>
  22964. //
  22965. // @param s the ATN state.
  22966. // @param stopState the ATN state to stop at. This can be a
  22967. // {@link BlockEndState} to detect epsilon paths through a closure.
  22968. // @param ctx The outer context, or {@code null} if the outer context should
  22969. // not be used.
  22970. // @param look The result lookahead set.
  22971. // @param lookBusy A set used for preventing epsilon closures in the ATN
  22972. // from causing a stack overflow. Outside code should pass
  22973. // {@code new Set<ATNConfig>} for this argument.
  22974. // @param calledRuleStack A set used for preventing left recursion in the
  22975. // ATN from causing a stack overflow. Outside code should pass
  22976. // {@code new BitSet()} for this argument.
  22977. // @param seeThruPreds {@code true} to true semantic predicates as
  22978. // implicitly {@code true} and "see through them", otherwise {@code false}
  22979. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  22980. // result if one is encountered.
  22981. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  22982. // outermost context is reached. This parameter has no effect if {@code ctx}
  22983. // is {@code null}.
  22984. ///
  22985. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  22986. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  22987. if (lookBusy.contains(c)) {
  22988. return;
  22989. }
  22990. lookBusy.add(c);
  22991. if (s === stopState) {
  22992. if (ctx === null) {
  22993. look.addOne(Token.EPSILON);
  22994. return;
  22995. } else if (ctx.isEmpty() && addEOF) {
  22996. look.addOne(Token.EOF);
  22997. return;
  22998. }
  22999. }
  23000. if (s instanceof RuleStopState) {
  23001. if (ctx === null) {
  23002. look.addOne(Token.EPSILON);
  23003. return;
  23004. } else if (ctx.isEmpty() && addEOF) {
  23005. look.addOne(Token.EOF);
  23006. return;
  23007. }
  23008. if (ctx !== PredictionContext.EMPTY) {
  23009. // run thru all possible stack tops in ctx
  23010. for (var i = 0; i < ctx.length; i++) {
  23011. var returnState = this.atn.states[ctx.getReturnState(i)];
  23012. var removed = calledRuleStack.contains(returnState.ruleIndex);
  23013. try {
  23014. calledRuleStack.remove(returnState.ruleIndex);
  23015. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23016. } finally {
  23017. if (removed) {
  23018. calledRuleStack.add(returnState.ruleIndex);
  23019. }
  23020. }
  23021. }
  23022. return;
  23023. }
  23024. }
  23025. for (var j = 0; j < s.transitions.length; j++) {
  23026. var t = s.transitions[j];
  23027. if (t.constructor === RuleTransition) {
  23028. if (calledRuleStack.contains(t.target.ruleIndex)) {
  23029. continue;
  23030. }
  23031. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  23032. try {
  23033. calledRuleStack.add(t.target.ruleIndex);
  23034. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23035. } finally {
  23036. calledRuleStack.remove(t.target.ruleIndex);
  23037. }
  23038. } else if (t instanceof AbstractPredicateTransition) {
  23039. if (seeThruPreds) {
  23040. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23041. } else {
  23042. look.addOne(LL1Analyzer.HIT_PRED);
  23043. }
  23044. } else if (t.isEpsilon) {
  23045. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23046. } else if (t.constructor === WildcardTransition) {
  23047. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  23048. } else {
  23049. var set = t.label;
  23050. if (set !== null) {
  23051. if (t instanceof NotSetTransition) {
  23052. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  23053. }
  23054. look.addSet(set);
  23055. }
  23056. }
  23057. }
  23058. };
  23059. exports.LL1Analyzer = LL1Analyzer;
  23060. /***/ }),
  23061. /***/ "./node_modules/antlr4/Lexer.js":
  23062. /*!**************************************!*\
  23063. !*** ./node_modules/antlr4/Lexer.js ***!
  23064. \**************************************/
  23065. /*! no static exports found */
  23066. /***/ (function(module, exports, __webpack_require__) {
  23067. "use strict";
  23068. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23069. * Use of this file is governed by the BSD 3-clause license that
  23070. * can be found in the LICENSE.txt file in the project root.
  23071. */
  23072. ///
  23073. // A lexer is recognizer that draws input symbols from a character stream.
  23074. // lexer grammars result in a subclass of this object. A Lexer object
  23075. // uses simplified match() and error recovery mechanisms in the interest of speed.
  23076. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23077. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  23078. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  23079. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  23080. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  23081. function TokenSource() {
  23082. return this;
  23083. }
  23084. function Lexer(input) {
  23085. Recognizer.call(this);
  23086. this._input = input;
  23087. this._factory = CommonTokenFactory.DEFAULT;
  23088. this._tokenFactorySourcePair = [this, input];
  23089. this._interp = null; // child classes must populate this
  23090. // The goal of all lexer rules/methods is to create a token object.
  23091. // this is an instance variable as multiple rules may collaborate to
  23092. // create a single token. nextToken will return this object after
  23093. // matching lexer rule(s). If you subclass to allow multiple token
  23094. // emissions, then set this to the last token to be matched or
  23095. // something nonnull so that the auto token emit mechanism will not
  23096. // emit another token.
  23097. this._token = null;
  23098. // What character index in the stream did the current token start at?
  23099. // Needed, for example, to get the text for current token. Set at
  23100. // the start of nextToken.
  23101. this._tokenStartCharIndex = -1;
  23102. // The line on which the first character of the token resides///
  23103. this._tokenStartLine = -1;
  23104. // The character position of first character within the line///
  23105. this._tokenStartColumn = -1;
  23106. // Once we see EOF on char stream, next token will be EOF.
  23107. // If you have DONE : EOF ; then you see DONE EOF.
  23108. this._hitEOF = false;
  23109. // The channel number for the current token///
  23110. this._channel = Token.DEFAULT_CHANNEL;
  23111. // The token type for the current token///
  23112. this._type = Token.INVALID_TYPE;
  23113. this._modeStack = [];
  23114. this._mode = Lexer.DEFAULT_MODE;
  23115. // You can set the text for the current token to override what is in
  23116. // the input char buffer. Use setText() or can set this instance var.
  23117. // /
  23118. this._text = null;
  23119. return this;
  23120. }
  23121. Lexer.prototype = Object.create(Recognizer.prototype);
  23122. Lexer.prototype.constructor = Lexer;
  23123. Lexer.DEFAULT_MODE = 0;
  23124. Lexer.MORE = -2;
  23125. Lexer.SKIP = -3;
  23126. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  23127. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  23128. Lexer.MIN_CHAR_VALUE = 0x0000;
  23129. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  23130. Lexer.prototype.reset = function () {
  23131. // wack Lexer state variables
  23132. if (this._input !== null) {
  23133. this._input.seek(0); // rewind the input
  23134. }
  23135. this._token = null;
  23136. this._type = Token.INVALID_TYPE;
  23137. this._channel = Token.DEFAULT_CHANNEL;
  23138. this._tokenStartCharIndex = -1;
  23139. this._tokenStartColumn = -1;
  23140. this._tokenStartLine = -1;
  23141. this._text = null;
  23142. this._hitEOF = false;
  23143. this._mode = Lexer.DEFAULT_MODE;
  23144. this._modeStack = [];
  23145. this._interp.reset();
  23146. };
  23147. // Return a token from this source; i.e., match a token on the char stream.
  23148. Lexer.prototype.nextToken = function () {
  23149. if (this._input === null) {
  23150. throw "nextToken requires a non-null input stream.";
  23151. }
  23152. // Mark start location in char stream so unbuffered streams are
  23153. // guaranteed at least have text of current token
  23154. var tokenStartMarker = this._input.mark();
  23155. try {
  23156. while (true) {
  23157. if (this._hitEOF) {
  23158. this.emitEOF();
  23159. return this._token;
  23160. }
  23161. this._token = null;
  23162. this._channel = Token.DEFAULT_CHANNEL;
  23163. this._tokenStartCharIndex = this._input.index;
  23164. this._tokenStartColumn = this._interp.column;
  23165. this._tokenStartLine = this._interp.line;
  23166. this._text = null;
  23167. var continueOuter = false;
  23168. while (true) {
  23169. this._type = Token.INVALID_TYPE;
  23170. var ttype = Lexer.SKIP;
  23171. try {
  23172. ttype = this._interp.match(this._input, this._mode);
  23173. } catch (e) {
  23174. if (e instanceof RecognitionException) {
  23175. this.notifyListeners(e); // report error
  23176. this.recover(e);
  23177. } else {
  23178. console.log(e.stack);
  23179. throw e;
  23180. }
  23181. }
  23182. if (this._input.LA(1) === Token.EOF) {
  23183. this._hitEOF = true;
  23184. }
  23185. if (this._type === Token.INVALID_TYPE) {
  23186. this._type = ttype;
  23187. }
  23188. if (this._type === Lexer.SKIP) {
  23189. continueOuter = true;
  23190. break;
  23191. }
  23192. if (this._type !== Lexer.MORE) {
  23193. break;
  23194. }
  23195. }
  23196. if (continueOuter) {
  23197. continue;
  23198. }
  23199. if (this._token === null) {
  23200. this.emit();
  23201. }
  23202. return this._token;
  23203. }
  23204. } finally {
  23205. // make sure we release marker after match or
  23206. // unbuffered char stream will keep buffering
  23207. this._input.release(tokenStartMarker);
  23208. }
  23209. };
  23210. // Instruct the lexer to skip creating a token for current lexer rule
  23211. // and look for another token. nextToken() knows to keep looking when
  23212. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  23213. // if token==null at end of any token rule, it creates one for you
  23214. // and emits it.
  23215. // /
  23216. Lexer.prototype.skip = function () {
  23217. this._type = Lexer.SKIP;
  23218. };
  23219. Lexer.prototype.more = function () {
  23220. this._type = Lexer.MORE;
  23221. };
  23222. Lexer.prototype.mode = function (m) {
  23223. this._mode = m;
  23224. };
  23225. Lexer.prototype.pushMode = function (m) {
  23226. if (this._interp.debug) {
  23227. console.log("pushMode " + m);
  23228. }
  23229. this._modeStack.push(this._mode);
  23230. this.mode(m);
  23231. };
  23232. Lexer.prototype.popMode = function () {
  23233. if (this._modeStack.length === 0) {
  23234. throw "Empty Stack";
  23235. }
  23236. if (this._interp.debug) {
  23237. console.log("popMode back to " + this._modeStack.slice(0, -1));
  23238. }
  23239. this.mode(this._modeStack.pop());
  23240. return this._mode;
  23241. };
  23242. // Set the char stream and reset the lexer
  23243. Object.defineProperty(Lexer.prototype, "inputStream", {
  23244. get: function get() {
  23245. return this._input;
  23246. },
  23247. set: function set(input) {
  23248. this._input = null;
  23249. this._tokenFactorySourcePair = [this, this._input];
  23250. this.reset();
  23251. this._input = input;
  23252. this._tokenFactorySourcePair = [this, this._input];
  23253. }
  23254. });
  23255. Object.defineProperty(Lexer.prototype, "sourceName", {
  23256. get: function sourceName() {
  23257. return this._input.sourceName;
  23258. }
  23259. });
  23260. // By default does not support multiple emits per nextToken invocation
  23261. // for efficiency reasons. Subclass and override this method, nextToken,
  23262. // and getToken (to push tokens into a list and pull from that list
  23263. // rather than a single variable as this implementation does).
  23264. // /
  23265. Lexer.prototype.emitToken = function (token) {
  23266. this._token = token;
  23267. };
  23268. // The standard method called to automatically emit a token at the
  23269. // outermost lexical rule. The token object should point into the
  23270. // char buffer start..stop. If there is a text override in 'text',
  23271. // use that to set the token's text. Override this method to emit
  23272. // custom Token objects or provide a new factory.
  23273. // /
  23274. Lexer.prototype.emit = function () {
  23275. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  23276. this.emitToken(t);
  23277. return t;
  23278. };
  23279. Lexer.prototype.emitEOF = function () {
  23280. var cpos = this.column;
  23281. var lpos = this.line;
  23282. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  23283. this.emitToken(eof);
  23284. return eof;
  23285. };
  23286. Object.defineProperty(Lexer.prototype, "type", {
  23287. get: function get() {
  23288. return this.type;
  23289. },
  23290. set: function set(type) {
  23291. this._type = type;
  23292. }
  23293. });
  23294. Object.defineProperty(Lexer.prototype, "line", {
  23295. get: function get() {
  23296. return this._interp.line;
  23297. },
  23298. set: function set(line) {
  23299. this._interp.line = line;
  23300. }
  23301. });
  23302. Object.defineProperty(Lexer.prototype, "column", {
  23303. get: function get() {
  23304. return this._interp.column;
  23305. },
  23306. set: function set(column) {
  23307. this._interp.column = column;
  23308. }
  23309. });
  23310. // What is the index of the current character of lookahead?///
  23311. Lexer.prototype.getCharIndex = function () {
  23312. return this._input.index;
  23313. };
  23314. // Return the text matched so far for the current token or any text override.
  23315. //Set the complete text of this token; it wipes any previous changes to the text.
  23316. Object.defineProperty(Lexer.prototype, "text", {
  23317. get: function get() {
  23318. if (this._text !== null) {
  23319. return this._text;
  23320. } else {
  23321. return this._interp.getText(this._input);
  23322. }
  23323. },
  23324. set: function set(text) {
  23325. this._text = text;
  23326. }
  23327. });
  23328. // Return a list of all Token objects in input char stream.
  23329. // Forces load of all tokens. Does not include EOF token.
  23330. // /
  23331. Lexer.prototype.getAllTokens = function () {
  23332. var tokens = [];
  23333. var t = this.nextToken();
  23334. while (t.type !== Token.EOF) {
  23335. tokens.push(t);
  23336. t = this.nextToken();
  23337. }
  23338. return tokens;
  23339. };
  23340. Lexer.prototype.notifyListeners = function (e) {
  23341. var start = this._tokenStartCharIndex;
  23342. var stop = this._input.index;
  23343. var text = this._input.getText(start, stop);
  23344. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  23345. var listener = this.getErrorListenerDispatch();
  23346. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  23347. };
  23348. Lexer.prototype.getErrorDisplay = function (s) {
  23349. var d = [];
  23350. for (var i = 0; i < s.length; i++) {
  23351. d.push(s[i]);
  23352. }
  23353. return d.join('');
  23354. };
  23355. Lexer.prototype.getErrorDisplayForChar = function (c) {
  23356. if (c.charCodeAt(0) === Token.EOF) {
  23357. return "<EOF>";
  23358. } else if (c === '\n') {
  23359. return "\\n";
  23360. } else if (c === '\t') {
  23361. return "\\t";
  23362. } else if (c === '\r') {
  23363. return "\\r";
  23364. } else {
  23365. return c;
  23366. }
  23367. };
  23368. Lexer.prototype.getCharErrorDisplay = function (c) {
  23369. return "'" + this.getErrorDisplayForChar(c) + "'";
  23370. };
  23371. // Lexers can normally match any char in it's vocabulary after matching
  23372. // a token, so do the easy thing and just kill a character and hope
  23373. // it all works out. You can instead use the rule invocation stack
  23374. // to do sophisticated error recovery if you are in a fragment rule.
  23375. // /
  23376. Lexer.prototype.recover = function (re) {
  23377. if (this._input.LA(1) !== Token.EOF) {
  23378. if (re instanceof LexerNoViableAltException) {
  23379. // skip a char and try again
  23380. this._interp.consume(this._input);
  23381. } else {
  23382. // TODO: Do we lose character or line position information?
  23383. this._input.consume();
  23384. }
  23385. }
  23386. };
  23387. exports.Lexer = Lexer;
  23388. /***/ }),
  23389. /***/ "./node_modules/antlr4/Parser.js":
  23390. /*!***************************************!*\
  23391. !*** ./node_modules/antlr4/Parser.js ***!
  23392. \***************************************/
  23393. /*! no static exports found */
  23394. /***/ (function(module, exports, __webpack_require__) {
  23395. "use strict";
  23396. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23397. * Use of this file is governed by the BSD 3-clause license that
  23398. * can be found in the LICENSE.txt file in the project root.
  23399. */
  23400. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23401. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  23402. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  23403. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  23404. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  23405. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  23406. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  23407. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  23408. function TraceListener(parser) {
  23409. ParseTreeListener.call(this);
  23410. this.parser = parser;
  23411. return this;
  23412. }
  23413. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  23414. TraceListener.prototype.constructor = TraceListener;
  23415. TraceListener.prototype.enterEveryRule = function (ctx) {
  23416. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  23417. };
  23418. TraceListener.prototype.visitTerminal = function (node) {
  23419. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  23420. };
  23421. TraceListener.prototype.exitEveryRule = function (ctx) {
  23422. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  23423. };
  23424. // this is all the parsing support code essentially; most of it is error
  23425. // recovery stuff.//
  23426. function Parser(input) {
  23427. Recognizer.call(this);
  23428. // The input stream.
  23429. this._input = null;
  23430. // The error handling strategy for the parser. The default value is a new
  23431. // instance of {@link DefaultErrorStrategy}.
  23432. this._errHandler = new DefaultErrorStrategy();
  23433. this._precedenceStack = [];
  23434. this._precedenceStack.push(0);
  23435. // The {@link ParserRuleContext} object for the currently executing rule.
  23436. // this is always non-null during the parsing process.
  23437. this._ctx = null;
  23438. // Specifies whether or not the parser should construct a parse tree during
  23439. // the parsing process. The default value is {@code true}.
  23440. this.buildParseTrees = true;
  23441. // When {@link //setTrace}{@code (true)} is called, a reference to the
  23442. // {@link TraceListener} is stored here so it can be easily removed in a
  23443. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  23444. // implemented as a parser listener so this field is not directly used by
  23445. // other parser methods.
  23446. this._tracer = null;
  23447. // The list of {@link ParseTreeListener} listeners registered to receive
  23448. // events during the parse.
  23449. this._parseListeners = null;
  23450. // The number of syntax errors reported during parsing. this value is
  23451. // incremented each time {@link //notifyErrorListeners} is called.
  23452. this._syntaxErrors = 0;
  23453. this.setInputStream(input);
  23454. return this;
  23455. }
  23456. Parser.prototype = Object.create(Recognizer.prototype);
  23457. Parser.prototype.contructor = Parser;
  23458. // this field maps from the serialized ATN string to the deserialized {@link
  23459. // ATN} with
  23460. // bypass alternatives.
  23461. //
  23462. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  23463. //
  23464. Parser.bypassAltsAtnCache = {};
  23465. // reset the parser's state//
  23466. Parser.prototype.reset = function () {
  23467. if (this._input !== null) {
  23468. this._input.seek(0);
  23469. }
  23470. this._errHandler.reset(this);
  23471. this._ctx = null;
  23472. this._syntaxErrors = 0;
  23473. this.setTrace(false);
  23474. this._precedenceStack = [];
  23475. this._precedenceStack.push(0);
  23476. if (this._interp !== null) {
  23477. this._interp.reset();
  23478. }
  23479. };
  23480. // Match current input symbol against {@code ttype}. If the symbol type
  23481. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  23482. // called to complete the match process.
  23483. //
  23484. // <p>If the symbol type does not match,
  23485. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23486. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23487. // {@code true} and the token index of the symbol returned by
  23488. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23489. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23490. //
  23491. // @param ttype the token type to match
  23492. // @return the matched symbol
  23493. // @throws RecognitionException if the current input symbol did not match
  23494. // {@code ttype} and the error strategy could not recover from the
  23495. // mismatched symbol
  23496. Parser.prototype.match = function (ttype) {
  23497. var t = this.getCurrentToken();
  23498. if (t.type === ttype) {
  23499. this._errHandler.reportMatch(this);
  23500. this.consume();
  23501. } else {
  23502. t = this._errHandler.recoverInline(this);
  23503. if (this.buildParseTrees && t.tokenIndex === -1) {
  23504. // we must have conjured up a new token during single token
  23505. // insertion
  23506. // if it's not the current symbol
  23507. this._ctx.addErrorNode(t);
  23508. }
  23509. }
  23510. return t;
  23511. };
  23512. // Match current input symbol as a wildcard. If the symbol type matches
  23513. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  23514. // and {@link //consume} are called to complete the match process.
  23515. //
  23516. // <p>If the symbol type does not match,
  23517. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23518. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23519. // {@code true} and the token index of the symbol returned by
  23520. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23521. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23522. //
  23523. // @return the matched symbol
  23524. // @throws RecognitionException if the current input symbol did not match
  23525. // a wildcard and the error strategy could not recover from the mismatched
  23526. // symbol
  23527. Parser.prototype.matchWildcard = function () {
  23528. var t = this.getCurrentToken();
  23529. if (t.type > 0) {
  23530. this._errHandler.reportMatch(this);
  23531. this.consume();
  23532. } else {
  23533. t = this._errHandler.recoverInline(this);
  23534. if (this._buildParseTrees && t.tokenIndex === -1) {
  23535. // we must have conjured up a new token during single token
  23536. // insertion
  23537. // if it's not the current symbol
  23538. this._ctx.addErrorNode(t);
  23539. }
  23540. }
  23541. return t;
  23542. };
  23543. Parser.prototype.getParseListeners = function () {
  23544. return this._parseListeners || [];
  23545. };
  23546. // Registers {@code listener} to receive events during the parsing process.
  23547. //
  23548. // <p>To support output-preserving grammar transformations (including but not
  23549. // limited to left-recursion removal, automated left-factoring, and
  23550. // optimized code generation), calls to listener methods during the parse
  23551. // may differ substantially from calls made by
  23552. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  23553. // particular, rule entry and exit events may occur in a different order
  23554. // during the parse than after the parser. In addition, calls to certain
  23555. // rule entry methods may be omitted.</p>
  23556. //
  23557. // <p>With the following specific exceptions, calls to listener events are
  23558. // <em>deterministic</em>, i.e. for identical input the calls to listener
  23559. // methods will be the same.</p>
  23560. //
  23561. // <ul>
  23562. // <li>Alterations to the grammar used to generate code may change the
  23563. // behavior of the listener calls.</li>
  23564. // <li>Alterations to the command line options passed to ANTLR 4 when
  23565. // generating the parser may change the behavior of the listener calls.</li>
  23566. // <li>Changing the version of the ANTLR Tool used to generate the parser
  23567. // may change the behavior of the listener calls.</li>
  23568. // </ul>
  23569. //
  23570. // @param listener the listener to add
  23571. //
  23572. // @throws NullPointerException if {@code} listener is {@code null}
  23573. //
  23574. Parser.prototype.addParseListener = function (listener) {
  23575. if (listener === null) {
  23576. throw "listener";
  23577. }
  23578. if (this._parseListeners === null) {
  23579. this._parseListeners = [];
  23580. }
  23581. this._parseListeners.push(listener);
  23582. };
  23583. //
  23584. // Remove {@code listener} from the list of parse listeners.
  23585. //
  23586. // <p>If {@code listener} is {@code null} or has not been added as a parse
  23587. // listener, this method does nothing.</p>
  23588. // @param listener the listener to remove
  23589. //
  23590. Parser.prototype.removeParseListener = function (listener) {
  23591. if (this._parseListeners !== null) {
  23592. var idx = this._parseListeners.indexOf(listener);
  23593. if (idx >= 0) {
  23594. this._parseListeners.splice(idx, 1);
  23595. }
  23596. if (this._parseListeners.length === 0) {
  23597. this._parseListeners = null;
  23598. }
  23599. }
  23600. };
  23601. // Remove all parse listeners.
  23602. Parser.prototype.removeParseListeners = function () {
  23603. this._parseListeners = null;
  23604. };
  23605. // Notify any parse listeners of an enter rule event.
  23606. Parser.prototype.triggerEnterRuleEvent = function () {
  23607. if (this._parseListeners !== null) {
  23608. var ctx = this._ctx;
  23609. this._parseListeners.map(function (listener) {
  23610. listener.enterEveryRule(ctx);
  23611. ctx.enterRule(listener);
  23612. });
  23613. }
  23614. };
  23615. //
  23616. // Notify any parse listeners of an exit rule event.
  23617. //
  23618. // @see //addParseListener
  23619. //
  23620. Parser.prototype.triggerExitRuleEvent = function () {
  23621. if (this._parseListeners !== null) {
  23622. // reverse order walk of listeners
  23623. var ctx = this._ctx;
  23624. this._parseListeners.slice(0).reverse().map(function (listener) {
  23625. ctx.exitRule(listener);
  23626. listener.exitEveryRule(ctx);
  23627. });
  23628. }
  23629. };
  23630. Parser.prototype.getTokenFactory = function () {
  23631. return this._input.tokenSource._factory;
  23632. };
  23633. // Tell our token source and error strategy about a new way to create tokens.//
  23634. Parser.prototype.setTokenFactory = function (factory) {
  23635. this._input.tokenSource._factory = factory;
  23636. };
  23637. // The ATN with bypass alternatives is expensive to create so we create it
  23638. // lazily.
  23639. //
  23640. // @throws UnsupportedOperationException if the current parser does not
  23641. // implement the {@link //getSerializedATN()} method.
  23642. //
  23643. Parser.prototype.getATNWithBypassAlts = function () {
  23644. var serializedAtn = this.getSerializedATN();
  23645. if (serializedAtn === null) {
  23646. throw "The current parser does not support an ATN with bypass alternatives.";
  23647. }
  23648. var result = this.bypassAltsAtnCache[serializedAtn];
  23649. if (result === null) {
  23650. var deserializationOptions = new ATNDeserializationOptions();
  23651. deserializationOptions.generateRuleBypassTransitions = true;
  23652. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23653. this.bypassAltsAtnCache[serializedAtn] = result;
  23654. }
  23655. return result;
  23656. };
  23657. // The preferred method of getting a tree pattern. For example, here's a
  23658. // sample use:
  23659. //
  23660. // <pre>
  23661. // ParseTree t = parser.expr();
  23662. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23663. // MyParser.RULE_expr);
  23664. // ParseTreeMatch m = p.match(t);
  23665. // String id = m.get("ID");
  23666. // </pre>
  23667. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23668. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23669. lexer = lexer || null;
  23670. if (lexer === null) {
  23671. if (this.getTokenStream() !== null) {
  23672. var tokenSource = this.getTokenStream().tokenSource;
  23673. if (tokenSource instanceof Lexer) {
  23674. lexer = tokenSource;
  23675. }
  23676. }
  23677. }
  23678. if (lexer === null) {
  23679. throw "Parser can't discover a lexer to use";
  23680. }
  23681. var m = new ParseTreePatternMatcher(lexer, this);
  23682. return m.compile(pattern, patternRuleIndex);
  23683. };
  23684. Parser.prototype.getInputStream = function () {
  23685. return this.getTokenStream();
  23686. };
  23687. Parser.prototype.setInputStream = function (input) {
  23688. this.setTokenStream(input);
  23689. };
  23690. Parser.prototype.getTokenStream = function () {
  23691. return this._input;
  23692. };
  23693. // Set the token stream and reset the parser.//
  23694. Parser.prototype.setTokenStream = function (input) {
  23695. this._input = null;
  23696. this.reset();
  23697. this._input = input;
  23698. };
  23699. // Match needs to return the current input symbol, which gets put
  23700. // into the label for the associated token ref; e.g., x=ID.
  23701. //
  23702. Parser.prototype.getCurrentToken = function () {
  23703. return this._input.LT(1);
  23704. };
  23705. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23706. offendingToken = offendingToken || null;
  23707. err = err || null;
  23708. if (offendingToken === null) {
  23709. offendingToken = this.getCurrentToken();
  23710. }
  23711. this._syntaxErrors += 1;
  23712. var line = offendingToken.line;
  23713. var column = offendingToken.column;
  23714. var listener = this.getErrorListenerDispatch();
  23715. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23716. };
  23717. //
  23718. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23719. //
  23720. // <p>E.g., given the following input with {@code A} being the current
  23721. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23722. // {@code A}.</p>
  23723. //
  23724. // <pre>
  23725. // A B
  23726. // ^
  23727. // </pre>
  23728. //
  23729. // If the parser is not in error recovery mode, the consumed symbol is added
  23730. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  23731. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  23732. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  23733. // added to the parse tree using
  23734. // {@link ParserRuleContext//addErrorNode(Token)}, and
  23735. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  23736. // listeners.
  23737. //
  23738. Parser.prototype.consume = function () {
  23739. var o = this.getCurrentToken();
  23740. if (o.type !== Token.EOF) {
  23741. this.getInputStream().consume();
  23742. }
  23743. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  23744. if (this.buildParseTrees || hasListener) {
  23745. var node;
  23746. if (this._errHandler.inErrorRecoveryMode(this)) {
  23747. node = this._ctx.addErrorNode(o);
  23748. } else {
  23749. node = this._ctx.addTokenNode(o);
  23750. }
  23751. node.invokingState = this.state;
  23752. if (hasListener) {
  23753. this._parseListeners.map(function (listener) {
  23754. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  23755. listener.visitErrorNode(node);
  23756. } else if (node instanceof TerminalNode) {
  23757. listener.visitTerminal(node);
  23758. }
  23759. });
  23760. }
  23761. }
  23762. return o;
  23763. };
  23764. Parser.prototype.addContextToParseTree = function () {
  23765. // add current context to parent if we have a parent
  23766. if (this._ctx.parentCtx !== null) {
  23767. this._ctx.parentCtx.addChild(this._ctx);
  23768. }
  23769. };
  23770. // Always called by generated parsers upon entry to a rule. Access field
  23771. // {@link //_ctx} get the current context.
  23772. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  23773. this.state = state;
  23774. this._ctx = localctx;
  23775. this._ctx.start = this._input.LT(1);
  23776. if (this.buildParseTrees) {
  23777. this.addContextToParseTree();
  23778. }
  23779. if (this._parseListeners !== null) {
  23780. this.triggerEnterRuleEvent();
  23781. }
  23782. };
  23783. Parser.prototype.exitRule = function () {
  23784. this._ctx.stop = this._input.LT(-1);
  23785. // trigger event on _ctx, before it reverts to parent
  23786. if (this._parseListeners !== null) {
  23787. this.triggerExitRuleEvent();
  23788. }
  23789. this.state = this._ctx.invokingState;
  23790. this._ctx = this._ctx.parentCtx;
  23791. };
  23792. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  23793. localctx.setAltNumber(altNum);
  23794. // if we have new localctx, make sure we replace existing ctx
  23795. // that is previous child of parse tree
  23796. if (this.buildParseTrees && this._ctx !== localctx) {
  23797. if (this._ctx.parentCtx !== null) {
  23798. this._ctx.parentCtx.removeLastChild();
  23799. this._ctx.parentCtx.addChild(localctx);
  23800. }
  23801. }
  23802. this._ctx = localctx;
  23803. };
  23804. // Get the precedence level for the top-most precedence rule.
  23805. //
  23806. // @return The precedence level for the top-most precedence rule, or -1 if
  23807. // the parser context is not nested within a precedence rule.
  23808. Parser.prototype.getPrecedence = function () {
  23809. if (this._precedenceStack.length === 0) {
  23810. return -1;
  23811. } else {
  23812. return this._precedenceStack[this._precedenceStack.length - 1];
  23813. }
  23814. };
  23815. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  23816. this.state = state;
  23817. this._precedenceStack.push(precedence);
  23818. this._ctx = localctx;
  23819. this._ctx.start = this._input.LT(1);
  23820. if (this._parseListeners !== null) {
  23821. this.triggerEnterRuleEvent(); // simulates rule entry for
  23822. // left-recursive rules
  23823. }
  23824. };
  23825. //
  23826. // Like {@link //enterRule} but for recursive rules.
  23827. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  23828. var previous = this._ctx;
  23829. previous.parentCtx = localctx;
  23830. previous.invokingState = state;
  23831. previous.stop = this._input.LT(-1);
  23832. this._ctx = localctx;
  23833. this._ctx.start = previous.start;
  23834. if (this.buildParseTrees) {
  23835. this._ctx.addChild(previous);
  23836. }
  23837. if (this._parseListeners !== null) {
  23838. this.triggerEnterRuleEvent(); // simulates rule entry for
  23839. // left-recursive rules
  23840. }
  23841. };
  23842. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  23843. this._precedenceStack.pop();
  23844. this._ctx.stop = this._input.LT(-1);
  23845. var retCtx = this._ctx; // save current ctx (return value)
  23846. // unroll so _ctx is as it was before call to recursive method
  23847. if (this._parseListeners !== null) {
  23848. while (this._ctx !== parentCtx) {
  23849. this.triggerExitRuleEvent();
  23850. this._ctx = this._ctx.parentCtx;
  23851. }
  23852. } else {
  23853. this._ctx = parentCtx;
  23854. }
  23855. // hook into tree
  23856. retCtx.parentCtx = parentCtx;
  23857. if (this.buildParseTrees && parentCtx !== null) {
  23858. // add return ctx into invoking rule's tree
  23859. parentCtx.addChild(retCtx);
  23860. }
  23861. };
  23862. Parser.prototype.getInvokingContext = function (ruleIndex) {
  23863. var ctx = this._ctx;
  23864. while (ctx !== null) {
  23865. if (ctx.ruleIndex === ruleIndex) {
  23866. return ctx;
  23867. }
  23868. ctx = ctx.parentCtx;
  23869. }
  23870. return null;
  23871. };
  23872. Parser.prototype.precpred = function (localctx, precedence) {
  23873. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  23874. };
  23875. Parser.prototype.inContext = function (context) {
  23876. // TODO: useful in parser?
  23877. return false;
  23878. };
  23879. //
  23880. // Checks whether or not {@code symbol} can follow the current state in the
  23881. // ATN. The behavior of this method is equivalent to the following, but is
  23882. // implemented such that the complete context-sensitive follow set does not
  23883. // need to be explicitly constructed.
  23884. //
  23885. // <pre>
  23886. // return getExpectedTokens().contains(symbol);
  23887. // </pre>
  23888. //
  23889. // @param symbol the symbol type to check
  23890. // @return {@code true} if {@code symbol} can follow the current state in
  23891. // the ATN, otherwise {@code false}.
  23892. Parser.prototype.isExpectedToken = function (symbol) {
  23893. var atn = this._interp.atn;
  23894. var ctx = this._ctx;
  23895. var s = atn.states[this.state];
  23896. var following = atn.nextTokens(s);
  23897. if (following.contains(symbol)) {
  23898. return true;
  23899. }
  23900. if (!following.contains(Token.EPSILON)) {
  23901. return false;
  23902. }
  23903. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  23904. var invokingState = atn.states[ctx.invokingState];
  23905. var rt = invokingState.transitions[0];
  23906. following = atn.nextTokens(rt.followState);
  23907. if (following.contains(symbol)) {
  23908. return true;
  23909. }
  23910. ctx = ctx.parentCtx;
  23911. }
  23912. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  23913. return true;
  23914. } else {
  23915. return false;
  23916. }
  23917. };
  23918. // Computes the set of input symbols which could follow the current parser
  23919. // state and context, as given by {@link //getState} and {@link //getContext},
  23920. // respectively.
  23921. //
  23922. // @see ATN//getExpectedTokens(int, RuleContext)
  23923. //
  23924. Parser.prototype.getExpectedTokens = function () {
  23925. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  23926. };
  23927. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  23928. var atn = this._interp.atn;
  23929. var s = atn.states[this.state];
  23930. return atn.nextTokens(s);
  23931. };
  23932. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  23933. Parser.prototype.getRuleIndex = function (ruleName) {
  23934. var ruleIndex = this.getRuleIndexMap()[ruleName];
  23935. if (ruleIndex !== null) {
  23936. return ruleIndex;
  23937. } else {
  23938. return -1;
  23939. }
  23940. };
  23941. // Return List&lt;String&gt; of the rule names in your parser instance
  23942. // leading up to a call to the current rule. You could override if
  23943. // you want more details such as the file/line info of where
  23944. // in the ATN a rule is invoked.
  23945. //
  23946. // this is very useful for error messages.
  23947. //
  23948. Parser.prototype.getRuleInvocationStack = function (p) {
  23949. p = p || null;
  23950. if (p === null) {
  23951. p = this._ctx;
  23952. }
  23953. var stack = [];
  23954. while (p !== null) {
  23955. // compute what follows who invoked us
  23956. var ruleIndex = p.ruleIndex;
  23957. if (ruleIndex < 0) {
  23958. stack.push("n/a");
  23959. } else {
  23960. stack.push(this.ruleNames[ruleIndex]);
  23961. }
  23962. p = p.parentCtx;
  23963. }
  23964. return stack;
  23965. };
  23966. // For debugging and other purposes.//
  23967. Parser.prototype.getDFAStrings = function () {
  23968. return this._interp.decisionToDFA.toString();
  23969. };
  23970. // For debugging and other purposes.//
  23971. Parser.prototype.dumpDFA = function () {
  23972. var seenOne = false;
  23973. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  23974. var dfa = this._interp.decisionToDFA[i];
  23975. if (dfa.states.length > 0) {
  23976. if (seenOne) {
  23977. console.log();
  23978. }
  23979. this.printer.println("Decision " + dfa.decision + ":");
  23980. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  23981. seenOne = true;
  23982. }
  23983. }
  23984. };
  23985. /*
  23986. " printer = function() {\r\n" +
  23987. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  23988. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  23989. " };\r\n" +
  23990. */
  23991. Parser.prototype.getSourceName = function () {
  23992. return this._input.sourceName;
  23993. };
  23994. // During a parse is sometimes useful to listen in on the rule entry and exit
  23995. // events as well as token matches. this is for quick and dirty debugging.
  23996. //
  23997. Parser.prototype.setTrace = function (trace) {
  23998. if (!trace) {
  23999. this.removeParseListener(this._tracer);
  24000. this._tracer = null;
  24001. } else {
  24002. if (this._tracer !== null) {
  24003. this.removeParseListener(this._tracer);
  24004. }
  24005. this._tracer = new TraceListener(this);
  24006. this.addParseListener(this._tracer);
  24007. }
  24008. };
  24009. exports.Parser = Parser;
  24010. /***/ }),
  24011. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  24012. /*!**************************************************!*\
  24013. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  24014. \**************************************************/
  24015. /*! no static exports found */
  24016. /***/ (function(module, exports, __webpack_require__) {
  24017. "use strict";
  24018. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24019. * Use of this file is governed by the BSD 3-clause license that
  24020. * can be found in the LICENSE.txt file in the project root.
  24021. */
  24022. //* A rule invocation record for parsing.
  24023. //
  24024. // Contains all of the information about the current rule not stored in the
  24025. // RuleContext. It handles parse tree children list, Any ATN state
  24026. // tracing, and the default values available for rule indications:
  24027. // start, stop, rule index, current alt number, current
  24028. // ATN state.
  24029. //
  24030. // Subclasses made for each rule and grammar track the parameters,
  24031. // return values, locals, and labels specific to that rule. These
  24032. // are the objects that are returned from rules.
  24033. //
  24034. // Note text is not an actual field of a rule return value; it is computed
  24035. // from start and stop using the input stream's toString() method. I
  24036. // could add a ctor to this so that we can pass in and store the input
  24037. // stream, but I'm not sure we want to do that. It would seem to be undefined
  24038. // to get the .text property anyway if the rule matches tokens from multiple
  24039. // input streams.
  24040. //
  24041. // I do not use getters for fields of objects that are used simply to
  24042. // group values such as this aggregate. The getters/setters are there to
  24043. // satisfy the superclass interface.
  24044. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  24045. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  24046. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  24047. var TerminalNode = Tree.TerminalNode;
  24048. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  24049. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  24050. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  24051. function ParserRuleContext(parent, invokingStateNumber) {
  24052. parent = parent || null;
  24053. invokingStateNumber = invokingStateNumber || null;
  24054. RuleContext.call(this, parent, invokingStateNumber);
  24055. this.ruleIndex = -1;
  24056. // * If we are debugging or building a parse tree for a visitor,
  24057. // we need to track all of the tokens and rule invocations associated
  24058. // with this rule's context. This is empty for parsing w/o tree constr.
  24059. // operation because we don't the need to track the details about
  24060. // how we parse this rule.
  24061. // /
  24062. this.children = null;
  24063. this.start = null;
  24064. this.stop = null;
  24065. // The exception that forced this rule to return. If the rule successfully
  24066. // completed, this is {@code null}.
  24067. this.exception = null;
  24068. }
  24069. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  24070. ParserRuleContext.prototype.constructor = ParserRuleContext;
  24071. // * COPY a ctx (I'm deliberately not using copy constructor)///
  24072. ParserRuleContext.prototype.copyFrom = function (ctx) {
  24073. // from RuleContext
  24074. this.parentCtx = ctx.parentCtx;
  24075. this.invokingState = ctx.invokingState;
  24076. this.children = null;
  24077. this.start = ctx.start;
  24078. this.stop = ctx.stop;
  24079. // copy any error nodes to alt label node
  24080. if (ctx.children) {
  24081. this.children = [];
  24082. // reset parent pointer for any error nodes
  24083. ctx.children.map(function (child) {
  24084. if (child instanceof ErrorNodeImpl) {
  24085. this.children.push(child);
  24086. child.parentCtx = this;
  24087. }
  24088. }, this);
  24089. }
  24090. };
  24091. // Double dispatch methods for listeners
  24092. ParserRuleContext.prototype.enterRule = function (listener) {};
  24093. ParserRuleContext.prototype.exitRule = function (listener) {};
  24094. // * Does not set parent link; other add methods do that///
  24095. ParserRuleContext.prototype.addChild = function (child) {
  24096. if (this.children === null) {
  24097. this.children = [];
  24098. }
  24099. this.children.push(child);
  24100. return child;
  24101. };
  24102. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  24103. // we entered a rule. If we have // label, we will need to remove
  24104. // generic ruleContext object.
  24105. // /
  24106. ParserRuleContext.prototype.removeLastChild = function () {
  24107. if (this.children !== null) {
  24108. this.children.pop();
  24109. }
  24110. };
  24111. ParserRuleContext.prototype.addTokenNode = function (token) {
  24112. var node = new TerminalNodeImpl(token);
  24113. this.addChild(node);
  24114. node.parentCtx = this;
  24115. return node;
  24116. };
  24117. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  24118. var node = new ErrorNodeImpl(badToken);
  24119. this.addChild(node);
  24120. node.parentCtx = this;
  24121. return node;
  24122. };
  24123. ParserRuleContext.prototype.getChild = function (i, type) {
  24124. type = type || null;
  24125. if (this.children === null || i < 0 || i >= this.children.length) {
  24126. return null;
  24127. }
  24128. if (type === null) {
  24129. return this.children[i];
  24130. } else {
  24131. for (var j = 0; j < this.children.length; j++) {
  24132. var child = this.children[j];
  24133. if (child instanceof type) {
  24134. if (i === 0) {
  24135. return child;
  24136. } else {
  24137. i -= 1;
  24138. }
  24139. }
  24140. }
  24141. return null;
  24142. }
  24143. };
  24144. ParserRuleContext.prototype.getToken = function (ttype, i) {
  24145. if (this.children === null || i < 0 || i >= this.children.length) {
  24146. return null;
  24147. }
  24148. for (var j = 0; j < this.children.length; j++) {
  24149. var child = this.children[j];
  24150. if (child instanceof TerminalNode) {
  24151. if (child.symbol.type === ttype) {
  24152. if (i === 0) {
  24153. return child;
  24154. } else {
  24155. i -= 1;
  24156. }
  24157. }
  24158. }
  24159. }
  24160. return null;
  24161. };
  24162. ParserRuleContext.prototype.getTokens = function (ttype) {
  24163. if (this.children === null) {
  24164. return [];
  24165. } else {
  24166. var tokens = [];
  24167. for (var j = 0; j < this.children.length; j++) {
  24168. var child = this.children[j];
  24169. if (child instanceof TerminalNode) {
  24170. if (child.symbol.type === ttype) {
  24171. tokens.push(child);
  24172. }
  24173. }
  24174. }
  24175. return tokens;
  24176. }
  24177. };
  24178. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  24179. return this.getChild(i, ctxType);
  24180. };
  24181. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  24182. if (this.children === null) {
  24183. return [];
  24184. } else {
  24185. var contexts = [];
  24186. for (var j = 0; j < this.children.length; j++) {
  24187. var child = this.children[j];
  24188. if (child instanceof ctxType) {
  24189. contexts.push(child);
  24190. }
  24191. }
  24192. return contexts;
  24193. }
  24194. };
  24195. ParserRuleContext.prototype.getChildCount = function () {
  24196. if (this.children === null) {
  24197. return 0;
  24198. } else {
  24199. return this.children.length;
  24200. }
  24201. };
  24202. ParserRuleContext.prototype.getSourceInterval = function () {
  24203. if (this.start === null || this.stop === null) {
  24204. return INVALID_INTERVAL;
  24205. } else {
  24206. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  24207. }
  24208. };
  24209. RuleContext.EMPTY = new ParserRuleContext();
  24210. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  24211. ParserRuleContext.call(parent, invokingStateNumber);
  24212. this.ruleIndex = ruleIndex;
  24213. return this;
  24214. }
  24215. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  24216. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  24217. exports.ParserRuleContext = ParserRuleContext;
  24218. /***/ }),
  24219. /***/ "./node_modules/antlr4/PredictionContext.js":
  24220. /*!**************************************************!*\
  24221. !*** ./node_modules/antlr4/PredictionContext.js ***!
  24222. \**************************************************/
  24223. /*! no static exports found */
  24224. /***/ (function(module, exports, __webpack_require__) {
  24225. "use strict";
  24226. //
  24227. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24228. * Use of this file is governed by the BSD 3-clause license that
  24229. * can be found in the LICENSE.txt file in the project root.
  24230. */
  24231. ///
  24232. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  24233. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  24234. function PredictionContext(cachedHashCode) {
  24235. this.cachedHashCode = cachedHashCode;
  24236. }
  24237. // Represents {@code $} in local context prediction, which means wildcard.
  24238. // {@code//+x =//}.
  24239. // /
  24240. PredictionContext.EMPTY = null;
  24241. // Represents {@code $} in an array in full context mode, when {@code $}
  24242. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  24243. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  24244. // /
  24245. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  24246. PredictionContext.globalNodeCount = 1;
  24247. PredictionContext.id = PredictionContext.globalNodeCount;
  24248. // Stores the computed hash code of this {@link PredictionContext}. The hash
  24249. // code is computed in parts to match the following reference algorithm.
  24250. //
  24251. // <pre>
  24252. // private int referenceHashCode() {
  24253. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  24254. // //INITIAL_HASH});
  24255. //
  24256. // for (int i = 0; i &lt; {@link //size()}; i++) {
  24257. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  24258. // getParent}(i));
  24259. // }
  24260. //
  24261. // for (int i = 0; i &lt; {@link //size()}; i++) {
  24262. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  24263. // //getReturnState getReturnState}(i));
  24264. // }
  24265. //
  24266. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  24267. // //size()});
  24268. // return hash;
  24269. // }
  24270. // </pre>
  24271. // /
  24272. // This means only the {@link //EMPTY} context is in set.
  24273. PredictionContext.prototype.isEmpty = function () {
  24274. return this === PredictionContext.EMPTY;
  24275. };
  24276. PredictionContext.prototype.hasEmptyPath = function () {
  24277. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  24278. };
  24279. PredictionContext.prototype.hashCode = function () {
  24280. return this.cachedHashCode;
  24281. };
  24282. PredictionContext.prototype.updateHashCode = function (hash) {
  24283. hash.update(this.cachedHashCode);
  24284. };
  24285. /*
  24286. function calculateHashString(parent, returnState) {
  24287. return "" + parent + returnState;
  24288. }
  24289. */
  24290. // Used to cache {@link PredictionContext} objects. Its used for the shared
  24291. // context cash associated with contexts in DFA states. This cache
  24292. // can be used for both lexers and parsers.
  24293. function PredictionContextCache() {
  24294. this.cache = {};
  24295. return this;
  24296. }
  24297. // Add a context to the cache and return it. If the context already exists,
  24298. // return that one instead and do not add a new context to the cache.
  24299. // Protect shared cache from unsafe thread access.
  24300. //
  24301. PredictionContextCache.prototype.add = function (ctx) {
  24302. if (ctx === PredictionContext.EMPTY) {
  24303. return PredictionContext.EMPTY;
  24304. }
  24305. var existing = this.cache[ctx] || null;
  24306. if (existing !== null) {
  24307. return existing;
  24308. }
  24309. this.cache[ctx] = ctx;
  24310. return ctx;
  24311. };
  24312. PredictionContextCache.prototype.get = function (ctx) {
  24313. return this.cache[ctx] || null;
  24314. };
  24315. Object.defineProperty(PredictionContextCache.prototype, "length", {
  24316. get: function get() {
  24317. return this.cache.length;
  24318. }
  24319. });
  24320. function SingletonPredictionContext(parent, returnState) {
  24321. var hashCode = 0;
  24322. if (parent !== null) {
  24323. var hash = new Hash();
  24324. hash.update(parent, returnState);
  24325. hashCode = hash.finish();
  24326. }
  24327. PredictionContext.call(this, hashCode);
  24328. this.parentCtx = parent;
  24329. this.returnState = returnState;
  24330. }
  24331. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  24332. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  24333. SingletonPredictionContext.create = function (parent, returnState) {
  24334. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  24335. // someone can pass in the bits of an array ctx that mean $
  24336. return PredictionContext.EMPTY;
  24337. } else {
  24338. return new SingletonPredictionContext(parent, returnState);
  24339. }
  24340. };
  24341. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  24342. get: function get() {
  24343. return 1;
  24344. }
  24345. });
  24346. SingletonPredictionContext.prototype.getParent = function (index) {
  24347. return this.parentCtx;
  24348. };
  24349. SingletonPredictionContext.prototype.getReturnState = function (index) {
  24350. return this.returnState;
  24351. };
  24352. SingletonPredictionContext.prototype.equals = function (other) {
  24353. if (this === other) {
  24354. return true;
  24355. } else if (!(other instanceof SingletonPredictionContext)) {
  24356. return false;
  24357. } else if (this.hashCode() !== other.hashCode()) {
  24358. return false; // can't be same if hash is different
  24359. } else {
  24360. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  24361. }
  24362. };
  24363. SingletonPredictionContext.prototype.toString = function () {
  24364. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  24365. if (up.length === 0) {
  24366. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  24367. return "$";
  24368. } else {
  24369. return "" + this.returnState;
  24370. }
  24371. } else {
  24372. return "" + this.returnState + " " + up;
  24373. }
  24374. };
  24375. function EmptyPredictionContext() {
  24376. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  24377. return this;
  24378. }
  24379. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  24380. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  24381. EmptyPredictionContext.prototype.isEmpty = function () {
  24382. return true;
  24383. };
  24384. EmptyPredictionContext.prototype.getParent = function (index) {
  24385. return null;
  24386. };
  24387. EmptyPredictionContext.prototype.getReturnState = function (index) {
  24388. return this.returnState;
  24389. };
  24390. EmptyPredictionContext.prototype.equals = function (other) {
  24391. return this === other;
  24392. };
  24393. EmptyPredictionContext.prototype.toString = function () {
  24394. return "$";
  24395. };
  24396. PredictionContext.EMPTY = new EmptyPredictionContext();
  24397. function ArrayPredictionContext(parents, returnStates) {
  24398. // Parent can be null only if full ctx mode and we make an array
  24399. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  24400. // null parent and
  24401. // returnState == {@link //EMPTY_RETURN_STATE}.
  24402. var h = new Hash();
  24403. h.update(parents, returnStates);
  24404. var hashCode = h.finish();
  24405. PredictionContext.call(this, hashCode);
  24406. this.parents = parents;
  24407. this.returnStates = returnStates;
  24408. return this;
  24409. }
  24410. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  24411. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  24412. ArrayPredictionContext.prototype.isEmpty = function () {
  24413. // since EMPTY_RETURN_STATE can only appear in the last position, we
  24414. // don't need to verify that size==1
  24415. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  24416. };
  24417. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  24418. get: function get() {
  24419. return this.returnStates.length;
  24420. }
  24421. });
  24422. ArrayPredictionContext.prototype.getParent = function (index) {
  24423. return this.parents[index];
  24424. };
  24425. ArrayPredictionContext.prototype.getReturnState = function (index) {
  24426. return this.returnStates[index];
  24427. };
  24428. ArrayPredictionContext.prototype.equals = function (other) {
  24429. if (this === other) {
  24430. return true;
  24431. } else if (!(other instanceof ArrayPredictionContext)) {
  24432. return false;
  24433. } else if (this.hashCode() !== other.hashCode()) {
  24434. return false; // can't be same if hash is different
  24435. } else {
  24436. return this.returnStates === other.returnStates && this.parents === other.parents;
  24437. }
  24438. };
  24439. ArrayPredictionContext.prototype.toString = function () {
  24440. if (this.isEmpty()) {
  24441. return "[]";
  24442. } else {
  24443. var s = "[";
  24444. for (var i = 0; i < this.returnStates.length; i++) {
  24445. if (i > 0) {
  24446. s = s + ", ";
  24447. }
  24448. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  24449. s = s + "$";
  24450. continue;
  24451. }
  24452. s = s + this.returnStates[i];
  24453. if (this.parents[i] !== null) {
  24454. s = s + " " + this.parents[i];
  24455. } else {
  24456. s = s + "null";
  24457. }
  24458. }
  24459. return s + "]";
  24460. }
  24461. };
  24462. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  24463. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  24464. // /
  24465. function predictionContextFromRuleContext(atn, outerContext) {
  24466. if (outerContext === undefined || outerContext === null) {
  24467. outerContext = RuleContext.EMPTY;
  24468. }
  24469. // if we are in RuleContext of start rule, s, then PredictionContext
  24470. // is EMPTY. Nobody called us. (if we are empty, return empty)
  24471. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  24472. return PredictionContext.EMPTY;
  24473. }
  24474. // If we have a parent, convert it to a PredictionContext graph
  24475. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  24476. var state = atn.states[outerContext.invokingState];
  24477. var transition = state.transitions[0];
  24478. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  24479. }
  24480. /*
  24481. function calculateListsHashString(parents, returnStates) {
  24482. var s = "";
  24483. parents.map(function(p) {
  24484. s = s + p;
  24485. });
  24486. returnStates.map(function(r) {
  24487. s = s + r;
  24488. });
  24489. return s;
  24490. }
  24491. */
  24492. function merge(a, b, rootIsWildcard, mergeCache) {
  24493. // share same graph if both same
  24494. if (a === b) {
  24495. return a;
  24496. }
  24497. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  24498. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  24499. }
  24500. // At least one of a or b is array
  24501. // If one is $ and rootIsWildcard, return $ as// wildcard
  24502. if (rootIsWildcard) {
  24503. if (a instanceof EmptyPredictionContext) {
  24504. return a;
  24505. }
  24506. if (b instanceof EmptyPredictionContext) {
  24507. return b;
  24508. }
  24509. }
  24510. // convert singleton so both are arrays to normalize
  24511. if (a instanceof SingletonPredictionContext) {
  24512. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  24513. }
  24514. if (b instanceof SingletonPredictionContext) {
  24515. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  24516. }
  24517. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  24518. }
  24519. //
  24520. // Merge two {@link SingletonPredictionContext} instances.
  24521. //
  24522. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  24523. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  24524. // type="image/svg+xml"/></p>
  24525. //
  24526. // <p>Same stack top, parents differ; merge parents giving array node, then
  24527. // remainders of those graphs. A new root node is created to point to the
  24528. // merged parents.<br>
  24529. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  24530. // type="image/svg+xml"/></p>
  24531. //
  24532. // <p>Different stack tops pointing to same parent. Make array node for the
  24533. // root where both element in the root point to the same (original)
  24534. // parent.<br>
  24535. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  24536. // type="image/svg+xml"/></p>
  24537. //
  24538. // <p>Different stack tops pointing to different parents. Make array node for
  24539. // the root where each element points to the corresponding original
  24540. // parent.<br>
  24541. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  24542. // type="image/svg+xml"/></p>
  24543. //
  24544. // @param a the first {@link SingletonPredictionContext}
  24545. // @param b the second {@link SingletonPredictionContext}
  24546. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24547. // otherwise false to indicate a full-context merge
  24548. // @param mergeCache
  24549. // /
  24550. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  24551. if (mergeCache !== null) {
  24552. var previous = mergeCache.get(a, b);
  24553. if (previous !== null) {
  24554. return previous;
  24555. }
  24556. previous = mergeCache.get(b, a);
  24557. if (previous !== null) {
  24558. return previous;
  24559. }
  24560. }
  24561. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  24562. if (rootMerge !== null) {
  24563. if (mergeCache !== null) {
  24564. mergeCache.set(a, b, rootMerge);
  24565. }
  24566. return rootMerge;
  24567. }
  24568. if (a.returnState === b.returnState) {
  24569. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  24570. // if parent is same as existing a or b parent or reduced to a parent,
  24571. // return it
  24572. if (parent === a.parentCtx) {
  24573. return a; // ax + bx = ax, if a=b
  24574. }
  24575. if (parent === b.parentCtx) {
  24576. return b; // ax + bx = bx, if a=b
  24577. }
  24578. // else: ax + ay = a'[x,y]
  24579. // merge parents x and y, giving array node with x,y then remainders
  24580. // of those graphs. dup a, a' points at merged array
  24581. // new joined parent so create new singleton pointing to it, a'
  24582. var spc = SingletonPredictionContext.create(parent, a.returnState);
  24583. if (mergeCache !== null) {
  24584. mergeCache.set(a, b, spc);
  24585. }
  24586. return spc;
  24587. } else {
  24588. // a != b payloads differ
  24589. // see if we can collapse parents due to $+x parents if local ctx
  24590. var singleParent = null;
  24591. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  24592. // ax +
  24593. // bx =
  24594. // [a,b]x
  24595. singleParent = a.parentCtx;
  24596. }
  24597. if (singleParent !== null) {
  24598. // parents are same
  24599. // sort payloads and use same parent
  24600. var payloads = [a.returnState, b.returnState];
  24601. if (a.returnState > b.returnState) {
  24602. payloads[0] = b.returnState;
  24603. payloads[1] = a.returnState;
  24604. }
  24605. var parents = [singleParent, singleParent];
  24606. var apc = new ArrayPredictionContext(parents, payloads);
  24607. if (mergeCache !== null) {
  24608. mergeCache.set(a, b, apc);
  24609. }
  24610. return apc;
  24611. }
  24612. // parents differ and can't merge them. Just pack together
  24613. // into array; can't merge.
  24614. // ax + by = [ax,by]
  24615. var payloads = [a.returnState, b.returnState];
  24616. var parents = [a.parentCtx, b.parentCtx];
  24617. if (a.returnState > b.returnState) {
  24618. // sort by payload
  24619. payloads[0] = b.returnState;
  24620. payloads[1] = a.returnState;
  24621. parents = [b.parentCtx, a.parentCtx];
  24622. }
  24623. var a_ = new ArrayPredictionContext(parents, payloads);
  24624. if (mergeCache !== null) {
  24625. mergeCache.set(a, b, a_);
  24626. }
  24627. return a_;
  24628. }
  24629. }
  24630. //
  24631. // Handle case where at least one of {@code a} or {@code b} is
  24632. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24633. // to represent {@link //EMPTY}.
  24634. //
  24635. // <h2>Local-Context Merges</h2>
  24636. //
  24637. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24638. // is true.</p>
  24639. //
  24640. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24641. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24642. //
  24643. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24644. // {@code //EMPTY}; return left graph.<br>
  24645. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24646. //
  24647. // <p>Special case of last merge if local context.<br>
  24648. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24649. //
  24650. // <h2>Full-Context Merges</h2>
  24651. //
  24652. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24653. // is false.</p>
  24654. //
  24655. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24656. //
  24657. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24658. // null parent).<br>
  24659. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24660. //
  24661. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24662. //
  24663. // @param a the first {@link SingletonPredictionContext}
  24664. // @param b the second {@link SingletonPredictionContext}
  24665. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24666. // otherwise false to indicate a full-context merge
  24667. // /
  24668. function mergeRoot(a, b, rootIsWildcard) {
  24669. if (rootIsWildcard) {
  24670. if (a === PredictionContext.EMPTY) {
  24671. return PredictionContext.EMPTY; // // + b =//
  24672. }
  24673. if (b === PredictionContext.EMPTY) {
  24674. return PredictionContext.EMPTY; // a +// =//
  24675. }
  24676. } else {
  24677. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24678. return PredictionContext.EMPTY; // $ + $ = $
  24679. } else if (a === PredictionContext.EMPTY) {
  24680. // $ + x = [$,x]
  24681. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24682. var parents = [b.parentCtx, null];
  24683. return new ArrayPredictionContext(parents, payloads);
  24684. } else if (b === PredictionContext.EMPTY) {
  24685. // x + $ = [$,x] ($ is always first if present)
  24686. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24687. var parents = [a.parentCtx, null];
  24688. return new ArrayPredictionContext(parents, payloads);
  24689. }
  24690. }
  24691. return null;
  24692. }
  24693. //
  24694. // Merge two {@link ArrayPredictionContext} instances.
  24695. //
  24696. // <p>Different tops, different parents.<br>
  24697. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24698. //
  24699. // <p>Shared top, same parents.<br>
  24700. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24701. //
  24702. // <p>Shared top, different parents.<br>
  24703. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24704. //
  24705. // <p>Shared top, all shared parents.<br>
  24706. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24707. // type="image/svg+xml"/></p>
  24708. //
  24709. // <p>Equal tops, merge parents and reduce top to
  24710. // {@link SingletonPredictionContext}.<br>
  24711. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24712. // /
  24713. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24714. if (mergeCache !== null) {
  24715. var previous = mergeCache.get(a, b);
  24716. if (previous !== null) {
  24717. return previous;
  24718. }
  24719. previous = mergeCache.get(b, a);
  24720. if (previous !== null) {
  24721. return previous;
  24722. }
  24723. }
  24724. // merge sorted payloads a + b => M
  24725. var i = 0; // walks a
  24726. var j = 0; // walks b
  24727. var k = 0; // walks target M array
  24728. var mergedReturnStates = [];
  24729. var mergedParents = [];
  24730. // walk and merge to yield mergedParents, mergedReturnStates
  24731. while (i < a.returnStates.length && j < b.returnStates.length) {
  24732. var a_parent = a.parents[i];
  24733. var b_parent = b.parents[j];
  24734. if (a.returnStates[i] === b.returnStates[j]) {
  24735. // same payload (stack tops are equal), must yield merged singleton
  24736. var payload = a.returnStates[i];
  24737. // $+$ = $
  24738. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  24739. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  24740. // ->
  24741. // ax
  24742. if (bothDollars || ax_ax) {
  24743. mergedParents[k] = a_parent; // choose left
  24744. mergedReturnStates[k] = payload;
  24745. } else {
  24746. // ax+ay -> a'[x,y]
  24747. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  24748. mergedParents[k] = mergedParent;
  24749. mergedReturnStates[k] = payload;
  24750. }
  24751. i += 1; // hop over left one as usual
  24752. j += 1; // but also skip one in right side since we merge
  24753. } else if (a.returnStates[i] < b.returnStates[j]) {
  24754. // copy a[i] to M
  24755. mergedParents[k] = a_parent;
  24756. mergedReturnStates[k] = a.returnStates[i];
  24757. i += 1;
  24758. } else {
  24759. // b > a, copy b[j] to M
  24760. mergedParents[k] = b_parent;
  24761. mergedReturnStates[k] = b.returnStates[j];
  24762. j += 1;
  24763. }
  24764. k += 1;
  24765. }
  24766. // copy over any payloads remaining in either array
  24767. if (i < a.returnStates.length) {
  24768. for (var p = i; p < a.returnStates.length; p++) {
  24769. mergedParents[k] = a.parents[p];
  24770. mergedReturnStates[k] = a.returnStates[p];
  24771. k += 1;
  24772. }
  24773. } else {
  24774. for (var p = j; p < b.returnStates.length; p++) {
  24775. mergedParents[k] = b.parents[p];
  24776. mergedReturnStates[k] = b.returnStates[p];
  24777. k += 1;
  24778. }
  24779. }
  24780. // trim merged if we combined a few that had same stack tops
  24781. if (k < mergedParents.length) {
  24782. // write index < last position; trim
  24783. if (k === 1) {
  24784. // for just one merged element, return singleton top
  24785. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  24786. if (mergeCache !== null) {
  24787. mergeCache.set(a, b, a_);
  24788. }
  24789. return a_;
  24790. }
  24791. mergedParents = mergedParents.slice(0, k);
  24792. mergedReturnStates = mergedReturnStates.slice(0, k);
  24793. }
  24794. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  24795. // if we created same array as a or b, return that instead
  24796. // TODO: track whether this is possible above during merge sort for speed
  24797. if (M === a) {
  24798. if (mergeCache !== null) {
  24799. mergeCache.set(a, b, a);
  24800. }
  24801. return a;
  24802. }
  24803. if (M === b) {
  24804. if (mergeCache !== null) {
  24805. mergeCache.set(a, b, b);
  24806. }
  24807. return b;
  24808. }
  24809. combineCommonParents(mergedParents);
  24810. if (mergeCache !== null) {
  24811. mergeCache.set(a, b, M);
  24812. }
  24813. return M;
  24814. }
  24815. //
  24816. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  24817. // ones.
  24818. // /
  24819. function combineCommonParents(parents) {
  24820. var uniqueParents = {};
  24821. for (var p = 0; p < parents.length; p++) {
  24822. var parent = parents[p];
  24823. if (!(parent in uniqueParents)) {
  24824. uniqueParents[parent] = parent;
  24825. }
  24826. }
  24827. for (var q = 0; q < parents.length; q++) {
  24828. parents[q] = uniqueParents[parents[q]];
  24829. }
  24830. }
  24831. function getCachedPredictionContext(context, contextCache, visited) {
  24832. if (context.isEmpty()) {
  24833. return context;
  24834. }
  24835. var existing = visited[context] || null;
  24836. if (existing !== null) {
  24837. return existing;
  24838. }
  24839. existing = contextCache.get(context);
  24840. if (existing !== null) {
  24841. visited[context] = existing;
  24842. return existing;
  24843. }
  24844. var changed = false;
  24845. var parents = [];
  24846. for (var i = 0; i < parents.length; i++) {
  24847. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  24848. if (changed || parent !== context.getParent(i)) {
  24849. if (!changed) {
  24850. parents = [];
  24851. for (var j = 0; j < context.length; j++) {
  24852. parents[j] = context.getParent(j);
  24853. }
  24854. changed = true;
  24855. }
  24856. parents[i] = parent;
  24857. }
  24858. }
  24859. if (!changed) {
  24860. contextCache.add(context);
  24861. visited[context] = context;
  24862. return context;
  24863. }
  24864. var updated = null;
  24865. if (parents.length === 0) {
  24866. updated = PredictionContext.EMPTY;
  24867. } else if (parents.length === 1) {
  24868. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  24869. } else {
  24870. updated = new ArrayPredictionContext(parents, context.returnStates);
  24871. }
  24872. contextCache.add(updated);
  24873. visited[updated] = updated;
  24874. visited[context] = updated;
  24875. return updated;
  24876. }
  24877. // ter's recursive version of Sam's getAllNodes()
  24878. function getAllContextNodes(context, nodes, visited) {
  24879. if (nodes === null) {
  24880. nodes = [];
  24881. return getAllContextNodes(context, nodes, visited);
  24882. } else if (visited === null) {
  24883. visited = {};
  24884. return getAllContextNodes(context, nodes, visited);
  24885. } else {
  24886. if (context === null || visited[context] !== null) {
  24887. return nodes;
  24888. }
  24889. visited[context] = context;
  24890. nodes.push(context);
  24891. for (var i = 0; i < context.length; i++) {
  24892. getAllContextNodes(context.getParent(i), nodes, visited);
  24893. }
  24894. return nodes;
  24895. }
  24896. }
  24897. exports.merge = merge;
  24898. exports.PredictionContext = PredictionContext;
  24899. exports.PredictionContextCache = PredictionContextCache;
  24900. exports.SingletonPredictionContext = SingletonPredictionContext;
  24901. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  24902. exports.getCachedPredictionContext = getCachedPredictionContext;
  24903. /***/ }),
  24904. /***/ "./node_modules/antlr4/Recognizer.js":
  24905. /*!*******************************************!*\
  24906. !*** ./node_modules/antlr4/Recognizer.js ***!
  24907. \*******************************************/
  24908. /*! no static exports found */
  24909. /***/ (function(module, exports, __webpack_require__) {
  24910. "use strict";
  24911. //
  24912. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24913. * Use of this file is governed by the BSD 3-clause license that
  24914. * can be found in the LICENSE.txt file in the project root.
  24915. */
  24916. //
  24917. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24918. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  24919. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  24920. function Recognizer() {
  24921. this._listeners = [ConsoleErrorListener.INSTANCE];
  24922. this._interp = null;
  24923. this._stateNumber = -1;
  24924. return this;
  24925. }
  24926. Recognizer.tokenTypeMapCache = {};
  24927. Recognizer.ruleIndexMapCache = {};
  24928. Recognizer.prototype.checkVersion = function (toolVersion) {
  24929. var runtimeVersion = "4.7.1";
  24930. if (runtimeVersion !== toolVersion) {
  24931. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  24932. }
  24933. };
  24934. Recognizer.prototype.addErrorListener = function (listener) {
  24935. this._listeners.push(listener);
  24936. };
  24937. Recognizer.prototype.removeErrorListeners = function () {
  24938. this._listeners = [];
  24939. };
  24940. Recognizer.prototype.getTokenTypeMap = function () {
  24941. var tokenNames = this.getTokenNames();
  24942. if (tokenNames === null) {
  24943. throw "The current recognizer does not provide a list of token names.";
  24944. }
  24945. var result = this.tokenTypeMapCache[tokenNames];
  24946. if (result === undefined) {
  24947. result = tokenNames.reduce(function (o, k, i) {
  24948. o[k] = i;
  24949. });
  24950. result.EOF = Token.EOF;
  24951. this.tokenTypeMapCache[tokenNames] = result;
  24952. }
  24953. return result;
  24954. };
  24955. // Get a map from rule names to rule indexes.
  24956. //
  24957. // <p>Used for XPath and tree pattern compilation.</p>
  24958. //
  24959. Recognizer.prototype.getRuleIndexMap = function () {
  24960. var ruleNames = this.ruleNames;
  24961. if (ruleNames === null) {
  24962. throw "The current recognizer does not provide a list of rule names.";
  24963. }
  24964. var result = this.ruleIndexMapCache[ruleNames];
  24965. if (result === undefined) {
  24966. result = ruleNames.reduce(function (o, k, i) {
  24967. o[k] = i;
  24968. });
  24969. this.ruleIndexMapCache[ruleNames] = result;
  24970. }
  24971. return result;
  24972. };
  24973. Recognizer.prototype.getTokenType = function (tokenName) {
  24974. var ttype = this.getTokenTypeMap()[tokenName];
  24975. if (ttype !== undefined) {
  24976. return ttype;
  24977. } else {
  24978. return Token.INVALID_TYPE;
  24979. }
  24980. };
  24981. // What is the error header, normally line/character position information?//
  24982. Recognizer.prototype.getErrorHeader = function (e) {
  24983. var line = e.getOffendingToken().line;
  24984. var column = e.getOffendingToken().column;
  24985. return "line " + line + ":" + column;
  24986. };
  24987. // How should a token be displayed in an error message? The default
  24988. // is to display just the text, but during development you might
  24989. // want to have a lot of information spit out. Override in that case
  24990. // to use t.toString() (which, for CommonToken, dumps everything about
  24991. // the token). This is better than forcing you to override a method in
  24992. // your token objects because you don't have to go modify your lexer
  24993. // so that it creates a new Java type.
  24994. //
  24995. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  24996. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  24997. // feature when necessary. For example, see
  24998. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  24999. //
  25000. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  25001. if (t === null) {
  25002. return "<no token>";
  25003. }
  25004. var s = t.text;
  25005. if (s === null) {
  25006. if (t.type === Token.EOF) {
  25007. s = "<EOF>";
  25008. } else {
  25009. s = "<" + t.type + ">";
  25010. }
  25011. }
  25012. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  25013. return "'" + s + "'";
  25014. };
  25015. Recognizer.prototype.getErrorListenerDispatch = function () {
  25016. return new ProxyErrorListener(this._listeners);
  25017. };
  25018. // subclass needs to override these if there are sempreds or actions
  25019. // that the ATN interp needs to execute
  25020. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  25021. return true;
  25022. };
  25023. Recognizer.prototype.precpred = function (localctx, precedence) {
  25024. return true;
  25025. };
  25026. //Indicate that the recognizer has changed internal state that is
  25027. //consistent with the ATN state passed in. This way we always know
  25028. //where we are in the ATN as the parser goes along. The rule
  25029. //context objects form a stack that lets us see the stack of
  25030. //invoking rules. Combine this and we have complete ATN
  25031. //configuration information.
  25032. Object.defineProperty(Recognizer.prototype, "state", {
  25033. get: function get() {
  25034. return this._stateNumber;
  25035. },
  25036. set: function set(state) {
  25037. this._stateNumber = state;
  25038. }
  25039. });
  25040. exports.Recognizer = Recognizer;
  25041. /***/ }),
  25042. /***/ "./node_modules/antlr4/RuleContext.js":
  25043. /*!********************************************!*\
  25044. !*** ./node_modules/antlr4/RuleContext.js ***!
  25045. \********************************************/
  25046. /*! no static exports found */
  25047. /***/ (function(module, exports, __webpack_require__) {
  25048. "use strict";
  25049. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25050. * Use of this file is governed by the BSD 3-clause license that
  25051. * can be found in the LICENSE.txt file in the project root.
  25052. */
  25053. ///
  25054. // A rule context is a record of a single rule invocation. It knows
  25055. // which context invoked it, if any. If there is no parent context, then
  25056. // naturally the invoking state is not valid. The parent link
  25057. // provides a chain upwards from the current rule invocation to the root
  25058. // of the invocation tree, forming a stack. We actually carry no
  25059. // information about the rule associated with this context (except
  25060. // when parsing). We keep only the state number of the invoking state from
  25061. // the ATN submachine that invoked this. Contrast this with the s
  25062. // pointer inside ParserRuleContext that tracks the current state
  25063. // being "executed" for the current rule.
  25064. //
  25065. // The parent contexts are useful for computing lookahead sets and
  25066. // getting error information.
  25067. //
  25068. // These objects are used during parsing and prediction.
  25069. // For the special case of parsers, we use the subclass
  25070. // ParserRuleContext.
  25071. //
  25072. // @see ParserRuleContext
  25073. ///
  25074. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  25075. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  25076. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  25077. function RuleContext(parent, invokingState) {
  25078. RuleNode.call(this);
  25079. // What context invoked this rule?
  25080. this.parentCtx = parent || null;
  25081. // What state invoked the rule associated with this context?
  25082. // The "return address" is the followState of invokingState
  25083. // If parent is null, this should be -1.
  25084. this.invokingState = invokingState || -1;
  25085. return this;
  25086. }
  25087. RuleContext.prototype = Object.create(RuleNode.prototype);
  25088. RuleContext.prototype.constructor = RuleContext;
  25089. RuleContext.prototype.depth = function () {
  25090. var n = 0;
  25091. var p = this;
  25092. while (p !== null) {
  25093. p = p.parentCtx;
  25094. n += 1;
  25095. }
  25096. return n;
  25097. };
  25098. // A context is empty if there is no invoking state; meaning nobody call
  25099. // current context.
  25100. RuleContext.prototype.isEmpty = function () {
  25101. return this.invokingState === -1;
  25102. };
  25103. // satisfy the ParseTree / SyntaxTree interface
  25104. RuleContext.prototype.getSourceInterval = function () {
  25105. return INVALID_INTERVAL;
  25106. };
  25107. RuleContext.prototype.getRuleContext = function () {
  25108. return this;
  25109. };
  25110. RuleContext.prototype.getPayload = function () {
  25111. return this;
  25112. };
  25113. // Return the combined text of all child nodes. This method only considers
  25114. // tokens which have been added to the parse tree.
  25115. // <p>
  25116. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  25117. // added to the parse trees, they will not appear in the output of this
  25118. // method.
  25119. // /
  25120. RuleContext.prototype.getText = function () {
  25121. if (this.getChildCount() === 0) {
  25122. return "";
  25123. } else {
  25124. return this.children.map(function (child) {
  25125. return child.getText();
  25126. }).join("");
  25127. }
  25128. };
  25129. // For rule associated with this parse tree internal node, return
  25130. // the outer alternative number used to match the input. Default
  25131. // implementation does not compute nor store this alt num. Create
  25132. // a subclass of ParserRuleContext with backing field and set
  25133. // option contextSuperClass.
  25134. // to set it.
  25135. RuleContext.prototype.getAltNumber = function () {
  25136. return INVALID_ALT_NUMBER;
  25137. };
  25138. // Set the outer alternative number for this context node. Default
  25139. // implementation does nothing to avoid backing field overhead for
  25140. // trees that don't need it. Create
  25141. // a subclass of ParserRuleContext with backing field and set
  25142. // option contextSuperClass.
  25143. RuleContext.prototype.setAltNumber = function (altNumber) {};
  25144. RuleContext.prototype.getChild = function (i) {
  25145. return null;
  25146. };
  25147. RuleContext.prototype.getChildCount = function () {
  25148. return 0;
  25149. };
  25150. RuleContext.prototype.accept = function (visitor) {
  25151. return visitor.visitChildren(this);
  25152. };
  25153. //need to manage circular dependencies, so export now
  25154. exports.RuleContext = RuleContext;
  25155. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  25156. // Print out a whole tree, not just a node, in LISP format
  25157. // (root child1 .. childN). Print just a node if this is a leaf.
  25158. //
  25159. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  25160. return Trees.toStringTree(this, ruleNames, recog);
  25161. };
  25162. RuleContext.prototype.toString = function (ruleNames, stop) {
  25163. ruleNames = ruleNames || null;
  25164. stop = stop || null;
  25165. var p = this;
  25166. var s = "[";
  25167. while (p !== null && p !== stop) {
  25168. if (ruleNames === null) {
  25169. if (!p.isEmpty()) {
  25170. s += p.invokingState;
  25171. }
  25172. } else {
  25173. var ri = p.ruleIndex;
  25174. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  25175. s += ruleName;
  25176. }
  25177. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  25178. s += " ";
  25179. }
  25180. p = p.parentCtx;
  25181. }
  25182. s += "]";
  25183. return s;
  25184. };
  25185. /***/ }),
  25186. /***/ "./node_modules/antlr4/Token.js":
  25187. /*!**************************************!*\
  25188. !*** ./node_modules/antlr4/Token.js ***!
  25189. \**************************************/
  25190. /*! no static exports found */
  25191. /***/ (function(module, exports, __webpack_require__) {
  25192. "use strict";
  25193. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25194. * Use of this file is governed by the BSD 3-clause license that
  25195. * can be found in the LICENSE.txt file in the project root.
  25196. */
  25197. //
  25198. // A token has properties: text, type, line, character position in the line
  25199. // (so we can ignore tabs), token channel, index, and source from which
  25200. // we obtained this token.
  25201. function Token() {
  25202. this.source = null;
  25203. this.type = null; // token type of the token
  25204. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  25205. this.start = null; // optional; return -1 if not implemented.
  25206. this.stop = null; // optional; return -1 if not implemented.
  25207. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  25208. this.line = null; // line=1..n of the 1st character
  25209. this.column = null; // beginning of the line at which it occurs, 0..n-1
  25210. this._text = null; // text of the token.
  25211. return this;
  25212. }
  25213. Token.INVALID_TYPE = 0;
  25214. // During lookahead operations, this "token" signifies we hit rule end ATN state
  25215. // and did not follow it despite needing to.
  25216. Token.EPSILON = -2;
  25217. Token.MIN_USER_TOKEN_TYPE = 1;
  25218. Token.EOF = -1;
  25219. // All tokens go to the parser (unless skip() is called in that rule)
  25220. // on a particular "channel". The parser tunes to a particular channel
  25221. // so that whitespace etc... can go to the parser on a "hidden" channel.
  25222. Token.DEFAULT_CHANNEL = 0;
  25223. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  25224. // by parser.
  25225. Token.HIDDEN_CHANNEL = 1;
  25226. // Explicitly set the text for this token. If {code text} is not
  25227. // {@code null}, then {@link //getText} will return this value rather than
  25228. // extracting the text from the input.
  25229. //
  25230. // @param text The explicit text of the token, or {@code null} if the text
  25231. // should be obtained from the input along with the start and stop indexes
  25232. // of the token.
  25233. Object.defineProperty(Token.prototype, "text", {
  25234. get: function get() {
  25235. return this._text;
  25236. },
  25237. set: function set(text) {
  25238. this._text = text;
  25239. }
  25240. });
  25241. Token.prototype.getTokenSource = function () {
  25242. return this.source[0];
  25243. };
  25244. Token.prototype.getInputStream = function () {
  25245. return this.source[1];
  25246. };
  25247. function CommonToken(source, type, channel, start, stop) {
  25248. Token.call(this);
  25249. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  25250. this.type = type !== undefined ? type : null;
  25251. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  25252. this.start = start !== undefined ? start : -1;
  25253. this.stop = stop !== undefined ? stop : -1;
  25254. this.tokenIndex = -1;
  25255. if (this.source[0] !== null) {
  25256. this.line = source[0].line;
  25257. this.column = source[0].column;
  25258. } else {
  25259. this.column = -1;
  25260. }
  25261. return this;
  25262. }
  25263. CommonToken.prototype = Object.create(Token.prototype);
  25264. CommonToken.prototype.constructor = CommonToken;
  25265. // An empty {@link Pair} which is used as the default value of
  25266. // {@link //source} for tokens that do not have a source.
  25267. CommonToken.EMPTY_SOURCE = [null, null];
  25268. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  25269. //
  25270. // <p>
  25271. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  25272. // constructed token will share a reference to the {@link //text} field and
  25273. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  25274. // be assigned the result of calling {@link //getText}, and {@link //source}
  25275. // will be constructed from the result of {@link Token//getTokenSource} and
  25276. // {@link Token//getInputStream}.</p>
  25277. //
  25278. // @param oldToken The token to copy.
  25279. //
  25280. CommonToken.prototype.clone = function () {
  25281. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  25282. t.tokenIndex = this.tokenIndex;
  25283. t.line = this.line;
  25284. t.column = this.column;
  25285. t.text = this.text;
  25286. return t;
  25287. };
  25288. Object.defineProperty(CommonToken.prototype, "text", {
  25289. get: function get() {
  25290. if (this._text !== null) {
  25291. return this._text;
  25292. }
  25293. var input = this.getInputStream();
  25294. if (input === null) {
  25295. return null;
  25296. }
  25297. var n = input.size;
  25298. if (this.start < n && this.stop < n) {
  25299. return input.getText(this.start, this.stop);
  25300. } else {
  25301. return "<EOF>";
  25302. }
  25303. },
  25304. set: function set(text) {
  25305. this._text = text;
  25306. }
  25307. });
  25308. CommonToken.prototype.toString = function () {
  25309. var txt = this.text;
  25310. if (txt !== null) {
  25311. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  25312. } else {
  25313. txt = "<no text>";
  25314. }
  25315. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  25316. };
  25317. exports.Token = Token;
  25318. exports.CommonToken = CommonToken;
  25319. /***/ }),
  25320. /***/ "./node_modules/antlr4/Utils.js":
  25321. /*!**************************************!*\
  25322. !*** ./node_modules/antlr4/Utils.js ***!
  25323. \**************************************/
  25324. /*! no static exports found */
  25325. /***/ (function(module, exports, __webpack_require__) {
  25326. "use strict";
  25327. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  25328. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25329. * Use of this file is governed by the BSD 3-clause license that
  25330. * can be found in the LICENSE.txt file in the project root.
  25331. */
  25332. function arrayToString(a) {
  25333. return "[" + a.join(", ") + "]";
  25334. }
  25335. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  25336. String.prototype.hashCode = function () {
  25337. var remainder,
  25338. bytes,
  25339. h1,
  25340. h1b,
  25341. c1,
  25342. c1b,
  25343. c2,
  25344. c2b,
  25345. k1,
  25346. i,
  25347. key = this.toString();
  25348. remainder = key.length & 3; // key.length % 4
  25349. bytes = key.length - remainder;
  25350. h1 = String.prototype.seed;
  25351. c1 = 0xcc9e2d51;
  25352. c2 = 0x1b873593;
  25353. i = 0;
  25354. while (i < bytes) {
  25355. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  25356. ++i;
  25357. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  25358. k1 = k1 << 15 | k1 >>> 17;
  25359. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  25360. h1 ^= k1;
  25361. h1 = h1 << 13 | h1 >>> 19;
  25362. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  25363. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  25364. }
  25365. k1 = 0;
  25366. switch (remainder) {
  25367. case 3:
  25368. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  25369. case 2:
  25370. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  25371. case 1:
  25372. k1 ^= key.charCodeAt(i) & 0xff;
  25373. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  25374. k1 = k1 << 15 | k1 >>> 17;
  25375. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  25376. h1 ^= k1;
  25377. }
  25378. h1 ^= key.length;
  25379. h1 ^= h1 >>> 16;
  25380. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  25381. h1 ^= h1 >>> 13;
  25382. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  25383. h1 ^= h1 >>> 16;
  25384. return h1 >>> 0;
  25385. };
  25386. function standardEqualsFunction(a, b) {
  25387. return a.equals(b);
  25388. }
  25389. function standardHashCodeFunction(a) {
  25390. return a.hashCode();
  25391. }
  25392. function Set(hashFunction, equalsFunction) {
  25393. this.data = {};
  25394. this.hashFunction = hashFunction || standardHashCodeFunction;
  25395. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25396. return this;
  25397. }
  25398. Object.defineProperty(Set.prototype, "length", {
  25399. get: function get() {
  25400. var l = 0;
  25401. for (var key in this.data) {
  25402. if (key.indexOf("hash_") === 0) {
  25403. l = l + this.data[key].length;
  25404. }
  25405. }
  25406. return l;
  25407. }
  25408. });
  25409. Set.prototype.add = function (value) {
  25410. var hash = this.hashFunction(value);
  25411. var key = "hash_" + hash;
  25412. if (key in this.data) {
  25413. var values = this.data[key];
  25414. for (var i = 0; i < values.length; i++) {
  25415. if (this.equalsFunction(value, values[i])) {
  25416. return values[i];
  25417. }
  25418. }
  25419. values.push(value);
  25420. return value;
  25421. } else {
  25422. this.data[key] = [value];
  25423. return value;
  25424. }
  25425. };
  25426. Set.prototype.contains = function (value) {
  25427. return this.get(value) != null;
  25428. };
  25429. Set.prototype.get = function (value) {
  25430. var hash = this.hashFunction(value);
  25431. var key = "hash_" + hash;
  25432. if (key in this.data) {
  25433. var values = this.data[key];
  25434. for (var i = 0; i < values.length; i++) {
  25435. if (this.equalsFunction(value, values[i])) {
  25436. return values[i];
  25437. }
  25438. }
  25439. }
  25440. return null;
  25441. };
  25442. Set.prototype.values = function () {
  25443. var l = [];
  25444. for (var key in this.data) {
  25445. if (key.indexOf("hash_") === 0) {
  25446. l = l.concat(this.data[key]);
  25447. }
  25448. }
  25449. return l;
  25450. };
  25451. Set.prototype.toString = function () {
  25452. return arrayToString(this.values());
  25453. };
  25454. function BitSet() {
  25455. this.data = [];
  25456. return this;
  25457. }
  25458. BitSet.prototype.add = function (value) {
  25459. this.data[value] = true;
  25460. };
  25461. BitSet.prototype.or = function (set) {
  25462. var bits = this;
  25463. Object.keys(set.data).map(function (alt) {
  25464. bits.add(alt);
  25465. });
  25466. };
  25467. BitSet.prototype.remove = function (value) {
  25468. delete this.data[value];
  25469. };
  25470. BitSet.prototype.contains = function (value) {
  25471. return this.data[value] === true;
  25472. };
  25473. BitSet.prototype.values = function () {
  25474. return Object.keys(this.data);
  25475. };
  25476. BitSet.prototype.minValue = function () {
  25477. return Math.min.apply(null, this.values());
  25478. };
  25479. BitSet.prototype.hashCode = function () {
  25480. var hash = new Hash();
  25481. hash.update(this.values());
  25482. return hash.finish();
  25483. };
  25484. BitSet.prototype.equals = function (other) {
  25485. if (!(other instanceof BitSet)) {
  25486. return false;
  25487. }
  25488. return this.hashCode() === other.hashCode();
  25489. };
  25490. Object.defineProperty(BitSet.prototype, "length", {
  25491. get: function get() {
  25492. return this.values().length;
  25493. }
  25494. });
  25495. BitSet.prototype.toString = function () {
  25496. return "{" + this.values().join(", ") + "}";
  25497. };
  25498. function Map(hashFunction, equalsFunction) {
  25499. this.data = {};
  25500. this.hashFunction = hashFunction || standardHashCodeFunction;
  25501. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25502. return this;
  25503. }
  25504. Object.defineProperty(Map.prototype, "length", {
  25505. get: function get() {
  25506. var l = 0;
  25507. for (var hashKey in this.data) {
  25508. if (hashKey.indexOf("hash_") === 0) {
  25509. l = l + this.data[hashKey].length;
  25510. }
  25511. }
  25512. return l;
  25513. }
  25514. });
  25515. Map.prototype.put = function (key, value) {
  25516. var hashKey = "hash_" + this.hashFunction(key);
  25517. if (hashKey in this.data) {
  25518. var entries = this.data[hashKey];
  25519. for (var i = 0; i < entries.length; i++) {
  25520. var entry = entries[i];
  25521. if (this.equalsFunction(key, entry.key)) {
  25522. var oldValue = entry.value;
  25523. entry.value = value;
  25524. return oldValue;
  25525. }
  25526. }
  25527. entries.push({ key: key, value: value });
  25528. return value;
  25529. } else {
  25530. this.data[hashKey] = [{ key: key, value: value }];
  25531. return value;
  25532. }
  25533. };
  25534. Map.prototype.containsKey = function (key) {
  25535. var hashKey = "hash_" + this.hashFunction(key);
  25536. if (hashKey in this.data) {
  25537. var entries = this.data[hashKey];
  25538. for (var i = 0; i < entries.length; i++) {
  25539. var entry = entries[i];
  25540. if (this.equalsFunction(key, entry.key)) return true;
  25541. }
  25542. }
  25543. return false;
  25544. };
  25545. Map.prototype.get = function (key) {
  25546. var hashKey = "hash_" + this.hashFunction(key);
  25547. if (hashKey in this.data) {
  25548. var entries = this.data[hashKey];
  25549. for (var i = 0; i < entries.length; i++) {
  25550. var entry = entries[i];
  25551. if (this.equalsFunction(key, entry.key)) return entry.value;
  25552. }
  25553. }
  25554. return null;
  25555. };
  25556. Map.prototype.entries = function () {
  25557. var l = [];
  25558. for (var key in this.data) {
  25559. if (key.indexOf("hash_") === 0) {
  25560. l = l.concat(this.data[key]);
  25561. }
  25562. }
  25563. return l;
  25564. };
  25565. Map.prototype.getKeys = function () {
  25566. return this.entries().map(function (e) {
  25567. return e.key;
  25568. });
  25569. };
  25570. Map.prototype.getValues = function () {
  25571. return this.entries().map(function (e) {
  25572. return e.value;
  25573. });
  25574. };
  25575. Map.prototype.toString = function () {
  25576. var ss = this.entries().map(function (entry) {
  25577. return '{' + entry.key + ':' + entry.value + '}';
  25578. });
  25579. return '[' + ss.join(", ") + ']';
  25580. };
  25581. function AltDict() {
  25582. this.data = {};
  25583. return this;
  25584. }
  25585. AltDict.prototype.get = function (key) {
  25586. key = "k-" + key;
  25587. if (key in this.data) {
  25588. return this.data[key];
  25589. } else {
  25590. return null;
  25591. }
  25592. };
  25593. AltDict.prototype.put = function (key, value) {
  25594. key = "k-" + key;
  25595. this.data[key] = value;
  25596. };
  25597. AltDict.prototype.values = function () {
  25598. var data = this.data;
  25599. var keys = Object.keys(this.data);
  25600. return keys.map(function (key) {
  25601. return data[key];
  25602. });
  25603. };
  25604. function DoubleDict() {
  25605. return this;
  25606. }
  25607. function Hash() {
  25608. this.count = 0;
  25609. this.hash = 0;
  25610. return this;
  25611. }
  25612. Hash.prototype.update = function () {
  25613. for (var i = 0; i < arguments.length; i++) {
  25614. var value = arguments[i];
  25615. if (value == null) continue;
  25616. if (Array.isArray(value)) this.update.apply(value);else {
  25617. var k = 0;
  25618. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25619. case 'undefined':
  25620. case 'function':
  25621. continue;
  25622. case 'number':
  25623. case 'boolean':
  25624. k = value;
  25625. break;
  25626. case 'string':
  25627. k = value.hashCode();
  25628. break;
  25629. default:
  25630. value.updateHashCode(this);
  25631. continue;
  25632. }
  25633. k = k * 0xCC9E2D51;
  25634. k = k << 15 | k >>> 32 - 15;
  25635. k = k * 0x1B873593;
  25636. this.count = this.count + 1;
  25637. var hash = this.hash ^ k;
  25638. hash = hash << 13 | hash >>> 32 - 13;
  25639. hash = hash * 5 + 0xE6546B64;
  25640. this.hash = hash;
  25641. }
  25642. }
  25643. };
  25644. Hash.prototype.finish = function () {
  25645. var hash = this.hash ^ this.count * 4;
  25646. hash = hash ^ hash >>> 16;
  25647. hash = hash * 0x85EBCA6B;
  25648. hash = hash ^ hash >>> 13;
  25649. hash = hash * 0xC2B2AE35;
  25650. hash = hash ^ hash >>> 16;
  25651. return hash;
  25652. };
  25653. function hashStuff() {
  25654. var hash = new Hash();
  25655. hash.update.apply(arguments);
  25656. return hash.finish();
  25657. }
  25658. DoubleDict.prototype.get = function (a, b) {
  25659. var d = this[a] || null;
  25660. return d === null ? null : d[b] || null;
  25661. };
  25662. DoubleDict.prototype.set = function (a, b, o) {
  25663. var d = this[a] || null;
  25664. if (d === null) {
  25665. d = {};
  25666. this[a] = d;
  25667. }
  25668. d[b] = o;
  25669. };
  25670. function escapeWhitespace(s, escapeSpaces) {
  25671. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25672. if (escapeSpaces) {
  25673. s = s.replace(/ /g, "\xB7");
  25674. }
  25675. return s;
  25676. }
  25677. function titleCase(str) {
  25678. return str.replace(/\w\S*/g, function (txt) {
  25679. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25680. });
  25681. };
  25682. function equalArrays(a, b) {
  25683. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25684. if (a == b) return true;
  25685. if (a.length != b.length) return false;
  25686. for (var i = 0; i < a.length; i++) {
  25687. if (a[i] == b[i]) continue;
  25688. if (!a[i].equals(b[i])) return false;
  25689. }
  25690. return true;
  25691. };
  25692. exports.Hash = Hash;
  25693. exports.Set = Set;
  25694. exports.Map = Map;
  25695. exports.BitSet = BitSet;
  25696. exports.AltDict = AltDict;
  25697. exports.DoubleDict = DoubleDict;
  25698. exports.hashStuff = hashStuff;
  25699. exports.escapeWhitespace = escapeWhitespace;
  25700. exports.arrayToString = arrayToString;
  25701. exports.titleCase = titleCase;
  25702. exports.equalArrays = equalArrays;
  25703. /***/ }),
  25704. /***/ "./node_modules/antlr4/atn/ATN.js":
  25705. /*!****************************************!*\
  25706. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25707. \****************************************/
  25708. /*! no static exports found */
  25709. /***/ (function(module, exports, __webpack_require__) {
  25710. "use strict";
  25711. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25712. * Use of this file is governed by the BSD 3-clause license that
  25713. * can be found in the LICENSE.txt file in the project root.
  25714. */
  25715. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25716. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25717. function ATN(grammarType, maxTokenType) {
  25718. // Used for runtime deserialization of ATNs from strings///
  25719. // The type of the ATN.
  25720. this.grammarType = grammarType;
  25721. // The maximum value for any symbol recognized by a transition in the ATN.
  25722. this.maxTokenType = maxTokenType;
  25723. this.states = [];
  25724. // Each subrule/rule is a decision point and we must track them so we
  25725. // can go back later and build DFA predictors for them. This includes
  25726. // all the rules, subrules, optional blocks, ()+, ()* etc...
  25727. this.decisionToState = [];
  25728. // Maps from rule index to starting state number.
  25729. this.ruleToStartState = [];
  25730. // Maps from rule index to stop state number.
  25731. this.ruleToStopState = null;
  25732. this.modeNameToStartState = {};
  25733. // For lexer ATNs, this maps the rule index to the resulting token type.
  25734. // For parser ATNs, this maps the rule index to the generated bypass token
  25735. // type if the
  25736. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  25737. // deserialization option was specified; otherwise, this is {@code null}.
  25738. this.ruleToTokenType = null;
  25739. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  25740. // be referenced by action transitions in the ATN.
  25741. this.lexerActions = null;
  25742. this.modeToStartState = [];
  25743. return this;
  25744. }
  25745. // Compute the set of valid tokens that can occur starting in state {@code s}.
  25746. // If {@code ctx} is null, the set of tokens will not include what can follow
  25747. // the rule surrounding {@code s}. In other words, the set will be
  25748. // restricted to tokens reachable staying within {@code s}'s rule.
  25749. ATN.prototype.nextTokensInContext = function (s, ctx) {
  25750. var anal = new LL1Analyzer(this);
  25751. return anal.LOOK(s, null, ctx);
  25752. };
  25753. // Compute the set of valid tokens that can occur starting in {@code s} and
  25754. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  25755. // rule.
  25756. ATN.prototype.nextTokensNoContext = function (s) {
  25757. if (s.nextTokenWithinRule !== null) {
  25758. return s.nextTokenWithinRule;
  25759. }
  25760. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  25761. s.nextTokenWithinRule.readOnly = true;
  25762. return s.nextTokenWithinRule;
  25763. };
  25764. ATN.prototype.nextTokens = function (s, ctx) {
  25765. if (ctx === undefined) {
  25766. return this.nextTokensNoContext(s);
  25767. } else {
  25768. return this.nextTokensInContext(s, ctx);
  25769. }
  25770. };
  25771. ATN.prototype.addState = function (state) {
  25772. if (state !== null) {
  25773. state.atn = this;
  25774. state.stateNumber = this.states.length;
  25775. }
  25776. this.states.push(state);
  25777. };
  25778. ATN.prototype.removeState = function (state) {
  25779. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  25780. };
  25781. ATN.prototype.defineDecisionState = function (s) {
  25782. this.decisionToState.push(s);
  25783. s.decision = this.decisionToState.length - 1;
  25784. return s.decision;
  25785. };
  25786. ATN.prototype.getDecisionState = function (decision) {
  25787. if (this.decisionToState.length === 0) {
  25788. return null;
  25789. } else {
  25790. return this.decisionToState[decision];
  25791. }
  25792. };
  25793. // Computes the set of input symbols which could follow ATN state number
  25794. // {@code stateNumber} in the specified full {@code context}. This method
  25795. // considers the complete parser context, but does not evaluate semantic
  25796. // predicates (i.e. all predicates encountered during the calculation are
  25797. // assumed true). If a path in the ATN exists from the starting state to the
  25798. // {@link RuleStopState} of the outermost context without matching any
  25799. // symbols, {@link Token//EOF} is added to the returned set.
  25800. //
  25801. // <p>If {@code context} is {@code null}, it is treated as
  25802. // {@link ParserRuleContext//EMPTY}.</p>
  25803. //
  25804. // @param stateNumber the ATN state number
  25805. // @param context the full parse context
  25806. // @return The set of potentially valid input symbols which could follow the
  25807. // specified state in the specified context.
  25808. // @throws IllegalArgumentException if the ATN does not contain a state with
  25809. // number {@code stateNumber}
  25810. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25811. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  25812. if (stateNumber < 0 || stateNumber >= this.states.length) {
  25813. throw "Invalid state number.";
  25814. }
  25815. var s = this.states[stateNumber];
  25816. var following = this.nextTokens(s);
  25817. if (!following.contains(Token.EPSILON)) {
  25818. return following;
  25819. }
  25820. var expected = new IntervalSet();
  25821. expected.addSet(following);
  25822. expected.removeOne(Token.EPSILON);
  25823. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  25824. var invokingState = this.states[ctx.invokingState];
  25825. var rt = invokingState.transitions[0];
  25826. following = this.nextTokens(rt.followState);
  25827. expected.addSet(following);
  25828. expected.removeOne(Token.EPSILON);
  25829. ctx = ctx.parentCtx;
  25830. }
  25831. if (following.contains(Token.EPSILON)) {
  25832. expected.addOne(Token.EOF);
  25833. }
  25834. return expected;
  25835. };
  25836. ATN.INVALID_ALT_NUMBER = 0;
  25837. exports.ATN = ATN;
  25838. /***/ }),
  25839. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  25840. /*!**********************************************!*\
  25841. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  25842. \**********************************************/
  25843. /*! no static exports found */
  25844. /***/ (function(module, exports, __webpack_require__) {
  25845. "use strict";
  25846. //
  25847. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25848. * Use of this file is governed by the BSD 3-clause license that
  25849. * can be found in the LICENSE.txt file in the project root.
  25850. */
  25851. ///
  25852. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  25853. // The syntactic context is a graph-structured stack node whose
  25854. // path(s) to the root is the rule invocation(s)
  25855. // chain used to arrive at the state. The semantic context is
  25856. // the tree of semantic predicates encountered before reaching
  25857. // an ATN state.
  25858. ///
  25859. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  25860. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25861. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  25862. function checkParams(params, isCfg) {
  25863. if (params === null) {
  25864. var result = { state: null, alt: null, context: null, semanticContext: null };
  25865. if (isCfg) {
  25866. result.reachesIntoOuterContext = 0;
  25867. }
  25868. return result;
  25869. } else {
  25870. var props = {};
  25871. props.state = params.state || null;
  25872. props.alt = params.alt === undefined ? null : params.alt;
  25873. props.context = params.context || null;
  25874. props.semanticContext = params.semanticContext || null;
  25875. if (isCfg) {
  25876. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  25877. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  25878. }
  25879. return props;
  25880. }
  25881. }
  25882. function ATNConfig(params, config) {
  25883. this.checkContext(params, config);
  25884. params = checkParams(params);
  25885. config = checkParams(config, true);
  25886. // The ATN state associated with this configuration///
  25887. this.state = params.state !== null ? params.state : config.state;
  25888. // What alt (or lexer rule) is predicted by this configuration///
  25889. this.alt = params.alt !== null ? params.alt : config.alt;
  25890. // The stack of invoking states leading to the rule/states associated
  25891. // with this config. We track only those contexts pushed during
  25892. // execution of the ATN simulator.
  25893. this.context = params.context !== null ? params.context : config.context;
  25894. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  25895. // We cannot execute predicates dependent upon local context unless
  25896. // we know for sure we are in the correct context. Because there is
  25897. // no way to do this efficiently, we simply cannot evaluate
  25898. // dependent predicates unless we are in the rule that initially
  25899. // invokes the ATN simulator.
  25900. //
  25901. // closure() tracks the depth of how far we dip into the
  25902. // outer context: depth &gt; 0. Note that it may not be totally
  25903. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  25904. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  25905. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  25906. return this;
  25907. }
  25908. ATNConfig.prototype.checkContext = function (params, config) {
  25909. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  25910. this.context = null;
  25911. }
  25912. };
  25913. ATNConfig.prototype.hashCode = function () {
  25914. var hash = new Hash();
  25915. this.updateHashCode(hash);
  25916. return hash.finish();
  25917. };
  25918. ATNConfig.prototype.updateHashCode = function (hash) {
  25919. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  25920. };
  25921. // An ATN configuration is equal to another if both have
  25922. // the same state, they predict the same alternative, and
  25923. // syntactic/semantic contexts are the same.
  25924. ATNConfig.prototype.equals = function (other) {
  25925. if (this === other) {
  25926. return true;
  25927. } else if (!(other instanceof ATNConfig)) {
  25928. return false;
  25929. } else {
  25930. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && (this.context === null ? other.context === null : this.context.equals(other.context)) && this.semanticContext.equals(other.semanticContext) && this.precedenceFilterSuppressed === other.precedenceFilterSuppressed;
  25931. }
  25932. };
  25933. ATNConfig.prototype.hashCodeForConfigSet = function () {
  25934. var hash = new Hash();
  25935. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  25936. return hash.finish();
  25937. };
  25938. ATNConfig.prototype.equalsForConfigSet = function (other) {
  25939. if (this === other) {
  25940. return true;
  25941. } else if (!(other instanceof ATNConfig)) {
  25942. return false;
  25943. } else {
  25944. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  25945. }
  25946. };
  25947. ATNConfig.prototype.toString = function () {
  25948. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  25949. };
  25950. function LexerATNConfig(params, config) {
  25951. ATNConfig.call(this, params, config);
  25952. // This is the backing field for {@link //getLexerActionExecutor}.
  25953. var lexerActionExecutor = params.lexerActionExecutor || null;
  25954. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  25955. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  25956. return this;
  25957. }
  25958. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  25959. LexerATNConfig.prototype.constructor = LexerATNConfig;
  25960. LexerATNConfig.prototype.updateHashCode = function (hash) {
  25961. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  25962. };
  25963. LexerATNConfig.prototype.equals = function (other) {
  25964. return this === other || other instanceof LexerATNConfig && this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision && (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) && ATNConfig.prototype.equals.call(this, other);
  25965. };
  25966. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  25967. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  25968. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  25969. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  25970. };
  25971. exports.ATNConfig = ATNConfig;
  25972. exports.LexerATNConfig = LexerATNConfig;
  25973. /***/ }),
  25974. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  25975. /*!*************************************************!*\
  25976. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  25977. \*************************************************/
  25978. /*! no static exports found */
  25979. /***/ (function(module, exports, __webpack_require__) {
  25980. "use strict";
  25981. //
  25982. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25983. * Use of this file is governed by the BSD 3-clause license that
  25984. * can be found in the LICENSE.txt file in the project root.
  25985. */
  25986. //
  25987. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  25988. // info about the set, with support for combining similar configurations using a
  25989. // graph-structured stack.
  25990. ///
  25991. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25992. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25993. var Hash = Utils.Hash;
  25994. var Set = Utils.Set;
  25995. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25996. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  25997. function hashATNConfig(c) {
  25998. return c.hashCodeForConfigSet();
  25999. }
  26000. function equalATNConfigs(a, b) {
  26001. if (a === b) {
  26002. return true;
  26003. } else if (a === null || b === null) {
  26004. return false;
  26005. } else return a.equalsForConfigSet(b);
  26006. }
  26007. function ATNConfigSet(fullCtx) {
  26008. //
  26009. // The reason that we need this is because we don't want the hash map to use
  26010. // the standard hash code and equals. We need all configurations with the
  26011. // same
  26012. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  26013. // doubles
  26014. // the number of objects associated with ATNConfigs. The other solution is
  26015. // to
  26016. // use a hash table that lets us specify the equals/hashcode operation.
  26017. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  26018. // when we go readonly as this set becomes a DFA state.
  26019. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  26020. // Indicates that this configuration set is part of a full context
  26021. // LL prediction. It will be used to determine how to merge $. With SLL
  26022. // it's a wildcard whereas it is not for LL context merge.
  26023. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  26024. // Indicates that the set of configurations is read-only. Do not
  26025. // allow any code to manipulate the set; DFA states will point at
  26026. // the sets and they must not change. This does not protect the other
  26027. // fields; in particular, conflictingAlts is set after
  26028. // we've made this readonly.
  26029. this.readOnly = false;
  26030. // Track the elements as they are added to the set; supports get(i)///
  26031. this.configs = [];
  26032. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  26033. // together, saves recomputation
  26034. // TODO: can we track conflicts as they are added to save scanning configs
  26035. // later?
  26036. this.uniqueAlt = 0;
  26037. this.conflictingAlts = null;
  26038. // Used in parser and lexer. In lexer, it indicates we hit a pred
  26039. // while computing a closure operation. Don't make a DFA state from this.
  26040. this.hasSemanticContext = false;
  26041. this.dipsIntoOuterContext = false;
  26042. this.cachedHashCode = -1;
  26043. return this;
  26044. }
  26045. // Adding a new config means merging contexts with existing configs for
  26046. // {@code (s, i, pi, _)}, where {@code s} is the
  26047. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  26048. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  26049. // {@code (s,i,pi)} as key.
  26050. //
  26051. // <p>This method updates {@link //dipsIntoOuterContext} and
  26052. // {@link //hasSemanticContext} when necessary.</p>
  26053. // /
  26054. ATNConfigSet.prototype.add = function (config, mergeCache) {
  26055. if (mergeCache === undefined) {
  26056. mergeCache = null;
  26057. }
  26058. if (this.readOnly) {
  26059. throw "This set is readonly";
  26060. }
  26061. if (config.semanticContext !== SemanticContext.NONE) {
  26062. this.hasSemanticContext = true;
  26063. }
  26064. if (config.reachesIntoOuterContext > 0) {
  26065. this.dipsIntoOuterContext = true;
  26066. }
  26067. var existing = this.configLookup.add(config);
  26068. if (existing === config) {
  26069. this.cachedHashCode = -1;
  26070. this.configs.push(config); // track order here
  26071. return true;
  26072. }
  26073. // a previous (s,i,pi,_), merge with it and save result
  26074. var rootIsWildcard = !this.fullCtx;
  26075. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  26076. // no need to check for existing.context, config.context in cache
  26077. // since only way to create new graphs is "call rule" and here. We
  26078. // cache at both places.
  26079. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  26080. // make sure to preserve the precedence filter suppression during the merge
  26081. if (config.precedenceFilterSuppressed) {
  26082. existing.precedenceFilterSuppressed = true;
  26083. }
  26084. existing.context = merged; // replace context; no need to alt mapping
  26085. return true;
  26086. };
  26087. ATNConfigSet.prototype.getStates = function () {
  26088. var states = new Set();
  26089. for (var i = 0; i < this.configs.length; i++) {
  26090. states.add(this.configs[i].state);
  26091. }
  26092. return states;
  26093. };
  26094. ATNConfigSet.prototype.getPredicates = function () {
  26095. var preds = [];
  26096. for (var i = 0; i < this.configs.length; i++) {
  26097. var c = this.configs[i].semanticContext;
  26098. if (c !== SemanticContext.NONE) {
  26099. preds.push(c.semanticContext);
  26100. }
  26101. }
  26102. return preds;
  26103. };
  26104. Object.defineProperty(ATNConfigSet.prototype, "items", {
  26105. get: function get() {
  26106. return this.configs;
  26107. }
  26108. });
  26109. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  26110. if (this.readOnly) {
  26111. throw "This set is readonly";
  26112. }
  26113. if (this.configLookup.length === 0) {
  26114. return;
  26115. }
  26116. for (var i = 0; i < this.configs.length; i++) {
  26117. var config = this.configs[i];
  26118. config.context = interpreter.getCachedContext(config.context);
  26119. }
  26120. };
  26121. ATNConfigSet.prototype.addAll = function (coll) {
  26122. for (var i = 0; i < coll.length; i++) {
  26123. this.add(coll[i]);
  26124. }
  26125. return false;
  26126. };
  26127. ATNConfigSet.prototype.equals = function (other) {
  26128. return this === other || other instanceof ATNConfigSet && Utils.equalArrays(this.configs, other.configs) && this.fullCtx === other.fullCtx && this.uniqueAlt === other.uniqueAlt && this.conflictingAlts === other.conflictingAlts && this.hasSemanticContext === other.hasSemanticContext && this.dipsIntoOuterContext === other.dipsIntoOuterContext;
  26129. };
  26130. ATNConfigSet.prototype.hashCode = function () {
  26131. var hash = new Hash();
  26132. this.updateHashCode(hash);
  26133. return hash.finish();
  26134. };
  26135. ATNConfigSet.prototype.updateHashCode = function (hash) {
  26136. if (this.readOnly) {
  26137. if (this.cachedHashCode === -1) {
  26138. var hash = new Hash();
  26139. hash.update(this.configs);
  26140. this.cachedHashCode = hash.finish();
  26141. }
  26142. hash.update(this.cachedHashCode);
  26143. } else {
  26144. hash.update(this.configs);
  26145. }
  26146. };
  26147. Object.defineProperty(ATNConfigSet.prototype, "length", {
  26148. get: function get() {
  26149. return this.configs.length;
  26150. }
  26151. });
  26152. ATNConfigSet.prototype.isEmpty = function () {
  26153. return this.configs.length === 0;
  26154. };
  26155. ATNConfigSet.prototype.contains = function (item) {
  26156. if (this.configLookup === null) {
  26157. throw "This method is not implemented for readonly sets.";
  26158. }
  26159. return this.configLookup.contains(item);
  26160. };
  26161. ATNConfigSet.prototype.containsFast = function (item) {
  26162. if (this.configLookup === null) {
  26163. throw "This method is not implemented for readonly sets.";
  26164. }
  26165. return this.configLookup.containsFast(item);
  26166. };
  26167. ATNConfigSet.prototype.clear = function () {
  26168. if (this.readOnly) {
  26169. throw "This set is readonly";
  26170. }
  26171. this.configs = [];
  26172. this.cachedHashCode = -1;
  26173. this.configLookup = new Set();
  26174. };
  26175. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  26176. this.readOnly = readOnly;
  26177. if (readOnly) {
  26178. this.configLookup = null; // can't mod, no need for lookup cache
  26179. }
  26180. };
  26181. ATNConfigSet.prototype.toString = function () {
  26182. return Utils.arrayToString(this.configs) + (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") + (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") + (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  26183. };
  26184. function OrderedATNConfigSet() {
  26185. ATNConfigSet.call(this);
  26186. this.configLookup = new Set();
  26187. return this;
  26188. }
  26189. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  26190. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  26191. exports.ATNConfigSet = ATNConfigSet;
  26192. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  26193. /***/ }),
  26194. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  26195. /*!**************************************************************!*\
  26196. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  26197. \**************************************************************/
  26198. /*! no static exports found */
  26199. /***/ (function(module, exports, __webpack_require__) {
  26200. "use strict";
  26201. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26202. * Use of this file is governed by the BSD 3-clause license that
  26203. * can be found in the LICENSE.txt file in the project root.
  26204. */
  26205. function ATNDeserializationOptions(copyFrom) {
  26206. if (copyFrom === undefined) {
  26207. copyFrom = null;
  26208. }
  26209. this.readOnly = false;
  26210. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  26211. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  26212. return this;
  26213. }
  26214. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  26215. ATNDeserializationOptions.defaultOptions.readOnly = true;
  26216. // def __setattr__(self, key, value):
  26217. // if key!="readOnly" and self.readOnly:
  26218. // raise Exception("The object is read only.")
  26219. // super(type(self), self).__setattr__(key,value)
  26220. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  26221. /***/ }),
  26222. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  26223. /*!****************************************************!*\
  26224. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  26225. \****************************************************/
  26226. /*! no static exports found */
  26227. /***/ (function(module, exports, __webpack_require__) {
  26228. "use strict";
  26229. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26230. * Use of this file is governed by the BSD 3-clause license that
  26231. * can be found in the LICENSE.txt file in the project root.
  26232. */
  26233. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26234. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26235. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  26236. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  26237. var ATNState = ATNStates.ATNState;
  26238. var BasicState = ATNStates.BasicState;
  26239. var DecisionState = ATNStates.DecisionState;
  26240. var BlockStartState = ATNStates.BlockStartState;
  26241. var BlockEndState = ATNStates.BlockEndState;
  26242. var LoopEndState = ATNStates.LoopEndState;
  26243. var RuleStartState = ATNStates.RuleStartState;
  26244. var RuleStopState = ATNStates.RuleStopState;
  26245. var TokensStartState = ATNStates.TokensStartState;
  26246. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  26247. var StarLoopbackState = ATNStates.StarLoopbackState;
  26248. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  26249. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  26250. var StarBlockStartState = ATNStates.StarBlockStartState;
  26251. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  26252. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  26253. var Transition = Transitions.Transition;
  26254. var AtomTransition = Transitions.AtomTransition;
  26255. var SetTransition = Transitions.SetTransition;
  26256. var NotSetTransition = Transitions.NotSetTransition;
  26257. var RuleTransition = Transitions.RuleTransition;
  26258. var RangeTransition = Transitions.RangeTransition;
  26259. var ActionTransition = Transitions.ActionTransition;
  26260. var EpsilonTransition = Transitions.EpsilonTransition;
  26261. var WildcardTransition = Transitions.WildcardTransition;
  26262. var PredicateTransition = Transitions.PredicateTransition;
  26263. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  26264. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  26265. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  26266. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  26267. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  26268. var LexerActionType = LexerActions.LexerActionType;
  26269. var LexerSkipAction = LexerActions.LexerSkipAction;
  26270. var LexerChannelAction = LexerActions.LexerChannelAction;
  26271. var LexerCustomAction = LexerActions.LexerCustomAction;
  26272. var LexerMoreAction = LexerActions.LexerMoreAction;
  26273. var LexerTypeAction = LexerActions.LexerTypeAction;
  26274. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  26275. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  26276. var LexerModeAction = LexerActions.LexerModeAction;
  26277. // This is the earliest supported serialized UUID.
  26278. // stick to serialized version for now, we don't need a UUID instance
  26279. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  26280. //
  26281. // This UUID indicates the serialized ATN contains two sets of
  26282. // IntervalSets, where the second set's values are encoded as
  26283. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  26284. //
  26285. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  26286. // This list contains all of the currently supported UUIDs, ordered by when
  26287. // the feature first appeared in this branch.
  26288. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  26289. var SERIALIZED_VERSION = 3;
  26290. // This is the current serialized UUID.
  26291. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  26292. function initArray(length, value) {
  26293. var tmp = [];
  26294. tmp[length - 1] = value;
  26295. return tmp.map(function (i) {
  26296. return value;
  26297. });
  26298. }
  26299. function ATNDeserializer(options) {
  26300. if (options === undefined || options === null) {
  26301. options = ATNDeserializationOptions.defaultOptions;
  26302. }
  26303. this.deserializationOptions = options;
  26304. this.stateFactories = null;
  26305. this.actionFactories = null;
  26306. return this;
  26307. }
  26308. // Determines if a particular serialized representation of an ATN supports
  26309. // a particular feature, identified by the {@link UUID} used for serializing
  26310. // the ATN at the time the feature was first introduced.
  26311. //
  26312. // @param feature The {@link UUID} marking the first time the feature was
  26313. // supported in the serialized ATN.
  26314. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  26315. // currently being deserialized.
  26316. // @return {@code true} if the {@code actualUuid} value represents a
  26317. // serialized ATN at or after the feature identified by {@code feature} was
  26318. // introduced; otherwise, {@code false}.
  26319. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  26320. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  26321. if (idx1 < 0) {
  26322. return false;
  26323. }
  26324. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  26325. return idx2 >= idx1;
  26326. };
  26327. ATNDeserializer.prototype.deserialize = function (data) {
  26328. this.reset(data);
  26329. this.checkVersion();
  26330. this.checkUUID();
  26331. var atn = this.readATN();
  26332. this.readStates(atn);
  26333. this.readRules(atn);
  26334. this.readModes(atn);
  26335. var sets = [];
  26336. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  26337. this.readSets(atn, sets, this.readInt.bind(this));
  26338. // Next, if the ATN was serialized with the Unicode SMP feature,
  26339. // deserialize sets with 32-bit arguments <= U+10FFFF.
  26340. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  26341. this.readSets(atn, sets, this.readInt32.bind(this));
  26342. }
  26343. this.readEdges(atn, sets);
  26344. this.readDecisions(atn);
  26345. this.readLexerActions(atn);
  26346. this.markPrecedenceDecisions(atn);
  26347. this.verifyATN(atn);
  26348. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  26349. this.generateRuleBypassTransitions(atn);
  26350. // re-verify after modification
  26351. this.verifyATN(atn);
  26352. }
  26353. return atn;
  26354. };
  26355. ATNDeserializer.prototype.reset = function (data) {
  26356. var adjust = function adjust(c) {
  26357. var v = c.charCodeAt(0);
  26358. return v > 1 ? v - 2 : v + 65533;
  26359. };
  26360. var temp = data.split("").map(adjust);
  26361. // don't adjust the first value since that's the version number
  26362. temp[0] = data.charCodeAt(0);
  26363. this.data = temp;
  26364. this.pos = 0;
  26365. };
  26366. ATNDeserializer.prototype.checkVersion = function () {
  26367. var version = this.readInt();
  26368. if (version !== SERIALIZED_VERSION) {
  26369. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  26370. }
  26371. };
  26372. ATNDeserializer.prototype.checkUUID = function () {
  26373. var uuid = this.readUUID();
  26374. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  26375. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  26376. }
  26377. this.uuid = uuid;
  26378. };
  26379. ATNDeserializer.prototype.readATN = function () {
  26380. var grammarType = this.readInt();
  26381. var maxTokenType = this.readInt();
  26382. return new ATN(grammarType, maxTokenType);
  26383. };
  26384. ATNDeserializer.prototype.readStates = function (atn) {
  26385. var j, pair, stateNumber;
  26386. var loopBackStateNumbers = [];
  26387. var endStateNumbers = [];
  26388. var nstates = this.readInt();
  26389. for (var i = 0; i < nstates; i++) {
  26390. var stype = this.readInt();
  26391. // ignore bad type of states
  26392. if (stype === ATNState.INVALID_TYPE) {
  26393. atn.addState(null);
  26394. continue;
  26395. }
  26396. var ruleIndex = this.readInt();
  26397. if (ruleIndex === 0xFFFF) {
  26398. ruleIndex = -1;
  26399. }
  26400. var s = this.stateFactory(stype, ruleIndex);
  26401. if (stype === ATNState.LOOP_END) {
  26402. // special case
  26403. var loopBackStateNumber = this.readInt();
  26404. loopBackStateNumbers.push([s, loopBackStateNumber]);
  26405. } else if (s instanceof BlockStartState) {
  26406. var endStateNumber = this.readInt();
  26407. endStateNumbers.push([s, endStateNumber]);
  26408. }
  26409. atn.addState(s);
  26410. }
  26411. // delay the assignment of loop back and end states until we know all the
  26412. // state instances have been initialized
  26413. for (j = 0; j < loopBackStateNumbers.length; j++) {
  26414. pair = loopBackStateNumbers[j];
  26415. pair[0].loopBackState = atn.states[pair[1]];
  26416. }
  26417. for (j = 0; j < endStateNumbers.length; j++) {
  26418. pair = endStateNumbers[j];
  26419. pair[0].endState = atn.states[pair[1]];
  26420. }
  26421. var numNonGreedyStates = this.readInt();
  26422. for (j = 0; j < numNonGreedyStates; j++) {
  26423. stateNumber = this.readInt();
  26424. atn.states[stateNumber].nonGreedy = true;
  26425. }
  26426. var numPrecedenceStates = this.readInt();
  26427. for (j = 0; j < numPrecedenceStates; j++) {
  26428. stateNumber = this.readInt();
  26429. atn.states[stateNumber].isPrecedenceRule = true;
  26430. }
  26431. };
  26432. ATNDeserializer.prototype.readRules = function (atn) {
  26433. var i;
  26434. var nrules = this.readInt();
  26435. if (atn.grammarType === ATNType.LEXER) {
  26436. atn.ruleToTokenType = initArray(nrules, 0);
  26437. }
  26438. atn.ruleToStartState = initArray(nrules, 0);
  26439. for (i = 0; i < nrules; i++) {
  26440. var s = this.readInt();
  26441. var startState = atn.states[s];
  26442. atn.ruleToStartState[i] = startState;
  26443. if (atn.grammarType === ATNType.LEXER) {
  26444. var tokenType = this.readInt();
  26445. if (tokenType === 0xFFFF) {
  26446. tokenType = Token.EOF;
  26447. }
  26448. atn.ruleToTokenType[i] = tokenType;
  26449. }
  26450. }
  26451. atn.ruleToStopState = initArray(nrules, 0);
  26452. for (i = 0; i < atn.states.length; i++) {
  26453. var state = atn.states[i];
  26454. if (!(state instanceof RuleStopState)) {
  26455. continue;
  26456. }
  26457. atn.ruleToStopState[state.ruleIndex] = state;
  26458. atn.ruleToStartState[state.ruleIndex].stopState = state;
  26459. }
  26460. };
  26461. ATNDeserializer.prototype.readModes = function (atn) {
  26462. var nmodes = this.readInt();
  26463. for (var i = 0; i < nmodes; i++) {
  26464. var s = this.readInt();
  26465. atn.modeToStartState.push(atn.states[s]);
  26466. }
  26467. };
  26468. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  26469. var m = this.readInt();
  26470. for (var i = 0; i < m; i++) {
  26471. var iset = new IntervalSet();
  26472. sets.push(iset);
  26473. var n = this.readInt();
  26474. var containsEof = this.readInt();
  26475. if (containsEof !== 0) {
  26476. iset.addOne(-1);
  26477. }
  26478. for (var j = 0; j < n; j++) {
  26479. var i1 = readUnicode();
  26480. var i2 = readUnicode();
  26481. iset.addRange(i1, i2);
  26482. }
  26483. }
  26484. };
  26485. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  26486. var i, j, state, trans, target;
  26487. var nedges = this.readInt();
  26488. for (i = 0; i < nedges; i++) {
  26489. var src = this.readInt();
  26490. var trg = this.readInt();
  26491. var ttype = this.readInt();
  26492. var arg1 = this.readInt();
  26493. var arg2 = this.readInt();
  26494. var arg3 = this.readInt();
  26495. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  26496. var srcState = atn.states[src];
  26497. srcState.addTransition(trans);
  26498. }
  26499. // edges for rule stop states can be derived, so they aren't serialized
  26500. for (i = 0; i < atn.states.length; i++) {
  26501. state = atn.states[i];
  26502. for (j = 0; j < state.transitions.length; j++) {
  26503. var t = state.transitions[j];
  26504. if (!(t instanceof RuleTransition)) {
  26505. continue;
  26506. }
  26507. var outermostPrecedenceReturn = -1;
  26508. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  26509. if (t.precedence === 0) {
  26510. outermostPrecedenceReturn = t.target.ruleIndex;
  26511. }
  26512. }
  26513. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  26514. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  26515. }
  26516. }
  26517. for (i = 0; i < atn.states.length; i++) {
  26518. state = atn.states[i];
  26519. if (state instanceof BlockStartState) {
  26520. // we need to know the end state to set its start state
  26521. if (state.endState === null) {
  26522. throw "IllegalState";
  26523. }
  26524. // block end states can only be associated to a single block start
  26525. // state
  26526. if (state.endState.startState !== null) {
  26527. throw "IllegalState";
  26528. }
  26529. state.endState.startState = state;
  26530. }
  26531. if (state instanceof PlusLoopbackState) {
  26532. for (j = 0; j < state.transitions.length; j++) {
  26533. target = state.transitions[j].target;
  26534. if (target instanceof PlusBlockStartState) {
  26535. target.loopBackState = state;
  26536. }
  26537. }
  26538. } else if (state instanceof StarLoopbackState) {
  26539. for (j = 0; j < state.transitions.length; j++) {
  26540. target = state.transitions[j].target;
  26541. if (target instanceof StarLoopEntryState) {
  26542. target.loopBackState = state;
  26543. }
  26544. }
  26545. }
  26546. }
  26547. };
  26548. ATNDeserializer.prototype.readDecisions = function (atn) {
  26549. var ndecisions = this.readInt();
  26550. for (var i = 0; i < ndecisions; i++) {
  26551. var s = this.readInt();
  26552. var decState = atn.states[s];
  26553. atn.decisionToState.push(decState);
  26554. decState.decision = i;
  26555. }
  26556. };
  26557. ATNDeserializer.prototype.readLexerActions = function (atn) {
  26558. if (atn.grammarType === ATNType.LEXER) {
  26559. var count = this.readInt();
  26560. atn.lexerActions = initArray(count, null);
  26561. for (var i = 0; i < count; i++) {
  26562. var actionType = this.readInt();
  26563. var data1 = this.readInt();
  26564. if (data1 === 0xFFFF) {
  26565. data1 = -1;
  26566. }
  26567. var data2 = this.readInt();
  26568. if (data2 === 0xFFFF) {
  26569. data2 = -1;
  26570. }
  26571. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  26572. atn.lexerActions[i] = lexerAction;
  26573. }
  26574. }
  26575. };
  26576. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  26577. var i;
  26578. var count = atn.ruleToStartState.length;
  26579. for (i = 0; i < count; i++) {
  26580. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  26581. }
  26582. for (i = 0; i < count; i++) {
  26583. this.generateRuleBypassTransition(atn, i);
  26584. }
  26585. };
  26586. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  26587. var i, state;
  26588. var bypassStart = new BasicBlockStartState();
  26589. bypassStart.ruleIndex = idx;
  26590. atn.addState(bypassStart);
  26591. var bypassStop = new BlockEndState();
  26592. bypassStop.ruleIndex = idx;
  26593. atn.addState(bypassStop);
  26594. bypassStart.endState = bypassStop;
  26595. atn.defineDecisionState(bypassStart);
  26596. bypassStop.startState = bypassStart;
  26597. var excludeTransition = null;
  26598. var endState = null;
  26599. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26600. // wrap from the beginning of the rule to the StarLoopEntryState
  26601. endState = null;
  26602. for (i = 0; i < atn.states.length; i++) {
  26603. state = atn.states[i];
  26604. if (this.stateIsEndStateFor(state, idx)) {
  26605. endState = state;
  26606. excludeTransition = state.loopBackState.transitions[0];
  26607. break;
  26608. }
  26609. }
  26610. if (excludeTransition === null) {
  26611. throw "Couldn't identify final state of the precedence rule prefix section.";
  26612. }
  26613. } else {
  26614. endState = atn.ruleToStopState[idx];
  26615. }
  26616. // all non-excluded transitions that currently target end state need to
  26617. // target blockEnd instead
  26618. for (i = 0; i < atn.states.length; i++) {
  26619. state = atn.states[i];
  26620. for (var j = 0; j < state.transitions.length; j++) {
  26621. var transition = state.transitions[j];
  26622. if (transition === excludeTransition) {
  26623. continue;
  26624. }
  26625. if (transition.target === endState) {
  26626. transition.target = bypassStop;
  26627. }
  26628. }
  26629. }
  26630. // all transitions leaving the rule start state need to leave blockStart
  26631. // instead
  26632. var ruleToStartState = atn.ruleToStartState[idx];
  26633. var count = ruleToStartState.transitions.length;
  26634. while (count > 0) {
  26635. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26636. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26637. }
  26638. // link the new states
  26639. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26640. bypassStop.addTransition(new EpsilonTransition(endState));
  26641. var matchState = new BasicState();
  26642. atn.addState(matchState);
  26643. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26644. bypassStart.addTransition(new EpsilonTransition(matchState));
  26645. };
  26646. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26647. if (state.ruleIndex !== idx) {
  26648. return null;
  26649. }
  26650. if (!(state instanceof StarLoopEntryState)) {
  26651. return null;
  26652. }
  26653. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26654. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26655. return null;
  26656. }
  26657. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26658. return state;
  26659. } else {
  26660. return null;
  26661. }
  26662. };
  26663. //
  26664. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26665. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26666. // correct value.
  26667. //
  26668. // @param atn The ATN.
  26669. //
  26670. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26671. for (var i = 0; i < atn.states.length; i++) {
  26672. var state = atn.states[i];
  26673. if (!(state instanceof StarLoopEntryState)) {
  26674. continue;
  26675. }
  26676. // We analyze the ATN to determine if this ATN decision state is the
  26677. // decision for the closure block that determines whether a
  26678. // precedence rule should continue or complete.
  26679. //
  26680. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26681. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26682. if (maybeLoopEndState instanceof LoopEndState) {
  26683. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26684. state.isPrecedenceDecision = true;
  26685. }
  26686. }
  26687. }
  26688. }
  26689. };
  26690. ATNDeserializer.prototype.verifyATN = function (atn) {
  26691. if (!this.deserializationOptions.verifyATN) {
  26692. return;
  26693. }
  26694. // verify assumptions
  26695. for (var i = 0; i < atn.states.length; i++) {
  26696. var state = atn.states[i];
  26697. if (state === null) {
  26698. continue;
  26699. }
  26700. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26701. if (state instanceof PlusBlockStartState) {
  26702. this.checkCondition(state.loopBackState !== null);
  26703. } else if (state instanceof StarLoopEntryState) {
  26704. this.checkCondition(state.loopBackState !== null);
  26705. this.checkCondition(state.transitions.length === 2);
  26706. if (state.transitions[0].target instanceof StarBlockStartState) {
  26707. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26708. this.checkCondition(!state.nonGreedy);
  26709. } else if (state.transitions[0].target instanceof LoopEndState) {
  26710. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26711. this.checkCondition(state.nonGreedy);
  26712. } else {
  26713. throw "IllegalState";
  26714. }
  26715. } else if (state instanceof StarLoopbackState) {
  26716. this.checkCondition(state.transitions.length === 1);
  26717. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26718. } else if (state instanceof LoopEndState) {
  26719. this.checkCondition(state.loopBackState !== null);
  26720. } else if (state instanceof RuleStartState) {
  26721. this.checkCondition(state.stopState !== null);
  26722. } else if (state instanceof BlockStartState) {
  26723. this.checkCondition(state.endState !== null);
  26724. } else if (state instanceof BlockEndState) {
  26725. this.checkCondition(state.startState !== null);
  26726. } else if (state instanceof DecisionState) {
  26727. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  26728. } else {
  26729. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  26730. }
  26731. }
  26732. };
  26733. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  26734. if (!condition) {
  26735. if (message === undefined || message === null) {
  26736. message = "IllegalState";
  26737. }
  26738. throw message;
  26739. }
  26740. };
  26741. ATNDeserializer.prototype.readInt = function () {
  26742. return this.data[this.pos++];
  26743. };
  26744. ATNDeserializer.prototype.readInt32 = function () {
  26745. var low = this.readInt();
  26746. var high = this.readInt();
  26747. return low | high << 16;
  26748. };
  26749. ATNDeserializer.prototype.readLong = function () {
  26750. var low = this.readInt32();
  26751. var high = this.readInt32();
  26752. return low & 0x00000000FFFFFFFF | high << 32;
  26753. };
  26754. function createByteToHex() {
  26755. var bth = [];
  26756. for (var i = 0; i < 256; i++) {
  26757. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  26758. }
  26759. return bth;
  26760. }
  26761. var byteToHex = createByteToHex();
  26762. ATNDeserializer.prototype.readUUID = function () {
  26763. var bb = [];
  26764. for (var i = 7; i >= 0; i--) {
  26765. var int = this.readInt();
  26766. /* jshint bitwise: false */
  26767. bb[2 * i + 1] = int & 0xFF;
  26768. bb[2 * i] = int >> 8 & 0xFF;
  26769. }
  26770. return byteToHex[bb[0]] + byteToHex[bb[1]] + byteToHex[bb[2]] + byteToHex[bb[3]] + '-' + byteToHex[bb[4]] + byteToHex[bb[5]] + '-' + byteToHex[bb[6]] + byteToHex[bb[7]] + '-' + byteToHex[bb[8]] + byteToHex[bb[9]] + '-' + byteToHex[bb[10]] + byteToHex[bb[11]] + byteToHex[bb[12]] + byteToHex[bb[13]] + byteToHex[bb[14]] + byteToHex[bb[15]];
  26771. };
  26772. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  26773. var target = atn.states[trg];
  26774. switch (type) {
  26775. case Transition.EPSILON:
  26776. return new EpsilonTransition(target);
  26777. case Transition.RANGE:
  26778. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  26779. case Transition.RULE:
  26780. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  26781. case Transition.PREDICATE:
  26782. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  26783. case Transition.PRECEDENCE:
  26784. return new PrecedencePredicateTransition(target, arg1);
  26785. case Transition.ATOM:
  26786. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  26787. case Transition.ACTION:
  26788. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  26789. case Transition.SET:
  26790. return new SetTransition(target, sets[arg1]);
  26791. case Transition.NOT_SET:
  26792. return new NotSetTransition(target, sets[arg1]);
  26793. case Transition.WILDCARD:
  26794. return new WildcardTransition(target);
  26795. default:
  26796. throw "The specified transition type: " + type + " is not valid.";
  26797. }
  26798. };
  26799. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  26800. if (this.stateFactories === null) {
  26801. var sf = [];
  26802. sf[ATNState.INVALID_TYPE] = null;
  26803. sf[ATNState.BASIC] = function () {
  26804. return new BasicState();
  26805. };
  26806. sf[ATNState.RULE_START] = function () {
  26807. return new RuleStartState();
  26808. };
  26809. sf[ATNState.BLOCK_START] = function () {
  26810. return new BasicBlockStartState();
  26811. };
  26812. sf[ATNState.PLUS_BLOCK_START] = function () {
  26813. return new PlusBlockStartState();
  26814. };
  26815. sf[ATNState.STAR_BLOCK_START] = function () {
  26816. return new StarBlockStartState();
  26817. };
  26818. sf[ATNState.TOKEN_START] = function () {
  26819. return new TokensStartState();
  26820. };
  26821. sf[ATNState.RULE_STOP] = function () {
  26822. return new RuleStopState();
  26823. };
  26824. sf[ATNState.BLOCK_END] = function () {
  26825. return new BlockEndState();
  26826. };
  26827. sf[ATNState.STAR_LOOP_BACK] = function () {
  26828. return new StarLoopbackState();
  26829. };
  26830. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  26831. return new StarLoopEntryState();
  26832. };
  26833. sf[ATNState.PLUS_LOOP_BACK] = function () {
  26834. return new PlusLoopbackState();
  26835. };
  26836. sf[ATNState.LOOP_END] = function () {
  26837. return new LoopEndState();
  26838. };
  26839. this.stateFactories = sf;
  26840. }
  26841. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  26842. throw "The specified state type " + type + " is not valid.";
  26843. } else {
  26844. var s = this.stateFactories[type]();
  26845. if (s !== null) {
  26846. s.ruleIndex = ruleIndex;
  26847. return s;
  26848. }
  26849. }
  26850. };
  26851. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  26852. if (this.actionFactories === null) {
  26853. var af = [];
  26854. af[LexerActionType.CHANNEL] = function (data1, data2) {
  26855. return new LexerChannelAction(data1);
  26856. };
  26857. af[LexerActionType.CUSTOM] = function (data1, data2) {
  26858. return new LexerCustomAction(data1, data2);
  26859. };
  26860. af[LexerActionType.MODE] = function (data1, data2) {
  26861. return new LexerModeAction(data1);
  26862. };
  26863. af[LexerActionType.MORE] = function (data1, data2) {
  26864. return LexerMoreAction.INSTANCE;
  26865. };
  26866. af[LexerActionType.POP_MODE] = function (data1, data2) {
  26867. return LexerPopModeAction.INSTANCE;
  26868. };
  26869. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  26870. return new LexerPushModeAction(data1);
  26871. };
  26872. af[LexerActionType.SKIP] = function (data1, data2) {
  26873. return LexerSkipAction.INSTANCE;
  26874. };
  26875. af[LexerActionType.TYPE] = function (data1, data2) {
  26876. return new LexerTypeAction(data1);
  26877. };
  26878. this.actionFactories = af;
  26879. }
  26880. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  26881. throw "The specified lexer action type " + type + " is not valid.";
  26882. } else {
  26883. return this.actionFactories[type](data1, data2);
  26884. }
  26885. };
  26886. exports.ATNDeserializer = ATNDeserializer;
  26887. /***/ }),
  26888. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  26889. /*!*************************************************!*\
  26890. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  26891. \*************************************************/
  26892. /*! no static exports found */
  26893. /***/ (function(module, exports, __webpack_require__) {
  26894. "use strict";
  26895. //
  26896. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26897. * Use of this file is governed by the BSD 3-clause license that
  26898. * can be found in the LICENSE.txt file in the project root.
  26899. */
  26900. ///
  26901. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26902. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26903. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  26904. function ATNSimulator(atn, sharedContextCache) {
  26905. // The context cache maps all PredictionContext objects that are ==
  26906. // to a single cached copy. This cache is shared across all contexts
  26907. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  26908. // to use only cached nodes/graphs in addDFAState(). We don't want to
  26909. // fill this during closure() since there are lots of contexts that
  26910. // pop up but are not used ever again. It also greatly slows down closure().
  26911. //
  26912. // <p>This cache makes a huge difference in memory and a little bit in speed.
  26913. // For the Java grammar on java.*, it dropped the memory requirements
  26914. // at the end from 25M to 16M. We don't store any of the full context
  26915. // graphs in the DFA because they are limited to local context only,
  26916. // but apparently there's a lot of repetition there as well. We optimize
  26917. // the config contexts before storing the config set in the DFA states
  26918. // by literally rebuilding them with cached subgraphs only.</p>
  26919. //
  26920. // <p>I tried a cache for use during closure operations, that was
  26921. // whacked after each adaptivePredict(). It cost a little bit
  26922. // more time I think and doesn't save on the overall footprint
  26923. // so it's not worth the complexity.</p>
  26924. ///
  26925. this.atn = atn;
  26926. this.sharedContextCache = sharedContextCache;
  26927. return this;
  26928. }
  26929. // Must distinguish between missing edge and edge we know leads nowhere///
  26930. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  26931. ATNSimulator.prototype.getCachedContext = function (context) {
  26932. if (this.sharedContextCache === null) {
  26933. return context;
  26934. }
  26935. var visited = {};
  26936. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  26937. };
  26938. exports.ATNSimulator = ATNSimulator;
  26939. /***/ }),
  26940. /***/ "./node_modules/antlr4/atn/ATNState.js":
  26941. /*!*********************************************!*\
  26942. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  26943. \*********************************************/
  26944. /*! no static exports found */
  26945. /***/ (function(module, exports, __webpack_require__) {
  26946. "use strict";
  26947. //
  26948. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26949. * Use of this file is governed by the BSD 3-clause license that
  26950. * can be found in the LICENSE.txt file in the project root.
  26951. */
  26952. //
  26953. // The following images show the relation of states and
  26954. // {@link ATNState//transitions} for various grammar constructs.
  26955. //
  26956. // <ul>
  26957. //
  26958. // <li>Solid edges marked with an &//0949; indicate a required
  26959. // {@link EpsilonTransition}.</li>
  26960. //
  26961. // <li>Dashed edges indicate locations where any transition derived from
  26962. // {@link Transition} might appear.</li>
  26963. //
  26964. // <li>Dashed nodes are place holders for either a sequence of linked
  26965. // {@link BasicState} states or the inclusion of a block representing a nested
  26966. // construct in one of the forms below.</li>
  26967. //
  26968. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  26969. // any number of alternatives (one or more). Nodes without the {@code ...} only
  26970. // support the exact number of alternatives shown in the diagram.</li>
  26971. //
  26972. // </ul>
  26973. //
  26974. // <h2>Basic Blocks</h2>
  26975. //
  26976. // <h3>Rule</h3>
  26977. //
  26978. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  26979. //
  26980. // <h3>Block of 1 or more alternatives</h3>
  26981. //
  26982. // <embed src="images/Block.svg" type="image/svg+xml"/>
  26983. //
  26984. // <h2>Greedy Loops</h2>
  26985. //
  26986. // <h3>Greedy Closure: {@code (...)*}</h3>
  26987. //
  26988. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  26989. //
  26990. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  26991. //
  26992. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  26993. //
  26994. // <h3>Greedy Optional: {@code (...)?}</h3>
  26995. //
  26996. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  26997. //
  26998. // <h2>Non-Greedy Loops</h2>
  26999. //
  27000. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  27001. //
  27002. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  27003. //
  27004. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  27005. //
  27006. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  27007. //
  27008. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  27009. //
  27010. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  27011. //
  27012. var INITIAL_NUM_TRANSITIONS = 4;
  27013. function ATNState() {
  27014. // Which ATN are we in?
  27015. this.atn = null;
  27016. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  27017. this.stateType = null;
  27018. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  27019. this.epsilonOnlyTransitions = false;
  27020. // Track the transitions emanating from this ATN state.
  27021. this.transitions = [];
  27022. // Used to cache lookahead during parsing, not used during construction
  27023. this.nextTokenWithinRule = null;
  27024. return this;
  27025. }
  27026. // constants for serialization
  27027. ATNState.INVALID_TYPE = 0;
  27028. ATNState.BASIC = 1;
  27029. ATNState.RULE_START = 2;
  27030. ATNState.BLOCK_START = 3;
  27031. ATNState.PLUS_BLOCK_START = 4;
  27032. ATNState.STAR_BLOCK_START = 5;
  27033. ATNState.TOKEN_START = 6;
  27034. ATNState.RULE_STOP = 7;
  27035. ATNState.BLOCK_END = 8;
  27036. ATNState.STAR_LOOP_BACK = 9;
  27037. ATNState.STAR_LOOP_ENTRY = 10;
  27038. ATNState.PLUS_LOOP_BACK = 11;
  27039. ATNState.LOOP_END = 12;
  27040. ATNState.serializationNames = ["INVALID", "BASIC", "RULE_START", "BLOCK_START", "PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP", "BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"];
  27041. ATNState.INVALID_STATE_NUMBER = -1;
  27042. ATNState.prototype.toString = function () {
  27043. return this.stateNumber;
  27044. };
  27045. ATNState.prototype.equals = function (other) {
  27046. if (other instanceof ATNState) {
  27047. return this.stateNumber === other.stateNumber;
  27048. } else {
  27049. return false;
  27050. }
  27051. };
  27052. ATNState.prototype.isNonGreedyExitState = function () {
  27053. return false;
  27054. };
  27055. ATNState.prototype.addTransition = function (trans, index) {
  27056. if (index === undefined) {
  27057. index = -1;
  27058. }
  27059. if (this.transitions.length === 0) {
  27060. this.epsilonOnlyTransitions = trans.isEpsilon;
  27061. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  27062. this.epsilonOnlyTransitions = false;
  27063. }
  27064. if (index === -1) {
  27065. this.transitions.push(trans);
  27066. } else {
  27067. this.transitions.splice(index, 1, trans);
  27068. }
  27069. };
  27070. function BasicState() {
  27071. ATNState.call(this);
  27072. this.stateType = ATNState.BASIC;
  27073. return this;
  27074. }
  27075. BasicState.prototype = Object.create(ATNState.prototype);
  27076. BasicState.prototype.constructor = BasicState;
  27077. function DecisionState() {
  27078. ATNState.call(this);
  27079. this.decision = -1;
  27080. this.nonGreedy = false;
  27081. return this;
  27082. }
  27083. DecisionState.prototype = Object.create(ATNState.prototype);
  27084. DecisionState.prototype.constructor = DecisionState;
  27085. // The start of a regular {@code (...)} block.
  27086. function BlockStartState() {
  27087. DecisionState.call(this);
  27088. this.endState = null;
  27089. return this;
  27090. }
  27091. BlockStartState.prototype = Object.create(DecisionState.prototype);
  27092. BlockStartState.prototype.constructor = BlockStartState;
  27093. function BasicBlockStartState() {
  27094. BlockStartState.call(this);
  27095. this.stateType = ATNState.BLOCK_START;
  27096. return this;
  27097. }
  27098. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27099. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  27100. // Terminal node of a simple {@code (a|b|c)} block.
  27101. function BlockEndState() {
  27102. ATNState.call(this);
  27103. this.stateType = ATNState.BLOCK_END;
  27104. this.startState = null;
  27105. return this;
  27106. }
  27107. BlockEndState.prototype = Object.create(ATNState.prototype);
  27108. BlockEndState.prototype.constructor = BlockEndState;
  27109. // The last node in the ATN for a rule, unless that rule is the start symbol.
  27110. // In that case, there is one transition to EOF. Later, we might encode
  27111. // references to all calls to this rule to compute FOLLOW sets for
  27112. // error handling.
  27113. //
  27114. function RuleStopState() {
  27115. ATNState.call(this);
  27116. this.stateType = ATNState.RULE_STOP;
  27117. return this;
  27118. }
  27119. RuleStopState.prototype = Object.create(ATNState.prototype);
  27120. RuleStopState.prototype.constructor = RuleStopState;
  27121. function RuleStartState() {
  27122. ATNState.call(this);
  27123. this.stateType = ATNState.RULE_START;
  27124. this.stopState = null;
  27125. this.isPrecedenceRule = false;
  27126. return this;
  27127. }
  27128. RuleStartState.prototype = Object.create(ATNState.prototype);
  27129. RuleStartState.prototype.constructor = RuleStartState;
  27130. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  27131. // one to the loop back to start of the block and one to exit.
  27132. //
  27133. function PlusLoopbackState() {
  27134. DecisionState.call(this);
  27135. this.stateType = ATNState.PLUS_LOOP_BACK;
  27136. return this;
  27137. }
  27138. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  27139. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  27140. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  27141. // we don't use for code generation; somebody might need it, so I'm defining
  27142. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  27143. // real decision-making note for {@code A+}.
  27144. //
  27145. function PlusBlockStartState() {
  27146. BlockStartState.call(this);
  27147. this.stateType = ATNState.PLUS_BLOCK_START;
  27148. this.loopBackState = null;
  27149. return this;
  27150. }
  27151. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27152. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  27153. // The block that begins a closure loop.
  27154. function StarBlockStartState() {
  27155. BlockStartState.call(this);
  27156. this.stateType = ATNState.STAR_BLOCK_START;
  27157. return this;
  27158. }
  27159. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27160. StarBlockStartState.prototype.constructor = StarBlockStartState;
  27161. function StarLoopbackState() {
  27162. ATNState.call(this);
  27163. this.stateType = ATNState.STAR_LOOP_BACK;
  27164. return this;
  27165. }
  27166. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  27167. StarLoopbackState.prototype.constructor = StarLoopbackState;
  27168. function StarLoopEntryState() {
  27169. DecisionState.call(this);
  27170. this.stateType = ATNState.STAR_LOOP_ENTRY;
  27171. this.loopBackState = null;
  27172. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  27173. this.isPrecedenceDecision = null;
  27174. return this;
  27175. }
  27176. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  27177. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  27178. // Mark the end of a * or + loop.
  27179. function LoopEndState() {
  27180. ATNState.call(this);
  27181. this.stateType = ATNState.LOOP_END;
  27182. this.loopBackState = null;
  27183. return this;
  27184. }
  27185. LoopEndState.prototype = Object.create(ATNState.prototype);
  27186. LoopEndState.prototype.constructor = LoopEndState;
  27187. // The Tokens rule start state linking to each lexer rule start state */
  27188. function TokensStartState() {
  27189. DecisionState.call(this);
  27190. this.stateType = ATNState.TOKEN_START;
  27191. return this;
  27192. }
  27193. TokensStartState.prototype = Object.create(DecisionState.prototype);
  27194. TokensStartState.prototype.constructor = TokensStartState;
  27195. exports.ATNState = ATNState;
  27196. exports.BasicState = BasicState;
  27197. exports.DecisionState = DecisionState;
  27198. exports.BlockStartState = BlockStartState;
  27199. exports.BlockEndState = BlockEndState;
  27200. exports.LoopEndState = LoopEndState;
  27201. exports.RuleStartState = RuleStartState;
  27202. exports.RuleStopState = RuleStopState;
  27203. exports.TokensStartState = TokensStartState;
  27204. exports.PlusLoopbackState = PlusLoopbackState;
  27205. exports.StarLoopbackState = StarLoopbackState;
  27206. exports.StarLoopEntryState = StarLoopEntryState;
  27207. exports.PlusBlockStartState = PlusBlockStartState;
  27208. exports.StarBlockStartState = StarBlockStartState;
  27209. exports.BasicBlockStartState = BasicBlockStartState;
  27210. /***/ }),
  27211. /***/ "./node_modules/antlr4/atn/ATNType.js":
  27212. /*!********************************************!*\
  27213. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  27214. \********************************************/
  27215. /*! no static exports found */
  27216. /***/ (function(module, exports, __webpack_require__) {
  27217. "use strict";
  27218. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27219. * Use of this file is governed by the BSD 3-clause license that
  27220. * can be found in the LICENSE.txt file in the project root.
  27221. */
  27222. ///
  27223. // Represents the type of recognizer an ATN applies to.
  27224. function ATNType() {}
  27225. ATNType.LEXER = 0;
  27226. ATNType.PARSER = 1;
  27227. exports.ATNType = ATNType;
  27228. /***/ }),
  27229. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  27230. /*!******************************************************!*\
  27231. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  27232. \******************************************************/
  27233. /*! no static exports found */
  27234. /***/ (function(module, exports, __webpack_require__) {
  27235. "use strict";
  27236. //
  27237. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27238. * Use of this file is governed by the BSD 3-clause license that
  27239. * can be found in the LICENSE.txt file in the project root.
  27240. */
  27241. ///
  27242. // When we hit an accept state in either the DFA or the ATN, we
  27243. // have to notify the character stream to start buffering characters
  27244. // via {@link IntStream//mark} and record the current state. The current sim state
  27245. // includes the current index into the input, the current line,
  27246. // and current character position in that line. Note that the Lexer is
  27247. // tracking the starting line and characterization of the token. These
  27248. // variables track the "state" of the simulator when it hits an accept state.
  27249. //
  27250. // <p>We track these variables separately for the DFA and ATN simulation
  27251. // because the DFA simulation often has to fail over to the ATN
  27252. // simulation. If the ATN simulation fails, we need the DFA to fall
  27253. // back to its previously accepted state, if any. If the ATN succeeds,
  27254. // then the ATN does the accept and the DFA simulator that invoked it
  27255. // can simply return the predicted token type.</p>
  27256. ///
  27257. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  27258. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  27259. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  27260. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  27261. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27262. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27263. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  27264. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  27265. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  27266. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27267. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  27268. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  27269. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  27270. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  27271. function resetSimState(sim) {
  27272. sim.index = -1;
  27273. sim.line = 0;
  27274. sim.column = -1;
  27275. sim.dfaState = null;
  27276. }
  27277. function SimState() {
  27278. resetSimState(this);
  27279. return this;
  27280. }
  27281. SimState.prototype.reset = function () {
  27282. resetSimState(this);
  27283. };
  27284. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  27285. ATNSimulator.call(this, atn, sharedContextCache);
  27286. this.decisionToDFA = decisionToDFA;
  27287. this.recog = recog;
  27288. // The current token's starting index into the character stream.
  27289. // Shared across DFA to ATN simulation in case the ATN fails and the
  27290. // DFA did not have a previous accept state. In this case, we use the
  27291. // ATN-generated exception object.
  27292. this.startIndex = -1;
  27293. // line number 1..n within the input///
  27294. this.line = 1;
  27295. // The index of the character relative to the beginning of the line
  27296. // 0..n-1///
  27297. this.column = 0;
  27298. this.mode = Lexer.DEFAULT_MODE;
  27299. // Used during DFA/ATN exec to record the most recent accept configuration
  27300. // info
  27301. this.prevAccept = new SimState();
  27302. // done
  27303. return this;
  27304. }
  27305. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  27306. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  27307. LexerATNSimulator.debug = false;
  27308. LexerATNSimulator.dfa_debug = false;
  27309. LexerATNSimulator.MIN_DFA_EDGE = 0;
  27310. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  27311. LexerATNSimulator.match_calls = 0;
  27312. LexerATNSimulator.prototype.copyState = function (simulator) {
  27313. this.column = simulator.column;
  27314. this.line = simulator.line;
  27315. this.mode = simulator.mode;
  27316. this.startIndex = simulator.startIndex;
  27317. };
  27318. LexerATNSimulator.prototype.match = function (input, mode) {
  27319. this.match_calls += 1;
  27320. this.mode = mode;
  27321. var mark = input.mark();
  27322. try {
  27323. this.startIndex = input.index;
  27324. this.prevAccept.reset();
  27325. var dfa = this.decisionToDFA[mode];
  27326. if (dfa.s0 === null) {
  27327. return this.matchATN(input);
  27328. } else {
  27329. return this.execATN(input, dfa.s0);
  27330. }
  27331. } finally {
  27332. input.release(mark);
  27333. }
  27334. };
  27335. LexerATNSimulator.prototype.reset = function () {
  27336. this.prevAccept.reset();
  27337. this.startIndex = -1;
  27338. this.line = 1;
  27339. this.column = 0;
  27340. this.mode = Lexer.DEFAULT_MODE;
  27341. };
  27342. LexerATNSimulator.prototype.matchATN = function (input) {
  27343. var startState = this.atn.modeToStartState[this.mode];
  27344. if (LexerATNSimulator.debug) {
  27345. console.log("matchATN mode " + this.mode + " start: " + startState);
  27346. }
  27347. var old_mode = this.mode;
  27348. var s0_closure = this.computeStartState(input, startState);
  27349. var suppressEdge = s0_closure.hasSemanticContext;
  27350. s0_closure.hasSemanticContext = false;
  27351. var next = this.addDFAState(s0_closure);
  27352. if (!suppressEdge) {
  27353. this.decisionToDFA[this.mode].s0 = next;
  27354. }
  27355. var predict = this.execATN(input, next);
  27356. if (LexerATNSimulator.debug) {
  27357. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  27358. }
  27359. return predict;
  27360. };
  27361. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  27362. if (LexerATNSimulator.debug) {
  27363. console.log("start state closure=" + ds0.configs);
  27364. }
  27365. if (ds0.isAcceptState) {
  27366. // allow zero-length tokens
  27367. this.captureSimState(this.prevAccept, input, ds0);
  27368. }
  27369. var t = input.LA(1);
  27370. var s = ds0; // s is current/from DFA state
  27371. while (true) {
  27372. // while more work
  27373. if (LexerATNSimulator.debug) {
  27374. console.log("execATN loop starting closure: " + s.configs);
  27375. }
  27376. // As we move src->trg, src->trg, we keep track of the previous trg to
  27377. // avoid looking up the DFA state again, which is expensive.
  27378. // If the previous target was already part of the DFA, we might
  27379. // be able to avoid doing a reach operation upon t. If s!=null,
  27380. // it means that semantic predicates didn't prevent us from
  27381. // creating a DFA state. Once we know s!=null, we check to see if
  27382. // the DFA state has an edge already for t. If so, we can just reuse
  27383. // it's configuration set; there's no point in re-computing it.
  27384. // This is kind of like doing DFA simulation within the ATN
  27385. // simulation because DFA simulation is really just a way to avoid
  27386. // computing reach/closure sets. Technically, once we know that
  27387. // we have a previously added DFA state, we could jump over to
  27388. // the DFA simulator. But, that would mean popping back and forth
  27389. // a lot and making things more complicated algorithmically.
  27390. // This optimization makes a lot of sense for loops within DFA.
  27391. // A character will take us back to an existing DFA state
  27392. // that already has lots of edges out of it. e.g., .* in comments.
  27393. // print("Target for:" + str(s) + " and:" + str(t))
  27394. var target = this.getExistingTargetState(s, t);
  27395. // print("Existing:" + str(target))
  27396. if (target === null) {
  27397. target = this.computeTargetState(input, s, t);
  27398. // print("Computed:" + str(target))
  27399. }
  27400. if (target === ATNSimulator.ERROR) {
  27401. break;
  27402. }
  27403. // If this is a consumable input element, make sure to consume before
  27404. // capturing the accept state so the input index, line, and char
  27405. // position accurately reflect the state of the interpreter at the
  27406. // end of the token.
  27407. if (t !== Token.EOF) {
  27408. this.consume(input);
  27409. }
  27410. if (target.isAcceptState) {
  27411. this.captureSimState(this.prevAccept, input, target);
  27412. if (t === Token.EOF) {
  27413. break;
  27414. }
  27415. }
  27416. t = input.LA(1);
  27417. s = target; // flip; current DFA target becomes new src/from state
  27418. }
  27419. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  27420. };
  27421. // Get an existing target state for an edge in the DFA. If the target state
  27422. // for the edge has not yet been computed or is otherwise not available,
  27423. // this method returns {@code null}.
  27424. //
  27425. // @param s The current DFA state
  27426. // @param t The next input symbol
  27427. // @return The existing target DFA state for the given input symbol
  27428. // {@code t}, or {@code null} if the target state for this edge is not
  27429. // already cached
  27430. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  27431. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  27432. return null;
  27433. }
  27434. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  27435. if (target === undefined) {
  27436. target = null;
  27437. }
  27438. if (LexerATNSimulator.debug && target !== null) {
  27439. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  27440. }
  27441. return target;
  27442. };
  27443. // Compute a target state for an edge in the DFA, and attempt to add the
  27444. // computed state and corresponding edge to the DFA.
  27445. //
  27446. // @param input The input stream
  27447. // @param s The current DFA state
  27448. // @param t The next input symbol
  27449. //
  27450. // @return The computed target DFA state for the given input symbol
  27451. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  27452. // returns {@link //ERROR}.
  27453. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  27454. var reach = new OrderedATNConfigSet();
  27455. // if we don't find an existing DFA state
  27456. // Fill reach starting from closure, following t transitions
  27457. this.getReachableConfigSet(input, s.configs, reach, t);
  27458. if (reach.items.length === 0) {
  27459. // we got nowhere on t from s
  27460. if (!reach.hasSemanticContext) {
  27461. // we got nowhere on t, don't throw out this knowledge; it'd
  27462. // cause a failover from DFA later.
  27463. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  27464. }
  27465. // stop when we can't match any more char
  27466. return ATNSimulator.ERROR;
  27467. }
  27468. // Add an edge from s to target DFA found/created for reach
  27469. return this.addDFAEdge(s, t, null, reach);
  27470. };
  27471. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  27472. if (this.prevAccept.dfaState !== null) {
  27473. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  27474. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  27475. return prevAccept.dfaState.prediction;
  27476. } else {
  27477. // if no accept and EOF is first char, return EOF
  27478. if (t === Token.EOF && input.index === this.startIndex) {
  27479. return Token.EOF;
  27480. }
  27481. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  27482. }
  27483. };
  27484. // Given a starting configuration set, figure out all ATN configurations
  27485. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  27486. // parameter.
  27487. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  27488. // this is used to skip processing for configs which have a lower priority
  27489. // than a config that already reached an accept state for the same rule
  27490. var skipAlt = ATN.INVALID_ALT_NUMBER;
  27491. for (var i = 0; i < closure.items.length; i++) {
  27492. var cfg = closure.items[i];
  27493. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  27494. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  27495. continue;
  27496. }
  27497. if (LexerATNSimulator.debug) {
  27498. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  27499. }
  27500. for (var j = 0; j < cfg.state.transitions.length; j++) {
  27501. var trans = cfg.state.transitions[j]; // for each transition
  27502. var target = this.getReachableTarget(trans, t);
  27503. if (target !== null) {
  27504. var lexerActionExecutor = cfg.lexerActionExecutor;
  27505. if (lexerActionExecutor !== null) {
  27506. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  27507. }
  27508. var treatEofAsEpsilon = t === Token.EOF;
  27509. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  27510. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  27511. // any remaining configs for this alt have a lower priority
  27512. // than the one that just reached an accept state.
  27513. skipAlt = cfg.alt;
  27514. }
  27515. }
  27516. }
  27517. }
  27518. };
  27519. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  27520. if (LexerATNSimulator.debug) {
  27521. console.log("ACTION %s\n", lexerActionExecutor);
  27522. }
  27523. // seek to after last char in token
  27524. input.seek(index);
  27525. this.line = line;
  27526. this.column = charPos;
  27527. if (lexerActionExecutor !== null && this.recog !== null) {
  27528. lexerActionExecutor.execute(this.recog, input, startIndex);
  27529. }
  27530. };
  27531. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  27532. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  27533. return trans.target;
  27534. } else {
  27535. return null;
  27536. }
  27537. };
  27538. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  27539. var initialContext = PredictionContext.EMPTY;
  27540. var configs = new OrderedATNConfigSet();
  27541. for (var i = 0; i < p.transitions.length; i++) {
  27542. var target = p.transitions[i].target;
  27543. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  27544. this.closure(input, cfg, configs, false, false, false);
  27545. }
  27546. return configs;
  27547. };
  27548. // Since the alternatives within any lexer decision are ordered by
  27549. // preference, this method stops pursuing the closure as soon as an accept
  27550. // state is reached. After the first accept state is reached by depth-first
  27551. // search from {@code config}, all other (potentially reachable) states for
  27552. // this rule would have a lower priority.
  27553. //
  27554. // @return {@code true} if an accept state is reached, otherwise
  27555. // {@code false}.
  27556. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  27557. var cfg = null;
  27558. if (LexerATNSimulator.debug) {
  27559. console.log("closure(" + config.toString(this.recog, true) + ")");
  27560. }
  27561. if (config.state instanceof RuleStopState) {
  27562. if (LexerATNSimulator.debug) {
  27563. if (this.recog !== null) {
  27564. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  27565. } else {
  27566. console.log("closure at rule stop %s\n", config);
  27567. }
  27568. }
  27569. if (config.context === null || config.context.hasEmptyPath()) {
  27570. if (config.context === null || config.context.isEmpty()) {
  27571. configs.add(config);
  27572. return true;
  27573. } else {
  27574. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  27575. currentAltReachedAcceptState = true;
  27576. }
  27577. }
  27578. if (config.context !== null && !config.context.isEmpty()) {
  27579. for (var i = 0; i < config.context.length; i++) {
  27580. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  27581. var newContext = config.context.getParent(i); // "pop" return state
  27582. var returnState = this.atn.states[config.context.getReturnState(i)];
  27583. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  27584. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27585. }
  27586. }
  27587. }
  27588. return currentAltReachedAcceptState;
  27589. }
  27590. // optimization
  27591. if (!config.state.epsilonOnlyTransitions) {
  27592. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27593. configs.add(config);
  27594. }
  27595. }
  27596. for (var j = 0; j < config.state.transitions.length; j++) {
  27597. var trans = config.state.transitions[j];
  27598. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27599. if (cfg !== null) {
  27600. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27601. }
  27602. }
  27603. return currentAltReachedAcceptState;
  27604. };
  27605. // side-effect: can alter configs.hasSemanticContext
  27606. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27607. var cfg = null;
  27608. if (trans.serializationType === Transition.RULE) {
  27609. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27610. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27611. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27612. throw "Precedence predicates are not supported in lexers.";
  27613. } else if (trans.serializationType === Transition.PREDICATE) {
  27614. // Track traversing semantic predicates. If we traverse,
  27615. // we cannot add a DFA state for this "reach" computation
  27616. // because the DFA would not test the predicate again in the
  27617. // future. Rather than creating collections of semantic predicates
  27618. // like v3 and testing them on prediction, v4 will test them on the
  27619. // fly all the time using the ATN not the DFA. This is slower but
  27620. // semantically it's not used that often. One of the key elements to
  27621. // this predicate mechanism is not adding DFA states that see
  27622. // predicates immediately afterwards in the ATN. For example,
  27623. // a : ID {p1}? | ID {p2}? ;
  27624. // should create the start state for rule 'a' (to save start state
  27625. // competition), but should not create target of ID state. The
  27626. // collection of ATN states the following ID references includes
  27627. // states reached by traversing predicates. Since this is when we
  27628. // test them, we cannot cash the DFA state target of ID.
  27629. if (LexerATNSimulator.debug) {
  27630. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27631. }
  27632. configs.hasSemanticContext = true;
  27633. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27634. cfg = new LexerATNConfig({ state: trans.target }, config);
  27635. }
  27636. } else if (trans.serializationType === Transition.ACTION) {
  27637. if (config.context === null || config.context.hasEmptyPath()) {
  27638. // execute actions anywhere in the start rule for a token.
  27639. //
  27640. // TODO: if the entry rule is invoked recursively, some
  27641. // actions may be executed during the recursive call. The
  27642. // problem can appear when hasEmptyPath() is true but
  27643. // isEmpty() is false. In this case, the config needs to be
  27644. // split into two contexts - one with just the empty path
  27645. // and another with everything but the empty path.
  27646. // Unfortunately, the current algorithm does not allow
  27647. // getEpsilonTarget to return two configurations, so
  27648. // additional modifications are needed before we can support
  27649. // the split operation.
  27650. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27651. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27652. } else {
  27653. // ignore actions in referenced rules
  27654. cfg = new LexerATNConfig({ state: trans.target }, config);
  27655. }
  27656. } else if (trans.serializationType === Transition.EPSILON) {
  27657. cfg = new LexerATNConfig({ state: trans.target }, config);
  27658. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27659. if (treatEofAsEpsilon) {
  27660. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27661. cfg = new LexerATNConfig({ state: trans.target }, config);
  27662. }
  27663. }
  27664. }
  27665. return cfg;
  27666. };
  27667. // Evaluate a predicate specified in the lexer.
  27668. //
  27669. // <p>If {@code speculative} is {@code true}, this method was called before
  27670. // {@link //consume} for the matched character. This method should call
  27671. // {@link //consume} before evaluating the predicate to ensure position
  27672. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27673. // and {@link Lexer//getcolumn}, properly reflect the current
  27674. // lexer state. This method should restore {@code input} and the simulator
  27675. // to the original state before returning (i.e. undo the actions made by the
  27676. // call to {@link //consume}.</p>
  27677. //
  27678. // @param input The input stream.
  27679. // @param ruleIndex The rule containing the predicate.
  27680. // @param predIndex The index of the predicate within the rule.
  27681. // @param speculative {@code true} if the current index in {@code input} is
  27682. // one character before the predicate's location.
  27683. //
  27684. // @return {@code true} if the specified predicate evaluates to
  27685. // {@code true}.
  27686. // /
  27687. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27688. // assume true if no recognizer was provided
  27689. if (this.recog === null) {
  27690. return true;
  27691. }
  27692. if (!speculative) {
  27693. return this.recog.sempred(null, ruleIndex, predIndex);
  27694. }
  27695. var savedcolumn = this.column;
  27696. var savedLine = this.line;
  27697. var index = input.index;
  27698. var marker = input.mark();
  27699. try {
  27700. this.consume(input);
  27701. return this.recog.sempred(null, ruleIndex, predIndex);
  27702. } finally {
  27703. this.column = savedcolumn;
  27704. this.line = savedLine;
  27705. input.seek(index);
  27706. input.release(marker);
  27707. }
  27708. };
  27709. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27710. settings.index = input.index;
  27711. settings.line = this.line;
  27712. settings.column = this.column;
  27713. settings.dfaState = dfaState;
  27714. };
  27715. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27716. if (to === undefined) {
  27717. to = null;
  27718. }
  27719. if (cfgs === undefined) {
  27720. cfgs = null;
  27721. }
  27722. if (to === null && cfgs !== null) {
  27723. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  27724. // marker indicating dynamic predicate evaluation makes this edge
  27725. // dependent on the specific input sequence, so the static edge in the
  27726. // DFA should be omitted. The target DFAState is still created since
  27727. // execATN has the ability to resynchronize with the DFA state cache
  27728. // following the predicate evaluation step.
  27729. //
  27730. // TJP notes: next time through the DFA, we see a pred again and eval.
  27731. // If that gets us to a previously created (but dangling) DFA
  27732. // state, we can continue in pure DFA mode from there.
  27733. // /
  27734. var suppressEdge = cfgs.hasSemanticContext;
  27735. cfgs.hasSemanticContext = false;
  27736. to = this.addDFAState(cfgs);
  27737. if (suppressEdge) {
  27738. return to;
  27739. }
  27740. }
  27741. // add the edge
  27742. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  27743. // Only track edges within the DFA bounds
  27744. return to;
  27745. }
  27746. if (LexerATNSimulator.debug) {
  27747. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  27748. }
  27749. if (from_.edges === null) {
  27750. // make room for tokens 1..n and -1 masquerading as index 0
  27751. from_.edges = [];
  27752. }
  27753. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  27754. return to;
  27755. };
  27756. // Add a new DFA state if there isn't one with this set of
  27757. // configurations already. This method also detects the first
  27758. // configuration containing an ATN rule stop state. Later, when
  27759. // traversing the DFA, we will know which rule to accept.
  27760. LexerATNSimulator.prototype.addDFAState = function (configs) {
  27761. var proposed = new DFAState(null, configs);
  27762. var firstConfigWithRuleStopState = null;
  27763. for (var i = 0; i < configs.items.length; i++) {
  27764. var cfg = configs.items[i];
  27765. if (cfg.state instanceof RuleStopState) {
  27766. firstConfigWithRuleStopState = cfg;
  27767. break;
  27768. }
  27769. }
  27770. if (firstConfigWithRuleStopState !== null) {
  27771. proposed.isAcceptState = true;
  27772. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  27773. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  27774. }
  27775. var dfa = this.decisionToDFA[this.mode];
  27776. var existing = dfa.states.get(proposed);
  27777. if (existing !== null) {
  27778. return existing;
  27779. }
  27780. var newState = proposed;
  27781. newState.stateNumber = dfa.states.length;
  27782. configs.setReadonly(true);
  27783. newState.configs = configs;
  27784. dfa.states.add(newState);
  27785. return newState;
  27786. };
  27787. LexerATNSimulator.prototype.getDFA = function (mode) {
  27788. return this.decisionToDFA[mode];
  27789. };
  27790. // Get the text matched so far for the current token.
  27791. LexerATNSimulator.prototype.getText = function (input) {
  27792. // index is first lookahead char, don't include.
  27793. return input.getText(this.startIndex, input.index - 1);
  27794. };
  27795. LexerATNSimulator.prototype.consume = function (input) {
  27796. var curChar = input.LA(1);
  27797. if (curChar === "\n".charCodeAt(0)) {
  27798. this.line += 1;
  27799. this.column = 0;
  27800. } else {
  27801. this.column += 1;
  27802. }
  27803. input.consume();
  27804. };
  27805. LexerATNSimulator.prototype.getTokenName = function (tt) {
  27806. if (tt === -1) {
  27807. return "EOF";
  27808. } else {
  27809. return "'" + String.fromCharCode(tt) + "'";
  27810. }
  27811. };
  27812. exports.LexerATNSimulator = LexerATNSimulator;
  27813. /***/ }),
  27814. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  27815. /*!************************************************!*\
  27816. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  27817. \************************************************/
  27818. /*! no static exports found */
  27819. /***/ (function(module, exports, __webpack_require__) {
  27820. "use strict";
  27821. //
  27822. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27823. * Use of this file is governed by the BSD 3-clause license that
  27824. * can be found in the LICENSE.txt file in the project root.
  27825. */
  27826. //
  27827. function LexerActionType() {}
  27828. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  27829. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  27830. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  27831. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  27832. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  27833. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  27834. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  27835. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  27836. function LexerAction(action) {
  27837. this.actionType = action;
  27838. this.isPositionDependent = false;
  27839. return this;
  27840. }
  27841. LexerAction.prototype.hashCode = function () {
  27842. var hash = new Hash();
  27843. this.updateHashCode(hash);
  27844. return hash.finish();
  27845. };
  27846. LexerAction.prototype.updateHashCode = function (hash) {
  27847. hash.update(this.actionType);
  27848. };
  27849. LexerAction.prototype.equals = function (other) {
  27850. return this === other;
  27851. };
  27852. //
  27853. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  27854. //
  27855. // <p>The {@code skip} command does not have any parameters, so this action is
  27856. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27857. function LexerSkipAction() {
  27858. LexerAction.call(this, LexerActionType.SKIP);
  27859. return this;
  27860. }
  27861. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  27862. LexerSkipAction.prototype.constructor = LexerSkipAction;
  27863. // Provides a singleton instance of this parameterless lexer action.
  27864. LexerSkipAction.INSTANCE = new LexerSkipAction();
  27865. LexerSkipAction.prototype.execute = function (lexer) {
  27866. lexer.skip();
  27867. };
  27868. LexerSkipAction.prototype.toString = function () {
  27869. return "skip";
  27870. };
  27871. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  27872. // with the assigned type.
  27873. function LexerTypeAction(type) {
  27874. LexerAction.call(this, LexerActionType.TYPE);
  27875. this.type = type;
  27876. return this;
  27877. }
  27878. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  27879. LexerTypeAction.prototype.constructor = LexerTypeAction;
  27880. LexerTypeAction.prototype.execute = function (lexer) {
  27881. lexer.type = this.type;
  27882. };
  27883. LexerTypeAction.prototype.updateHashCode = function (hash) {
  27884. hash.update(this.actionType, this.type);
  27885. };
  27886. LexerTypeAction.prototype.equals = function (other) {
  27887. if (this === other) {
  27888. return true;
  27889. } else if (!(other instanceof LexerTypeAction)) {
  27890. return false;
  27891. } else {
  27892. return this.type === other.type;
  27893. }
  27894. };
  27895. LexerTypeAction.prototype.toString = function () {
  27896. return "type(" + this.type + ")";
  27897. };
  27898. // Implements the {@code pushMode} lexer action by calling
  27899. // {@link Lexer//pushMode} with the assigned mode.
  27900. function LexerPushModeAction(mode) {
  27901. LexerAction.call(this, LexerActionType.PUSH_MODE);
  27902. this.mode = mode;
  27903. return this;
  27904. }
  27905. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  27906. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  27907. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  27908. // value provided by {@link //getMode}.</p>
  27909. LexerPushModeAction.prototype.execute = function (lexer) {
  27910. lexer.pushMode(this.mode);
  27911. };
  27912. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  27913. hash.update(this.actionType, this.mode);
  27914. };
  27915. LexerPushModeAction.prototype.equals = function (other) {
  27916. if (this === other) {
  27917. return true;
  27918. } else if (!(other instanceof LexerPushModeAction)) {
  27919. return false;
  27920. } else {
  27921. return this.mode === other.mode;
  27922. }
  27923. };
  27924. LexerPushModeAction.prototype.toString = function () {
  27925. return "pushMode(" + this.mode + ")";
  27926. };
  27927. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  27928. //
  27929. // <p>The {@code popMode} command does not have any parameters, so this action is
  27930. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27931. function LexerPopModeAction() {
  27932. LexerAction.call(this, LexerActionType.POP_MODE);
  27933. return this;
  27934. }
  27935. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  27936. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  27937. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  27938. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27939. LexerPopModeAction.prototype.execute = function (lexer) {
  27940. lexer.popMode();
  27941. };
  27942. LexerPopModeAction.prototype.toString = function () {
  27943. return "popMode";
  27944. };
  27945. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  27946. //
  27947. // <p>The {@code more} command does not have any parameters, so this action is
  27948. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27949. function LexerMoreAction() {
  27950. LexerAction.call(this, LexerActionType.MORE);
  27951. return this;
  27952. }
  27953. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  27954. LexerMoreAction.prototype.constructor = LexerMoreAction;
  27955. LexerMoreAction.INSTANCE = new LexerMoreAction();
  27956. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27957. LexerMoreAction.prototype.execute = function (lexer) {
  27958. lexer.more();
  27959. };
  27960. LexerMoreAction.prototype.toString = function () {
  27961. return "more";
  27962. };
  27963. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  27964. // the assigned mode.
  27965. function LexerModeAction(mode) {
  27966. LexerAction.call(this, LexerActionType.MODE);
  27967. this.mode = mode;
  27968. return this;
  27969. }
  27970. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  27971. LexerModeAction.prototype.constructor = LexerModeAction;
  27972. // <p>This action is implemented by calling {@link Lexer//mode} with the
  27973. // value provided by {@link //getMode}.</p>
  27974. LexerModeAction.prototype.execute = function (lexer) {
  27975. lexer.mode(this.mode);
  27976. };
  27977. LexerModeAction.prototype.updateHashCode = function (hash) {
  27978. hash.update(this.actionType, this.mode);
  27979. };
  27980. LexerModeAction.prototype.equals = function (other) {
  27981. if (this === other) {
  27982. return true;
  27983. } else if (!(other instanceof LexerModeAction)) {
  27984. return false;
  27985. } else {
  27986. return this.mode === other.mode;
  27987. }
  27988. };
  27989. LexerModeAction.prototype.toString = function () {
  27990. return "mode(" + this.mode + ")";
  27991. };
  27992. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  27993. // rule and action indexes assigned to the custom action. The implementation of
  27994. // a custom action is added to the generated code for the lexer in an override
  27995. // of {@link Recognizer//action} when the grammar is compiled.
  27996. //
  27997. // <p>This class may represent embedded actions created with the <code>{...}</code>
  27998. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  27999. // command argument could not be evaluated when the grammar was compiled.</p>
  28000. // Constructs a custom lexer action with the specified rule and action
  28001. // indexes.
  28002. //
  28003. // @param ruleIndex The rule index to use for calls to
  28004. // {@link Recognizer//action}.
  28005. // @param actionIndex The action index to use for calls to
  28006. // {@link Recognizer//action}.
  28007. function LexerCustomAction(ruleIndex, actionIndex) {
  28008. LexerAction.call(this, LexerActionType.CUSTOM);
  28009. this.ruleIndex = ruleIndex;
  28010. this.actionIndex = actionIndex;
  28011. this.isPositionDependent = true;
  28012. return this;
  28013. }
  28014. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  28015. LexerCustomAction.prototype.constructor = LexerCustomAction;
  28016. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  28017. // appropriate rule and action indexes.</p>
  28018. LexerCustomAction.prototype.execute = function (lexer) {
  28019. lexer.action(null, this.ruleIndex, this.actionIndex);
  28020. };
  28021. LexerCustomAction.prototype.updateHashCode = function (hash) {
  28022. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  28023. };
  28024. LexerCustomAction.prototype.equals = function (other) {
  28025. if (this === other) {
  28026. return true;
  28027. } else if (!(other instanceof LexerCustomAction)) {
  28028. return false;
  28029. } else {
  28030. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  28031. }
  28032. };
  28033. // Implements the {@code channel} lexer action by calling
  28034. // {@link Lexer//setChannel} with the assigned channel.
  28035. // Constructs a new {@code channel} action with the specified channel value.
  28036. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  28037. function LexerChannelAction(channel) {
  28038. LexerAction.call(this, LexerActionType.CHANNEL);
  28039. this.channel = channel;
  28040. return this;
  28041. }
  28042. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  28043. LexerChannelAction.prototype.constructor = LexerChannelAction;
  28044. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  28045. // value provided by {@link //getChannel}.</p>
  28046. LexerChannelAction.prototype.execute = function (lexer) {
  28047. lexer._channel = this.channel;
  28048. };
  28049. LexerChannelAction.prototype.updateHashCode = function (hash) {
  28050. hash.update(this.actionType, this.channel);
  28051. };
  28052. LexerChannelAction.prototype.equals = function (other) {
  28053. if (this === other) {
  28054. return true;
  28055. } else if (!(other instanceof LexerChannelAction)) {
  28056. return false;
  28057. } else {
  28058. return this.channel === other.channel;
  28059. }
  28060. };
  28061. LexerChannelAction.prototype.toString = function () {
  28062. return "channel(" + this.channel + ")";
  28063. };
  28064. // This implementation of {@link LexerAction} is used for tracking input offsets
  28065. // for position-dependent actions within a {@link LexerActionExecutor}.
  28066. //
  28067. // <p>This action is not serialized as part of the ATN, and is only required for
  28068. // position-dependent lexer actions which appear at a location other than the
  28069. // end of a rule. For more information about DFA optimizations employed for
  28070. // lexer actions, see {@link LexerActionExecutor//append} and
  28071. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  28072. // Constructs a new indexed custom action by associating a character offset
  28073. // with a {@link LexerAction}.
  28074. //
  28075. // <p>Note: This class is only required for lexer actions for which
  28076. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  28077. //
  28078. // @param offset The offset into the input {@link CharStream}, relative to
  28079. // the token start index, at which the specified lexer action should be
  28080. // executed.
  28081. // @param action The lexer action to execute at a particular offset in the
  28082. // input {@link CharStream}.
  28083. function LexerIndexedCustomAction(offset, action) {
  28084. LexerAction.call(this, action.actionType);
  28085. this.offset = offset;
  28086. this.action = action;
  28087. this.isPositionDependent = true;
  28088. return this;
  28089. }
  28090. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  28091. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  28092. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  28093. // using the provided {@code lexer}.</p>
  28094. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  28095. // assume the input stream position was properly set by the calling code
  28096. this.action.execute(lexer);
  28097. };
  28098. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  28099. hash.update(this.actionType, this.offset, this.action);
  28100. };
  28101. LexerIndexedCustomAction.prototype.equals = function (other) {
  28102. if (this === other) {
  28103. return true;
  28104. } else if (!(other instanceof LexerIndexedCustomAction)) {
  28105. return false;
  28106. } else {
  28107. return this.offset === other.offset && this.action === other.action;
  28108. }
  28109. };
  28110. exports.LexerActionType = LexerActionType;
  28111. exports.LexerSkipAction = LexerSkipAction;
  28112. exports.LexerChannelAction = LexerChannelAction;
  28113. exports.LexerCustomAction = LexerCustomAction;
  28114. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  28115. exports.LexerMoreAction = LexerMoreAction;
  28116. exports.LexerTypeAction = LexerTypeAction;
  28117. exports.LexerPushModeAction = LexerPushModeAction;
  28118. exports.LexerPopModeAction = LexerPopModeAction;
  28119. exports.LexerModeAction = LexerModeAction;
  28120. /***/ }),
  28121. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  28122. /*!********************************************************!*\
  28123. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  28124. \********************************************************/
  28125. /*! no static exports found */
  28126. /***/ (function(module, exports, __webpack_require__) {
  28127. "use strict";
  28128. //
  28129. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28130. * Use of this file is governed by the BSD 3-clause license that
  28131. * can be found in the LICENSE.txt file in the project root.
  28132. */
  28133. ///
  28134. // Represents an executor for a sequence of lexer actions which traversed during
  28135. // the matching operation of a lexer rule (token).
  28136. //
  28137. // <p>The executor tracks position information for position-dependent lexer actions
  28138. // efficiently, ensuring that actions appearing only at the end of the rule do
  28139. // not cause bloating of the {@link DFA} created for the lexer.</p>
  28140. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  28141. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  28142. function LexerActionExecutor(lexerActions) {
  28143. this.lexerActions = lexerActions === null ? [] : lexerActions;
  28144. // Caches the result of {@link //hashCode} since the hash code is an element
  28145. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  28146. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  28147. // lexerActions]))
  28148. return this;
  28149. }
  28150. // Creates a {@link LexerActionExecutor} which executes the actions for
  28151. // the input {@code lexerActionExecutor} followed by a specified
  28152. // {@code lexerAction}.
  28153. //
  28154. // @param lexerActionExecutor The executor for actions already traversed by
  28155. // the lexer while matching a token within a particular
  28156. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  28157. // though it were an empty executor.
  28158. // @param lexerAction The lexer action to execute after the actions
  28159. // specified in {@code lexerActionExecutor}.
  28160. //
  28161. // @return A {@link LexerActionExecutor} for executing the combine actions
  28162. // of {@code lexerActionExecutor} and {@code lexerAction}.
  28163. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  28164. if (lexerActionExecutor === null) {
  28165. return new LexerActionExecutor([lexerAction]);
  28166. }
  28167. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  28168. return new LexerActionExecutor(lexerActions);
  28169. };
  28170. // Creates a {@link LexerActionExecutor} which encodes the current offset
  28171. // for position-dependent lexer actions.
  28172. //
  28173. // <p>Normally, when the executor encounters lexer actions where
  28174. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  28175. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  28176. // position to the <em>end</em> of the current token. This behavior provides
  28177. // for efficient DFA representation of lexer actions which appear at the end
  28178. // of a lexer rule, even when the lexer rule matches a variable number of
  28179. // characters.</p>
  28180. //
  28181. // <p>Prior to traversing a match transition in the ATN, the current offset
  28182. // from the token start index is assigned to all position-dependent lexer
  28183. // actions which have not already been assigned a fixed offset. By storing
  28184. // the offsets relative to the token start index, the DFA representation of
  28185. // lexer actions which appear in the middle of tokens remains efficient due
  28186. // to sharing among tokens of the same length, regardless of their absolute
  28187. // position in the input stream.</p>
  28188. //
  28189. // <p>If the current executor already has offsets assigned to all
  28190. // position-dependent lexer actions, the method returns {@code this}.</p>
  28191. //
  28192. // @param offset The current offset to assign to all position-dependent
  28193. // lexer actions which do not already have offsets assigned.
  28194. //
  28195. // @return A {@link LexerActionExecutor} which stores input stream offsets
  28196. // for all position-dependent lexer actions.
  28197. // /
  28198. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  28199. var updatedLexerActions = null;
  28200. for (var i = 0; i < this.lexerActions.length; i++) {
  28201. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  28202. if (updatedLexerActions === null) {
  28203. updatedLexerActions = this.lexerActions.concat([]);
  28204. }
  28205. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  28206. }
  28207. }
  28208. if (updatedLexerActions === null) {
  28209. return this;
  28210. } else {
  28211. return new LexerActionExecutor(updatedLexerActions);
  28212. }
  28213. };
  28214. // Execute the actions encapsulated by this executor within the context of a
  28215. // particular {@link Lexer}.
  28216. //
  28217. // <p>This method calls {@link IntStream//seek} to set the position of the
  28218. // {@code input} {@link CharStream} prior to calling
  28219. // {@link LexerAction//execute} on a position-dependent action. Before the
  28220. // method returns, the input position will be restored to the same position
  28221. // it was in when the method was invoked.</p>
  28222. //
  28223. // @param lexer The lexer instance.
  28224. // @param input The input stream which is the source for the current token.
  28225. // When this method is called, the current {@link IntStream//index} for
  28226. // {@code input} should be the start of the following token, i.e. 1
  28227. // character past the end of the current token.
  28228. // @param startIndex The token start index. This value may be passed to
  28229. // {@link IntStream//seek} to set the {@code input} position to the beginning
  28230. // of the token.
  28231. // /
  28232. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  28233. var requiresSeek = false;
  28234. var stopIndex = input.index;
  28235. try {
  28236. for (var i = 0; i < this.lexerActions.length; i++) {
  28237. var lexerAction = this.lexerActions[i];
  28238. if (lexerAction instanceof LexerIndexedCustomAction) {
  28239. var offset = lexerAction.offset;
  28240. input.seek(startIndex + offset);
  28241. lexerAction = lexerAction.action;
  28242. requiresSeek = startIndex + offset !== stopIndex;
  28243. } else if (lexerAction.isPositionDependent) {
  28244. input.seek(stopIndex);
  28245. requiresSeek = false;
  28246. }
  28247. lexerAction.execute(lexer);
  28248. }
  28249. } finally {
  28250. if (requiresSeek) {
  28251. input.seek(stopIndex);
  28252. }
  28253. }
  28254. };
  28255. LexerActionExecutor.prototype.hashCode = function () {
  28256. return this.cachedHashCode;
  28257. };
  28258. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  28259. hash.update(this.cachedHashCode);
  28260. };
  28261. LexerActionExecutor.prototype.equals = function (other) {
  28262. if (this === other) {
  28263. return true;
  28264. } else if (!(other instanceof LexerActionExecutor)) {
  28265. return false;
  28266. } else if (this.cachedHashCode != other.cachedHashCode) {
  28267. return false;
  28268. } else if (this.lexerActions.length != other.lexerActions.length) {
  28269. return false;
  28270. } else {
  28271. var numActions = this.lexerActions.length;
  28272. for (var idx = 0; idx < numActions; ++idx) {
  28273. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  28274. return false;
  28275. }
  28276. }
  28277. return true;
  28278. }
  28279. };
  28280. exports.LexerActionExecutor = LexerActionExecutor;
  28281. /***/ }),
  28282. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  28283. /*!*******************************************************!*\
  28284. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  28285. \*******************************************************/
  28286. /*! no static exports found */
  28287. /***/ (function(module, exports, __webpack_require__) {
  28288. "use strict";
  28289. //
  28290. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28291. * Use of this file is governed by the BSD 3-clause license that
  28292. * can be found in the LICENSE.txt file in the project root.
  28293. */
  28294. //
  28295. //
  28296. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  28297. //
  28298. // <p>
  28299. // The basic complexity of the adaptive strategy makes it harder to understand.
  28300. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  28301. // requests go through the DFA first. If they reach a state without an edge for
  28302. // the current symbol, the algorithm fails over to the ATN simulation to
  28303. // complete the DFA path for the current input (until it finds a conflict state
  28304. // or uniquely predicting state).</p>
  28305. //
  28306. // <p>
  28307. // All of that is done without using the outer context because we want to create
  28308. // a DFA that is not dependent upon the rule invocation stack when we do a
  28309. // prediction. One DFA works in all contexts. We avoid using context not
  28310. // necessarily because it's slower, although it can be, but because of the DFA
  28311. // caching problem. The closure routine only considers the rule invocation stack
  28312. // created during prediction beginning in the decision rule. For example, if
  28313. // prediction occurs without invoking another rule's ATN, there are no context
  28314. // stacks in the configurations. When lack of context leads to a conflict, we
  28315. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  28316. // strategy (versus full LL(*)).</p>
  28317. //
  28318. // <p>
  28319. // When SLL yields a configuration set with conflict, we rewind the input and
  28320. // retry the ATN simulation, this time using full outer context without adding
  28321. // to the DFA. Configuration context stacks will be the full invocation stacks
  28322. // from the start rule. If we get a conflict using full context, then we can
  28323. // definitively say we have a true ambiguity for that input sequence. If we
  28324. // don't get a conflict, it implies that the decision is sensitive to the outer
  28325. // context. (It is not context-sensitive in the sense of context-sensitive
  28326. // grammars.)</p>
  28327. //
  28328. // <p>
  28329. // The next time we reach this DFA state with an SLL conflict, through DFA
  28330. // simulation, we will again retry the ATN simulation using full context mode.
  28331. // This is slow because we can't save the results and have to "interpret" the
  28332. // ATN each time we get that input.</p>
  28333. //
  28334. // <p>
  28335. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  28336. //
  28337. // <p>
  28338. // We could cache results from full context to predicted alternative easily and
  28339. // that saves a lot of time but doesn't work in presence of predicates. The set
  28340. // of visible predicates from the ATN start state changes depending on the
  28341. // context, because closure can fall off the end of a rule. I tried to cache
  28342. // tuples (stack context, semantic context, predicted alt) but it was slower
  28343. // than interpreting and much more complicated. Also required a huge amount of
  28344. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  28345. // to keep this algorithm simple. By launching multiple threads, we can improve
  28346. // the speed of parsing across a large number of files.</p>
  28347. //
  28348. // <p>
  28349. // There is no strict ordering between the amount of input used by SLL vs LL,
  28350. // which makes it really hard to build a cache for full context. Let's say that
  28351. // we have input A B C that leads to an SLL conflict with full context X. That
  28352. // implies that using X we might only use A B but we could also use A B C D to
  28353. // resolve conflict. Input A B C D could predict alternative 1 in one position
  28354. // in the input and A B C E could predict alternative 2 in another position in
  28355. // input. The conflicting SLL configurations could still be non-unique in the
  28356. // full context prediction, which would lead us to requiring more input than the
  28357. // original A B C. To make a prediction cache work, we have to track the exact
  28358. // input used during the previous prediction. That amounts to a cache that maps
  28359. // X to a specific DFA for that context.</p>
  28360. //
  28361. // <p>
  28362. // Something should be done for left-recursive expression predictions. They are
  28363. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  28364. // with full LL thing Sam does.</p>
  28365. //
  28366. // <p>
  28367. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  28368. //
  28369. // <p>
  28370. // We avoid doing full context retry when the outer context is empty, we did not
  28371. // dip into the outer context by falling off the end of the decision state rule,
  28372. // or when we force SLL mode.</p>
  28373. //
  28374. // <p>
  28375. // As an example of the not dip into outer context case, consider as super
  28376. // constructor calls versus function calls. One grammar might look like
  28377. // this:</p>
  28378. //
  28379. // <pre>
  28380. // ctorBody
  28381. // : '{' superCall? stat* '}'
  28382. // ;
  28383. // </pre>
  28384. //
  28385. // <p>
  28386. // Or, you might see something like</p>
  28387. //
  28388. // <pre>
  28389. // stat
  28390. // : superCall ';'
  28391. // | expression ';'
  28392. // | ...
  28393. // ;
  28394. // </pre>
  28395. //
  28396. // <p>
  28397. // In both cases I believe that no closure operations will dip into the outer
  28398. // context. In the first case ctorBody in the worst case will stop at the '}'.
  28399. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  28400. // entry rule and not dip into the outer context.</p>
  28401. //
  28402. // <p>
  28403. // <strong>PREDICATES</strong></p>
  28404. //
  28405. // <p>
  28406. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  28407. // LL simulation deals with predicates differently. SLL collects predicates as
  28408. // it performs closure operations like ANTLR v3 did. It delays predicate
  28409. // evaluation until it reaches and accept state. This allows us to cache the SLL
  28410. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  28411. // closure, the DFA state configuration sets would be different and we couldn't
  28412. // build up a suitable DFA.</p>
  28413. //
  28414. // <p>
  28415. // When building a DFA accept state during ATN simulation, we evaluate any
  28416. // predicates and return the sole semantically valid alternative. If there is
  28417. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  28418. // we throw an exception. Alternatives without predicates act like they have
  28419. // true predicates. The simple way to think about it is to strip away all
  28420. // alternatives with false predicates and choose the minimum alternative that
  28421. // remains.</p>
  28422. //
  28423. // <p>
  28424. // When we start in the DFA and reach an accept state that's predicated, we test
  28425. // those and return the minimum semantically viable alternative. If no
  28426. // alternatives are viable, we throw an exception.</p>
  28427. //
  28428. // <p>
  28429. // During full LL ATN simulation, closure always evaluates predicates and
  28430. // on-the-fly. This is crucial to reducing the configuration set size during
  28431. // closure. It hits a landmine when parsing with the Java grammar, for example,
  28432. // without this on-the-fly evaluation.</p>
  28433. //
  28434. // <p>
  28435. // <strong>SHARING DFA</strong></p>
  28436. //
  28437. // <p>
  28438. // All instances of the same parser share the same decision DFAs through a
  28439. // static field. Each instance gets its own ATN simulator but they share the
  28440. // same {@link //decisionToDFA} field. They also share a
  28441. // {@link PredictionContextCache} object that makes sure that all
  28442. // {@link PredictionContext} objects are shared among the DFA states. This makes
  28443. // a big size difference.</p>
  28444. //
  28445. // <p>
  28446. // <strong>THREAD SAFETY</strong></p>
  28447. //
  28448. // <p>
  28449. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  28450. // it adds a new DFA object to that array. {@link //addDFAEdge}
  28451. // locks on the DFA for the current decision when setting the
  28452. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  28453. // the DFA for the current decision when looking up a DFA state to see if it
  28454. // already exists. We must make sure that all requests to add DFA states that
  28455. // are equivalent result in the same shared DFA object. This is because lots of
  28456. // threads will be trying to update the DFA at once. The
  28457. // {@link //addDFAState} method also locks inside the DFA lock
  28458. // but this time on the shared context cache when it rebuilds the
  28459. // configurations' {@link PredictionContext} objects using cached
  28460. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  28461. // safe as long as we can guarantee that all threads referencing
  28462. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  28463. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  28464. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  28465. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  28466. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  28467. // {@code dfa.edges[t]} to be non-null. The
  28468. // {@link //addDFAEdge} method could be racing to set the field
  28469. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  28470. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  28471. // way it will work because it's not doing a test and set operation.</p>
  28472. //
  28473. // <p>
  28474. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  28475. // Parsing)</strong></p>
  28476. //
  28477. // <p>
  28478. // Sam pointed out that if SLL does not give a syntax error, then there is no
  28479. // point in doing full LL, which is slower. We only have to try LL if we get a
  28480. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  28481. // mode with the {@link BailErrorStrategy}:</p>
  28482. //
  28483. // <pre>
  28484. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  28485. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  28486. // </pre>
  28487. //
  28488. // <p>
  28489. // If it does not get a syntax error, then we're done. If it does get a syntax
  28490. // error, we need to retry with the combined SLL/LL strategy.</p>
  28491. //
  28492. // <p>
  28493. // The reason this works is as follows. If there are no SLL conflicts, then the
  28494. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  28495. // the full LL analysis must yield a set of viable alternatives which is a
  28496. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  28497. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  28498. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  28499. // is truly ambiguous on the current input. If the LL set is smaller, then the
  28500. // SLL conflict resolution might choose an alternative that the full LL would
  28501. // rule out as a possibility based upon better context information. If that's
  28502. // the case, then the SLL parse will definitely get an error because the full LL
  28503. // analysis says it's not viable. If SLL conflict resolution chooses an
  28504. // alternative within the LL set, them both SLL and LL would choose the same
  28505. // alternative because they both choose the minimum of multiple conflicting
  28506. // alternatives.</p>
  28507. //
  28508. // <p>
  28509. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  28510. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  28511. // parsing will get an error because SLL will pursue alternative 1. If
  28512. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  28513. // choose the same alternative because alternative one is the minimum of either
  28514. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  28515. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  28516. //
  28517. // <p>
  28518. // Of course, if the input is invalid, then we will get an error for sure in
  28519. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  28520. // the input.</p>
  28521. //
  28522. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28523. var Set = Utils.Set;
  28524. var BitSet = Utils.BitSet;
  28525. var DoubleDict = Utils.DoubleDict;
  28526. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28527. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28528. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28529. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28530. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28531. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  28532. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28533. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  28534. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28535. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  28536. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  28537. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28538. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28539. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28540. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  28541. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28542. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28543. var Transition = Transitions.Transition;
  28544. var SetTransition = Transitions.SetTransition;
  28545. var NotSetTransition = Transitions.NotSetTransition;
  28546. var RuleTransition = Transitions.RuleTransition;
  28547. var ActionTransition = Transitions.ActionTransition;
  28548. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  28549. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  28550. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  28551. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  28552. ATNSimulator.call(this, atn, sharedContextCache);
  28553. this.parser = parser;
  28554. this.decisionToDFA = decisionToDFA;
  28555. // SLL, LL, or LL + exact ambig detection?//
  28556. this.predictionMode = PredictionMode.LL;
  28557. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  28558. this._input = null;
  28559. this._startIndex = 0;
  28560. this._outerContext = null;
  28561. this._dfa = null;
  28562. // Each prediction operation uses a cache for merge of prediction contexts.
  28563. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  28564. // isn't synchronized but we're ok since two threads shouldn't reuse same
  28565. // parser/atnsim object because it can only handle one input at a time.
  28566. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  28567. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  28568. // also be examined during cache lookup.
  28569. //
  28570. this.mergeCache = null;
  28571. return this;
  28572. }
  28573. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  28574. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  28575. ParserATNSimulator.prototype.debug = false;
  28576. ParserATNSimulator.prototype.debug_closure = false;
  28577. ParserATNSimulator.prototype.debug_add = false;
  28578. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  28579. ParserATNSimulator.prototype.dfa_debug = false;
  28580. ParserATNSimulator.prototype.retry_debug = false;
  28581. ParserATNSimulator.prototype.reset = function () {};
  28582. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  28583. if (this.debug || this.debug_list_atn_decisions) {
  28584. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28585. }
  28586. this._input = input;
  28587. this._startIndex = input.index;
  28588. this._outerContext = outerContext;
  28589. var dfa = this.decisionToDFA[decision];
  28590. this._dfa = dfa;
  28591. var m = input.mark();
  28592. var index = input.index;
  28593. // Now we are certain to have a specific decision's DFA
  28594. // But, do we still need an initial state?
  28595. try {
  28596. var s0;
  28597. if (dfa.precedenceDfa) {
  28598. // the start state for a precedence DFA depends on the current
  28599. // parser precedence, and is provided by a DFA method.
  28600. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28601. } else {
  28602. // the start state for a "regular" DFA is just s0
  28603. s0 = dfa.s0;
  28604. }
  28605. if (s0 === null) {
  28606. if (outerContext === null) {
  28607. outerContext = RuleContext.EMPTY;
  28608. }
  28609. if (this.debug || this.debug_list_atn_decisions) {
  28610. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28611. }
  28612. var fullCtx = false;
  28613. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28614. if (dfa.precedenceDfa) {
  28615. // If this is a precedence DFA, we use applyPrecedenceFilter
  28616. // to convert the computed start state to a precedence start
  28617. // state. We then use DFA.setPrecedenceStartState to set the
  28618. // appropriate start state for the precedence level rather
  28619. // than simply setting DFA.s0.
  28620. //
  28621. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28622. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28623. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28624. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28625. } else {
  28626. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28627. dfa.s0 = s0;
  28628. }
  28629. }
  28630. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28631. if (this.debug) {
  28632. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28633. }
  28634. return alt;
  28635. } finally {
  28636. this._dfa = null;
  28637. this.mergeCache = null; // wack cache after each prediction
  28638. input.seek(index);
  28639. input.release(m);
  28640. }
  28641. };
  28642. // Performs ATN simulation to compute a predicted alternative based
  28643. // upon the remaining input, but also updates the DFA cache to avoid
  28644. // having to traverse the ATN again for the same input sequence.
  28645. // There are some key conditions we're looking for after computing a new
  28646. // set of ATN configs (proposed DFA state):
  28647. // if the set is empty, there is no viable alternative for current symbol
  28648. // does the state uniquely predict an alternative?
  28649. // does the state have a conflict that would prevent us from
  28650. // putting it on the work list?
  28651. // We also have some key operations to do:
  28652. // add an edge from previous DFA state to potentially new DFA state, D,
  28653. // upon current symbol but only if adding to work list, which means in all
  28654. // cases except no viable alternative (and possibly non-greedy decisions?)
  28655. // collecting predicates and adding semantic context to DFA accept states
  28656. // adding rule context to context-sensitive DFA accept states
  28657. // consuming an input symbol
  28658. // reporting a conflict
  28659. // reporting an ambiguity
  28660. // reporting a context sensitivity
  28661. // reporting insufficient predicates
  28662. // cover these cases:
  28663. // dead end
  28664. // single alt
  28665. // single alt + preds
  28666. // conflict
  28667. // conflict + preds
  28668. //
  28669. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28670. if (this.debug || this.debug_list_atn_decisions) {
  28671. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28672. }
  28673. var alt;
  28674. var previousD = s0;
  28675. if (this.debug) {
  28676. console.log("s0 = " + s0);
  28677. }
  28678. var t = input.LA(1);
  28679. while (true) {
  28680. // while more work
  28681. var D = this.getExistingTargetState(previousD, t);
  28682. if (D === null) {
  28683. D = this.computeTargetState(dfa, previousD, t);
  28684. }
  28685. if (D === ATNSimulator.ERROR) {
  28686. // if any configs in previous dipped into outer context, that
  28687. // means that input up to t actually finished entry rule
  28688. // at least for SLL decision. Full LL doesn't dip into outer
  28689. // so don't need special case.
  28690. // We will get an error no matter what so delay until after
  28691. // decision; better error message. Also, no reachable target
  28692. // ATN states in SLL implies LL will also get nowhere.
  28693. // If conflict in states that dip out, choose min since we
  28694. // will get error no matter what.
  28695. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28696. input.seek(startIndex);
  28697. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28698. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28699. return alt;
  28700. } else {
  28701. throw e;
  28702. }
  28703. }
  28704. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28705. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28706. var conflictingAlts = null;
  28707. if (D.predicates !== null) {
  28708. if (this.debug) {
  28709. console.log("DFA state has preds in DFA sim LL failover");
  28710. }
  28711. var conflictIndex = input.index;
  28712. if (conflictIndex !== startIndex) {
  28713. input.seek(startIndex);
  28714. }
  28715. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28716. if (conflictingAlts.length === 1) {
  28717. if (this.debug) {
  28718. console.log("Full LL avoided");
  28719. }
  28720. return conflictingAlts.minValue();
  28721. }
  28722. if (conflictIndex !== startIndex) {
  28723. // restore the index so reporting the fallback to full
  28724. // context occurs with the index at the correct spot
  28725. input.seek(conflictIndex);
  28726. }
  28727. }
  28728. if (this.dfa_debug) {
  28729. console.log("ctx sensitive state " + outerContext + " in " + D);
  28730. }
  28731. var fullCtx = true;
  28732. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  28733. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  28734. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  28735. return alt;
  28736. }
  28737. if (D.isAcceptState) {
  28738. if (D.predicates === null) {
  28739. return D.prediction;
  28740. }
  28741. var stopIndex = input.index;
  28742. input.seek(startIndex);
  28743. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  28744. if (alts.length === 0) {
  28745. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  28746. } else if (alts.length === 1) {
  28747. return alts.minValue();
  28748. } else {
  28749. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  28750. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  28751. return alts.minValue();
  28752. }
  28753. }
  28754. previousD = D;
  28755. if (t !== Token.EOF) {
  28756. input.consume();
  28757. t = input.LA(1);
  28758. }
  28759. }
  28760. };
  28761. //
  28762. // Get an existing target state for an edge in the DFA. If the target state
  28763. // for the edge has not yet been computed or is otherwise not available,
  28764. // this method returns {@code null}.
  28765. //
  28766. // @param previousD The current DFA state
  28767. // @param t The next input symbol
  28768. // @return The existing target DFA state for the given input symbol
  28769. // {@code t}, or {@code null} if the target state for this edge is not
  28770. // already cached
  28771. //
  28772. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  28773. var edges = previousD.edges;
  28774. if (edges === null) {
  28775. return null;
  28776. } else {
  28777. return edges[t + 1] || null;
  28778. }
  28779. };
  28780. //
  28781. // Compute a target state for an edge in the DFA, and attempt to add the
  28782. // computed state and corresponding edge to the DFA.
  28783. //
  28784. // @param dfa The DFA
  28785. // @param previousD The current DFA state
  28786. // @param t The next input symbol
  28787. //
  28788. // @return The computed target DFA state for the given input symbol
  28789. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  28790. // returns {@link //ERROR}.
  28791. //
  28792. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  28793. var reach = this.computeReachSet(previousD.configs, t, false);
  28794. if (reach === null) {
  28795. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  28796. return ATNSimulator.ERROR;
  28797. }
  28798. // create new target state; we'll add to DFA after it's complete
  28799. var D = new DFAState(null, reach);
  28800. var predictedAlt = this.getUniqueAlt(reach);
  28801. if (this.debug) {
  28802. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28803. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  28804. }
  28805. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28806. // NO CONFLICT, UNIQUELY PREDICTED ALT
  28807. D.isAcceptState = true;
  28808. D.configs.uniqueAlt = predictedAlt;
  28809. D.prediction = predictedAlt;
  28810. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  28811. // MORE THAN ONE VIABLE ALTERNATIVE
  28812. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  28813. D.requiresFullContext = true;
  28814. // in SLL-only mode, we will stop at this state and return the minimum alt
  28815. D.isAcceptState = true;
  28816. D.prediction = D.configs.conflictingAlts.minValue();
  28817. }
  28818. if (D.isAcceptState && D.configs.hasSemanticContext) {
  28819. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  28820. if (D.predicates !== null) {
  28821. D.prediction = ATN.INVALID_ALT_NUMBER;
  28822. }
  28823. }
  28824. // all adds to dfa are done after we've created full D state
  28825. D = this.addDFAEdge(dfa, previousD, t, D);
  28826. return D;
  28827. };
  28828. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  28829. // We need to test all predicates, even in DFA states that
  28830. // uniquely predict alternative.
  28831. var nalts = decisionState.transitions.length;
  28832. // Update DFA so reach becomes accept state with (predicate,alt)
  28833. // pairs if preds found for conflicting alts
  28834. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  28835. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  28836. if (altToPred !== null) {
  28837. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  28838. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  28839. } else {
  28840. // There are preds in configs but they might go away
  28841. // when OR'd together like {p}? || NONE == NONE. If neither
  28842. // alt has preds, resolve to min alt
  28843. dfaState.prediction = altsToCollectPredsFrom.minValue();
  28844. }
  28845. };
  28846. // comes back with reach.uniqueAlt set to a valid alt
  28847. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  28848. s0, input, startIndex, outerContext) {
  28849. if (this.debug || this.debug_list_atn_decisions) {
  28850. console.log("execATNWithFullContext " + s0);
  28851. }
  28852. var fullCtx = true;
  28853. var foundExactAmbig = false;
  28854. var reach = null;
  28855. var previous = s0;
  28856. input.seek(startIndex);
  28857. var t = input.LA(1);
  28858. var predictedAlt = -1;
  28859. while (true) {
  28860. // while more work
  28861. reach = this.computeReachSet(previous, t, fullCtx);
  28862. if (reach === null) {
  28863. // if any configs in previous dipped into outer context, that
  28864. // means that input up to t actually finished entry rule
  28865. // at least for LL decision. Full LL doesn't dip into outer
  28866. // so don't need special case.
  28867. // We will get an error no matter what so delay until after
  28868. // decision; better error message. Also, no reachable target
  28869. // ATN states in SLL implies LL will also get nowhere.
  28870. // If conflict in states that dip out, choose min since we
  28871. // will get error no matter what.
  28872. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  28873. input.seek(startIndex);
  28874. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  28875. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28876. return alt;
  28877. } else {
  28878. throw e;
  28879. }
  28880. }
  28881. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28882. if (this.debug) {
  28883. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  28884. }
  28885. reach.uniqueAlt = this.getUniqueAlt(reach);
  28886. // unique prediction?
  28887. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28888. predictedAlt = reach.uniqueAlt;
  28889. break;
  28890. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  28891. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  28892. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28893. break;
  28894. }
  28895. } else {
  28896. // In exact ambiguity mode, we never try to terminate early.
  28897. // Just keeps scarfing until we know what the conflict is
  28898. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  28899. foundExactAmbig = true;
  28900. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  28901. break;
  28902. }
  28903. // else there are multiple non-conflicting subsets or
  28904. // we're not sure what the ambiguity is yet.
  28905. // So, keep going.
  28906. }
  28907. previous = reach;
  28908. if (t !== Token.EOF) {
  28909. input.consume();
  28910. t = input.LA(1);
  28911. }
  28912. }
  28913. // If the configuration set uniquely predicts an alternative,
  28914. // without conflict, then we know that it's a full LL decision
  28915. // not SLL.
  28916. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28917. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  28918. return predictedAlt;
  28919. }
  28920. // We do not check predicates here because we have checked them
  28921. // on-the-fly when doing full context prediction.
  28922. //
  28923. // In non-exact ambiguity detection mode, we might actually be able to
  28924. // detect an exact ambiguity, but I'm not going to spend the cycles
  28925. // needed to check. We only emit ambiguity warnings in exact ambiguity
  28926. // mode.
  28927. //
  28928. // For example, we might know that we have conflicting configurations.
  28929. // But, that does not mean that there is no way forward without a
  28930. // conflict. It's possible to have nonconflicting alt subsets as in:
  28931. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  28932. // from
  28933. //
  28934. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  28935. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  28936. //
  28937. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  28938. // would resolve this without conflict to alternative 1. Any other viable
  28939. // next sequence, however, is associated with a conflict. We stop
  28940. // looking for input because no amount of further lookahead will alter
  28941. // the fact that we should predict alternative 1. We just can't say for
  28942. // sure that there is an ambiguity without looking further.
  28943. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  28944. return predictedAlt;
  28945. };
  28946. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  28947. if (this.debug) {
  28948. console.log("in computeReachSet, starting closure: " + closure);
  28949. }
  28950. if (this.mergeCache === null) {
  28951. this.mergeCache = new DoubleDict();
  28952. }
  28953. var intermediate = new ATNConfigSet(fullCtx);
  28954. // Configurations already in a rule stop state indicate reaching the end
  28955. // of the decision rule (local context) or end of the start rule (full
  28956. // context). Once reached, these configurations are never updated by a
  28957. // closure operation, so they are handled separately for the performance
  28958. // advantage of having a smaller intermediate set when calling closure.
  28959. //
  28960. // For full-context reach operations, separate handling is required to
  28961. // ensure that the alternative matching the longest overall sequence is
  28962. // chosen when multiple such configurations can match the input.
  28963. var skippedStopStates = null;
  28964. // First figure out where we can reach on input t
  28965. for (var i = 0; i < closure.items.length; i++) {
  28966. var c = closure.items[i];
  28967. if (this.debug_add) {
  28968. console.log("testing " + this.getTokenName(t) + " at " + c);
  28969. }
  28970. if (c.state instanceof RuleStopState) {
  28971. if (fullCtx || t === Token.EOF) {
  28972. if (skippedStopStates === null) {
  28973. skippedStopStates = [];
  28974. }
  28975. skippedStopStates.push(c);
  28976. if (this.debug_add) {
  28977. console.log("added " + c + " to skippedStopStates");
  28978. }
  28979. }
  28980. continue;
  28981. }
  28982. for (var j = 0; j < c.state.transitions.length; j++) {
  28983. var trans = c.state.transitions[j];
  28984. var target = this.getReachableTarget(trans, t);
  28985. if (target !== null) {
  28986. var cfg = new ATNConfig({ state: target }, c);
  28987. intermediate.add(cfg, this.mergeCache);
  28988. if (this.debug_add) {
  28989. console.log("added " + cfg + " to intermediate");
  28990. }
  28991. }
  28992. }
  28993. }
  28994. // Now figure out where the reach operation can take us...
  28995. var reach = null;
  28996. // This block optimizes the reach operation for intermediate sets which
  28997. // trivially indicate a termination state for the overall
  28998. // adaptivePredict operation.
  28999. //
  29000. // The conditions assume that intermediate
  29001. // contains all configurations relevant to the reach set, but this
  29002. // condition is not true when one or more configurations have been
  29003. // withheld in skippedStopStates, or when the current symbol is EOF.
  29004. //
  29005. if (skippedStopStates === null && t !== Token.EOF) {
  29006. if (intermediate.items.length === 1) {
  29007. // Don't pursue the closure if there is just one state.
  29008. // It can only have one alternative; just add to result
  29009. // Also don't pursue the closure if there is unique alternative
  29010. // among the configurations.
  29011. reach = intermediate;
  29012. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  29013. // Also don't pursue the closure if there is unique alternative
  29014. // among the configurations.
  29015. reach = intermediate;
  29016. }
  29017. }
  29018. // If the reach set could not be trivially determined, perform a closure
  29019. // operation on the intermediate set to compute its initial value.
  29020. //
  29021. if (reach === null) {
  29022. reach = new ATNConfigSet(fullCtx);
  29023. var closureBusy = new Set();
  29024. var treatEofAsEpsilon = t === Token.EOF;
  29025. for (var k = 0; k < intermediate.items.length; k++) {
  29026. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  29027. }
  29028. }
  29029. if (t === Token.EOF) {
  29030. // After consuming EOF no additional input is possible, so we are
  29031. // only interested in configurations which reached the end of the
  29032. // decision rule (local context) or end of the start rule (full
  29033. // context). Update reach to contain only these configurations. This
  29034. // handles both explicit EOF transitions in the grammar and implicit
  29035. // EOF transitions following the end of the decision or start rule.
  29036. //
  29037. // When reach==intermediate, no closure operation was performed. In
  29038. // this case, removeAllConfigsNotInRuleStopState needs to check for
  29039. // reachable rule stop states as well as configurations already in
  29040. // a rule stop state.
  29041. //
  29042. // This is handled before the configurations in skippedStopStates,
  29043. // because any configurations potentially added from that list are
  29044. // already guaranteed to meet this condition whether or not it's
  29045. // required.
  29046. //
  29047. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  29048. }
  29049. // If skippedStopStates!==null, then it contains at least one
  29050. // configuration. For full-context reach operations, these
  29051. // configurations reached the end of the start rule, in which case we
  29052. // only add them back to reach if no configuration during the current
  29053. // closure operation reached such a state. This ensures adaptivePredict
  29054. // chooses an alternative matching the longest overall sequence when
  29055. // multiple alternatives are viable.
  29056. //
  29057. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  29058. for (var l = 0; l < skippedStopStates.length; l++) {
  29059. reach.add(skippedStopStates[l], this.mergeCache);
  29060. }
  29061. }
  29062. if (reach.items.length === 0) {
  29063. return null;
  29064. } else {
  29065. return reach;
  29066. }
  29067. };
  29068. //
  29069. // Return a configuration set containing only the configurations from
  29070. // {@code configs} which are in a {@link RuleStopState}. If all
  29071. // configurations in {@code configs} are already in a rule stop state, this
  29072. // method simply returns {@code configs}.
  29073. //
  29074. // <p>When {@code lookToEndOfRule} is true, this method uses
  29075. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  29076. // not already in a rule stop state to see if a rule stop state is reachable
  29077. // from the configuration via epsilon-only transitions.</p>
  29078. //
  29079. // @param configs the configuration set to update
  29080. // @param lookToEndOfRule when true, this method checks for rule stop states
  29081. // reachable by epsilon-only transitions from each configuration in
  29082. // {@code configs}.
  29083. //
  29084. // @return {@code configs} if all configurations in {@code configs} are in a
  29085. // rule stop state, otherwise return a new configuration set containing only
  29086. // the configurations from {@code configs} which are in a rule stop state
  29087. //
  29088. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  29089. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29090. return configs;
  29091. }
  29092. var result = new ATNConfigSet(configs.fullCtx);
  29093. for (var i = 0; i < configs.items.length; i++) {
  29094. var config = configs.items[i];
  29095. if (config.state instanceof RuleStopState) {
  29096. result.add(config, this.mergeCache);
  29097. continue;
  29098. }
  29099. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  29100. var nextTokens = this.atn.nextTokens(config.state);
  29101. if (nextTokens.contains(Token.EPSILON)) {
  29102. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  29103. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  29104. }
  29105. }
  29106. }
  29107. return result;
  29108. };
  29109. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  29110. // always at least the implicit call to start rule
  29111. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  29112. var configs = new ATNConfigSet(fullCtx);
  29113. for (var i = 0; i < p.transitions.length; i++) {
  29114. var target = p.transitions[i].target;
  29115. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  29116. var closureBusy = new Set();
  29117. this.closure(c, configs, closureBusy, true, fullCtx, false);
  29118. }
  29119. return configs;
  29120. };
  29121. //
  29122. // This method transforms the start state computed by
  29123. // {@link //computeStartState} to the special start state used by a
  29124. // precedence DFA for a particular precedence value. The transformation
  29125. // process applies the following changes to the start state's configuration
  29126. // set.
  29127. //
  29128. // <ol>
  29129. // <li>Evaluate the precedence predicates for each configuration using
  29130. // {@link SemanticContext//evalPrecedence}.</li>
  29131. // <li>Remove all configurations which predict an alternative greater than
  29132. // 1, for which another configuration that predicts alternative 1 is in the
  29133. // same ATN state with the same prediction context. This transformation is
  29134. // valid for the following reasons:
  29135. // <ul>
  29136. // <li>The closure block cannot contain any epsilon transitions which bypass
  29137. // the body of the closure, so all states reachable via alternative 1 are
  29138. // part of the precedence alternatives of the transformed left-recursive
  29139. // rule.</li>
  29140. // <li>The "primary" portion of a left recursive rule cannot contain an
  29141. // epsilon transition, so the only way an alternative other than 1 can exist
  29142. // in a state that is also reachable via alternative 1 is by nesting calls
  29143. // to the left-recursive rule, with the outer calls not being at the
  29144. // preferred precedence level.</li>
  29145. // </ul>
  29146. // </li>
  29147. // </ol>
  29148. //
  29149. // <p>
  29150. // The prediction context must be considered by this filter to address
  29151. // situations like the following.
  29152. // </p>
  29153. // <code>
  29154. // <pre>
  29155. // grammar TA;
  29156. // prog: statement* EOF;
  29157. // statement: letterA | statement letterA 'b' ;
  29158. // letterA: 'a';
  29159. // </pre>
  29160. // </code>
  29161. // <p>
  29162. // If the above grammar, the ATN state immediately before the token
  29163. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  29164. // of both the primary and closure blocks of the left-recursive rule
  29165. // {@code statement}. The prediction context associated with each of these
  29166. // configurations distinguishes between them, and prevents the alternative
  29167. // which stepped out to {@code prog} (and then back in to {@code statement}
  29168. // from being eliminated by the filter.
  29169. // </p>
  29170. //
  29171. // @param configs The configuration set computed by
  29172. // {@link //computeStartState} as the start state for the DFA.
  29173. // @return The transformed configuration set representing the start state
  29174. // for a precedence DFA at a particular precedence level (determined by
  29175. // calling {@link Parser//getPrecedence}).
  29176. //
  29177. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  29178. var config;
  29179. var statesFromAlt1 = [];
  29180. var configSet = new ATNConfigSet(configs.fullCtx);
  29181. for (var i = 0; i < configs.items.length; i++) {
  29182. config = configs.items[i];
  29183. // handle alt 1 first
  29184. if (config.alt !== 1) {
  29185. continue;
  29186. }
  29187. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  29188. if (updatedContext === null) {
  29189. // the configuration was eliminated
  29190. continue;
  29191. }
  29192. statesFromAlt1[config.state.stateNumber] = config.context;
  29193. if (updatedContext !== config.semanticContext) {
  29194. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  29195. } else {
  29196. configSet.add(config, this.mergeCache);
  29197. }
  29198. }
  29199. for (i = 0; i < configs.items.length; i++) {
  29200. config = configs.items[i];
  29201. if (config.alt === 1) {
  29202. // already handled
  29203. continue;
  29204. }
  29205. // In the future, this elimination step could be updated to also
  29206. // filter the prediction context for alternatives predicting alt>1
  29207. // (basically a graph subtraction algorithm).
  29208. if (!config.precedenceFilterSuppressed) {
  29209. var context = statesFromAlt1[config.state.stateNumber] || null;
  29210. if (context !== null && context.equals(config.context)) {
  29211. // eliminated
  29212. continue;
  29213. }
  29214. }
  29215. configSet.add(config, this.mergeCache);
  29216. }
  29217. return configSet;
  29218. };
  29219. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  29220. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  29221. return trans.target;
  29222. } else {
  29223. return null;
  29224. }
  29225. };
  29226. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  29227. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  29228. // altToPred starts as an array of all null contexts. The entry at index i
  29229. // corresponds to alternative i. altToPred[i] may have one of three values:
  29230. // 1. null: no ATNConfig c is found such that c.alt==i
  29231. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  29232. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  29233. // alt i has at least one unpredicated config.
  29234. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  29235. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  29236. //
  29237. // From this, it is clear that NONE||anything==NONE.
  29238. //
  29239. var altToPred = [];
  29240. for (var i = 0; i < configs.items.length; i++) {
  29241. var c = configs.items[i];
  29242. if (ambigAlts.contains(c.alt)) {
  29243. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  29244. }
  29245. }
  29246. var nPredAlts = 0;
  29247. for (i = 1; i < nalts + 1; i++) {
  29248. var pred = altToPred[i] || null;
  29249. if (pred === null) {
  29250. altToPred[i] = SemanticContext.NONE;
  29251. } else if (pred !== SemanticContext.NONE) {
  29252. nPredAlts += 1;
  29253. }
  29254. }
  29255. // nonambig alts are null in altToPred
  29256. if (nPredAlts === 0) {
  29257. altToPred = null;
  29258. }
  29259. if (this.debug) {
  29260. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  29261. }
  29262. return altToPred;
  29263. };
  29264. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  29265. var pairs = [];
  29266. var containsPredicate = false;
  29267. for (var i = 1; i < altToPred.length; i++) {
  29268. var pred = altToPred[i];
  29269. // unpredicated is indicated by SemanticContext.NONE
  29270. if (ambigAlts !== null && ambigAlts.contains(i)) {
  29271. pairs.push(new PredPrediction(pred, i));
  29272. }
  29273. if (pred !== SemanticContext.NONE) {
  29274. containsPredicate = true;
  29275. }
  29276. }
  29277. if (!containsPredicate) {
  29278. return null;
  29279. }
  29280. return pairs;
  29281. };
  29282. //
  29283. // This method is used to improve the localization of error messages by
  29284. // choosing an alternative rather than throwing a
  29285. // {@link NoViableAltException} in particular prediction scenarios where the
  29286. // {@link //ERROR} state was reached during ATN simulation.
  29287. //
  29288. // <p>
  29289. // The default implementation of this method uses the following
  29290. // algorithm to identify an ATN configuration which successfully parsed the
  29291. // decision entry rule. Choosing such an alternative ensures that the
  29292. // {@link ParserRuleContext} returned by the calling rule will be complete
  29293. // and valid, and the syntax error will be reported later at a more
  29294. // localized location.</p>
  29295. //
  29296. // <ul>
  29297. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  29298. // they are semantically valid if predicated, return the min associated alt.</li>
  29299. // <li>Else, if a semantically invalid but syntactically valid path exist
  29300. // or paths exist, return the minimum associated alt.
  29301. // </li>
  29302. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  29303. // </ul>
  29304. //
  29305. // <p>
  29306. // In some scenarios, the algorithm described above could predict an
  29307. // alternative which will result in a {@link FailedPredicateException} in
  29308. // the parser. Specifically, this could occur if the <em>only</em> configuration
  29309. // capable of successfully parsing to the end of the decision rule is
  29310. // blocked by a semantic predicate. By choosing this alternative within
  29311. // {@link //adaptivePredict} instead of throwing a
  29312. // {@link NoViableAltException}, the resulting
  29313. // {@link FailedPredicateException} in the parser will identify the specific
  29314. // predicate which is preventing the parser from successfully parsing the
  29315. // decision rule, which helps developers identify and correct logic errors
  29316. // in semantic predicates.
  29317. // </p>
  29318. //
  29319. // @param configs The ATN configurations which were valid immediately before
  29320. // the {@link //ERROR} state was reached
  29321. // @param outerContext The is the \gamma_0 initial parser context from the paper
  29322. // or the parser stack at the instant before prediction commences.
  29323. //
  29324. // @return The value to return from {@link //adaptivePredict}, or
  29325. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  29326. // identified and {@link //adaptivePredict} should report an error instead.
  29327. //
  29328. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  29329. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  29330. var semValidConfigs = cfgs[0];
  29331. var semInvalidConfigs = cfgs[1];
  29332. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  29333. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29334. // semantically/syntactically viable path exists
  29335. return alt;
  29336. }
  29337. // Is there a syntactically valid path with a failed pred?
  29338. if (semInvalidConfigs.items.length > 0) {
  29339. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  29340. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29341. // syntactically viable path exists
  29342. return alt;
  29343. }
  29344. }
  29345. return ATN.INVALID_ALT_NUMBER;
  29346. };
  29347. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  29348. var alts = [];
  29349. for (var i = 0; i < configs.items.length; i++) {
  29350. var c = configs.items[i];
  29351. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  29352. if (alts.indexOf(c.alt) < 0) {
  29353. alts.push(c.alt);
  29354. }
  29355. }
  29356. }
  29357. if (alts.length === 0) {
  29358. return ATN.INVALID_ALT_NUMBER;
  29359. } else {
  29360. return Math.min.apply(null, alts);
  29361. }
  29362. };
  29363. // Walk the list of configurations and split them according to
  29364. // those that have preds evaluating to true/false. If no pred, assume
  29365. // true pred and include in succeeded set. Returns Pair of sets.
  29366. //
  29367. // Create a new set so as not to alter the incoming parameter.
  29368. //
  29369. // Assumption: the input stream has been restored to the starting point
  29370. // prediction, which is where predicates need to evaluate.
  29371. //
  29372. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  29373. var succeeded = new ATNConfigSet(configs.fullCtx);
  29374. var failed = new ATNConfigSet(configs.fullCtx);
  29375. for (var i = 0; i < configs.items.length; i++) {
  29376. var c = configs.items[i];
  29377. if (c.semanticContext !== SemanticContext.NONE) {
  29378. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  29379. if (predicateEvaluationResult) {
  29380. succeeded.add(c);
  29381. } else {
  29382. failed.add(c);
  29383. }
  29384. } else {
  29385. succeeded.add(c);
  29386. }
  29387. }
  29388. return [succeeded, failed];
  29389. };
  29390. // Look through a list of predicate/alt pairs, returning alts for the
  29391. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  29392. // unpredicated config which behaves as "always true." If !complete
  29393. // then we stop at the first predicate that evaluates to true. This
  29394. // includes pairs with null predicates.
  29395. //
  29396. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  29397. var predictions = new BitSet();
  29398. for (var i = 0; i < predPredictions.length; i++) {
  29399. var pair = predPredictions[i];
  29400. if (pair.pred === SemanticContext.NONE) {
  29401. predictions.add(pair.alt);
  29402. if (!complete) {
  29403. break;
  29404. }
  29405. continue;
  29406. }
  29407. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  29408. if (this.debug || this.dfa_debug) {
  29409. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  29410. }
  29411. if (predicateEvaluationResult) {
  29412. if (this.debug || this.dfa_debug) {
  29413. console.log("PREDICT " + pair.alt);
  29414. }
  29415. predictions.add(pair.alt);
  29416. if (!complete) {
  29417. break;
  29418. }
  29419. }
  29420. }
  29421. return predictions;
  29422. };
  29423. // TODO: If we are doing predicates, there is no point in pursuing
  29424. // closure operations if we reach a DFA state that uniquely predicts
  29425. // alternative. We will not be caching that DFA state and it is a
  29426. // waste to pursue the closure. Might have to advance when we do
  29427. // ambig detection thought :(
  29428. //
  29429. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  29430. var initialDepth = 0;
  29431. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  29432. };
  29433. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29434. if (this.debug || this.debug_closure) {
  29435. console.log("closure(" + config.toString(this.parser, true) + ")");
  29436. // console.log("configs(" + configs.toString() + ")");
  29437. if (config.reachesIntoOuterContext > 50) {
  29438. throw "problem";
  29439. }
  29440. }
  29441. if (config.state instanceof RuleStopState) {
  29442. // We hit rule end. If we have context info, use it
  29443. // run thru all possible stack tops in ctx
  29444. if (!config.context.isEmpty()) {
  29445. for (var i = 0; i < config.context.length; i++) {
  29446. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  29447. if (fullCtx) {
  29448. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  29449. continue;
  29450. } else {
  29451. // we have no context info, just chase follow links (if greedy)
  29452. if (this.debug) {
  29453. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29454. }
  29455. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29456. }
  29457. continue;
  29458. }
  29459. var returnState = this.atn.states[config.context.getReturnState(i)];
  29460. var newContext = config.context.getParent(i); // "pop" return state
  29461. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  29462. var c = new ATNConfig(parms, null);
  29463. // While we have context to pop back from, we may have
  29464. // gotten that context AFTER having falling off a rule.
  29465. // Make sure we track that we are now out of context.
  29466. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  29467. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  29468. }
  29469. return;
  29470. } else if (fullCtx) {
  29471. // reached end of start rule
  29472. configs.add(config, this.mergeCache);
  29473. return;
  29474. } else {
  29475. // else if we have no context info, just chase follow links (if greedy)
  29476. if (this.debug) {
  29477. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29478. }
  29479. }
  29480. }
  29481. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29482. };
  29483. // Do the actual work of walking epsilon edges//
  29484. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29485. var p = config.state;
  29486. // optimization
  29487. if (!p.epsilonOnlyTransitions) {
  29488. configs.add(config, this.mergeCache);
  29489. // make sure to not return here, because EOF transitions can act as
  29490. // both epsilon transitions and non-epsilon transitions.
  29491. }
  29492. for (var i = 0; i < p.transitions.length; i++) {
  29493. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  29494. var t = p.transitions[i];
  29495. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  29496. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  29497. if (c !== null) {
  29498. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  29499. // avoid infinite recursion for EOF* and EOF+
  29500. continue;
  29501. }
  29502. var newDepth = depth;
  29503. if (config.state instanceof RuleStopState) {
  29504. // target fell off end of rule; mark resulting c as having dipped into outer context
  29505. // We can't get here if incoming config was rule stop and we had context
  29506. // track how far we dip into outer context. Might
  29507. // come in handy and we avoid evaluating context dependent
  29508. // preds if this is > 0.
  29509. if (closureBusy.add(c) !== c) {
  29510. // avoid infinite recursion for right-recursive rules
  29511. continue;
  29512. }
  29513. if (this._dfa !== null && this._dfa.precedenceDfa) {
  29514. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  29515. c.precedenceFilterSuppressed = true;
  29516. }
  29517. }
  29518. c.reachesIntoOuterContext += 1;
  29519. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  29520. newDepth -= 1;
  29521. if (this.debug) {
  29522. console.log("dips into outer ctx: " + c);
  29523. }
  29524. } else if (t instanceof RuleTransition) {
  29525. // latch when newDepth goes negative - once we step out of the entry context we can't return
  29526. if (newDepth >= 0) {
  29527. newDepth += 1;
  29528. }
  29529. }
  29530. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  29531. }
  29532. }
  29533. };
  29534. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  29535. // return False
  29536. var p = config.state;
  29537. // First check to see if we are in StarLoopEntryState generated during
  29538. // left-recursion elimination. For efficiency, also check if
  29539. // the context has an empty stack case. If so, it would mean
  29540. // global FOLLOW so we can't perform optimization
  29541. // Are we the special loop entry/exit state? or SLL wildcard
  29542. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  29543. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  29544. // Require all return states to return back to the same rule that p is in.
  29545. var numCtxs = config.context.length;
  29546. for (var i = 0; i < numCtxs; i++) {
  29547. // for each stack context
  29548. var returnState = this.atn.states[config.context.getReturnState(i)];
  29549. if (returnState.ruleIndex != p.ruleIndex) return false;
  29550. }
  29551. var decisionStartState = p.transitions[0].target;
  29552. var blockEndStateNum = decisionStartState.endState.stateNumber;
  29553. var blockEndState = this.atn.states[blockEndStateNum];
  29554. // Verify that the top of each stack context leads to loop entry/exit
  29555. // state through epsilon edges and w/o leaving rule.
  29556. for (var i = 0; i < numCtxs; i++) {
  29557. // for each stack context
  29558. var returnStateNumber = config.context.getReturnState(i);
  29559. var returnState = this.atn.states[returnStateNumber];
  29560. // all states must have single outgoing epsilon edge
  29561. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  29562. // Look for prefix op case like 'not expr', (' type ')' expr
  29563. var returnStateTarget = returnState.transitions[0].target;
  29564. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  29565. // Look for 'expr op expr' or case where expr's return state is block end
  29566. // of (...)* internal block; the block end points to loop back
  29567. // which points to p but we don't need to check that
  29568. if (returnState == blockEndState) continue;
  29569. // Look for ternary expr ? expr : expr. The return state points at block end,
  29570. // which points at loop entry state
  29571. if (returnStateTarget == blockEndState) continue;
  29572. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  29573. // return state points at block end state of (...)* internal block
  29574. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  29575. // anything else ain't conforming
  29576. return false;
  29577. }
  29578. return true;
  29579. };
  29580. ParserATNSimulator.prototype.getRuleName = function (index) {
  29581. if (this.parser !== null && index >= 0) {
  29582. return this.parser.ruleNames[index];
  29583. } else {
  29584. return "<rule " + index + ">";
  29585. }
  29586. };
  29587. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  29588. switch (t.serializationType) {
  29589. case Transition.RULE:
  29590. return this.ruleTransition(config, t);
  29591. case Transition.PRECEDENCE:
  29592. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29593. case Transition.PREDICATE:
  29594. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29595. case Transition.ACTION:
  29596. return this.actionTransition(config, t);
  29597. case Transition.EPSILON:
  29598. return new ATNConfig({ state: t.target }, config);
  29599. case Transition.ATOM:
  29600. case Transition.RANGE:
  29601. case Transition.SET:
  29602. // EOF transitions act like epsilon transitions after the first EOF
  29603. // transition is traversed
  29604. if (treatEofAsEpsilon) {
  29605. if (t.matches(Token.EOF, 0, 1)) {
  29606. return new ATNConfig({ state: t.target }, config);
  29607. }
  29608. }
  29609. return null;
  29610. default:
  29611. return null;
  29612. }
  29613. };
  29614. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29615. if (this.debug) {
  29616. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29617. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29618. }
  29619. return new ATNConfig({ state: t.target }, config);
  29620. };
  29621. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29622. if (this.debug) {
  29623. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29624. if (this.parser !== null) {
  29625. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29626. }
  29627. }
  29628. var c = null;
  29629. if (collectPredicates && inContext) {
  29630. if (fullCtx) {
  29631. // In full context mode, we can evaluate predicates on-the-fly
  29632. // during closure, which dramatically reduces the size of
  29633. // the config sets. It also obviates the need to test predicates
  29634. // later during conflict resolution.
  29635. var currentPosition = this._input.index;
  29636. this._input.seek(this._startIndex);
  29637. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29638. this._input.seek(currentPosition);
  29639. if (predSucceeds) {
  29640. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29641. }
  29642. } else {
  29643. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29644. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29645. }
  29646. } else {
  29647. c = new ATNConfig({ state: pt.target }, config);
  29648. }
  29649. if (this.debug) {
  29650. console.log("config from pred transition=" + c);
  29651. }
  29652. return c;
  29653. };
  29654. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29655. if (this.debug) {
  29656. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29657. if (this.parser !== null) {
  29658. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29659. }
  29660. }
  29661. var c = null;
  29662. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29663. if (fullCtx) {
  29664. // In full context mode, we can evaluate predicates on-the-fly
  29665. // during closure, which dramatically reduces the size of
  29666. // the config sets. It also obviates the need to test predicates
  29667. // later during conflict resolution.
  29668. var currentPosition = this._input.index;
  29669. this._input.seek(this._startIndex);
  29670. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29671. this._input.seek(currentPosition);
  29672. if (predSucceeds) {
  29673. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29674. }
  29675. } else {
  29676. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29677. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29678. }
  29679. } else {
  29680. c = new ATNConfig({ state: pt.target }, config);
  29681. }
  29682. if (this.debug) {
  29683. console.log("config from pred transition=" + c);
  29684. }
  29685. return c;
  29686. };
  29687. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29688. if (this.debug) {
  29689. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29690. }
  29691. var returnState = t.followState;
  29692. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29693. return new ATNConfig({ state: t.target, context: newContext }, config);
  29694. };
  29695. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29696. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29697. return PredictionMode.getAlts(altsets);
  29698. };
  29699. // Sam pointed out a problem with the previous definition, v3, of
  29700. // ambiguous states. If we have another state associated with conflicting
  29701. // alternatives, we should keep going. For example, the following grammar
  29702. //
  29703. // s : (ID | ID ID?) ';' ;
  29704. //
  29705. // When the ATN simulation reaches the state before ';', it has a DFA
  29706. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29707. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29708. // because alternative to has another way to continue, via [6|2|[]].
  29709. // The key is that we have a single state that has config's only associated
  29710. // with a single alternative, 2, and crucially the state transitions
  29711. // among the configurations are all non-epsilon transitions. That means
  29712. // we don't consider any conflicts that include alternative 2. So, we
  29713. // ignore the conflict between alts 1 and 2. We ignore a set of
  29714. // conflicting alts when there is an intersection with an alternative
  29715. // associated with a single alt state in the state&rarr;config-list map.
  29716. //
  29717. // It's also the case that we might have two conflicting configurations but
  29718. // also a 3rd nonconflicting configuration for a different alternative:
  29719. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29720. //
  29721. // a : A | A | A B ;
  29722. //
  29723. // After matching input A, we reach the stop state for rule A, state 1.
  29724. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29725. // conflict and no amount of further lookahead will separate the two.
  29726. // However, alternative 3 will be able to continue and so we do not
  29727. // stop working on this state. In the previous example, we're concerned
  29728. // with states associated with the conflicting alternatives. Here alt
  29729. // 3 is not associated with the conflicting configs, but since we can continue
  29730. // looking for input reasonably, I don't declare the state done. We
  29731. // ignore a set of conflicting alts when we have an alternative
  29732. // that we still need to pursue.
  29733. //
  29734. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  29735. var conflictingAlts = null;
  29736. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29737. conflictingAlts = new BitSet();
  29738. conflictingAlts.add(configs.uniqueAlt);
  29739. } else {
  29740. conflictingAlts = configs.conflictingAlts;
  29741. }
  29742. return conflictingAlts;
  29743. };
  29744. ParserATNSimulator.prototype.getTokenName = function (t) {
  29745. if (t === Token.EOF) {
  29746. return "EOF";
  29747. }
  29748. if (this.parser !== null && this.parser.literalNames !== null) {
  29749. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  29750. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  29751. console.log("" + this.parser.getInputStream().getTokens());
  29752. } else {
  29753. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  29754. return name + "<" + t + ">";
  29755. }
  29756. }
  29757. return "" + t;
  29758. };
  29759. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  29760. return this.getTokenName(input.LA(1));
  29761. };
  29762. // Used for debugging in adaptivePredict around execATN but I cut
  29763. // it out for clarity now that alg. works well. We can leave this
  29764. // "dead" code for a bit.
  29765. //
  29766. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  29767. console.log("dead end configs: ");
  29768. var decs = nvae.getDeadEndConfigs();
  29769. for (var i = 0; i < decs.length; i++) {
  29770. var c = decs[i];
  29771. var trans = "no edges";
  29772. if (c.state.transitions.length > 0) {
  29773. var t = c.state.transitions[0];
  29774. if (t instanceof AtomTransition) {
  29775. trans = "Atom " + this.getTokenName(t.label);
  29776. } else if (t instanceof SetTransition) {
  29777. var neg = t instanceof NotSetTransition;
  29778. trans = (neg ? "~" : "") + "Set " + t.set;
  29779. }
  29780. }
  29781. console.error(c.toString(this.parser, true) + ":" + trans);
  29782. }
  29783. };
  29784. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  29785. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  29786. };
  29787. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  29788. var alt = ATN.INVALID_ALT_NUMBER;
  29789. for (var i = 0; i < configs.items.length; i++) {
  29790. var c = configs.items[i];
  29791. if (alt === ATN.INVALID_ALT_NUMBER) {
  29792. alt = c.alt; // found first alt
  29793. } else if (c.alt !== alt) {
  29794. return ATN.INVALID_ALT_NUMBER;
  29795. }
  29796. }
  29797. return alt;
  29798. };
  29799. //
  29800. // Add an edge to the DFA, if possible. This method calls
  29801. // {@link //addDFAState} to ensure the {@code to} state is present in the
  29802. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  29803. // range of edges that can be represented in the DFA tables, this method
  29804. // returns without adding the edge to the DFA.
  29805. //
  29806. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  29807. // Otherwise, this method returns the {@link DFAState} returned by calling
  29808. // {@link //addDFAState} for the {@code to} state.</p>
  29809. //
  29810. // @param dfa The DFA
  29811. // @param from The source state for the edge
  29812. // @param t The input symbol
  29813. // @param to The target state for the edge
  29814. //
  29815. // @return If {@code to} is {@code null}, this method returns {@code null};
  29816. // otherwise this method returns the result of calling {@link //addDFAState}
  29817. // on {@code to}
  29818. //
  29819. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  29820. if (this.debug) {
  29821. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  29822. }
  29823. if (to === null) {
  29824. return null;
  29825. }
  29826. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  29827. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  29828. return to;
  29829. }
  29830. if (from_.edges === null) {
  29831. from_.edges = [];
  29832. }
  29833. from_.edges[t + 1] = to; // connect
  29834. if (this.debug) {
  29835. var literalNames = this.parser === null ? null : this.parser.literalNames;
  29836. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  29837. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  29838. }
  29839. return to;
  29840. };
  29841. //
  29842. // Add state {@code D} to the DFA if it is not already present, and return
  29843. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  29844. // is already in the DFA, the existing state is returned. Otherwise this
  29845. // method returns {@code D} after adding it to the DFA.
  29846. //
  29847. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  29848. // does not change the DFA.</p>
  29849. //
  29850. // @param dfa The dfa
  29851. // @param D The DFA state to add
  29852. // @return The state stored in the DFA. This will be either the existing
  29853. // state if {@code D} is already in the DFA, or {@code D} itself if the
  29854. // state was not already present.
  29855. //
  29856. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  29857. if (D == ATNSimulator.ERROR) {
  29858. return D;
  29859. }
  29860. var existing = dfa.states.get(D);
  29861. if (existing !== null) {
  29862. return existing;
  29863. }
  29864. D.stateNumber = dfa.states.length;
  29865. if (!D.configs.readOnly) {
  29866. D.configs.optimizeConfigs(this);
  29867. D.configs.setReadonly(true);
  29868. }
  29869. dfa.states.add(D);
  29870. if (this.debug) {
  29871. console.log("adding new DFA state: " + D);
  29872. }
  29873. return D;
  29874. };
  29875. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  29876. if (this.debug || this.retry_debug) {
  29877. var interval = new Interval(startIndex, stopIndex + 1);
  29878. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29879. }
  29880. if (this.parser !== null) {
  29881. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  29882. }
  29883. };
  29884. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  29885. if (this.debug || this.retry_debug) {
  29886. var interval = new Interval(startIndex, stopIndex + 1);
  29887. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29888. }
  29889. if (this.parser !== null) {
  29890. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  29891. }
  29892. };
  29893. // If context sensitive parsing, we know it's ambiguity not conflict//
  29894. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  29895. if (this.debug || this.retry_debug) {
  29896. var interval = new Interval(startIndex, stopIndex + 1);
  29897. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29898. }
  29899. if (this.parser !== null) {
  29900. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  29901. }
  29902. };
  29903. exports.ParserATNSimulator = ParserATNSimulator;
  29904. /***/ }),
  29905. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  29906. /*!***************************************************!*\
  29907. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  29908. \***************************************************/
  29909. /*! no static exports found */
  29910. /***/ (function(module, exports, __webpack_require__) {
  29911. "use strict";
  29912. //
  29913. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29914. * Use of this file is governed by the BSD 3-clause license that
  29915. * can be found in the LICENSE.txt file in the project root.
  29916. */
  29917. //
  29918. //
  29919. // This enumeration defines the prediction modes available in ANTLR 4 along with
  29920. // utility methods for analyzing configuration sets for conflicts and/or
  29921. // ambiguities.
  29922. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29923. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  29924. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  29925. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  29926. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  29927. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  29928. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29929. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  29930. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  29931. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29932. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  29933. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  29934. function PredictionMode() {
  29935. return this;
  29936. }
  29937. //
  29938. // The SLL(*) prediction mode. This prediction mode ignores the current
  29939. // parser context when making predictions. This is the fastest prediction
  29940. // mode, and provides correct results for many grammars. This prediction
  29941. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  29942. // may result in syntax errors for grammar and input combinations which are
  29943. // not SLL.
  29944. //
  29945. // <p>
  29946. // When using this prediction mode, the parser will either return a correct
  29947. // parse tree (i.e. the same parse tree that would be returned with the
  29948. // {@link //LL} prediction mode), or it will report a syntax error. If a
  29949. // syntax error is encountered when using the {@link //SLL} prediction mode,
  29950. // it may be due to either an actual syntax error in the input or indicate
  29951. // that the particular combination of grammar and input requires the more
  29952. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  29953. //
  29954. // <p>
  29955. // This prediction mode does not provide any guarantees for prediction
  29956. // behavior for syntactically-incorrect inputs.</p>
  29957. //
  29958. PredictionMode.SLL = 0;
  29959. //
  29960. // The LL(*) prediction mode. This prediction mode allows the current parser
  29961. // context to be used for resolving SLL conflicts that occur during
  29962. // prediction. This is the fastest prediction mode that guarantees correct
  29963. // parse results for all combinations of grammars with syntactically correct
  29964. // inputs.
  29965. //
  29966. // <p>
  29967. // When using this prediction mode, the parser will make correct decisions
  29968. // for all syntactically-correct grammar and input combinations. However, in
  29969. // cases where the grammar is truly ambiguous this prediction mode might not
  29970. // report a precise answer for <em>exactly which</em> alternatives are
  29971. // ambiguous.</p>
  29972. //
  29973. // <p>
  29974. // This prediction mode does not provide any guarantees for prediction
  29975. // behavior for syntactically-incorrect inputs.</p>
  29976. //
  29977. PredictionMode.LL = 1;
  29978. //
  29979. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  29980. // the correctness guarantees provided by the {@link //LL} prediction mode,
  29981. // this prediction mode instructs the prediction algorithm to determine the
  29982. // complete and exact set of ambiguous alternatives for every ambiguous
  29983. // decision encountered while parsing.
  29984. //
  29985. // <p>
  29986. // This prediction mode may be used for diagnosing ambiguities during
  29987. // grammar development. Due to the performance overhead of calculating sets
  29988. // of ambiguous alternatives, this prediction mode should be avoided when
  29989. // the exact results are not necessary.</p>
  29990. //
  29991. // <p>
  29992. // This prediction mode does not provide any guarantees for prediction
  29993. // behavior for syntactically-incorrect inputs.</p>
  29994. //
  29995. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  29996. //
  29997. // Computes the SLL prediction termination condition.
  29998. //
  29999. // <p>
  30000. // This method computes the SLL prediction termination condition for both of
  30001. // the following cases.</p>
  30002. //
  30003. // <ul>
  30004. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  30005. // <li>Pure SLL without LL fallback</li>
  30006. // </ul>
  30007. //
  30008. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  30009. //
  30010. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  30011. // ensured regardless of how the termination condition is computed by this
  30012. // method. Due to the substantially higher cost of LL prediction, the
  30013. // prediction should only fall back to LL when the additional lookahead
  30014. // cannot lead to a unique SLL prediction.</p>
  30015. //
  30016. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  30017. // conflicting subsets should fall back to full LL, even if the
  30018. // configuration sets don't resolve to the same alternative (e.g.
  30019. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  30020. // configuration, SLL could continue with the hopes that more lookahead will
  30021. // resolve via one of those non-conflicting configurations.</p>
  30022. //
  30023. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  30024. // stops when it sees only conflicting configuration subsets. In contrast,
  30025. // full LL keeps going when there is uncertainty.</p>
  30026. //
  30027. // <p><strong>HEURISTIC</strong></p>
  30028. //
  30029. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  30030. // unless we see a state that only has one alternative associated with it.
  30031. // The single-alt-state thing lets prediction continue upon rules like
  30032. // (otherwise, it would admit defeat too soon):</p>
  30033. //
  30034. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  30035. //
  30036. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  30037. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  30038. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  30039. // processing this node because alternative to has another way to continue,
  30040. // via {@code [6|2|[]]}.</p>
  30041. //
  30042. // <p>It also let's us continue for this rule:</p>
  30043. //
  30044. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  30045. //
  30046. // <p>After matching input A, we reach the stop state for rule A, state 1.
  30047. // State 8 is the state right before B. Clearly alternatives 1 and 2
  30048. // conflict and no amount of further lookahead will separate the two.
  30049. // However, alternative 3 will be able to continue and so we do not stop
  30050. // working on this state. In the previous example, we're concerned with
  30051. // states associated with the conflicting alternatives. Here alt 3 is not
  30052. // associated with the conflicting configs, but since we can continue
  30053. // looking for input reasonably, don't declare the state done.</p>
  30054. //
  30055. // <p><strong>PURE SLL PARSING</strong></p>
  30056. //
  30057. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  30058. // combine stack contexts for configurations that differ only by semantic
  30059. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  30060. //
  30061. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  30062. //
  30063. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  30064. // states because they need to create the DFA cache that works in all
  30065. // semantic situations. In contrast, full LL evaluates predicates collected
  30066. // during start state computation so it can ignore predicates thereafter.
  30067. // This means that SLL termination detection can totally ignore semantic
  30068. // predicates.</p>
  30069. //
  30070. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  30071. // semantic predicate contexts so we might see two configurations like the
  30072. // following.</p>
  30073. //
  30074. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  30075. //
  30076. // <p>Before testing these configurations against others, we have to merge
  30077. // {@code x} and {@code x'} (without modifying the existing configurations).
  30078. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  30079. // the following configurations.</p>
  30080. //
  30081. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  30082. //
  30083. // <p>If the configuration set has predicates (as indicated by
  30084. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  30085. // the configurations to strip out all of the predicates so that a standard
  30086. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  30087. //
  30088. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  30089. // Configs in rule stop states indicate reaching the end of the decision
  30090. // rule (local context) or end of start rule (full context). If all
  30091. // configs meet this condition, then none of the configurations is able
  30092. // to match additional input so we terminate prediction.
  30093. //
  30094. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  30095. return true;
  30096. }
  30097. // pure SLL mode parsing
  30098. if (mode === PredictionMode.SLL) {
  30099. // Don't bother with combining configs from different semantic
  30100. // contexts if we can fail over to full LL; costs more time
  30101. // since we'll often fail over anyway.
  30102. if (configs.hasSemanticContext) {
  30103. // dup configs, tossing out semantic predicates
  30104. var dup = new ATNConfigSet();
  30105. for (var i = 0; i < configs.items.length; i++) {
  30106. var c = configs.items[i];
  30107. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  30108. dup.add(c);
  30109. }
  30110. configs = dup;
  30111. }
  30112. // now we have combined contexts for configs with dissimilar preds
  30113. }
  30114. // pure SLL or combined SLL+LL mode parsing
  30115. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  30116. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  30117. };
  30118. // Checks if any configuration in {@code configs} is in a
  30119. // {@link RuleStopState}. Configurations meeting this condition have reached
  30120. // the end of the decision rule (local context) or end of start rule (full
  30121. // context).
  30122. //
  30123. // @param configs the configuration set to test
  30124. // @return {@code true} if any configuration in {@code configs} is in a
  30125. // {@link RuleStopState}, otherwise {@code false}
  30126. PredictionMode.hasConfigInRuleStopState = function (configs) {
  30127. for (var i = 0; i < configs.items.length; i++) {
  30128. var c = configs.items[i];
  30129. if (c.state instanceof RuleStopState) {
  30130. return true;
  30131. }
  30132. }
  30133. return false;
  30134. };
  30135. // Checks if all configurations in {@code configs} are in a
  30136. // {@link RuleStopState}. Configurations meeting this condition have reached
  30137. // the end of the decision rule (local context) or end of start rule (full
  30138. // context).
  30139. //
  30140. // @param configs the configuration set to test
  30141. // @return {@code true} if all configurations in {@code configs} are in a
  30142. // {@link RuleStopState}, otherwise {@code false}
  30143. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  30144. for (var i = 0; i < configs.items.length; i++) {
  30145. var c = configs.items[i];
  30146. if (!(c.state instanceof RuleStopState)) {
  30147. return false;
  30148. }
  30149. }
  30150. return true;
  30151. };
  30152. //
  30153. // Full LL prediction termination.
  30154. //
  30155. // <p>Can we stop looking ahead during ATN simulation or is there some
  30156. // uncertainty as to which alternative we will ultimately pick, after
  30157. // consuming more input? Even if there are partial conflicts, we might know
  30158. // that everything is going to resolve to the same minimum alternative. That
  30159. // means we can stop since no more lookahead will change that fact. On the
  30160. // other hand, there might be multiple conflicts that resolve to different
  30161. // minimums. That means we need more look ahead to decide which of those
  30162. // alternatives we should predict.</p>
  30163. //
  30164. // <p>The basic idea is to split the set of configurations {@code C}, into
  30165. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  30166. // non-conflicting configurations. Two configurations conflict if they have
  30167. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  30168. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  30169. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  30170. //
  30171. // <p>Reduce these configuration subsets to the set of possible alternatives.
  30172. // You can compute the alternative subsets in one pass as follows:</p>
  30173. //
  30174. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  30175. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  30176. //
  30177. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  30178. //
  30179. // <pre>
  30180. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  30181. // alt and not pred
  30182. // </pre>
  30183. //
  30184. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  30185. //
  30186. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  30187. // {@code s} and {@code ctx}.</p>
  30188. //
  30189. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  30190. // the union of these alternative subsets is a singleton, then no amount of
  30191. // more lookahead will help us. We will always pick that alternative. If,
  30192. // however, there is more than one alternative, then we are uncertain which
  30193. // alternative to predict and must continue looking for resolution. We may
  30194. // or may not discover an ambiguity in the future, even if there are no
  30195. // conflicting subsets this round.</p>
  30196. //
  30197. // <p>The biggest sin is to terminate early because it means we've made a
  30198. // decision but were uncertain as to the eventual outcome. We haven't used
  30199. // enough lookahead. On the other hand, announcing a conflict too late is no
  30200. // big deal; you will still have the conflict. It's just inefficient. It
  30201. // might even look until the end of file.</p>
  30202. //
  30203. // <p>No special consideration for semantic predicates is required because
  30204. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  30205. // no configuration contains a semantic context during the termination
  30206. // check.</p>
  30207. //
  30208. // <p><strong>CONFLICTING CONFIGS</strong></p>
  30209. //
  30210. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  30211. // when {@code i!=j} but {@code x=x'}. Because we merge all
  30212. // {@code (s, i, _)} configurations together, that means that there are at
  30213. // most {@code n} configurations associated with state {@code s} for
  30214. // {@code n} possible alternatives in the decision. The merged stacks
  30215. // complicate the comparison of configuration contexts {@code x} and
  30216. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  30217. // merge and checking to see if the merged result is either {@code x} or
  30218. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  30219. // is the superset, then {@code i} is the only possible prediction since the
  30220. // others resolve to {@code min(i)} as well. However, if {@code x} is
  30221. // associated with {@code j>i} then at least one stack configuration for
  30222. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  30223. // should keep going, looking for more lookahead due to the uncertainty.</p>
  30224. //
  30225. // <p>For simplicity, I'm doing a equality check between {@code x} and
  30226. // {@code x'} that lets the algorithm continue to consume lookahead longer
  30227. // than necessary. The reason I like the equality is of course the
  30228. // simplicity but also because that is the test you need to detect the
  30229. // alternatives that are actually in conflict.</p>
  30230. //
  30231. // <p><strong>CONTINUE/STOP RULE</strong></p>
  30232. //
  30233. // <p>Continue if union of resolved alternative sets from non-conflicting and
  30234. // conflicting alternative subsets has more than one alternative. We are
  30235. // uncertain about which alternative to predict.</p>
  30236. //
  30237. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  30238. // alternatives are still in the running for the amount of input we've
  30239. // consumed at this point. The conflicting sets let us to strip away
  30240. // configurations that won't lead to more states because we resolve
  30241. // conflicts to the configuration with a minimum alternate for the
  30242. // conflicting set.</p>
  30243. //
  30244. // <p><strong>CASES</strong></p>
  30245. //
  30246. // <ul>
  30247. //
  30248. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  30249. //
  30250. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  30251. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  30252. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  30253. // {@code {1,3}} =&gt; continue
  30254. // </li>
  30255. //
  30256. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  30257. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  30258. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  30259. // {@code {1}} =&gt; stop and predict 1</li>
  30260. //
  30261. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  30262. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  30263. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  30264. // ambiguity {@code {1,2}}</li>
  30265. //
  30266. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  30267. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  30268. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  30269. //
  30270. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  30271. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  30272. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  30273. //
  30274. // </ul>
  30275. //
  30276. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  30277. //
  30278. // <p>If all states report the same conflicting set of alternatives, then we
  30279. // know we have the exact ambiguity set.</p>
  30280. //
  30281. // <p><code>|A_<em>i</em>|&gt;1</code> and
  30282. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  30283. //
  30284. // <p>In other words, we continue examining lookahead until all {@code A_i}
  30285. // have more than one alternative and all {@code A_i} are the same. If
  30286. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  30287. // because the resolved set is {@code {1}}. To determine what the real
  30288. // ambiguity is, we have to know whether the ambiguity is between one and
  30289. // two or one and three so we keep going. We can only stop prediction when
  30290. // we need exact ambiguity detection when the sets look like
  30291. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  30292. //
  30293. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  30294. return PredictionMode.getSingleViableAlt(altsets);
  30295. };
  30296. //
  30297. // Determines if every alternative subset in {@code altsets} contains more
  30298. // than one alternative.
  30299. //
  30300. // @param altsets a collection of alternative subsets
  30301. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  30302. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  30303. //
  30304. PredictionMode.allSubsetsConflict = function (altsets) {
  30305. return !PredictionMode.hasNonConflictingAltSet(altsets);
  30306. };
  30307. //
  30308. // Determines if any single alternative subset in {@code altsets} contains
  30309. // exactly one alternative.
  30310. //
  30311. // @param altsets a collection of alternative subsets
  30312. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  30313. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  30314. //
  30315. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  30316. for (var i = 0; i < altsets.length; i++) {
  30317. var alts = altsets[i];
  30318. if (alts.length === 1) {
  30319. return true;
  30320. }
  30321. }
  30322. return false;
  30323. };
  30324. //
  30325. // Determines if any single alternative subset in {@code altsets} contains
  30326. // more than one alternative.
  30327. //
  30328. // @param altsets a collection of alternative subsets
  30329. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  30330. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  30331. //
  30332. PredictionMode.hasConflictingAltSet = function (altsets) {
  30333. for (var i = 0; i < altsets.length; i++) {
  30334. var alts = altsets[i];
  30335. if (alts.length > 1) {
  30336. return true;
  30337. }
  30338. }
  30339. return false;
  30340. };
  30341. //
  30342. // Determines if every alternative subset in {@code altsets} is equivalent.
  30343. //
  30344. // @param altsets a collection of alternative subsets
  30345. // @return {@code true} if every member of {@code altsets} is equal to the
  30346. // others, otherwise {@code false}
  30347. //
  30348. PredictionMode.allSubsetsEqual = function (altsets) {
  30349. var first = null;
  30350. for (var i = 0; i < altsets.length; i++) {
  30351. var alts = altsets[i];
  30352. if (first === null) {
  30353. first = alts;
  30354. } else if (alts !== first) {
  30355. return false;
  30356. }
  30357. }
  30358. return true;
  30359. };
  30360. //
  30361. // Returns the unique alternative predicted by all alternative subsets in
  30362. // {@code altsets}. If no such alternative exists, this method returns
  30363. // {@link ATN//INVALID_ALT_NUMBER}.
  30364. //
  30365. // @param altsets a collection of alternative subsets
  30366. //
  30367. PredictionMode.getUniqueAlt = function (altsets) {
  30368. var all = PredictionMode.getAlts(altsets);
  30369. if (all.length === 1) {
  30370. return all.minValue();
  30371. } else {
  30372. return ATN.INVALID_ALT_NUMBER;
  30373. }
  30374. };
  30375. // Gets the complete set of represented alternatives for a collection of
  30376. // alternative subsets. This method returns the union of each {@link BitSet}
  30377. // in {@code altsets}.
  30378. //
  30379. // @param altsets a collection of alternative subsets
  30380. // @return the set of represented alternatives in {@code altsets}
  30381. //
  30382. PredictionMode.getAlts = function (altsets) {
  30383. var all = new BitSet();
  30384. altsets.map(function (alts) {
  30385. all.or(alts);
  30386. });
  30387. return all;
  30388. };
  30389. //
  30390. // This function gets the conflicting alt subsets from a configuration set.
  30391. // For each configuration {@code c} in {@code configs}:
  30392. //
  30393. // <pre>
  30394. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  30395. // alt and not pred
  30396. // </pre>
  30397. PredictionMode.getConflictingAltSubsets = function (configs) {
  30398. var configToAlts = new Map();
  30399. configToAlts.hashFunction = function (cfg) {
  30400. hashStuff(cfg.state.stateNumber, cfg.context);
  30401. };
  30402. configToAlts.equalsFunction = function (c1, c2) {
  30403. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  30404. };
  30405. configs.items.map(function (cfg) {
  30406. var alts = configToAlts.get(cfg);
  30407. if (alts === null) {
  30408. alts = new BitSet();
  30409. configToAlts.put(cfg, alts);
  30410. }
  30411. alts.add(cfg.alt);
  30412. });
  30413. return configToAlts.getValues();
  30414. };
  30415. //
  30416. // Get a map from state to alt subset from a configuration set. For each
  30417. // configuration {@code c} in {@code configs}:
  30418. //
  30419. // <pre>
  30420. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  30421. // </pre>
  30422. //
  30423. PredictionMode.getStateToAltMap = function (configs) {
  30424. var m = new AltDict();
  30425. configs.items.map(function (c) {
  30426. var alts = m.get(c.state);
  30427. if (alts === null) {
  30428. alts = new BitSet();
  30429. m.put(c.state, alts);
  30430. }
  30431. alts.add(c.alt);
  30432. });
  30433. return m;
  30434. };
  30435. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  30436. var values = PredictionMode.getStateToAltMap(configs).values();
  30437. for (var i = 0; i < values.length; i++) {
  30438. if (values[i].length === 1) {
  30439. return true;
  30440. }
  30441. }
  30442. return false;
  30443. };
  30444. PredictionMode.getSingleViableAlt = function (altsets) {
  30445. var result = null;
  30446. for (var i = 0; i < altsets.length; i++) {
  30447. var alts = altsets[i];
  30448. var minAlt = alts.minValue();
  30449. if (result === null) {
  30450. result = minAlt;
  30451. } else if (result !== minAlt) {
  30452. // more than 1 viable alt
  30453. return ATN.INVALID_ALT_NUMBER;
  30454. }
  30455. }
  30456. return result;
  30457. };
  30458. exports.PredictionMode = PredictionMode;
  30459. /***/ }),
  30460. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  30461. /*!****************************************************!*\
  30462. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  30463. \****************************************************/
  30464. /*! no static exports found */
  30465. /***/ (function(module, exports, __webpack_require__) {
  30466. "use strict";
  30467. //
  30468. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30469. * Use of this file is governed by the BSD 3-clause license that
  30470. * can be found in the LICENSE.txt file in the project root.
  30471. */
  30472. //
  30473. // A tree structure used to record the semantic context in which
  30474. // an ATN configuration is valid. It's either a single predicate,
  30475. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  30476. //
  30477. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  30478. // {@link SemanticContext} within the scope of this outer class.</p>
  30479. //
  30480. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30481. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30482. function SemanticContext() {
  30483. return this;
  30484. }
  30485. SemanticContext.prototype.hashCode = function () {
  30486. var hash = new Hash();
  30487. this.updateHashCode(hash);
  30488. return hash.finish();
  30489. };
  30490. // For context independent predicates, we evaluate them without a local
  30491. // context (i.e., null context). That way, we can evaluate them without
  30492. // having to create proper rule-specific context during prediction (as
  30493. // opposed to the parser, which creates them naturally). In a practical
  30494. // sense, this avoids a cast exception from RuleContext to myruleContext.
  30495. //
  30496. // <p>For context dependent predicates, we must pass in a local context so that
  30497. // references such as $arg evaluate properly as _localctx.arg. We only
  30498. // capture context dependent predicates in the context in which we begin
  30499. // prediction, so we passed in the outer context here in case of context
  30500. // dependent predicate evaluation.</p>
  30501. //
  30502. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  30503. //
  30504. // Evaluate the precedence predicates for the context and reduce the result.
  30505. //
  30506. // @param parser The parser instance.
  30507. // @param outerContext The current parser context object.
  30508. // @return The simplified semantic context after precedence predicates are
  30509. // evaluated, which will be one of the following values.
  30510. // <ul>
  30511. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  30512. // precedence predicates are evaluated.</li>
  30513. // <li>{@code null}: if the predicate simplifies to {@code false} after
  30514. // precedence predicates are evaluated.</li>
  30515. // <li>{@code this}: if the semantic context is not changed as a result of
  30516. // precedence predicate evaluation.</li>
  30517. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  30518. // semantic context after precedence predicates are evaluated.</li>
  30519. // </ul>
  30520. //
  30521. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  30522. return this;
  30523. };
  30524. SemanticContext.andContext = function (a, b) {
  30525. if (a === null || a === SemanticContext.NONE) {
  30526. return b;
  30527. }
  30528. if (b === null || b === SemanticContext.NONE) {
  30529. return a;
  30530. }
  30531. var result = new AND(a, b);
  30532. if (result.opnds.length === 1) {
  30533. return result.opnds[0];
  30534. } else {
  30535. return result;
  30536. }
  30537. };
  30538. SemanticContext.orContext = function (a, b) {
  30539. if (a === null) {
  30540. return b;
  30541. }
  30542. if (b === null) {
  30543. return a;
  30544. }
  30545. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  30546. return SemanticContext.NONE;
  30547. }
  30548. var result = new OR(a, b);
  30549. if (result.opnds.length === 1) {
  30550. return result.opnds[0];
  30551. } else {
  30552. return result;
  30553. }
  30554. };
  30555. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  30556. SemanticContext.call(this);
  30557. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  30558. this.predIndex = predIndex === undefined ? -1 : predIndex;
  30559. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30560. return this;
  30561. }
  30562. Predicate.prototype = Object.create(SemanticContext.prototype);
  30563. Predicate.prototype.constructor = Predicate;
  30564. //The default {@link SemanticContext}, which is semantically equivalent to
  30565. //a predicate of the form {@code {true}?}.
  30566. //
  30567. SemanticContext.NONE = new Predicate();
  30568. Predicate.prototype.evaluate = function (parser, outerContext) {
  30569. var localctx = this.isCtxDependent ? outerContext : null;
  30570. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  30571. };
  30572. Predicate.prototype.updateHashCode = function (hash) {
  30573. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30574. };
  30575. Predicate.prototype.equals = function (other) {
  30576. if (this === other) {
  30577. return true;
  30578. } else if (!(other instanceof Predicate)) {
  30579. return false;
  30580. } else {
  30581. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  30582. }
  30583. };
  30584. Predicate.prototype.toString = function () {
  30585. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  30586. };
  30587. function PrecedencePredicate(precedence) {
  30588. SemanticContext.call(this);
  30589. this.precedence = precedence === undefined ? 0 : precedence;
  30590. }
  30591. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  30592. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30593. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30594. return parser.precpred(outerContext, this.precedence);
  30595. };
  30596. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30597. if (parser.precpred(outerContext, this.precedence)) {
  30598. return SemanticContext.NONE;
  30599. } else {
  30600. return null;
  30601. }
  30602. };
  30603. PrecedencePredicate.prototype.compareTo = function (other) {
  30604. return this.precedence - other.precedence;
  30605. };
  30606. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30607. hash.update(31);
  30608. };
  30609. PrecedencePredicate.prototype.equals = function (other) {
  30610. if (this === other) {
  30611. return true;
  30612. } else if (!(other instanceof PrecedencePredicate)) {
  30613. return false;
  30614. } else {
  30615. return this.precedence === other.precedence;
  30616. }
  30617. };
  30618. PrecedencePredicate.prototype.toString = function () {
  30619. return "{" + this.precedence + ">=prec}?";
  30620. };
  30621. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30622. var result = [];
  30623. set.values().map(function (context) {
  30624. if (context instanceof PrecedencePredicate) {
  30625. result.push(context);
  30626. }
  30627. });
  30628. return result;
  30629. };
  30630. // A semantic context which is true whenever none of the contained contexts
  30631. // is false.
  30632. //
  30633. function AND(a, b) {
  30634. SemanticContext.call(this);
  30635. var operands = new Set();
  30636. if (a instanceof AND) {
  30637. a.opnds.map(function (o) {
  30638. operands.add(o);
  30639. });
  30640. } else {
  30641. operands.add(a);
  30642. }
  30643. if (b instanceof AND) {
  30644. b.opnds.map(function (o) {
  30645. operands.add(o);
  30646. });
  30647. } else {
  30648. operands.add(b);
  30649. }
  30650. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30651. if (precedencePredicates.length > 0) {
  30652. // interested in the transition with the lowest precedence
  30653. var reduced = null;
  30654. precedencePredicates.map(function (p) {
  30655. if (reduced === null || p.precedence < reduced.precedence) {
  30656. reduced = p;
  30657. }
  30658. });
  30659. operands.add(reduced);
  30660. }
  30661. this.opnds = operands.values();
  30662. return this;
  30663. }
  30664. AND.prototype = Object.create(SemanticContext.prototype);
  30665. AND.prototype.constructor = AND;
  30666. AND.prototype.equals = function (other) {
  30667. if (this === other) {
  30668. return true;
  30669. } else if (!(other instanceof AND)) {
  30670. return false;
  30671. } else {
  30672. return this.opnds === other.opnds;
  30673. }
  30674. };
  30675. AND.prototype.updateHashCode = function (hash) {
  30676. hash.update(this.opnds, "AND");
  30677. };
  30678. //
  30679. // {@inheritDoc}
  30680. //
  30681. // <p>
  30682. // The evaluation of predicates by this context is short-circuiting, but
  30683. // unordered.</p>
  30684. //
  30685. AND.prototype.evaluate = function (parser, outerContext) {
  30686. for (var i = 0; i < this.opnds.length; i++) {
  30687. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30688. return false;
  30689. }
  30690. }
  30691. return true;
  30692. };
  30693. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30694. var differs = false;
  30695. var operands = [];
  30696. for (var i = 0; i < this.opnds.length; i++) {
  30697. var context = this.opnds[i];
  30698. var evaluated = context.evalPrecedence(parser, outerContext);
  30699. differs |= evaluated !== context;
  30700. if (evaluated === null) {
  30701. // The AND context is false if any element is false
  30702. return null;
  30703. } else if (evaluated !== SemanticContext.NONE) {
  30704. // Reduce the result by skipping true elements
  30705. operands.push(evaluated);
  30706. }
  30707. }
  30708. if (!differs) {
  30709. return this;
  30710. }
  30711. if (operands.length === 0) {
  30712. // all elements were true, so the AND context is true
  30713. return SemanticContext.NONE;
  30714. }
  30715. var result = null;
  30716. operands.map(function (o) {
  30717. result = result === null ? o : SemanticContext.andContext(result, o);
  30718. });
  30719. return result;
  30720. };
  30721. AND.prototype.toString = function () {
  30722. var s = "";
  30723. this.opnds.map(function (o) {
  30724. s += "&& " + o.toString();
  30725. });
  30726. return s.length > 3 ? s.slice(3) : s;
  30727. };
  30728. //
  30729. // A semantic context which is true whenever at least one of the contained
  30730. // contexts is true.
  30731. //
  30732. function OR(a, b) {
  30733. SemanticContext.call(this);
  30734. var operands = new Set();
  30735. if (a instanceof OR) {
  30736. a.opnds.map(function (o) {
  30737. operands.add(o);
  30738. });
  30739. } else {
  30740. operands.add(a);
  30741. }
  30742. if (b instanceof OR) {
  30743. b.opnds.map(function (o) {
  30744. operands.add(o);
  30745. });
  30746. } else {
  30747. operands.add(b);
  30748. }
  30749. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30750. if (precedencePredicates.length > 0) {
  30751. // interested in the transition with the highest precedence
  30752. var s = precedencePredicates.sort(function (a, b) {
  30753. return a.compareTo(b);
  30754. });
  30755. var reduced = s[s.length - 1];
  30756. operands.add(reduced);
  30757. }
  30758. this.opnds = operands.values();
  30759. return this;
  30760. }
  30761. OR.prototype = Object.create(SemanticContext.prototype);
  30762. OR.prototype.constructor = OR;
  30763. OR.prototype.constructor = function (other) {
  30764. if (this === other) {
  30765. return true;
  30766. } else if (!(other instanceof OR)) {
  30767. return false;
  30768. } else {
  30769. return this.opnds === other.opnds;
  30770. }
  30771. };
  30772. OR.prototype.updateHashCode = function (hash) {
  30773. hash.update(this.opnds, "OR");
  30774. };
  30775. // <p>
  30776. // The evaluation of predicates by this context is short-circuiting, but
  30777. // unordered.</p>
  30778. //
  30779. OR.prototype.evaluate = function (parser, outerContext) {
  30780. for (var i = 0; i < this.opnds.length; i++) {
  30781. if (this.opnds[i].evaluate(parser, outerContext)) {
  30782. return true;
  30783. }
  30784. }
  30785. return false;
  30786. };
  30787. OR.prototype.evalPrecedence = function (parser, outerContext) {
  30788. var differs = false;
  30789. var operands = [];
  30790. for (var i = 0; i < this.opnds.length; i++) {
  30791. var context = this.opnds[i];
  30792. var evaluated = context.evalPrecedence(parser, outerContext);
  30793. differs |= evaluated !== context;
  30794. if (evaluated === SemanticContext.NONE) {
  30795. // The OR context is true if any element is true
  30796. return SemanticContext.NONE;
  30797. } else if (evaluated !== null) {
  30798. // Reduce the result by skipping false elements
  30799. operands.push(evaluated);
  30800. }
  30801. }
  30802. if (!differs) {
  30803. return this;
  30804. }
  30805. if (operands.length === 0) {
  30806. // all elements were false, so the OR context is false
  30807. return null;
  30808. }
  30809. var result = null;
  30810. operands.map(function (o) {
  30811. return result === null ? o : SemanticContext.orContext(result, o);
  30812. });
  30813. return result;
  30814. };
  30815. OR.prototype.toString = function () {
  30816. var s = "";
  30817. this.opnds.map(function (o) {
  30818. s += "|| " + o.toString();
  30819. });
  30820. return s.length > 3 ? s.slice(3) : s;
  30821. };
  30822. exports.SemanticContext = SemanticContext;
  30823. exports.PrecedencePredicate = PrecedencePredicate;
  30824. exports.Predicate = Predicate;
  30825. /***/ }),
  30826. /***/ "./node_modules/antlr4/atn/Transition.js":
  30827. /*!***********************************************!*\
  30828. !*** ./node_modules/antlr4/atn/Transition.js ***!
  30829. \***********************************************/
  30830. /*! no static exports found */
  30831. /***/ (function(module, exports, __webpack_require__) {
  30832. "use strict";
  30833. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30834. * Use of this file is governed by the BSD 3-clause license that
  30835. * can be found in the LICENSE.txt file in the project root.
  30836. */
  30837. //
  30838. // An ATN transition between any two ATN states. Subclasses define
  30839. // atom, set, epsilon, action, predicate, rule transitions.
  30840. //
  30841. // <p>This is a one way link. It emanates from a state (usually via a list of
  30842. // transitions) and has a target state.</p>
  30843. //
  30844. // <p>Since we never have to change the ATN transitions once we construct it,
  30845. // we can fix these transitions as specific classes. The DFA transitions
  30846. // on the other hand need to update the labels as it adds transitions to
  30847. // the states. We'll use the term Edge for the DFA to distinguish them from
  30848. // ATN transitions.</p>
  30849. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30850. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30851. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30852. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  30853. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  30854. function Transition(target) {
  30855. // The target of this transition.
  30856. if (target === undefined || target === null) {
  30857. throw "target cannot be null.";
  30858. }
  30859. this.target = target;
  30860. // Are we epsilon, action, sempred?
  30861. this.isEpsilon = false;
  30862. this.label = null;
  30863. return this;
  30864. }
  30865. // constants for serialization
  30866. Transition.EPSILON = 1;
  30867. Transition.RANGE = 2;
  30868. Transition.RULE = 3;
  30869. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  30870. Transition.ATOM = 5;
  30871. Transition.ACTION = 6;
  30872. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  30873. Transition.NOT_SET = 8;
  30874. Transition.WILDCARD = 9;
  30875. Transition.PRECEDENCE = 10;
  30876. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  30877. Transition.serializationTypes = {
  30878. EpsilonTransition: Transition.EPSILON,
  30879. RangeTransition: Transition.RANGE,
  30880. RuleTransition: Transition.RULE,
  30881. PredicateTransition: Transition.PREDICATE,
  30882. AtomTransition: Transition.ATOM,
  30883. ActionTransition: Transition.ACTION,
  30884. SetTransition: Transition.SET,
  30885. NotSetTransition: Transition.NOT_SET,
  30886. WildcardTransition: Transition.WILDCARD,
  30887. PrecedencePredicateTransition: Transition.PRECEDENCE
  30888. };
  30889. // TODO: make all transitions sets? no, should remove set edges
  30890. function AtomTransition(target, label) {
  30891. Transition.call(this, target);
  30892. this.label_ = label; // The token type or character value; or, signifies special label.
  30893. this.label = this.makeLabel();
  30894. this.serializationType = Transition.ATOM;
  30895. return this;
  30896. }
  30897. AtomTransition.prototype = Object.create(Transition.prototype);
  30898. AtomTransition.prototype.constructor = AtomTransition;
  30899. AtomTransition.prototype.makeLabel = function () {
  30900. var s = new IntervalSet();
  30901. s.addOne(this.label_);
  30902. return s;
  30903. };
  30904. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30905. return this.label_ === symbol;
  30906. };
  30907. AtomTransition.prototype.toString = function () {
  30908. return this.label_;
  30909. };
  30910. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  30911. Transition.call(this, ruleStart);
  30912. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  30913. this.precedence = precedence;
  30914. this.followState = followState; // what node to begin computations following ref to rule
  30915. this.serializationType = Transition.RULE;
  30916. this.isEpsilon = true;
  30917. return this;
  30918. }
  30919. RuleTransition.prototype = Object.create(Transition.prototype);
  30920. RuleTransition.prototype.constructor = RuleTransition;
  30921. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30922. return false;
  30923. };
  30924. function EpsilonTransition(target, outermostPrecedenceReturn) {
  30925. Transition.call(this, target);
  30926. this.serializationType = Transition.EPSILON;
  30927. this.isEpsilon = true;
  30928. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  30929. return this;
  30930. }
  30931. EpsilonTransition.prototype = Object.create(Transition.prototype);
  30932. EpsilonTransition.prototype.constructor = EpsilonTransition;
  30933. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30934. return false;
  30935. };
  30936. EpsilonTransition.prototype.toString = function () {
  30937. return "epsilon";
  30938. };
  30939. function RangeTransition(target, start, stop) {
  30940. Transition.call(this, target);
  30941. this.serializationType = Transition.RANGE;
  30942. this.start = start;
  30943. this.stop = stop;
  30944. this.label = this.makeLabel();
  30945. return this;
  30946. }
  30947. RangeTransition.prototype = Object.create(Transition.prototype);
  30948. RangeTransition.prototype.constructor = RangeTransition;
  30949. RangeTransition.prototype.makeLabel = function () {
  30950. var s = new IntervalSet();
  30951. s.addRange(this.start, this.stop);
  30952. return s;
  30953. };
  30954. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30955. return symbol >= this.start && symbol <= this.stop;
  30956. };
  30957. RangeTransition.prototype.toString = function () {
  30958. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  30959. };
  30960. function AbstractPredicateTransition(target) {
  30961. Transition.call(this, target);
  30962. return this;
  30963. }
  30964. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  30965. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  30966. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  30967. AbstractPredicateTransition.call(this, target);
  30968. this.serializationType = Transition.PREDICATE;
  30969. this.ruleIndex = ruleIndex;
  30970. this.predIndex = predIndex;
  30971. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  30972. this.isEpsilon = true;
  30973. return this;
  30974. }
  30975. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30976. PredicateTransition.prototype.constructor = PredicateTransition;
  30977. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30978. return false;
  30979. };
  30980. PredicateTransition.prototype.getPredicate = function () {
  30981. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30982. };
  30983. PredicateTransition.prototype.toString = function () {
  30984. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  30985. };
  30986. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  30987. Transition.call(this, target);
  30988. this.serializationType = Transition.ACTION;
  30989. this.ruleIndex = ruleIndex;
  30990. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  30991. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30992. this.isEpsilon = true;
  30993. return this;
  30994. }
  30995. ActionTransition.prototype = Object.create(Transition.prototype);
  30996. ActionTransition.prototype.constructor = ActionTransition;
  30997. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30998. return false;
  30999. };
  31000. ActionTransition.prototype.toString = function () {
  31001. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  31002. };
  31003. // A transition containing a set of values.
  31004. function SetTransition(target, set) {
  31005. Transition.call(this, target);
  31006. this.serializationType = Transition.SET;
  31007. if (set !== undefined && set !== null) {
  31008. this.label = set;
  31009. } else {
  31010. this.label = new IntervalSet();
  31011. this.label.addOne(Token.INVALID_TYPE);
  31012. }
  31013. return this;
  31014. }
  31015. SetTransition.prototype = Object.create(Transition.prototype);
  31016. SetTransition.prototype.constructor = SetTransition;
  31017. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31018. return this.label.contains(symbol);
  31019. };
  31020. SetTransition.prototype.toString = function () {
  31021. return this.label.toString();
  31022. };
  31023. function NotSetTransition(target, set) {
  31024. SetTransition.call(this, target, set);
  31025. this.serializationType = Transition.NOT_SET;
  31026. return this;
  31027. }
  31028. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  31029. NotSetTransition.prototype.constructor = NotSetTransition;
  31030. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31031. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  31032. };
  31033. NotSetTransition.prototype.toString = function () {
  31034. return '~' + SetTransition.prototype.toString.call(this);
  31035. };
  31036. function WildcardTransition(target) {
  31037. Transition.call(this, target);
  31038. this.serializationType = Transition.WILDCARD;
  31039. return this;
  31040. }
  31041. WildcardTransition.prototype = Object.create(Transition.prototype);
  31042. WildcardTransition.prototype.constructor = WildcardTransition;
  31043. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31044. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  31045. };
  31046. WildcardTransition.prototype.toString = function () {
  31047. return ".";
  31048. };
  31049. function PrecedencePredicateTransition(target, precedence) {
  31050. AbstractPredicateTransition.call(this, target);
  31051. this.serializationType = Transition.PRECEDENCE;
  31052. this.precedence = precedence;
  31053. this.isEpsilon = true;
  31054. return this;
  31055. }
  31056. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  31057. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  31058. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31059. return false;
  31060. };
  31061. PrecedencePredicateTransition.prototype.getPredicate = function () {
  31062. return new PrecedencePredicate(this.precedence);
  31063. };
  31064. PrecedencePredicateTransition.prototype.toString = function () {
  31065. return this.precedence + " >= _p";
  31066. };
  31067. exports.Transition = Transition;
  31068. exports.AtomTransition = AtomTransition;
  31069. exports.SetTransition = SetTransition;
  31070. exports.NotSetTransition = NotSetTransition;
  31071. exports.RuleTransition = RuleTransition;
  31072. exports.ActionTransition = ActionTransition;
  31073. exports.EpsilonTransition = EpsilonTransition;
  31074. exports.RangeTransition = RangeTransition;
  31075. exports.WildcardTransition = WildcardTransition;
  31076. exports.PredicateTransition = PredicateTransition;
  31077. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  31078. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  31079. /***/ }),
  31080. /***/ "./node_modules/antlr4/atn/index.js":
  31081. /*!******************************************!*\
  31082. !*** ./node_modules/antlr4/atn/index.js ***!
  31083. \******************************************/
  31084. /*! no static exports found */
  31085. /***/ (function(module, exports, __webpack_require__) {
  31086. "use strict";
  31087. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31088. * Use of this file is governed by the BSD 3-clause license that
  31089. * can be found in the LICENSE.txt file in the project root.
  31090. */
  31091. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31092. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  31093. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  31094. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  31095. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  31096. /***/ }),
  31097. /***/ "./node_modules/antlr4/dfa/DFA.js":
  31098. /*!****************************************!*\
  31099. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  31100. \****************************************/
  31101. /*! no static exports found */
  31102. /***/ (function(module, exports, __webpack_require__) {
  31103. "use strict";
  31104. //
  31105. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31106. * Use of this file is governed by the BSD 3-clause license that
  31107. * can be found in the LICENSE.txt file in the project root.
  31108. */
  31109. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  31110. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  31111. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  31112. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31113. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31114. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31115. function DFA(atnStartState, decision) {
  31116. if (decision === undefined) {
  31117. decision = 0;
  31118. }
  31119. // From which ATN state did we create this DFA?
  31120. this.atnStartState = atnStartState;
  31121. this.decision = decision;
  31122. // A set of all DFA states. Use {@link Map} so we can get old state back
  31123. // ({@link Set} only allows you to see if it's there).
  31124. this._states = new Set();
  31125. this.s0 = null;
  31126. // {@code true} if this DFA is for a precedence decision; otherwise,
  31127. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  31128. // {@link //setPrecedenceDfa}.
  31129. this.precedenceDfa = false;
  31130. if (atnStartState instanceof StarLoopEntryState) {
  31131. if (atnStartState.isPrecedenceDecision) {
  31132. this.precedenceDfa = true;
  31133. var precedenceState = new DFAState(null, new ATNConfigSet());
  31134. precedenceState.edges = [];
  31135. precedenceState.isAcceptState = false;
  31136. precedenceState.requiresFullContext = false;
  31137. this.s0 = precedenceState;
  31138. }
  31139. }
  31140. return this;
  31141. }
  31142. // Get the start state for a specific precedence value.
  31143. //
  31144. // @param precedence The current precedence.
  31145. // @return The start state corresponding to the specified precedence, or
  31146. // {@code null} if no start state exists for the specified precedence.
  31147. //
  31148. // @throws IllegalStateException if this is not a precedence DFA.
  31149. // @see //isPrecedenceDfa()
  31150. DFA.prototype.getPrecedenceStartState = function (precedence) {
  31151. if (!this.precedenceDfa) {
  31152. throw "Only precedence DFAs may contain a precedence start state.";
  31153. }
  31154. // s0.edges is never null for a precedence DFA
  31155. if (precedence < 0 || precedence >= this.s0.edges.length) {
  31156. return null;
  31157. }
  31158. return this.s0.edges[precedence] || null;
  31159. };
  31160. // Set the start state for a specific precedence value.
  31161. //
  31162. // @param precedence The current precedence.
  31163. // @param startState The start state corresponding to the specified
  31164. // precedence.
  31165. //
  31166. // @throws IllegalStateException if this is not a precedence DFA.
  31167. // @see //isPrecedenceDfa()
  31168. //
  31169. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  31170. if (!this.precedenceDfa) {
  31171. throw "Only precedence DFAs may contain a precedence start state.";
  31172. }
  31173. if (precedence < 0) {
  31174. return;
  31175. }
  31176. // synchronization on s0 here is ok. when the DFA is turned into a
  31177. // precedence DFA, s0 will be initialized once and not updated again
  31178. // s0.edges is never null for a precedence DFA
  31179. this.s0.edges[precedence] = startState;
  31180. };
  31181. //
  31182. // Sets whether this is a precedence DFA. If the specified value differs
  31183. // from the current DFA configuration, the following actions are taken;
  31184. // otherwise no changes are made to the current DFA.
  31185. //
  31186. // <ul>
  31187. // <li>The {@link //states} map is cleared</li>
  31188. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  31189. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  31190. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  31191. // store the start states for individual precedence values.</li>
  31192. // <li>The {@link //precedenceDfa} field is updated</li>
  31193. // </ul>
  31194. //
  31195. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  31196. // {@code false}
  31197. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  31198. if (this.precedenceDfa !== precedenceDfa) {
  31199. this._states = new DFAStatesSet();
  31200. if (precedenceDfa) {
  31201. var precedenceState = new DFAState(null, new ATNConfigSet());
  31202. precedenceState.edges = [];
  31203. precedenceState.isAcceptState = false;
  31204. precedenceState.requiresFullContext = false;
  31205. this.s0 = precedenceState;
  31206. } else {
  31207. this.s0 = null;
  31208. }
  31209. this.precedenceDfa = precedenceDfa;
  31210. }
  31211. };
  31212. Object.defineProperty(DFA.prototype, "states", {
  31213. get: function get() {
  31214. return this._states;
  31215. }
  31216. });
  31217. // Return a list of all states in this DFA, ordered by state number.
  31218. DFA.prototype.sortedStates = function () {
  31219. var list = this._states.values();
  31220. return list.sort(function (a, b) {
  31221. return a.stateNumber - b.stateNumber;
  31222. });
  31223. };
  31224. DFA.prototype.toString = function (literalNames, symbolicNames) {
  31225. literalNames = literalNames || null;
  31226. symbolicNames = symbolicNames || null;
  31227. if (this.s0 === null) {
  31228. return "";
  31229. }
  31230. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  31231. return serializer.toString();
  31232. };
  31233. DFA.prototype.toLexerString = function () {
  31234. if (this.s0 === null) {
  31235. return "";
  31236. }
  31237. var serializer = new LexerDFASerializer(this);
  31238. return serializer.toString();
  31239. };
  31240. exports.DFA = DFA;
  31241. /***/ }),
  31242. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  31243. /*!**************************************************!*\
  31244. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  31245. \**************************************************/
  31246. /*! no static exports found */
  31247. /***/ (function(module, exports, __webpack_require__) {
  31248. "use strict";
  31249. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31250. * Use of this file is governed by the BSD 3-clause license that
  31251. * can be found in the LICENSE.txt file in the project root.
  31252. */
  31253. // A DFA walker that knows how to dump them to serialized strings.#/
  31254. function DFASerializer(dfa, literalNames, symbolicNames) {
  31255. this.dfa = dfa;
  31256. this.literalNames = literalNames || [];
  31257. this.symbolicNames = symbolicNames || [];
  31258. return this;
  31259. }
  31260. DFASerializer.prototype.toString = function () {
  31261. if (this.dfa.s0 === null) {
  31262. return null;
  31263. }
  31264. var buf = "";
  31265. var states = this.dfa.sortedStates();
  31266. for (var i = 0; i < states.length; i++) {
  31267. var s = states[i];
  31268. if (s.edges !== null) {
  31269. var n = s.edges.length;
  31270. for (var j = 0; j < n; j++) {
  31271. var t = s.edges[j] || null;
  31272. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  31273. buf = buf.concat(this.getStateString(s));
  31274. buf = buf.concat("-");
  31275. buf = buf.concat(this.getEdgeLabel(j));
  31276. buf = buf.concat("->");
  31277. buf = buf.concat(this.getStateString(t));
  31278. buf = buf.concat('\n');
  31279. }
  31280. }
  31281. }
  31282. }
  31283. return buf.length === 0 ? null : buf;
  31284. };
  31285. DFASerializer.prototype.getEdgeLabel = function (i) {
  31286. if (i === 0) {
  31287. return "EOF";
  31288. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  31289. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  31290. } else {
  31291. return String.fromCharCode(i - 1);
  31292. }
  31293. };
  31294. DFASerializer.prototype.getStateString = function (s) {
  31295. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  31296. if (s.isAcceptState) {
  31297. if (s.predicates !== null) {
  31298. return baseStateStr + "=>" + s.predicates.toString();
  31299. } else {
  31300. return baseStateStr + "=>" + s.prediction.toString();
  31301. }
  31302. } else {
  31303. return baseStateStr;
  31304. }
  31305. };
  31306. function LexerDFASerializer(dfa) {
  31307. DFASerializer.call(this, dfa, null);
  31308. return this;
  31309. }
  31310. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  31311. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  31312. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  31313. return "'" + String.fromCharCode(i) + "'";
  31314. };
  31315. exports.DFASerializer = DFASerializer;
  31316. exports.LexerDFASerializer = LexerDFASerializer;
  31317. /***/ }),
  31318. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  31319. /*!*********************************************!*\
  31320. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  31321. \*********************************************/
  31322. /*! no static exports found */
  31323. /***/ (function(module, exports, __webpack_require__) {
  31324. "use strict";
  31325. //
  31326. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31327. * Use of this file is governed by the BSD 3-clause license that
  31328. * can be found in the LICENSE.txt file in the project root.
  31329. */
  31330. ///
  31331. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31332. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31333. var Hash = Utils.Hash;
  31334. var Set = Utils.Set;
  31335. // Map a predicate to a predicted alternative.///
  31336. function PredPrediction(pred, alt) {
  31337. this.alt = alt;
  31338. this.pred = pred;
  31339. return this;
  31340. }
  31341. PredPrediction.prototype.toString = function () {
  31342. return "(" + this.pred + ", " + this.alt + ")";
  31343. };
  31344. // A DFA state represents a set of possible ATN configurations.
  31345. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  31346. // to keep track of all possible states the ATN can be in after
  31347. // reading each input symbol. That is to say, after reading
  31348. // input a1a2..an, the DFA is in a state that represents the
  31349. // subset T of the states of the ATN that are reachable from the
  31350. // ATN's start state along some path labeled a1a2..an."
  31351. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  31352. // would be a bitset representing the set of states the
  31353. // ATN could be in. We need to track the alt predicted by each
  31354. // state as well, however. More importantly, we need to maintain
  31355. // a stack of states, tracking the closure operations as they
  31356. // jump from rule to rule, emulating rule invocations (method calls).
  31357. // I have to add a stack to simulate the proper lookahead sequences for
  31358. // the underlying LL grammar from which the ATN was derived.
  31359. //
  31360. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  31361. // is both a state (ala normal conversion) and a RuleContext describing
  31362. // the chain of rules (if any) followed to arrive at that state.</p>
  31363. //
  31364. // <p>A DFA state may have multiple references to a particular state,
  31365. // but with different ATN contexts (with same or different alts)
  31366. // meaning that state was reached via a different set of rule invocations.</p>
  31367. // /
  31368. function DFAState(stateNumber, configs) {
  31369. if (stateNumber === null) {
  31370. stateNumber = -1;
  31371. }
  31372. if (configs === null) {
  31373. configs = new ATNConfigSet();
  31374. }
  31375. this.stateNumber = stateNumber;
  31376. this.configs = configs;
  31377. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  31378. // {@link Token//EOF} maps to {@code edges[0]}.
  31379. this.edges = null;
  31380. this.isAcceptState = false;
  31381. // if accept state, what ttype do we match or alt do we predict?
  31382. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  31383. // //predicates}{@code !=null} or
  31384. // {@link //requiresFullContext}.
  31385. this.prediction = 0;
  31386. this.lexerActionExecutor = null;
  31387. // Indicates that this state was created during SLL prediction that
  31388. // discovered a conflict between the configurations in the state. Future
  31389. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  31390. // full context prediction if this field is true.
  31391. this.requiresFullContext = false;
  31392. // During SLL parsing, this is a list of predicates associated with the
  31393. // ATN configurations of the DFA state. When we have predicates,
  31394. // {@link //requiresFullContext} is {@code false} since full context
  31395. // prediction evaluates predicates
  31396. // on-the-fly. If this is not null, then {@link //prediction} is
  31397. // {@link ATN//INVALID_ALT_NUMBER}.
  31398. //
  31399. // <p>We only use these for non-{@link //requiresFullContext} but
  31400. // conflicting states. That
  31401. // means we know from the context (it's $ or we don't dip into outer
  31402. // context) that it's an ambiguity not a conflict.</p>
  31403. //
  31404. // <p>This list is computed by {@link
  31405. // ParserATNSimulator//predicateDFAState}.</p>
  31406. this.predicates = null;
  31407. return this;
  31408. }
  31409. // Get the set of all alts mentioned by all ATN configurations in this
  31410. // DFA state.
  31411. DFAState.prototype.getAltSet = function () {
  31412. var alts = new Set();
  31413. if (this.configs !== null) {
  31414. for (var i = 0; i < this.configs.length; i++) {
  31415. var c = this.configs[i];
  31416. alts.add(c.alt);
  31417. }
  31418. }
  31419. if (alts.length === 0) {
  31420. return null;
  31421. } else {
  31422. return alts;
  31423. }
  31424. };
  31425. // Two {@link DFAState} instances are equal if their ATN configuration sets
  31426. // are the same. This method is used to see if a state already exists.
  31427. //
  31428. // <p>Because the number of alternatives and number of ATN configurations are
  31429. // finite, there is a finite number of DFA states that can be processed.
  31430. // This is necessary to show that the algorithm terminates.</p>
  31431. //
  31432. // <p>Cannot test the DFA state numbers here because in
  31433. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  31434. // exists that has this exact set of ATN configurations. The
  31435. // {@link //stateNumber} is irrelevant.</p>
  31436. DFAState.prototype.equals = function (other) {
  31437. // compare set of ATN configurations in this set with other
  31438. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  31439. };
  31440. DFAState.prototype.toString = function () {
  31441. var s = "" + this.stateNumber + ":" + this.configs;
  31442. if (this.isAcceptState) {
  31443. s = s + "=>";
  31444. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  31445. }
  31446. return s;
  31447. };
  31448. DFAState.prototype.hashCode = function () {
  31449. var hash = new Hash();
  31450. hash.update(this.configs);
  31451. if (this.isAcceptState) {
  31452. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  31453. }
  31454. return hash.finish();
  31455. };
  31456. exports.DFAState = DFAState;
  31457. exports.PredPrediction = PredPrediction;
  31458. /***/ }),
  31459. /***/ "./node_modules/antlr4/dfa/index.js":
  31460. /*!******************************************!*\
  31461. !*** ./node_modules/antlr4/dfa/index.js ***!
  31462. \******************************************/
  31463. /*! no static exports found */
  31464. /***/ (function(module, exports, __webpack_require__) {
  31465. "use strict";
  31466. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31467. * Use of this file is governed by the BSD 3-clause license that
  31468. * can be found in the LICENSE.txt file in the project root.
  31469. */
  31470. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  31471. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31472. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31473. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  31474. /***/ }),
  31475. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  31476. /*!**************************************************************!*\
  31477. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  31478. \**************************************************************/
  31479. /*! no static exports found */
  31480. /***/ (function(module, exports, __webpack_require__) {
  31481. "use strict";
  31482. //
  31483. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31484. * Use of this file is governed by the BSD 3-clause license that
  31485. * can be found in the LICENSE.txt file in the project root.
  31486. */
  31487. //
  31488. //
  31489. // This implementation of {@link ANTLRErrorListener} can be used to identify
  31490. // certain potential correctness and performance problems in grammars. "Reports"
  31491. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  31492. // message.
  31493. //
  31494. // <ul>
  31495. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  31496. // grammar can match the input.</li>
  31497. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  31498. // prediction resolved an SLL conflict to a unique alternative which equaled the
  31499. // minimum alternative of the SLL conflict.</li>
  31500. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  31501. // full-context prediction resolved an SLL conflict to a unique alternative,
  31502. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  31503. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  31504. // this situation occurs.</li>
  31505. // </ul>
  31506. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  31507. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  31508. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31509. function DiagnosticErrorListener(exactOnly) {
  31510. ErrorListener.call(this);
  31511. exactOnly = exactOnly || true;
  31512. // whether all ambiguities or only exact ambiguities are reported.
  31513. this.exactOnly = exactOnly;
  31514. return this;
  31515. }
  31516. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  31517. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  31518. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31519. if (this.exactOnly && !exact) {
  31520. return;
  31521. }
  31522. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31523. recognizer.notifyErrorListeners(msg);
  31524. };
  31525. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31526. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31527. recognizer.notifyErrorListeners(msg);
  31528. };
  31529. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31530. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31531. recognizer.notifyErrorListeners(msg);
  31532. };
  31533. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  31534. var decision = dfa.decision;
  31535. var ruleIndex = dfa.atnStartState.ruleIndex;
  31536. var ruleNames = recognizer.ruleNames;
  31537. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  31538. return "" + decision;
  31539. }
  31540. var ruleName = ruleNames[ruleIndex] || null;
  31541. if (ruleName === null || ruleName.length === 0) {
  31542. return "" + decision;
  31543. }
  31544. return "" + decision + " (" + ruleName + ")";
  31545. };
  31546. //
  31547. // Computes the set of conflicting or ambiguous alternatives from a
  31548. // configuration set, if that information was not already provided by the
  31549. // parser.
  31550. //
  31551. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  31552. // reported by the parser.
  31553. // @param configs The conflicting or ambiguous configuration set.
  31554. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  31555. // returns the set of alternatives represented in {@code configs}.
  31556. //
  31557. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  31558. if (reportedAlts !== null) {
  31559. return reportedAlts;
  31560. }
  31561. var result = new BitSet();
  31562. for (var i = 0; i < configs.items.length; i++) {
  31563. result.add(configs.items[i].alt);
  31564. }
  31565. return "{" + result.values().join(", ") + "}";
  31566. };
  31567. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  31568. /***/ }),
  31569. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  31570. /*!****************************************************!*\
  31571. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  31572. \****************************************************/
  31573. /*! no static exports found */
  31574. /***/ (function(module, exports, __webpack_require__) {
  31575. "use strict";
  31576. //
  31577. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31578. * Use of this file is governed by the BSD 3-clause license that
  31579. * can be found in the LICENSE.txt file in the project root.
  31580. */
  31581. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  31582. // default implementation of each method does nothing, but can be overridden as
  31583. // necessary.
  31584. function ErrorListener() {
  31585. return this;
  31586. }
  31587. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  31588. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  31589. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  31590. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  31591. function ConsoleErrorListener() {
  31592. ErrorListener.call(this);
  31593. return this;
  31594. }
  31595. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31596. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31597. //
  31598. // Provides a default instance of {@link ConsoleErrorListener}.
  31599. //
  31600. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31601. //
  31602. // {@inheritDoc}
  31603. //
  31604. // <p>
  31605. // This implementation prints messages to {@link System//err} containing the
  31606. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31607. // the following format.</p>
  31608. //
  31609. // <pre>
  31610. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31611. // </pre>
  31612. //
  31613. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31614. console.error("line " + line + ":" + column + " " + msg);
  31615. };
  31616. function ProxyErrorListener(delegates) {
  31617. ErrorListener.call(this);
  31618. if (delegates === null) {
  31619. throw "delegates";
  31620. }
  31621. this.delegates = delegates;
  31622. return this;
  31623. }
  31624. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31625. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31626. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31627. this.delegates.map(function (d) {
  31628. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31629. });
  31630. };
  31631. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31632. this.delegates.map(function (d) {
  31633. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31634. });
  31635. };
  31636. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31637. this.delegates.map(function (d) {
  31638. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31639. });
  31640. };
  31641. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31642. this.delegates.map(function (d) {
  31643. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31644. });
  31645. };
  31646. exports.ErrorListener = ErrorListener;
  31647. exports.ConsoleErrorListener = ConsoleErrorListener;
  31648. exports.ProxyErrorListener = ProxyErrorListener;
  31649. /***/ }),
  31650. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31651. /*!****************************************************!*\
  31652. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31653. \****************************************************/
  31654. /*! no static exports found */
  31655. /***/ (function(module, exports, __webpack_require__) {
  31656. "use strict";
  31657. //
  31658. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31659. * Use of this file is governed by the BSD 3-clause license that
  31660. * can be found in the LICENSE.txt file in the project root.
  31661. */
  31662. //
  31663. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31664. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31665. var NoViableAltException = Errors.NoViableAltException;
  31666. var InputMismatchException = Errors.InputMismatchException;
  31667. var FailedPredicateException = Errors.FailedPredicateException;
  31668. var ParseCancellationException = Errors.ParseCancellationException;
  31669. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31670. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31671. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31672. function ErrorStrategy() {}
  31673. ErrorStrategy.prototype.reset = function (recognizer) {};
  31674. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31675. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31676. ErrorStrategy.prototype.sync = function (recognizer) {};
  31677. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31678. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31679. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31680. // error reporting and recovery in ANTLR parsers.
  31681. //
  31682. function DefaultErrorStrategy() {
  31683. ErrorStrategy.call(this);
  31684. // Indicates whether the error strategy is currently "recovering from an
  31685. // error". This is used to suppress reporting multiple error messages while
  31686. // attempting to recover from a detected syntax error.
  31687. //
  31688. // @see //inErrorRecoveryMode
  31689. //
  31690. this.errorRecoveryMode = false;
  31691. // The index into the input stream where the last error occurred.
  31692. // This is used to prevent infinite loops where an error is found
  31693. // but no token is consumed during recovery...another error is found,
  31694. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31695. // one token/tree node is consumed for two errors.
  31696. //
  31697. this.lastErrorIndex = -1;
  31698. this.lastErrorStates = null;
  31699. return this;
  31700. }
  31701. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31702. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31703. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31704. // ensure that the handler is not in error recovery mode.</p>
  31705. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31706. this.endErrorCondition(recognizer);
  31707. };
  31708. //
  31709. // This method is called to enter error recovery mode when a recognition
  31710. // exception is reported.
  31711. //
  31712. // @param recognizer the parser instance
  31713. //
  31714. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31715. this.errorRecoveryMode = true;
  31716. };
  31717. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31718. return this.errorRecoveryMode;
  31719. };
  31720. //
  31721. // This method is called to leave error recovery mode after recovering from
  31722. // a recognition exception.
  31723. //
  31724. // @param recognizer
  31725. //
  31726. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  31727. this.errorRecoveryMode = false;
  31728. this.lastErrorStates = null;
  31729. this.lastErrorIndex = -1;
  31730. };
  31731. //
  31732. // {@inheritDoc}
  31733. //
  31734. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  31735. //
  31736. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  31737. this.endErrorCondition(recognizer);
  31738. };
  31739. //
  31740. // {@inheritDoc}
  31741. //
  31742. // <p>The default implementation returns immediately if the handler is already
  31743. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  31744. // and dispatches the reporting task based on the runtime type of {@code e}
  31745. // according to the following table.</p>
  31746. //
  31747. // <ul>
  31748. // <li>{@link NoViableAltException}: Dispatches the call to
  31749. // {@link //reportNoViableAlternative}</li>
  31750. // <li>{@link InputMismatchException}: Dispatches the call to
  31751. // {@link //reportInputMismatch}</li>
  31752. // <li>{@link FailedPredicateException}: Dispatches the call to
  31753. // {@link //reportFailedPredicate}</li>
  31754. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  31755. // the exception</li>
  31756. // </ul>
  31757. //
  31758. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  31759. // if we've already reported an error and have not matched a token
  31760. // yet successfully, don't report any errors.
  31761. if (this.inErrorRecoveryMode(recognizer)) {
  31762. return; // don't report spurious errors
  31763. }
  31764. this.beginErrorCondition(recognizer);
  31765. if (e instanceof NoViableAltException) {
  31766. this.reportNoViableAlternative(recognizer, e);
  31767. } else if (e instanceof InputMismatchException) {
  31768. this.reportInputMismatch(recognizer, e);
  31769. } else if (e instanceof FailedPredicateException) {
  31770. this.reportFailedPredicate(recognizer, e);
  31771. } else {
  31772. console.log("unknown recognition error type: " + e.constructor.name);
  31773. console.log(e.stack);
  31774. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  31775. }
  31776. };
  31777. //
  31778. // {@inheritDoc}
  31779. //
  31780. // <p>The default implementation resynchronizes the parser by consuming tokens
  31781. // until we find one in the resynchronization set--loosely the set of tokens
  31782. // that can follow the current rule.</p>
  31783. //
  31784. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  31785. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  31786. // uh oh, another error at same token index and previously-visited
  31787. // state in ATN; must be a case where LT(1) is in the recovery
  31788. // token set so nothing got consumed. Consume a single token
  31789. // at least to prevent an infinite loop; this is a failsafe.
  31790. recognizer.consume();
  31791. }
  31792. this.lastErrorIndex = recognizer._input.index;
  31793. if (this.lastErrorStates === null) {
  31794. this.lastErrorStates = [];
  31795. }
  31796. this.lastErrorStates.push(recognizer.state);
  31797. var followSet = this.getErrorRecoverySet(recognizer);
  31798. this.consumeUntil(recognizer, followSet);
  31799. };
  31800. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  31801. // that the current lookahead symbol is consistent with what were expecting
  31802. // at this point in the ATN. You can call this anytime but ANTLR only
  31803. // generates code to check before subrules/loops and each iteration.
  31804. //
  31805. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  31806. // subrules. E.g.,</p>
  31807. //
  31808. // <pre>
  31809. // a : sync ( stuff sync )* ;
  31810. // sync : {consume to what can follow sync} ;
  31811. // </pre>
  31812. //
  31813. // At the start of a sub rule upon error, {@link //sync} performs single
  31814. // token deletion, if possible. If it can't do that, it bails on the current
  31815. // rule and uses the default error recovery, which consumes until the
  31816. // resynchronization set of the current rule.
  31817. //
  31818. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  31819. // with an empty alternative), then the expected set includes what follows
  31820. // the subrule.</p>
  31821. //
  31822. // <p>During loop iteration, it consumes until it sees a token that can start a
  31823. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  31824. // stay in the loop as long as possible.</p>
  31825. //
  31826. // <p><strong>ORIGINS</strong></p>
  31827. //
  31828. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  31829. // A single mismatch token or missing token would force the parser to bail
  31830. // out of the entire rules surrounding the loop. So, for rule</p>
  31831. //
  31832. // <pre>
  31833. // classDef : 'class' ID '{' member* '}'
  31834. // </pre>
  31835. //
  31836. // input with an extra token between members would force the parser to
  31837. // consume until it found the next class definition rather than the next
  31838. // member definition of the current class.
  31839. //
  31840. // <p>This functionality cost a little bit of effort because the parser has to
  31841. // compare token set at the start of the loop and at each iteration. If for
  31842. // some reason speed is suffering for you, you can turn off this
  31843. // functionality by simply overriding this method as a blank { }.</p>
  31844. //
  31845. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  31846. // If already recovering, don't try to sync
  31847. if (this.inErrorRecoveryMode(recognizer)) {
  31848. return;
  31849. }
  31850. var s = recognizer._interp.atn.states[recognizer.state];
  31851. var la = recognizer.getTokenStream().LA(1);
  31852. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  31853. var nextTokens = recognizer.atn.nextTokens(s);
  31854. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  31855. return;
  31856. }
  31857. switch (s.stateType) {
  31858. case ATNState.BLOCK_START:
  31859. case ATNState.STAR_BLOCK_START:
  31860. case ATNState.PLUS_BLOCK_START:
  31861. case ATNState.STAR_LOOP_ENTRY:
  31862. // report error and recover if possible
  31863. if (this.singleTokenDeletion(recognizer) !== null) {
  31864. return;
  31865. } else {
  31866. throw new InputMismatchException(recognizer);
  31867. }
  31868. break;
  31869. case ATNState.PLUS_LOOP_BACK:
  31870. case ATNState.STAR_LOOP_BACK:
  31871. this.reportUnwantedToken(recognizer);
  31872. var expecting = new IntervalSet();
  31873. expecting.addSet(recognizer.getExpectedTokens());
  31874. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  31875. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  31876. break;
  31877. default:
  31878. // do nothing if we can't identify the exact kind of ATN state
  31879. }
  31880. };
  31881. // This is called by {@link //reportError} when the exception is a
  31882. // {@link NoViableAltException}.
  31883. //
  31884. // @see //reportError
  31885. //
  31886. // @param recognizer the parser instance
  31887. // @param e the recognition exception
  31888. //
  31889. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  31890. var tokens = recognizer.getTokenStream();
  31891. var input;
  31892. if (tokens !== null) {
  31893. if (e.startToken.type === Token.EOF) {
  31894. input = "<EOF>";
  31895. } else {
  31896. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  31897. }
  31898. } else {
  31899. input = "<unknown input>";
  31900. }
  31901. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  31902. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31903. };
  31904. //
  31905. // This is called by {@link //reportError} when the exception is an
  31906. // {@link InputMismatchException}.
  31907. //
  31908. // @see //reportError
  31909. //
  31910. // @param recognizer the parser instance
  31911. // @param e the recognition exception
  31912. //
  31913. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  31914. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  31915. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31916. };
  31917. //
  31918. // This is called by {@link //reportError} when the exception is a
  31919. // {@link FailedPredicateException}.
  31920. //
  31921. // @see //reportError
  31922. //
  31923. // @param recognizer the parser instance
  31924. // @param e the recognition exception
  31925. //
  31926. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  31927. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  31928. var msg = "rule " + ruleName + " " + e.message;
  31929. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31930. };
  31931. // This method is called to report a syntax error which requires the removal
  31932. // of a token from the input stream. At the time this method is called, the
  31933. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  31934. // removed from the input stream. When this method returns,
  31935. // {@code recognizer} is in error recovery mode.
  31936. //
  31937. // <p>This method is called when {@link //singleTokenDeletion} identifies
  31938. // single-token deletion as a viable recovery strategy for a mismatched
  31939. // input error.</p>
  31940. //
  31941. // <p>The default implementation simply returns if the handler is already in
  31942. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31943. // enter error recovery mode, followed by calling
  31944. // {@link Parser//notifyErrorListeners}.</p>
  31945. //
  31946. // @param recognizer the parser instance
  31947. //
  31948. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  31949. if (this.inErrorRecoveryMode(recognizer)) {
  31950. return;
  31951. }
  31952. this.beginErrorCondition(recognizer);
  31953. var t = recognizer.getCurrentToken();
  31954. var tokenName = this.getTokenErrorDisplay(t);
  31955. var expecting = this.getExpectedTokens(recognizer);
  31956. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  31957. recognizer.notifyErrorListeners(msg, t, null);
  31958. };
  31959. // This method is called to report a syntax error which requires the
  31960. // insertion of a missing token into the input stream. At the time this
  31961. // method is called, the missing token has not yet been inserted. When this
  31962. // method returns, {@code recognizer} is in error recovery mode.
  31963. //
  31964. // <p>This method is called when {@link //singleTokenInsertion} identifies
  31965. // single-token insertion as a viable recovery strategy for a mismatched
  31966. // input error.</p>
  31967. //
  31968. // <p>The default implementation simply returns if the handler is already in
  31969. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31970. // enter error recovery mode, followed by calling
  31971. // {@link Parser//notifyErrorListeners}.</p>
  31972. //
  31973. // @param recognizer the parser instance
  31974. //
  31975. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  31976. if (this.inErrorRecoveryMode(recognizer)) {
  31977. return;
  31978. }
  31979. this.beginErrorCondition(recognizer);
  31980. var t = recognizer.getCurrentToken();
  31981. var expecting = this.getExpectedTokens(recognizer);
  31982. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  31983. recognizer.notifyErrorListeners(msg, t, null);
  31984. };
  31985. // <p>The default implementation attempts to recover from the mismatched input
  31986. // by using single token insertion and deletion as described below. If the
  31987. // recovery attempt fails, this method throws an
  31988. // {@link InputMismatchException}.</p>
  31989. //
  31990. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  31991. //
  31992. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  31993. // right token, however, then assume {@code LA(1)} is some extra spurious
  31994. // token and delete it. Then consume and return the next token (which was
  31995. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  31996. //
  31997. // <p>This recovery strategy is implemented by {@link
  31998. // //singleTokenDeletion}.</p>
  31999. //
  32000. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  32001. //
  32002. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  32003. // after the expected {@code LA(1)} token, then assume the token is missing
  32004. // and use the parser's {@link TokenFactory} to create it on the fly. The
  32005. // "insertion" is performed by returning the created token as the successful
  32006. // result of the match operation.</p>
  32007. //
  32008. // <p>This recovery strategy is implemented by {@link
  32009. // //singleTokenInsertion}.</p>
  32010. //
  32011. // <p><strong>EXAMPLE</strong></p>
  32012. //
  32013. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  32014. // the parser returns from the nested call to {@code expr}, it will have
  32015. // call chain:</p>
  32016. //
  32017. // <pre>
  32018. // stat &rarr; expr &rarr; atom
  32019. // </pre>
  32020. //
  32021. // and it will be trying to match the {@code ')'} at this point in the
  32022. // derivation:
  32023. //
  32024. // <pre>
  32025. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  32026. // ^
  32027. // </pre>
  32028. //
  32029. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  32030. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  32031. // is in the set of tokens that can follow the {@code ')'} token reference
  32032. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  32033. //
  32034. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  32035. // SINGLE TOKEN DELETION
  32036. var matchedSymbol = this.singleTokenDeletion(recognizer);
  32037. if (matchedSymbol !== null) {
  32038. // we have deleted the extra token.
  32039. // now, move past ttype token as if all were ok
  32040. recognizer.consume();
  32041. return matchedSymbol;
  32042. }
  32043. // SINGLE TOKEN INSERTION
  32044. if (this.singleTokenInsertion(recognizer)) {
  32045. return this.getMissingSymbol(recognizer);
  32046. }
  32047. // even that didn't work; must throw the exception
  32048. throw new InputMismatchException(recognizer);
  32049. };
  32050. //
  32051. // This method implements the single-token insertion inline error recovery
  32052. // strategy. It is called by {@link //recoverInline} if the single-token
  32053. // deletion strategy fails to recover from the mismatched input. If this
  32054. // method returns {@code true}, {@code recognizer} will be in error recovery
  32055. // mode.
  32056. //
  32057. // <p>This method determines whether or not single-token insertion is viable by
  32058. // checking if the {@code LA(1)} input symbol could be successfully matched
  32059. // if it were instead the {@code LA(2)} symbol. If this method returns
  32060. // {@code true}, the caller is responsible for creating and inserting a
  32061. // token with the correct type to produce this behavior.</p>
  32062. //
  32063. // @param recognizer the parser instance
  32064. // @return {@code true} if single-token insertion is a viable recovery
  32065. // strategy for the current mismatched input, otherwise {@code false}
  32066. //
  32067. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  32068. var currentSymbolType = recognizer.getTokenStream().LA(1);
  32069. // if current token is consistent with what could come after current
  32070. // ATN state, then we know we're missing a token; error recovery
  32071. // is free to conjure up and insert the missing token
  32072. var atn = recognizer._interp.atn;
  32073. var currentState = atn.states[recognizer.state];
  32074. var next = currentState.transitions[0].target;
  32075. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  32076. if (expectingAtLL2.contains(currentSymbolType)) {
  32077. this.reportMissingToken(recognizer);
  32078. return true;
  32079. } else {
  32080. return false;
  32081. }
  32082. };
  32083. // This method implements the single-token deletion inline error recovery
  32084. // strategy. It is called by {@link //recoverInline} to attempt to recover
  32085. // from mismatched input. If this method returns null, the parser and error
  32086. // handler state will not have changed. If this method returns non-null,
  32087. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  32088. // returned token was a successful match.
  32089. //
  32090. // <p>If the single-token deletion is successful, this method calls
  32091. // {@link //reportUnwantedToken} to report the error, followed by
  32092. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  32093. // before returning {@link //reportMatch} is called to signal a successful
  32094. // match.</p>
  32095. //
  32096. // @param recognizer the parser instance
  32097. // @return the successfully matched {@link Token} instance if single-token
  32098. // deletion successfully recovers from the mismatched input, otherwise
  32099. // {@code null}
  32100. //
  32101. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  32102. var nextTokenType = recognizer.getTokenStream().LA(2);
  32103. var expecting = this.getExpectedTokens(recognizer);
  32104. if (expecting.contains(nextTokenType)) {
  32105. this.reportUnwantedToken(recognizer);
  32106. // print("recoverFromMismatchedToken deleting " \
  32107. // + str(recognizer.getTokenStream().LT(1)) \
  32108. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  32109. // + " is what we want", file=sys.stderr)
  32110. recognizer.consume(); // simply delete extra token
  32111. // we want to return the token we're actually matching
  32112. var matchedSymbol = recognizer.getCurrentToken();
  32113. this.reportMatch(recognizer); // we know current token is correct
  32114. return matchedSymbol;
  32115. } else {
  32116. return null;
  32117. }
  32118. };
  32119. // Conjure up a missing token during error recovery.
  32120. //
  32121. // The recognizer attempts to recover from single missing
  32122. // symbols. But, actions might refer to that missing symbol.
  32123. // For example, x=ID {f($x);}. The action clearly assumes
  32124. // that there has been an identifier matched previously and that
  32125. // $x points at that token. If that token is missing, but
  32126. // the next token in the stream is what we want we assume that
  32127. // this token is missing and we keep going. Because we
  32128. // have to return some token to replace the missing token,
  32129. // we have to conjure one up. This method gives the user control
  32130. // over the tokens returned for missing tokens. Mostly,
  32131. // you will want to create something special for identifier
  32132. // tokens. For literals such as '{' and ',', the default
  32133. // action in the parser or tree parser works. It simply creates
  32134. // a CommonToken of the appropriate type. The text will be the token.
  32135. // If you change what tokens must be created by the lexer,
  32136. // override this method to create the appropriate tokens.
  32137. //
  32138. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  32139. var currentSymbol = recognizer.getCurrentToken();
  32140. var expecting = this.getExpectedTokens(recognizer);
  32141. var expectedTokenType = expecting.first(); // get any element
  32142. var tokenText;
  32143. if (expectedTokenType === Token.EOF) {
  32144. tokenText = "<missing EOF>";
  32145. } else {
  32146. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  32147. }
  32148. var current = currentSymbol;
  32149. var lookback = recognizer.getTokenStream().LT(-1);
  32150. if (current.type === Token.EOF && lookback !== null) {
  32151. current = lookback;
  32152. }
  32153. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  32154. };
  32155. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  32156. return recognizer.getExpectedTokens();
  32157. };
  32158. // How should a token be displayed in an error message? The default
  32159. // is to display just the text, but during development you might
  32160. // want to have a lot of information spit out. Override in that case
  32161. // to use t.toString() (which, for CommonToken, dumps everything about
  32162. // the token). This is better than forcing you to override a method in
  32163. // your token objects because you don't have to go modify your lexer
  32164. // so that it creates a new Java type.
  32165. //
  32166. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  32167. if (t === null) {
  32168. return "<no token>";
  32169. }
  32170. var s = t.text;
  32171. if (s === null) {
  32172. if (t.type === Token.EOF) {
  32173. s = "<EOF>";
  32174. } else {
  32175. s = "<" + t.type + ">";
  32176. }
  32177. }
  32178. return this.escapeWSAndQuote(s);
  32179. };
  32180. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  32181. s = s.replace(/\n/g, "\\n");
  32182. s = s.replace(/\r/g, "\\r");
  32183. s = s.replace(/\t/g, "\\t");
  32184. return "'" + s + "'";
  32185. };
  32186. // Compute the error recovery set for the current rule. During
  32187. // rule invocation, the parser pushes the set of tokens that can
  32188. // follow that rule reference on the stack; this amounts to
  32189. // computing FIRST of what follows the rule reference in the
  32190. // enclosing rule. See LinearApproximator.FIRST().
  32191. // This local follow set only includes tokens
  32192. // from within the rule; i.e., the FIRST computation done by
  32193. // ANTLR stops at the end of a rule.
  32194. //
  32195. // EXAMPLE
  32196. //
  32197. // When you find a "no viable alt exception", the input is not
  32198. // consistent with any of the alternatives for rule r. The best
  32199. // thing to do is to consume tokens until you see something that
  32200. // can legally follow a call to r//or* any rule that called r.
  32201. // You don't want the exact set of viable next tokens because the
  32202. // input might just be missing a token--you might consume the
  32203. // rest of the input looking for one of the missing tokens.
  32204. //
  32205. // Consider grammar:
  32206. //
  32207. // a : '[' b ']'
  32208. // | '(' b ')'
  32209. // ;
  32210. // b : c '^' INT ;
  32211. // c : ID
  32212. // | INT
  32213. // ;
  32214. //
  32215. // At each rule invocation, the set of tokens that could follow
  32216. // that rule is pushed on a stack. Here are the various
  32217. // context-sensitive follow sets:
  32218. //
  32219. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  32220. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  32221. // FOLLOW(c_in_b) = FIRST('^') = '^'
  32222. //
  32223. // Upon erroneous input "[]", the call chain is
  32224. //
  32225. // a -> b -> c
  32226. //
  32227. // and, hence, the follow context stack is:
  32228. //
  32229. // depth follow set start of rule execution
  32230. // 0 <EOF> a (from main())
  32231. // 1 ']' b
  32232. // 2 '^' c
  32233. //
  32234. // Notice that ')' is not included, because b would have to have
  32235. // been called from a different context in rule a for ')' to be
  32236. // included.
  32237. //
  32238. // For error recovery, we cannot consider FOLLOW(c)
  32239. // (context-sensitive or otherwise). We need the combined set of
  32240. // all context-sensitive FOLLOW sets--the set of all tokens that
  32241. // could follow any reference in the call chain. We need to
  32242. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  32243. // we resync'd to that token, we'd consume until EOF. We need to
  32244. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  32245. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  32246. // not consume anything. After printing an error, rule c would
  32247. // return normally. Rule b would not find the required '^' though.
  32248. // At this point, it gets a mismatched token error and throws an
  32249. // exception (since LA(1) is not in the viable following token
  32250. // set). The rule exception handler tries to recover, but finds
  32251. // the same recovery set and doesn't consume anything. Rule b
  32252. // exits normally returning to rule a. Now it finds the ']' (and
  32253. // with the successful match exits errorRecovery mode).
  32254. //
  32255. // So, you can see that the parser walks up the call chain looking
  32256. // for the token that was a member of the recovery set.
  32257. //
  32258. // Errors are not generated in errorRecovery mode.
  32259. //
  32260. // ANTLR's error recovery mechanism is based upon original ideas:
  32261. //
  32262. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  32263. //
  32264. // and
  32265. //
  32266. // "A note on error recovery in recursive descent parsers":
  32267. // http://portal.acm.org/citation.cfm?id=947902.947905
  32268. //
  32269. // Later, Josef Grosch had some good ideas:
  32270. //
  32271. // "Efficient and Comfortable Error Recovery in Recursive Descent
  32272. // Parsers":
  32273. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  32274. //
  32275. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  32276. // at run-time upon error to avoid overhead during parsing.
  32277. //
  32278. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  32279. var atn = recognizer._interp.atn;
  32280. var ctx = recognizer._ctx;
  32281. var recoverSet = new IntervalSet();
  32282. while (ctx !== null && ctx.invokingState >= 0) {
  32283. // compute what follows who invoked us
  32284. var invokingState = atn.states[ctx.invokingState];
  32285. var rt = invokingState.transitions[0];
  32286. var follow = atn.nextTokens(rt.followState);
  32287. recoverSet.addSet(follow);
  32288. ctx = ctx.parentCtx;
  32289. }
  32290. recoverSet.removeOne(Token.EPSILON);
  32291. return recoverSet;
  32292. };
  32293. // Consume tokens until one matches the given token set.//
  32294. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  32295. var ttype = recognizer.getTokenStream().LA(1);
  32296. while (ttype !== Token.EOF && !set.contains(ttype)) {
  32297. recognizer.consume();
  32298. ttype = recognizer.getTokenStream().LA(1);
  32299. }
  32300. };
  32301. //
  32302. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  32303. // by immediately canceling the parse operation with a
  32304. // {@link ParseCancellationException}. The implementation ensures that the
  32305. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  32306. // that were not completed prior to encountering the error.
  32307. //
  32308. // <p>
  32309. // This error strategy is useful in the following scenarios.</p>
  32310. //
  32311. // <ul>
  32312. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  32313. // stage of two-stage parsing to immediately terminate if an error is
  32314. // encountered, and immediately fall back to the second stage. In addition to
  32315. // avoiding wasted work by attempting to recover from errors here, the empty
  32316. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  32317. // the first stage.</li>
  32318. // <li><strong>Silent validation:</strong> When syntax errors are not being
  32319. // reported or logged, and the parse result is simply ignored if errors occur,
  32320. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  32321. // when the result will be ignored either way.</li>
  32322. // </ul>
  32323. //
  32324. // <p>
  32325. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  32326. //
  32327. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  32328. //
  32329. function BailErrorStrategy() {
  32330. DefaultErrorStrategy.call(this);
  32331. return this;
  32332. }
  32333. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  32334. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  32335. // Instead of recovering from exception {@code e}, re-throw it wrapped
  32336. // in a {@link ParseCancellationException} so it is not caught by the
  32337. // rule function catches. Use {@link Exception//getCause()} to get the
  32338. // original {@link RecognitionException}.
  32339. //
  32340. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  32341. var context = recognizer._ctx;
  32342. while (context !== null) {
  32343. context.exception = e;
  32344. context = context.parentCtx;
  32345. }
  32346. throw new ParseCancellationException(e);
  32347. };
  32348. // Make sure we don't attempt to recover inline; if the parser
  32349. // successfully recovers, it won't throw an exception.
  32350. //
  32351. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  32352. this.recover(recognizer, new InputMismatchException(recognizer));
  32353. };
  32354. // Make sure we don't attempt to recover from problems in subrules.//
  32355. BailErrorStrategy.prototype.sync = function (recognizer) {
  32356. // pass
  32357. };
  32358. exports.BailErrorStrategy = BailErrorStrategy;
  32359. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  32360. /***/ }),
  32361. /***/ "./node_modules/antlr4/error/Errors.js":
  32362. /*!*********************************************!*\
  32363. !*** ./node_modules/antlr4/error/Errors.js ***!
  32364. \*********************************************/
  32365. /*! no static exports found */
  32366. /***/ (function(module, exports, __webpack_require__) {
  32367. "use strict";
  32368. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32369. * Use of this file is governed by the BSD 3-clause license that
  32370. * can be found in the LICENSE.txt file in the project root.
  32371. */
  32372. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  32373. // 3 kinds of errors: prediction errors, failed predicate errors, and
  32374. // mismatched input errors. In each case, the parser knows where it is
  32375. // in the input, where it is in the ATN, the rule invocation stack,
  32376. // and what kind of problem occurred.
  32377. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  32378. function RecognitionException(params) {
  32379. Error.call(this);
  32380. if (!!Error.captureStackTrace) {
  32381. Error.captureStackTrace(this, RecognitionException);
  32382. } else {
  32383. var stack = new Error().stack;
  32384. }
  32385. this.message = params.message;
  32386. this.recognizer = params.recognizer;
  32387. this.input = params.input;
  32388. this.ctx = params.ctx;
  32389. // The current {@link Token} when an error occurred. Since not all streams
  32390. // support accessing symbols by index, we have to track the {@link Token}
  32391. // instance itself.
  32392. this.offendingToken = null;
  32393. // Get the ATN state number the parser was in at the time the error
  32394. // occurred. For {@link NoViableAltException} and
  32395. // {@link LexerNoViableAltException} exceptions, this is the
  32396. // {@link DecisionState} number. For others, it is the state whose outgoing
  32397. // edge we couldn't match.
  32398. this.offendingState = -1;
  32399. if (this.recognizer !== null) {
  32400. this.offendingState = this.recognizer.state;
  32401. }
  32402. return this;
  32403. }
  32404. RecognitionException.prototype = Object.create(Error.prototype);
  32405. RecognitionException.prototype.constructor = RecognitionException;
  32406. // <p>If the state number is not known, this method returns -1.</p>
  32407. //
  32408. // Gets the set of input symbols which could potentially follow the
  32409. // previously matched symbol at the time this exception was thrown.
  32410. //
  32411. // <p>If the set of expected tokens is not known and could not be computed,
  32412. // this method returns {@code null}.</p>
  32413. //
  32414. // @return The set of token types that could potentially follow the current
  32415. // state in the ATN, or {@code null} if the information is not available.
  32416. // /
  32417. RecognitionException.prototype.getExpectedTokens = function () {
  32418. if (this.recognizer !== null) {
  32419. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  32420. } else {
  32421. return null;
  32422. }
  32423. };
  32424. RecognitionException.prototype.toString = function () {
  32425. return this.message;
  32426. };
  32427. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  32428. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  32429. this.startIndex = startIndex;
  32430. this.deadEndConfigs = deadEndConfigs;
  32431. return this;
  32432. }
  32433. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32434. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  32435. LexerNoViableAltException.prototype.toString = function () {
  32436. var symbol = "";
  32437. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  32438. symbol = this.input.getText((this.startIndex, this.startIndex));
  32439. }
  32440. return "LexerNoViableAltException" + symbol;
  32441. };
  32442. // Indicates that the parser could not decide which of two or more paths
  32443. // to take based upon the remaining input. It tracks the starting token
  32444. // of the offending input and also knows where the parser was
  32445. // in the various paths when the error. Reported by reportNoViableAlternative()
  32446. //
  32447. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  32448. ctx = ctx || recognizer._ctx;
  32449. offendingToken = offendingToken || recognizer.getCurrentToken();
  32450. startToken = startToken || recognizer.getCurrentToken();
  32451. input = input || recognizer.getInputStream();
  32452. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  32453. // Which configurations did we try at input.index() that couldn't match
  32454. // input.LT(1)?//
  32455. this.deadEndConfigs = deadEndConfigs;
  32456. // The token object at the start index; the input stream might
  32457. // not be buffering tokens so get a reference to it. (At the
  32458. // time the error occurred, of course the stream needs to keep a
  32459. // buffer all of the tokens but later we might not have access to those.)
  32460. this.startToken = startToken;
  32461. this.offendingToken = offendingToken;
  32462. }
  32463. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32464. NoViableAltException.prototype.constructor = NoViableAltException;
  32465. // This signifies any kind of mismatched input exceptions such as
  32466. // when the current input does not match the expected token.
  32467. //
  32468. function InputMismatchException(recognizer) {
  32469. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32470. this.offendingToken = recognizer.getCurrentToken();
  32471. }
  32472. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  32473. InputMismatchException.prototype.constructor = InputMismatchException;
  32474. // A semantic predicate failed during validation. Validation of predicates
  32475. // occurs when normally parsing the alternative just like matching a token.
  32476. // Disambiguating predicate evaluation occurs when we test a predicate during
  32477. // prediction.
  32478. function FailedPredicateException(recognizer, predicate, message) {
  32479. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  32480. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32481. var s = recognizer._interp.atn.states[recognizer.state];
  32482. var trans = s.transitions[0];
  32483. if (trans instanceof PredicateTransition) {
  32484. this.ruleIndex = trans.ruleIndex;
  32485. this.predicateIndex = trans.predIndex;
  32486. } else {
  32487. this.ruleIndex = 0;
  32488. this.predicateIndex = 0;
  32489. }
  32490. this.predicate = predicate;
  32491. this.offendingToken = recognizer.getCurrentToken();
  32492. return this;
  32493. }
  32494. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  32495. FailedPredicateException.prototype.constructor = FailedPredicateException;
  32496. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  32497. if (message !== null) {
  32498. return message;
  32499. } else {
  32500. return "failed predicate: {" + predicate + "}?";
  32501. }
  32502. };
  32503. function ParseCancellationException() {
  32504. Error.call(this);
  32505. Error.captureStackTrace(this, ParseCancellationException);
  32506. return this;
  32507. }
  32508. ParseCancellationException.prototype = Object.create(Error.prototype);
  32509. ParseCancellationException.prototype.constructor = ParseCancellationException;
  32510. exports.RecognitionException = RecognitionException;
  32511. exports.NoViableAltException = NoViableAltException;
  32512. exports.LexerNoViableAltException = LexerNoViableAltException;
  32513. exports.InputMismatchException = InputMismatchException;
  32514. exports.FailedPredicateException = FailedPredicateException;
  32515. exports.ParseCancellationException = ParseCancellationException;
  32516. /***/ }),
  32517. /***/ "./node_modules/antlr4/error/index.js":
  32518. /*!********************************************!*\
  32519. !*** ./node_modules/antlr4/error/index.js ***!
  32520. \********************************************/
  32521. /*! no static exports found */
  32522. /***/ (function(module, exports, __webpack_require__) {
  32523. "use strict";
  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. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  32529. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  32530. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32531. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  32532. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  32533. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  32534. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  32535. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  32536. /***/ }),
  32537. /***/ "./node_modules/antlr4/index.js":
  32538. /*!**************************************!*\
  32539. !*** ./node_modules/antlr4/index.js ***!
  32540. \**************************************/
  32541. /*! no static exports found */
  32542. /***/ (function(module, exports, __webpack_require__) {
  32543. "use strict";
  32544. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32545. * Use of this file is governed by the BSD 3-clause license that
  32546. * can be found in the LICENSE.txt file in the project root.
  32547. */
  32548. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  32549. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  32550. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  32551. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  32552. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  32553. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  32554. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  32555. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  32556. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  32557. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  32558. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  32559. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  32560. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32561. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  32562. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  32563. exports.PredictionContextCache = pc.PredictionContextCache;
  32564. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32565. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32566. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  32567. /***/ }),
  32568. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  32569. /*!******************************************************!*\
  32570. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  32571. \******************************************************/
  32572. /*! no static exports found */
  32573. /***/ (function(module, exports, __webpack_require__) {
  32574. "use strict";
  32575. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  32576. if (!String.prototype.codePointAt) {
  32577. (function () {
  32578. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  32579. var defineProperty = function () {
  32580. // IE 8 only supports `Object.defineProperty` on DOM elements
  32581. try {
  32582. var object = {};
  32583. var $defineProperty = Object.defineProperty;
  32584. var result = $defineProperty(object, object, object) && $defineProperty;
  32585. } catch (error) {}
  32586. return result;
  32587. }();
  32588. var codePointAt = function codePointAt(position) {
  32589. if (this == null) {
  32590. throw TypeError();
  32591. }
  32592. var string = String(this);
  32593. var size = string.length;
  32594. // `ToInteger`
  32595. var index = position ? Number(position) : 0;
  32596. if (index != index) {
  32597. // better `isNaN`
  32598. index = 0;
  32599. }
  32600. // Account for out-of-bounds indices:
  32601. if (index < 0 || index >= size) {
  32602. return undefined;
  32603. }
  32604. // Get the first code unit
  32605. var first = string.charCodeAt(index);
  32606. var second;
  32607. if ( // check if it’s the start of a surrogate pair
  32608. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32609. size > index + 1 // there is a next code unit
  32610. ) {
  32611. second = string.charCodeAt(index + 1);
  32612. if (second >= 0xDC00 && second <= 0xDFFF) {
  32613. // low surrogate
  32614. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32615. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32616. }
  32617. }
  32618. return first;
  32619. };
  32620. if (defineProperty) {
  32621. defineProperty(String.prototype, 'codePointAt', {
  32622. 'value': codePointAt,
  32623. 'configurable': true,
  32624. 'writable': true
  32625. });
  32626. } else {
  32627. String.prototype.codePointAt = codePointAt;
  32628. }
  32629. })();
  32630. }
  32631. /***/ }),
  32632. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32633. /*!********************************************************!*\
  32634. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32635. \********************************************************/
  32636. /*! no static exports found */
  32637. /***/ (function(module, exports, __webpack_require__) {
  32638. "use strict";
  32639. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32640. if (!String.fromCodePoint) {
  32641. (function () {
  32642. var defineProperty = function () {
  32643. // IE 8 only supports `Object.defineProperty` on DOM elements
  32644. try {
  32645. var object = {};
  32646. var $defineProperty = Object.defineProperty;
  32647. var result = $defineProperty(object, object, object) && $defineProperty;
  32648. } catch (error) {}
  32649. return result;
  32650. }();
  32651. var stringFromCharCode = String.fromCharCode;
  32652. var floor = Math.floor;
  32653. var fromCodePoint = function fromCodePoint(_) {
  32654. var MAX_SIZE = 0x4000;
  32655. var codeUnits = [];
  32656. var highSurrogate;
  32657. var lowSurrogate;
  32658. var index = -1;
  32659. var length = arguments.length;
  32660. if (!length) {
  32661. return '';
  32662. }
  32663. var result = '';
  32664. while (++index < length) {
  32665. var codePoint = Number(arguments[index]);
  32666. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32667. codePoint < 0 || // not a valid Unicode code point
  32668. codePoint > 0x10FFFF || // not a valid Unicode code point
  32669. floor(codePoint) != codePoint // not an integer
  32670. ) {
  32671. throw RangeError('Invalid code point: ' + codePoint);
  32672. }
  32673. if (codePoint <= 0xFFFF) {
  32674. // BMP code point
  32675. codeUnits.push(codePoint);
  32676. } else {
  32677. // Astral code point; split in surrogate halves
  32678. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32679. codePoint -= 0x10000;
  32680. highSurrogate = (codePoint >> 10) + 0xD800;
  32681. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32682. codeUnits.push(highSurrogate, lowSurrogate);
  32683. }
  32684. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32685. result += stringFromCharCode.apply(null, codeUnits);
  32686. codeUnits.length = 0;
  32687. }
  32688. }
  32689. return result;
  32690. };
  32691. if (defineProperty) {
  32692. defineProperty(String, 'fromCodePoint', {
  32693. 'value': fromCodePoint,
  32694. 'configurable': true,
  32695. 'writable': true
  32696. });
  32697. } else {
  32698. String.fromCodePoint = fromCodePoint;
  32699. }
  32700. })();
  32701. }
  32702. /***/ }),
  32703. /***/ "./node_modules/antlr4/tree/Tree.js":
  32704. /*!******************************************!*\
  32705. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32706. \******************************************/
  32707. /*! no static exports found */
  32708. /***/ (function(module, exports, __webpack_require__) {
  32709. "use strict";
  32710. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32711. * Use of this file is governed by the BSD 3-clause license that
  32712. * can be found in the LICENSE.txt file in the project root.
  32713. */
  32714. ///
  32715. // The basic notion of a tree has a parent, a payload, and a list of children.
  32716. // It is the most abstract interface for all the trees used by ANTLR.
  32717. ///
  32718. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32719. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32720. var INVALID_INTERVAL = new Interval(-1, -2);
  32721. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32722. function Tree() {
  32723. return this;
  32724. }
  32725. function SyntaxTree() {
  32726. Tree.call(this);
  32727. return this;
  32728. }
  32729. SyntaxTree.prototype = Object.create(Tree.prototype);
  32730. SyntaxTree.prototype.constructor = SyntaxTree;
  32731. function ParseTree() {
  32732. SyntaxTree.call(this);
  32733. return this;
  32734. }
  32735. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  32736. ParseTree.prototype.constructor = ParseTree;
  32737. function RuleNode() {
  32738. ParseTree.call(this);
  32739. return this;
  32740. }
  32741. RuleNode.prototype = Object.create(ParseTree.prototype);
  32742. RuleNode.prototype.constructor = RuleNode;
  32743. function TerminalNode() {
  32744. ParseTree.call(this);
  32745. return this;
  32746. }
  32747. TerminalNode.prototype = Object.create(ParseTree.prototype);
  32748. TerminalNode.prototype.constructor = TerminalNode;
  32749. function ErrorNode() {
  32750. TerminalNode.call(this);
  32751. return this;
  32752. }
  32753. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  32754. ErrorNode.prototype.constructor = ErrorNode;
  32755. function ParseTreeVisitor() {
  32756. return this;
  32757. }
  32758. ParseTreeVisitor.prototype.visit = function (ctx) {
  32759. if (Array.isArray(ctx)) {
  32760. return ctx.map(function (child) {
  32761. return child.accept(this);
  32762. }, this);
  32763. } else {
  32764. return ctx.accept(this);
  32765. }
  32766. };
  32767. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  32768. return this.visit(ctx.children);
  32769. };
  32770. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  32771. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  32772. function ParseTreeListener() {
  32773. return this;
  32774. }
  32775. ParseTreeListener.prototype.visitTerminal = function (node) {};
  32776. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  32777. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  32778. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  32779. function TerminalNodeImpl(symbol) {
  32780. TerminalNode.call(this);
  32781. this.parentCtx = null;
  32782. this.symbol = symbol;
  32783. return this;
  32784. }
  32785. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  32786. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  32787. TerminalNodeImpl.prototype.getChild = function (i) {
  32788. return null;
  32789. };
  32790. TerminalNodeImpl.prototype.getSymbol = function () {
  32791. return this.symbol;
  32792. };
  32793. TerminalNodeImpl.prototype.getParent = function () {
  32794. return this.parentCtx;
  32795. };
  32796. TerminalNodeImpl.prototype.getPayload = function () {
  32797. return this.symbol;
  32798. };
  32799. TerminalNodeImpl.prototype.getSourceInterval = function () {
  32800. if (this.symbol === null) {
  32801. return INVALID_INTERVAL;
  32802. }
  32803. var tokenIndex = this.symbol.tokenIndex;
  32804. return new Interval(tokenIndex, tokenIndex);
  32805. };
  32806. TerminalNodeImpl.prototype.getChildCount = function () {
  32807. return 0;
  32808. };
  32809. TerminalNodeImpl.prototype.accept = function (visitor) {
  32810. return visitor.visitTerminal(this);
  32811. };
  32812. TerminalNodeImpl.prototype.getText = function () {
  32813. return this.symbol.text;
  32814. };
  32815. TerminalNodeImpl.prototype.toString = function () {
  32816. if (this.symbol.type === Token.EOF) {
  32817. return "<EOF>";
  32818. } else {
  32819. return this.symbol.text;
  32820. }
  32821. };
  32822. // Represents a token that was consumed during resynchronization
  32823. // rather than during a valid match operation. For example,
  32824. // we will create this kind of a node during single token insertion
  32825. // and deletion as well as during "consume until error recovery set"
  32826. // upon no viable alternative exceptions.
  32827. function ErrorNodeImpl(token) {
  32828. TerminalNodeImpl.call(this, token);
  32829. return this;
  32830. }
  32831. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  32832. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  32833. ErrorNodeImpl.prototype.isErrorNode = function () {
  32834. return true;
  32835. };
  32836. ErrorNodeImpl.prototype.accept = function (visitor) {
  32837. return visitor.visitErrorNode(this);
  32838. };
  32839. function ParseTreeWalker() {
  32840. return this;
  32841. }
  32842. ParseTreeWalker.prototype.walk = function (listener, t) {
  32843. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  32844. if (errorNode) {
  32845. listener.visitErrorNode(t);
  32846. } else if (t instanceof TerminalNode) {
  32847. listener.visitTerminal(t);
  32848. } else {
  32849. this.enterRule(listener, t);
  32850. for (var i = 0; i < t.getChildCount(); i++) {
  32851. var child = t.getChild(i);
  32852. this.walk(listener, child);
  32853. }
  32854. this.exitRule(listener, t);
  32855. }
  32856. };
  32857. //
  32858. // The discovery of a rule node, involves sending two events: the generic
  32859. // {@link ParseTreeListener//enterEveryRule} and a
  32860. // {@link RuleContext}-specific event. First we trigger the generic and then
  32861. // the rule specific. We to them in reverse order upon finishing the node.
  32862. //
  32863. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  32864. var ctx = r.getRuleContext();
  32865. listener.enterEveryRule(ctx);
  32866. ctx.enterRule(listener);
  32867. };
  32868. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  32869. var ctx = r.getRuleContext();
  32870. ctx.exitRule(listener);
  32871. listener.exitEveryRule(ctx);
  32872. };
  32873. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  32874. exports.RuleNode = RuleNode;
  32875. exports.ErrorNode = ErrorNode;
  32876. exports.TerminalNode = TerminalNode;
  32877. exports.ErrorNodeImpl = ErrorNodeImpl;
  32878. exports.TerminalNodeImpl = TerminalNodeImpl;
  32879. exports.ParseTreeListener = ParseTreeListener;
  32880. exports.ParseTreeVisitor = ParseTreeVisitor;
  32881. exports.ParseTreeWalker = ParseTreeWalker;
  32882. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  32883. /***/ }),
  32884. /***/ "./node_modules/antlr4/tree/Trees.js":
  32885. /*!*******************************************!*\
  32886. !*** ./node_modules/antlr4/tree/Trees.js ***!
  32887. \*******************************************/
  32888. /*! no static exports found */
  32889. /***/ (function(module, exports, __webpack_require__) {
  32890. "use strict";
  32891. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32892. * Use of this file is governed by the BSD 3-clause license that
  32893. * can be found in the LICENSE.txt file in the project root.
  32894. */
  32895. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  32896. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32897. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  32898. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  32899. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  32900. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32901. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  32902. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  32903. /** A set of utility routines useful for all kinds of ANTLR trees. */
  32904. function Trees() {}
  32905. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  32906. // node payloads to get the text for the nodes. Detect
  32907. // parse trees and extract data appropriately.
  32908. Trees.toStringTree = function (tree, ruleNames, recog) {
  32909. ruleNames = ruleNames || null;
  32910. recog = recog || null;
  32911. if (recog !== null) {
  32912. ruleNames = recog.ruleNames;
  32913. }
  32914. var s = Trees.getNodeText(tree, ruleNames);
  32915. s = Utils.escapeWhitespace(s, false);
  32916. var c = tree.getChildCount();
  32917. if (c === 0) {
  32918. return s;
  32919. }
  32920. var res = "(" + s + ' ';
  32921. if (c > 0) {
  32922. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  32923. res = res.concat(s);
  32924. }
  32925. for (var i = 1; i < c; i++) {
  32926. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  32927. res = res.concat(' ' + s);
  32928. }
  32929. res = res.concat(")");
  32930. return res;
  32931. };
  32932. Trees.getNodeText = function (t, ruleNames, recog) {
  32933. ruleNames = ruleNames || null;
  32934. recog = recog || null;
  32935. if (recog !== null) {
  32936. ruleNames = recog.ruleNames;
  32937. }
  32938. if (ruleNames !== null) {
  32939. if (t instanceof RuleContext) {
  32940. var altNumber = t.getAltNumber();
  32941. if (altNumber != INVALID_ALT_NUMBER) {
  32942. return ruleNames[t.ruleIndex] + ":" + altNumber;
  32943. }
  32944. return ruleNames[t.ruleIndex];
  32945. } else if (t instanceof ErrorNode) {
  32946. return t.toString();
  32947. } else if (t instanceof TerminalNode) {
  32948. if (t.symbol !== null) {
  32949. return t.symbol.text;
  32950. }
  32951. }
  32952. }
  32953. // no recog for rule names
  32954. var payload = t.getPayload();
  32955. if (payload instanceof Token) {
  32956. return payload.text;
  32957. }
  32958. return t.getPayload().toString();
  32959. };
  32960. // Return ordered list of all children of this node
  32961. Trees.getChildren = function (t) {
  32962. var list = [];
  32963. for (var i = 0; i < t.getChildCount(); i++) {
  32964. list.push(t.getChild(i));
  32965. }
  32966. return list;
  32967. };
  32968. // Return a list of all ancestors of this node. The first node of
  32969. // list is the root and the last is the parent of this node.
  32970. //
  32971. Trees.getAncestors = function (t) {
  32972. var ancestors = [];
  32973. t = t.getParent();
  32974. while (t !== null) {
  32975. ancestors = [t].concat(ancestors);
  32976. t = t.getParent();
  32977. }
  32978. return ancestors;
  32979. };
  32980. Trees.findAllTokenNodes = function (t, ttype) {
  32981. return Trees.findAllNodes(t, ttype, true);
  32982. };
  32983. Trees.findAllRuleNodes = function (t, ruleIndex) {
  32984. return Trees.findAllNodes(t, ruleIndex, false);
  32985. };
  32986. Trees.findAllNodes = function (t, index, findTokens) {
  32987. var nodes = [];
  32988. Trees._findAllNodes(t, index, findTokens, nodes);
  32989. return nodes;
  32990. };
  32991. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  32992. // check this node (the root) first
  32993. if (findTokens && t instanceof TerminalNode) {
  32994. if (t.symbol.type === index) {
  32995. nodes.push(t);
  32996. }
  32997. } else if (!findTokens && t instanceof ParserRuleContext) {
  32998. if (t.ruleIndex === index) {
  32999. nodes.push(t);
  33000. }
  33001. }
  33002. // check children
  33003. for (var i = 0; i < t.getChildCount(); i++) {
  33004. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  33005. }
  33006. };
  33007. Trees.descendants = function (t) {
  33008. var nodes = [t];
  33009. for (var i = 0; i < t.getChildCount(); i++) {
  33010. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  33011. }
  33012. return nodes;
  33013. };
  33014. exports.Trees = Trees;
  33015. /***/ }),
  33016. /***/ "./node_modules/antlr4/tree/index.js":
  33017. /*!*******************************************!*\
  33018. !*** ./node_modules/antlr4/tree/index.js ***!
  33019. \*******************************************/
  33020. /*! no static exports found */
  33021. /***/ (function(module, exports, __webpack_require__) {
  33022. "use strict";
  33023. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33024. * Use of this file is governed by the BSD 3-clause license that
  33025. * can be found in the LICENSE.txt file in the project root.
  33026. */
  33027. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  33028. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  33029. exports.RuleNode = Tree.RuleNode;
  33030. exports.ParseTreeListener = Tree.ParseTreeListener;
  33031. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  33032. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  33033. /***/ }),
  33034. /***/ "./node_modules/decimal.js/decimal.js":
  33035. /*!********************************************!*\
  33036. !*** ./node_modules/decimal.js/decimal.js ***!
  33037. \********************************************/
  33038. /*! no static exports found */
  33039. /***/ (function(module, exports, __webpack_require__) {
  33040. "use strict";
  33041. var __WEBPACK_AMD_DEFINE_RESULT__;
  33042. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  33043. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  33044. ;(function (globalScope) {
  33045. 'use strict';
  33046. /*
  33047. * decimal.js v10.0.1
  33048. * An arbitrary-precision Decimal type for JavaScript.
  33049. * https://github.com/MikeMcl/decimal.js
  33050. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  33051. * MIT Licence
  33052. */
  33053. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  33054. // The maximum exponent magnitude.
  33055. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  33056. var EXP_LIMIT = 9e15,
  33057. // 0 to 9e15
  33058. // The limit on the value of `precision`, and on the value of the first argument to
  33059. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  33060. MAX_DIGITS = 1e9,
  33061. // 0 to 1e9
  33062. // Base conversion alphabet.
  33063. NUMERALS = '0123456789abcdef',
  33064. // The natural logarithm of 10 (1025 digits).
  33065. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  33066. // Pi (1025 digits).
  33067. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  33068. // The initial configuration properties of the Decimal constructor.
  33069. DEFAULTS = {
  33070. // These values must be integers within the stated ranges (inclusive).
  33071. // Most of these values can be changed at run-time using the `Decimal.config` method.
  33072. // The maximum number of significant digits of the result of a calculation or base conversion.
  33073. // E.g. `Decimal.config({ precision: 20 });`
  33074. precision: 20, // 1 to MAX_DIGITS
  33075. // The rounding mode used when rounding to `precision`.
  33076. //
  33077. // ROUND_UP 0 Away from zero.
  33078. // ROUND_DOWN 1 Towards zero.
  33079. // ROUND_CEIL 2 Towards +Infinity.
  33080. // ROUND_FLOOR 3 Towards -Infinity.
  33081. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  33082. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  33083. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  33084. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  33085. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  33086. //
  33087. // E.g.
  33088. // `Decimal.rounding = 4;`
  33089. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  33090. rounding: 4, // 0 to 8
  33091. // The modulo mode used when calculating the modulus: a mod n.
  33092. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  33093. // The remainder (r) is calculated as: r = a - n * q.
  33094. //
  33095. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  33096. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  33097. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  33098. // HALF_EVEN 6 The IEEE 754 remainder function.
  33099. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  33100. //
  33101. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  33102. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  33103. // be used, but they may not give useful results.
  33104. modulo: 1, // 0 to 9
  33105. // The exponent value at and beneath which `toString` returns exponential notation.
  33106. // JavaScript numbers: -7
  33107. toExpNeg: -7, // 0 to -EXP_LIMIT
  33108. // The exponent value at and above which `toString` returns exponential notation.
  33109. // JavaScript numbers: 21
  33110. toExpPos: 21, // 0 to EXP_LIMIT
  33111. // The minimum exponent value, beneath which underflow to zero occurs.
  33112. // JavaScript numbers: -324 (5e-324)
  33113. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  33114. // The maximum exponent value, above which overflow to Infinity occurs.
  33115. // JavaScript numbers: 308 (1.7976931348623157e+308)
  33116. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  33117. // Whether to use cryptographically-secure random number generation, if available.
  33118. crypto: false // true/false
  33119. },
  33120. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  33121. Decimal,
  33122. inexact,
  33123. noConflict,
  33124. quadrant,
  33125. external = true,
  33126. decimalError = '[DecimalError] ',
  33127. invalidArgument = decimalError + 'Invalid argument: ',
  33128. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  33129. cryptoUnavailable = decimalError + 'crypto unavailable',
  33130. mathfloor = Math.floor,
  33131. mathpow = Math.pow,
  33132. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  33133. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  33134. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  33135. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  33136. BASE = 1e7,
  33137. LOG_BASE = 7,
  33138. MAX_SAFE_INTEGER = 9007199254740991,
  33139. LN10_PRECISION = LN10.length - 1,
  33140. PI_PRECISION = PI.length - 1,
  33141. // Decimal.prototype object
  33142. P = { name: '[object Decimal]' };
  33143. // Decimal prototype methods
  33144. /*
  33145. * absoluteValue abs
  33146. * ceil
  33147. * comparedTo cmp
  33148. * cosine cos
  33149. * cubeRoot cbrt
  33150. * decimalPlaces dp
  33151. * dividedBy div
  33152. * dividedToIntegerBy divToInt
  33153. * equals eq
  33154. * floor
  33155. * greaterThan gt
  33156. * greaterThanOrEqualTo gte
  33157. * hyperbolicCosine cosh
  33158. * hyperbolicSine sinh
  33159. * hyperbolicTangent tanh
  33160. * inverseCosine acos
  33161. * inverseHyperbolicCosine acosh
  33162. * inverseHyperbolicSine asinh
  33163. * inverseHyperbolicTangent atanh
  33164. * inverseSine asin
  33165. * inverseTangent atan
  33166. * isFinite
  33167. * isInteger isInt
  33168. * isNaN
  33169. * isNegative isNeg
  33170. * isPositive isPos
  33171. * isZero
  33172. * lessThan lt
  33173. * lessThanOrEqualTo lte
  33174. * logarithm log
  33175. * [maximum] [max]
  33176. * [minimum] [min]
  33177. * minus sub
  33178. * modulo mod
  33179. * naturalExponential exp
  33180. * naturalLogarithm ln
  33181. * negated neg
  33182. * plus add
  33183. * precision sd
  33184. * round
  33185. * sine sin
  33186. * squareRoot sqrt
  33187. * tangent tan
  33188. * times mul
  33189. * toBinary
  33190. * toDecimalPlaces toDP
  33191. * toExponential
  33192. * toFixed
  33193. * toFraction
  33194. * toHexadecimal toHex
  33195. * toNearest
  33196. * toNumber
  33197. * toOctal
  33198. * toPower pow
  33199. * toPrecision
  33200. * toSignificantDigits toSD
  33201. * toString
  33202. * truncated trunc
  33203. * valueOf toJSON
  33204. */
  33205. /*
  33206. * Return a new Decimal whose value is the absolute value of this Decimal.
  33207. *
  33208. */
  33209. P.absoluteValue = P.abs = function () {
  33210. var x = new this.constructor(this);
  33211. if (x.s < 0) x.s = 1;
  33212. return finalise(x);
  33213. };
  33214. /*
  33215. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33216. * direction of positive Infinity.
  33217. *
  33218. */
  33219. P.ceil = function () {
  33220. return finalise(new this.constructor(this), this.e + 1, 2);
  33221. };
  33222. /*
  33223. * Return
  33224. * 1 if the value of this Decimal is greater than the value of `y`,
  33225. * -1 if the value of this Decimal is less than the value of `y`,
  33226. * 0 if they have the same value,
  33227. * NaN if the value of either Decimal is NaN.
  33228. *
  33229. */
  33230. P.comparedTo = P.cmp = function (y) {
  33231. var i,
  33232. j,
  33233. xdL,
  33234. ydL,
  33235. x = this,
  33236. xd = x.d,
  33237. yd = (y = new x.constructor(y)).d,
  33238. xs = x.s,
  33239. ys = y.s;
  33240. // Either NaN or ±Infinity?
  33241. if (!xd || !yd) {
  33242. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  33243. }
  33244. // Either zero?
  33245. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  33246. // Signs differ?
  33247. if (xs !== ys) return xs;
  33248. // Compare exponents.
  33249. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  33250. xdL = xd.length;
  33251. ydL = yd.length;
  33252. // Compare digit by digit.
  33253. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  33254. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  33255. }
  33256. // Compare lengths.
  33257. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  33258. };
  33259. /*
  33260. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  33261. *
  33262. * Domain: [-Infinity, Infinity]
  33263. * Range: [-1, 1]
  33264. *
  33265. * cos(0) = 1
  33266. * cos(-0) = 1
  33267. * cos(Infinity) = NaN
  33268. * cos(-Infinity) = NaN
  33269. * cos(NaN) = NaN
  33270. *
  33271. */
  33272. P.cosine = P.cos = function () {
  33273. var pr,
  33274. rm,
  33275. x = this,
  33276. Ctor = x.constructor;
  33277. if (!x.d) return new Ctor(NaN);
  33278. // cos(0) = cos(-0) = 1
  33279. if (!x.d[0]) return new Ctor(1);
  33280. pr = Ctor.precision;
  33281. rm = Ctor.rounding;
  33282. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  33283. Ctor.rounding = 1;
  33284. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  33285. Ctor.precision = pr;
  33286. Ctor.rounding = rm;
  33287. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  33288. };
  33289. /*
  33290. *
  33291. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  33292. * `precision` significant digits using rounding mode `rounding`.
  33293. *
  33294. * cbrt(0) = 0
  33295. * cbrt(-0) = -0
  33296. * cbrt(1) = 1
  33297. * cbrt(-1) = -1
  33298. * cbrt(N) = N
  33299. * cbrt(-I) = -I
  33300. * cbrt(I) = I
  33301. *
  33302. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  33303. *
  33304. */
  33305. P.cubeRoot = P.cbrt = function () {
  33306. var e,
  33307. m,
  33308. n,
  33309. r,
  33310. rep,
  33311. s,
  33312. sd,
  33313. t,
  33314. t3,
  33315. t3plusx,
  33316. x = this,
  33317. Ctor = x.constructor;
  33318. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33319. external = false;
  33320. // Initial estimate.
  33321. s = x.s * Math.pow(x.s * x, 1 / 3);
  33322. // Math.cbrt underflow/overflow?
  33323. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  33324. if (!s || Math.abs(s) == 1 / 0) {
  33325. n = digitsToString(x.d);
  33326. e = x.e;
  33327. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  33328. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  33329. s = Math.pow(n, 1 / 3);
  33330. // Rarely, e may be one less than the result exponent value.
  33331. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  33332. if (s == 1 / 0) {
  33333. n = '5e' + e;
  33334. } else {
  33335. n = s.toExponential();
  33336. n = n.slice(0, n.indexOf('e') + 1) + e;
  33337. }
  33338. r = new Ctor(n);
  33339. r.s = x.s;
  33340. } else {
  33341. r = new Ctor(s.toString());
  33342. }
  33343. sd = (e = Ctor.precision) + 3;
  33344. // Halley's method.
  33345. // TODO? Compare Newton's method.
  33346. for (;;) {
  33347. t = r;
  33348. t3 = t.times(t).times(t);
  33349. t3plusx = t3.plus(x);
  33350. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  33351. // TODO? Replace with for-loop and checkRoundingDigits.
  33352. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  33353. n = n.slice(sd - 3, sd + 1);
  33354. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  33355. // , i.e. approaching a rounding boundary, continue the iteration.
  33356. if (n == '9999' || !rep && n == '4999') {
  33357. // On the first iteration only, check to see if rounding up gives the exact result as the
  33358. // nines may infinitely repeat.
  33359. if (!rep) {
  33360. finalise(t, e + 1, 0);
  33361. if (t.times(t).times(t).eq(x)) {
  33362. r = t;
  33363. break;
  33364. }
  33365. }
  33366. sd += 4;
  33367. rep = 1;
  33368. } else {
  33369. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  33370. // If not, then there are further digits and m will be truthy.
  33371. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  33372. // Truncate to the first rounding digit.
  33373. finalise(r, e + 1, 1);
  33374. m = !r.times(r).times(r).eq(x);
  33375. }
  33376. break;
  33377. }
  33378. }
  33379. }
  33380. external = true;
  33381. return finalise(r, e, Ctor.rounding, m);
  33382. };
  33383. /*
  33384. * Return the number of decimal places of the value of this Decimal.
  33385. *
  33386. */
  33387. P.decimalPlaces = P.dp = function () {
  33388. var w,
  33389. d = this.d,
  33390. n = NaN;
  33391. if (d) {
  33392. w = d.length - 1;
  33393. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  33394. // Subtract the number of trailing zeros of the last word.
  33395. w = d[w];
  33396. if (w) for (; w % 10 == 0; w /= 10) {
  33397. n--;
  33398. }if (n < 0) n = 0;
  33399. }
  33400. return n;
  33401. };
  33402. /*
  33403. * n / 0 = I
  33404. * n / N = N
  33405. * n / I = 0
  33406. * 0 / n = 0
  33407. * 0 / 0 = N
  33408. * 0 / N = N
  33409. * 0 / I = 0
  33410. * N / n = N
  33411. * N / 0 = N
  33412. * N / N = N
  33413. * N / I = N
  33414. * I / n = I
  33415. * I / 0 = I
  33416. * I / N = N
  33417. * I / I = N
  33418. *
  33419. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  33420. * `precision` significant digits using rounding mode `rounding`.
  33421. *
  33422. */
  33423. P.dividedBy = P.div = function (y) {
  33424. return divide(this, new this.constructor(y));
  33425. };
  33426. /*
  33427. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  33428. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  33429. *
  33430. */
  33431. P.dividedToIntegerBy = P.divToInt = function (y) {
  33432. var x = this,
  33433. Ctor = x.constructor;
  33434. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  33435. };
  33436. /*
  33437. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  33438. *
  33439. */
  33440. P.equals = P.eq = function (y) {
  33441. return this.cmp(y) === 0;
  33442. };
  33443. /*
  33444. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33445. * direction of negative Infinity.
  33446. *
  33447. */
  33448. P.floor = function () {
  33449. return finalise(new this.constructor(this), this.e + 1, 3);
  33450. };
  33451. /*
  33452. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  33453. * false.
  33454. *
  33455. */
  33456. P.greaterThan = P.gt = function (y) {
  33457. return this.cmp(y) > 0;
  33458. };
  33459. /*
  33460. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  33461. * otherwise return false.
  33462. *
  33463. */
  33464. P.greaterThanOrEqualTo = P.gte = function (y) {
  33465. var k = this.cmp(y);
  33466. return k == 1 || k === 0;
  33467. };
  33468. /*
  33469. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  33470. * Decimal.
  33471. *
  33472. * Domain: [-Infinity, Infinity]
  33473. * Range: [1, Infinity]
  33474. *
  33475. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  33476. *
  33477. * cosh(0) = 1
  33478. * cosh(-0) = 1
  33479. * cosh(Infinity) = Infinity
  33480. * cosh(-Infinity) = Infinity
  33481. * cosh(NaN) = NaN
  33482. *
  33483. * x time taken (ms) result
  33484. * 1000 9 9.8503555700852349694e+433
  33485. * 10000 25 4.4034091128314607936e+4342
  33486. * 100000 171 1.4033316802130615897e+43429
  33487. * 1000000 3817 1.5166076984010437725e+434294
  33488. * 10000000 abandoned after 2 minute wait
  33489. *
  33490. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  33491. *
  33492. */
  33493. P.hyperbolicCosine = P.cosh = function () {
  33494. var k,
  33495. n,
  33496. pr,
  33497. rm,
  33498. len,
  33499. x = this,
  33500. Ctor = x.constructor,
  33501. one = new Ctor(1);
  33502. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  33503. if (x.isZero()) return one;
  33504. pr = Ctor.precision;
  33505. rm = Ctor.rounding;
  33506. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33507. Ctor.rounding = 1;
  33508. len = x.d.length;
  33509. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  33510. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  33511. // Estimate the optimum number of times to use the argument reduction.
  33512. // TODO? Estimation reused from cosine() and may not be optimal here.
  33513. if (len < 32) {
  33514. k = Math.ceil(len / 3);
  33515. n = Math.pow(4, -k).toString();
  33516. } else {
  33517. k = 16;
  33518. n = '2.3283064365386962890625e-10';
  33519. }
  33520. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  33521. // Reverse argument reduction
  33522. var cosh2_x,
  33523. i = k,
  33524. d8 = new Ctor(8);
  33525. for (; i--;) {
  33526. cosh2_x = x.times(x);
  33527. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  33528. }
  33529. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  33530. };
  33531. /*
  33532. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  33533. * Decimal.
  33534. *
  33535. * Domain: [-Infinity, Infinity]
  33536. * Range: [-Infinity, Infinity]
  33537. *
  33538. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  33539. *
  33540. * sinh(0) = 0
  33541. * sinh(-0) = -0
  33542. * sinh(Infinity) = Infinity
  33543. * sinh(-Infinity) = -Infinity
  33544. * sinh(NaN) = NaN
  33545. *
  33546. * x time taken (ms)
  33547. * 10 2 ms
  33548. * 100 5 ms
  33549. * 1000 14 ms
  33550. * 10000 82 ms
  33551. * 100000 886 ms 1.4033316802130615897e+43429
  33552. * 200000 2613 ms
  33553. * 300000 5407 ms
  33554. * 400000 8824 ms
  33555. * 500000 13026 ms 8.7080643612718084129e+217146
  33556. * 1000000 48543 ms
  33557. *
  33558. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  33559. *
  33560. */
  33561. P.hyperbolicSine = P.sinh = function () {
  33562. var k,
  33563. pr,
  33564. rm,
  33565. len,
  33566. x = this,
  33567. Ctor = x.constructor;
  33568. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33569. pr = Ctor.precision;
  33570. rm = Ctor.rounding;
  33571. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33572. Ctor.rounding = 1;
  33573. len = x.d.length;
  33574. if (len < 3) {
  33575. x = taylorSeries(Ctor, 2, x, x, true);
  33576. } else {
  33577. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  33578. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  33579. // 3 multiplications and 1 addition
  33580. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  33581. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  33582. // 4 multiplications and 2 additions
  33583. // Estimate the optimum number of times to use the argument reduction.
  33584. k = 1.4 * Math.sqrt(len);
  33585. k = k > 16 ? 16 : k | 0;
  33586. x = x.times(Math.pow(5, -k));
  33587. x = taylorSeries(Ctor, 2, x, x, true);
  33588. // Reverse argument reduction
  33589. var sinh2_x,
  33590. d5 = new Ctor(5),
  33591. d16 = new Ctor(16),
  33592. d20 = new Ctor(20);
  33593. for (; k--;) {
  33594. sinh2_x = x.times(x);
  33595. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33596. }
  33597. }
  33598. Ctor.precision = pr;
  33599. Ctor.rounding = rm;
  33600. return finalise(x, pr, rm, true);
  33601. };
  33602. /*
  33603. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33604. * Decimal.
  33605. *
  33606. * Domain: [-Infinity, Infinity]
  33607. * Range: [-1, 1]
  33608. *
  33609. * tanh(x) = sinh(x) / cosh(x)
  33610. *
  33611. * tanh(0) = 0
  33612. * tanh(-0) = -0
  33613. * tanh(Infinity) = 1
  33614. * tanh(-Infinity) = -1
  33615. * tanh(NaN) = NaN
  33616. *
  33617. */
  33618. P.hyperbolicTangent = P.tanh = function () {
  33619. var pr,
  33620. rm,
  33621. x = this,
  33622. Ctor = x.constructor;
  33623. if (!x.isFinite()) return new Ctor(x.s);
  33624. if (x.isZero()) return new Ctor(x);
  33625. pr = Ctor.precision;
  33626. rm = Ctor.rounding;
  33627. Ctor.precision = pr + 7;
  33628. Ctor.rounding = 1;
  33629. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33630. };
  33631. /*
  33632. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33633. * this Decimal.
  33634. *
  33635. * Domain: [-1, 1]
  33636. * Range: [0, pi]
  33637. *
  33638. * acos(x) = pi/2 - asin(x)
  33639. *
  33640. * acos(0) = pi/2
  33641. * acos(-0) = pi/2
  33642. * acos(1) = 0
  33643. * acos(-1) = pi
  33644. * acos(1/2) = pi/3
  33645. * acos(-1/2) = 2*pi/3
  33646. * acos(|x| > 1) = NaN
  33647. * acos(NaN) = NaN
  33648. *
  33649. */
  33650. P.inverseCosine = P.acos = function () {
  33651. var halfPi,
  33652. x = this,
  33653. Ctor = x.constructor,
  33654. k = x.abs().cmp(1),
  33655. pr = Ctor.precision,
  33656. rm = Ctor.rounding;
  33657. if (k !== -1) {
  33658. return k === 0
  33659. // |x| is 1
  33660. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33661. // |x| > 1 or x is NaN
  33662. : new Ctor(NaN);
  33663. }
  33664. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33665. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33666. Ctor.precision = pr + 6;
  33667. Ctor.rounding = 1;
  33668. x = x.asin();
  33669. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33670. Ctor.precision = pr;
  33671. Ctor.rounding = rm;
  33672. return halfPi.minus(x);
  33673. };
  33674. /*
  33675. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33676. * value of this Decimal.
  33677. *
  33678. * Domain: [1, Infinity]
  33679. * Range: [0, Infinity]
  33680. *
  33681. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33682. *
  33683. * acosh(x < 1) = NaN
  33684. * acosh(NaN) = NaN
  33685. * acosh(Infinity) = Infinity
  33686. * acosh(-Infinity) = NaN
  33687. * acosh(0) = NaN
  33688. * acosh(-0) = NaN
  33689. * acosh(1) = 0
  33690. * acosh(-1) = NaN
  33691. *
  33692. */
  33693. P.inverseHyperbolicCosine = P.acosh = function () {
  33694. var pr,
  33695. rm,
  33696. x = this,
  33697. Ctor = x.constructor;
  33698. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33699. if (!x.isFinite()) return new Ctor(x);
  33700. pr = Ctor.precision;
  33701. rm = Ctor.rounding;
  33702. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33703. Ctor.rounding = 1;
  33704. external = false;
  33705. x = x.times(x).minus(1).sqrt().plus(x);
  33706. external = true;
  33707. Ctor.precision = pr;
  33708. Ctor.rounding = rm;
  33709. return x.ln();
  33710. };
  33711. /*
  33712. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33713. * of this Decimal.
  33714. *
  33715. * Domain: [-Infinity, Infinity]
  33716. * Range: [-Infinity, Infinity]
  33717. *
  33718. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33719. *
  33720. * asinh(NaN) = NaN
  33721. * asinh(Infinity) = Infinity
  33722. * asinh(-Infinity) = -Infinity
  33723. * asinh(0) = 0
  33724. * asinh(-0) = -0
  33725. *
  33726. */
  33727. P.inverseHyperbolicSine = P.asinh = function () {
  33728. var pr,
  33729. rm,
  33730. x = this,
  33731. Ctor = x.constructor;
  33732. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33733. pr = Ctor.precision;
  33734. rm = Ctor.rounding;
  33735. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  33736. Ctor.rounding = 1;
  33737. external = false;
  33738. x = x.times(x).plus(1).sqrt().plus(x);
  33739. external = true;
  33740. Ctor.precision = pr;
  33741. Ctor.rounding = rm;
  33742. return x.ln();
  33743. };
  33744. /*
  33745. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  33746. * value of this Decimal.
  33747. *
  33748. * Domain: [-1, 1]
  33749. * Range: [-Infinity, Infinity]
  33750. *
  33751. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  33752. *
  33753. * atanh(|x| > 1) = NaN
  33754. * atanh(NaN) = NaN
  33755. * atanh(Infinity) = NaN
  33756. * atanh(-Infinity) = NaN
  33757. * atanh(0) = 0
  33758. * atanh(-0) = -0
  33759. * atanh(1) = Infinity
  33760. * atanh(-1) = -Infinity
  33761. *
  33762. */
  33763. P.inverseHyperbolicTangent = P.atanh = function () {
  33764. var pr,
  33765. rm,
  33766. wpr,
  33767. xsd,
  33768. x = this,
  33769. Ctor = x.constructor;
  33770. if (!x.isFinite()) return new Ctor(NaN);
  33771. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  33772. pr = Ctor.precision;
  33773. rm = Ctor.rounding;
  33774. xsd = x.sd();
  33775. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  33776. Ctor.precision = wpr = xsd - x.e;
  33777. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  33778. Ctor.precision = pr + 4;
  33779. Ctor.rounding = 1;
  33780. x = x.ln();
  33781. Ctor.precision = pr;
  33782. Ctor.rounding = rm;
  33783. return x.times(0.5);
  33784. };
  33785. /*
  33786. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  33787. * Decimal.
  33788. *
  33789. * Domain: [-Infinity, Infinity]
  33790. * Range: [-pi/2, pi/2]
  33791. *
  33792. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  33793. *
  33794. * asin(0) = 0
  33795. * asin(-0) = -0
  33796. * asin(1/2) = pi/6
  33797. * asin(-1/2) = -pi/6
  33798. * asin(1) = pi/2
  33799. * asin(-1) = -pi/2
  33800. * asin(|x| > 1) = NaN
  33801. * asin(NaN) = NaN
  33802. *
  33803. * TODO? Compare performance of Taylor series.
  33804. *
  33805. */
  33806. P.inverseSine = P.asin = function () {
  33807. var halfPi,
  33808. k,
  33809. pr,
  33810. rm,
  33811. x = this,
  33812. Ctor = x.constructor;
  33813. if (x.isZero()) return new Ctor(x);
  33814. k = x.abs().cmp(1);
  33815. pr = Ctor.precision;
  33816. rm = Ctor.rounding;
  33817. if (k !== -1) {
  33818. // |x| is 1
  33819. if (k === 0) {
  33820. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33821. halfPi.s = x.s;
  33822. return halfPi;
  33823. }
  33824. // |x| > 1 or x is NaN
  33825. return new Ctor(NaN);
  33826. }
  33827. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  33828. Ctor.precision = pr + 6;
  33829. Ctor.rounding = 1;
  33830. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  33831. Ctor.precision = pr;
  33832. Ctor.rounding = rm;
  33833. return x.times(2);
  33834. };
  33835. /*
  33836. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  33837. * of this Decimal.
  33838. *
  33839. * Domain: [-Infinity, Infinity]
  33840. * Range: [-pi/2, pi/2]
  33841. *
  33842. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33843. *
  33844. * atan(0) = 0
  33845. * atan(-0) = -0
  33846. * atan(1) = pi/4
  33847. * atan(-1) = -pi/4
  33848. * atan(Infinity) = pi/2
  33849. * atan(-Infinity) = -pi/2
  33850. * atan(NaN) = NaN
  33851. *
  33852. */
  33853. P.inverseTangent = P.atan = function () {
  33854. var i,
  33855. j,
  33856. k,
  33857. n,
  33858. px,
  33859. t,
  33860. r,
  33861. wpr,
  33862. x2,
  33863. x = this,
  33864. Ctor = x.constructor,
  33865. pr = Ctor.precision,
  33866. rm = Ctor.rounding;
  33867. if (!x.isFinite()) {
  33868. if (!x.s) return new Ctor(NaN);
  33869. if (pr + 4 <= PI_PRECISION) {
  33870. r = getPi(Ctor, pr + 4, rm).times(0.5);
  33871. r.s = x.s;
  33872. return r;
  33873. }
  33874. } else if (x.isZero()) {
  33875. return new Ctor(x);
  33876. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  33877. r = getPi(Ctor, pr + 4, rm).times(0.25);
  33878. r.s = x.s;
  33879. return r;
  33880. }
  33881. Ctor.precision = wpr = pr + 10;
  33882. Ctor.rounding = 1;
  33883. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  33884. // Argument reduction
  33885. // Ensure |x| < 0.42
  33886. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  33887. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  33888. for (i = k; i; --i) {
  33889. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  33890. }external = false;
  33891. j = Math.ceil(wpr / LOG_BASE);
  33892. n = 1;
  33893. x2 = x.times(x);
  33894. r = new Ctor(x);
  33895. px = x;
  33896. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33897. for (; i !== -1;) {
  33898. px = px.times(x2);
  33899. t = r.minus(px.div(n += 2));
  33900. px = px.times(x2);
  33901. r = t.plus(px.div(n += 2));
  33902. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  33903. }
  33904. if (k) r = r.times(2 << k - 1);
  33905. external = true;
  33906. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  33907. };
  33908. /*
  33909. * Return true if the value of this Decimal is a finite number, otherwise return false.
  33910. *
  33911. */
  33912. P.isFinite = function () {
  33913. return !!this.d;
  33914. };
  33915. /*
  33916. * Return true if the value of this Decimal is an integer, otherwise return false.
  33917. *
  33918. */
  33919. P.isInteger = P.isInt = function () {
  33920. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  33921. };
  33922. /*
  33923. * Return true if the value of this Decimal is NaN, otherwise return false.
  33924. *
  33925. */
  33926. P.isNaN = function () {
  33927. return !this.s;
  33928. };
  33929. /*
  33930. * Return true if the value of this Decimal is negative, otherwise return false.
  33931. *
  33932. */
  33933. P.isNegative = P.isNeg = function () {
  33934. return this.s < 0;
  33935. };
  33936. /*
  33937. * Return true if the value of this Decimal is positive, otherwise return false.
  33938. *
  33939. */
  33940. P.isPositive = P.isPos = function () {
  33941. return this.s > 0;
  33942. };
  33943. /*
  33944. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  33945. *
  33946. */
  33947. P.isZero = function () {
  33948. return !!this.d && this.d[0] === 0;
  33949. };
  33950. /*
  33951. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  33952. *
  33953. */
  33954. P.lessThan = P.lt = function (y) {
  33955. return this.cmp(y) < 0;
  33956. };
  33957. /*
  33958. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  33959. *
  33960. */
  33961. P.lessThanOrEqualTo = P.lte = function (y) {
  33962. return this.cmp(y) < 1;
  33963. };
  33964. /*
  33965. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  33966. * significant digits using rounding mode `rounding`.
  33967. *
  33968. * If no base is specified, return log[10](arg).
  33969. *
  33970. * log[base](arg) = ln(arg) / ln(base)
  33971. *
  33972. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  33973. * otherwise:
  33974. *
  33975. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  33976. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  33977. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  33978. *
  33979. * log[-b](a) = NaN
  33980. * log[0](a) = NaN
  33981. * log[1](a) = NaN
  33982. * log[NaN](a) = NaN
  33983. * log[Infinity](a) = NaN
  33984. * log[b](0) = -Infinity
  33985. * log[b](-0) = -Infinity
  33986. * log[b](-a) = NaN
  33987. * log[b](1) = 0
  33988. * log[b](Infinity) = Infinity
  33989. * log[b](NaN) = NaN
  33990. *
  33991. * [base] {number|string|Decimal} The base of the logarithm.
  33992. *
  33993. */
  33994. P.logarithm = P.log = function (base) {
  33995. var isBase10,
  33996. d,
  33997. denominator,
  33998. k,
  33999. inf,
  34000. num,
  34001. sd,
  34002. r,
  34003. arg = this,
  34004. Ctor = arg.constructor,
  34005. pr = Ctor.precision,
  34006. rm = Ctor.rounding,
  34007. guard = 5;
  34008. // Default base is 10.
  34009. if (base == null) {
  34010. base = new Ctor(10);
  34011. isBase10 = true;
  34012. } else {
  34013. base = new Ctor(base);
  34014. d = base.d;
  34015. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  34016. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  34017. isBase10 = base.eq(10);
  34018. }
  34019. d = arg.d;
  34020. // Is arg negative, non-finite, 0 or 1?
  34021. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  34022. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  34023. }
  34024. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  34025. // integer power of 10.
  34026. if (isBase10) {
  34027. if (d.length > 1) {
  34028. inf = true;
  34029. } else {
  34030. for (k = d[0]; k % 10 === 0;) {
  34031. k /= 10;
  34032. }inf = k !== 1;
  34033. }
  34034. }
  34035. external = false;
  34036. sd = pr + guard;
  34037. num = naturalLogarithm(arg, sd);
  34038. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  34039. // The result will have 5 rounding digits.
  34040. r = divide(num, denominator, sd, 1);
  34041. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  34042. // calculate 10 further digits.
  34043. //
  34044. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  34045. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  34046. // further digits, the last 14 are nines, round up and assume the result is exact.
  34047. // Also assume the result is exact if the last 14 are zero.
  34048. //
  34049. // Example of a result that will be incorrectly rounded:
  34050. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  34051. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  34052. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  34053. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  34054. // place is still 2.6.
  34055. if (checkRoundingDigits(r.d, k = pr, rm)) {
  34056. do {
  34057. sd += 10;
  34058. num = naturalLogarithm(arg, sd);
  34059. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  34060. r = divide(num, denominator, sd, 1);
  34061. if (!inf) {
  34062. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  34063. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  34064. r = finalise(r, pr + 1, 0);
  34065. }
  34066. break;
  34067. }
  34068. } while (checkRoundingDigits(r.d, k += 10, rm));
  34069. }
  34070. external = true;
  34071. return finalise(r, pr, rm);
  34072. };
  34073. /*
  34074. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  34075. *
  34076. * arguments {number|string|Decimal}
  34077. *
  34078. P.max = function () {
  34079. Array.prototype.push.call(arguments, this);
  34080. return maxOrMin(this.constructor, arguments, 'lt');
  34081. };
  34082. */
  34083. /*
  34084. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  34085. *
  34086. * arguments {number|string|Decimal}
  34087. *
  34088. P.min = function () {
  34089. Array.prototype.push.call(arguments, this);
  34090. return maxOrMin(this.constructor, arguments, 'gt');
  34091. };
  34092. */
  34093. /*
  34094. * n - 0 = n
  34095. * n - N = N
  34096. * n - I = -I
  34097. * 0 - n = -n
  34098. * 0 - 0 = 0
  34099. * 0 - N = N
  34100. * 0 - I = -I
  34101. * N - n = N
  34102. * N - 0 = N
  34103. * N - N = N
  34104. * N - I = N
  34105. * I - n = I
  34106. * I - 0 = I
  34107. * I - N = N
  34108. * I - I = N
  34109. *
  34110. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  34111. * significant digits using rounding mode `rounding`.
  34112. *
  34113. */
  34114. P.minus = P.sub = function (y) {
  34115. var d,
  34116. e,
  34117. i,
  34118. j,
  34119. k,
  34120. len,
  34121. pr,
  34122. rm,
  34123. xd,
  34124. xe,
  34125. xLTy,
  34126. yd,
  34127. x = this,
  34128. Ctor = x.constructor;
  34129. y = new Ctor(y);
  34130. // If either is not finite...
  34131. if (!x.d || !y.d) {
  34132. // Return NaN if either is NaN.
  34133. if (!x.s || !y.s) y = new Ctor(NaN);
  34134. // Return y negated if x is finite and y is ±Infinity.
  34135. else if (x.d) y.s = -y.s;
  34136. // Return x if y is finite and x is ±Infinity.
  34137. // Return x if both are ±Infinity with different signs.
  34138. // Return NaN if both are ±Infinity with the same sign.
  34139. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  34140. return y;
  34141. }
  34142. // If signs differ...
  34143. if (x.s != y.s) {
  34144. y.s = -y.s;
  34145. return x.plus(y);
  34146. }
  34147. xd = x.d;
  34148. yd = y.d;
  34149. pr = Ctor.precision;
  34150. rm = Ctor.rounding;
  34151. // If either is zero...
  34152. if (!xd[0] || !yd[0]) {
  34153. // Return y negated if x is zero and y is non-zero.
  34154. if (yd[0]) y.s = -y.s;
  34155. // Return x if y is zero and x is non-zero.
  34156. else if (xd[0]) y = new Ctor(x);
  34157. // Return zero if both are zero.
  34158. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  34159. else return new Ctor(rm === 3 ? -0 : 0);
  34160. return external ? finalise(y, pr, rm) : y;
  34161. }
  34162. // x and y are finite, non-zero numbers with the same sign.
  34163. // Calculate base 1e7 exponents.
  34164. e = mathfloor(y.e / LOG_BASE);
  34165. xe = mathfloor(x.e / LOG_BASE);
  34166. xd = xd.slice();
  34167. k = xe - e;
  34168. // If base 1e7 exponents differ...
  34169. if (k) {
  34170. xLTy = k < 0;
  34171. if (xLTy) {
  34172. d = xd;
  34173. k = -k;
  34174. len = yd.length;
  34175. } else {
  34176. d = yd;
  34177. e = xe;
  34178. len = xd.length;
  34179. }
  34180. // Numbers with massively different exponents would result in a very high number of
  34181. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  34182. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  34183. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  34184. if (k > i) {
  34185. k = i;
  34186. d.length = 1;
  34187. }
  34188. // Prepend zeros to equalise exponents.
  34189. d.reverse();
  34190. for (i = k; i--;) {
  34191. d.push(0);
  34192. }d.reverse();
  34193. // Base 1e7 exponents equal.
  34194. } else {
  34195. // Check digits to determine which is the bigger number.
  34196. i = xd.length;
  34197. len = yd.length;
  34198. xLTy = i < len;
  34199. if (xLTy) len = i;
  34200. for (i = 0; i < len; i++) {
  34201. if (xd[i] != yd[i]) {
  34202. xLTy = xd[i] < yd[i];
  34203. break;
  34204. }
  34205. }
  34206. k = 0;
  34207. }
  34208. if (xLTy) {
  34209. d = xd;
  34210. xd = yd;
  34211. yd = d;
  34212. y.s = -y.s;
  34213. }
  34214. len = xd.length;
  34215. // Append zeros to `xd` if shorter.
  34216. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  34217. for (i = yd.length - len; i > 0; --i) {
  34218. xd[len++] = 0;
  34219. } // Subtract yd from xd.
  34220. for (i = yd.length; i > k;) {
  34221. if (xd[--i] < yd[i]) {
  34222. for (j = i; j && xd[--j] === 0;) {
  34223. xd[j] = BASE - 1;
  34224. }--xd[j];
  34225. xd[i] += BASE;
  34226. }
  34227. xd[i] -= yd[i];
  34228. }
  34229. // Remove trailing zeros.
  34230. for (; xd[--len] === 0;) {
  34231. xd.pop();
  34232. } // Remove leading zeros and adjust exponent accordingly.
  34233. for (; xd[0] === 0; xd.shift()) {
  34234. --e;
  34235. } // Zero?
  34236. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  34237. y.d = xd;
  34238. y.e = getBase10Exponent(xd, e);
  34239. return external ? finalise(y, pr, rm) : y;
  34240. };
  34241. /*
  34242. * n % 0 = N
  34243. * n % N = N
  34244. * n % I = n
  34245. * 0 % n = 0
  34246. * -0 % n = -0
  34247. * 0 % 0 = N
  34248. * 0 % N = N
  34249. * 0 % I = 0
  34250. * N % n = N
  34251. * N % 0 = N
  34252. * N % N = N
  34253. * N % I = N
  34254. * I % n = N
  34255. * I % 0 = N
  34256. * I % N = N
  34257. * I % I = N
  34258. *
  34259. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  34260. * `precision` significant digits using rounding mode `rounding`.
  34261. *
  34262. * The result depends on the modulo mode.
  34263. *
  34264. */
  34265. P.modulo = P.mod = function (y) {
  34266. var q,
  34267. x = this,
  34268. Ctor = x.constructor;
  34269. y = new Ctor(y);
  34270. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  34271. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  34272. // Return x if y is ±Infinity or x is ±0.
  34273. if (!y.d || x.d && !x.d[0]) {
  34274. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  34275. }
  34276. // Prevent rounding of intermediate calculations.
  34277. external = false;
  34278. if (Ctor.modulo == 9) {
  34279. // Euclidian division: q = sign(y) * floor(x / abs(y))
  34280. // result = x - q * y where 0 <= result < abs(y)
  34281. q = divide(x, y.abs(), 0, 3, 1);
  34282. q.s *= y.s;
  34283. } else {
  34284. q = divide(x, y, 0, Ctor.modulo, 1);
  34285. }
  34286. q = q.times(y);
  34287. external = true;
  34288. return x.minus(q);
  34289. };
  34290. /*
  34291. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  34292. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  34293. * significant digits using rounding mode `rounding`.
  34294. *
  34295. */
  34296. P.naturalExponential = P.exp = function () {
  34297. return naturalExponential(this);
  34298. };
  34299. /*
  34300. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  34301. * rounded to `precision` significant digits using rounding mode `rounding`.
  34302. *
  34303. */
  34304. P.naturalLogarithm = P.ln = function () {
  34305. return naturalLogarithm(this);
  34306. };
  34307. /*
  34308. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  34309. * -1.
  34310. *
  34311. */
  34312. P.negated = P.neg = function () {
  34313. var x = new this.constructor(this);
  34314. x.s = -x.s;
  34315. return finalise(x);
  34316. };
  34317. /*
  34318. * n + 0 = n
  34319. * n + N = N
  34320. * n + I = I
  34321. * 0 + n = n
  34322. * 0 + 0 = 0
  34323. * 0 + N = N
  34324. * 0 + I = I
  34325. * N + n = N
  34326. * N + 0 = N
  34327. * N + N = N
  34328. * N + I = N
  34329. * I + n = I
  34330. * I + 0 = I
  34331. * I + N = N
  34332. * I + I = I
  34333. *
  34334. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  34335. * significant digits using rounding mode `rounding`.
  34336. *
  34337. */
  34338. P.plus = P.add = function (y) {
  34339. var carry,
  34340. d,
  34341. e,
  34342. i,
  34343. k,
  34344. len,
  34345. pr,
  34346. rm,
  34347. xd,
  34348. yd,
  34349. x = this,
  34350. Ctor = x.constructor;
  34351. y = new Ctor(y);
  34352. // If either is not finite...
  34353. if (!x.d || !y.d) {
  34354. // Return NaN if either is NaN.
  34355. if (!x.s || !y.s) y = new Ctor(NaN);
  34356. // Return x if y is finite and x is ±Infinity.
  34357. // Return x if both are ±Infinity with the same sign.
  34358. // Return NaN if both are ±Infinity with different signs.
  34359. // Return y if x is finite and y is ±Infinity.
  34360. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  34361. return y;
  34362. }
  34363. // If signs differ...
  34364. if (x.s != y.s) {
  34365. y.s = -y.s;
  34366. return x.minus(y);
  34367. }
  34368. xd = x.d;
  34369. yd = y.d;
  34370. pr = Ctor.precision;
  34371. rm = Ctor.rounding;
  34372. // If either is zero...
  34373. if (!xd[0] || !yd[0]) {
  34374. // Return x if y is zero.
  34375. // Return y if y is non-zero.
  34376. if (!yd[0]) y = new Ctor(x);
  34377. return external ? finalise(y, pr, rm) : y;
  34378. }
  34379. // x and y are finite, non-zero numbers with the same sign.
  34380. // Calculate base 1e7 exponents.
  34381. k = mathfloor(x.e / LOG_BASE);
  34382. e = mathfloor(y.e / LOG_BASE);
  34383. xd = xd.slice();
  34384. i = k - e;
  34385. // If base 1e7 exponents differ...
  34386. if (i) {
  34387. if (i < 0) {
  34388. d = xd;
  34389. i = -i;
  34390. len = yd.length;
  34391. } else {
  34392. d = yd;
  34393. e = k;
  34394. len = xd.length;
  34395. }
  34396. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  34397. k = Math.ceil(pr / LOG_BASE);
  34398. len = k > len ? k + 1 : len + 1;
  34399. if (i > len) {
  34400. i = len;
  34401. d.length = 1;
  34402. }
  34403. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  34404. d.reverse();
  34405. for (; i--;) {
  34406. d.push(0);
  34407. }d.reverse();
  34408. }
  34409. len = xd.length;
  34410. i = yd.length;
  34411. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  34412. if (len - i < 0) {
  34413. i = len;
  34414. d = yd;
  34415. yd = xd;
  34416. xd = d;
  34417. }
  34418. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  34419. for (carry = 0; i;) {
  34420. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  34421. xd[i] %= BASE;
  34422. }
  34423. if (carry) {
  34424. xd.unshift(carry);
  34425. ++e;
  34426. }
  34427. // Remove trailing zeros.
  34428. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  34429. for (len = xd.length; xd[--len] == 0;) {
  34430. xd.pop();
  34431. }y.d = xd;
  34432. y.e = getBase10Exponent(xd, e);
  34433. return external ? finalise(y, pr, rm) : y;
  34434. };
  34435. /*
  34436. * Return the number of significant digits of the value of this Decimal.
  34437. *
  34438. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  34439. *
  34440. */
  34441. P.precision = P.sd = function (z) {
  34442. var k,
  34443. x = this;
  34444. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  34445. if (x.d) {
  34446. k = getPrecision(x.d);
  34447. if (z && x.e + 1 > k) k = x.e + 1;
  34448. } else {
  34449. k = NaN;
  34450. }
  34451. return k;
  34452. };
  34453. /*
  34454. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  34455. * rounding mode `rounding`.
  34456. *
  34457. */
  34458. P.round = function () {
  34459. var x = this,
  34460. Ctor = x.constructor;
  34461. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  34462. };
  34463. /*
  34464. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  34465. *
  34466. * Domain: [-Infinity, Infinity]
  34467. * Range: [-1, 1]
  34468. *
  34469. * sin(x) = x - x^3/3! + x^5/5! - ...
  34470. *
  34471. * sin(0) = 0
  34472. * sin(-0) = -0
  34473. * sin(Infinity) = NaN
  34474. * sin(-Infinity) = NaN
  34475. * sin(NaN) = NaN
  34476. *
  34477. */
  34478. P.sine = P.sin = function () {
  34479. var pr,
  34480. rm,
  34481. x = this,
  34482. Ctor = x.constructor;
  34483. if (!x.isFinite()) return new Ctor(NaN);
  34484. if (x.isZero()) return new Ctor(x);
  34485. pr = Ctor.precision;
  34486. rm = Ctor.rounding;
  34487. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  34488. Ctor.rounding = 1;
  34489. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  34490. Ctor.precision = pr;
  34491. Ctor.rounding = rm;
  34492. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  34493. };
  34494. /*
  34495. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  34496. * significant digits using rounding mode `rounding`.
  34497. *
  34498. * sqrt(-n) = N
  34499. * sqrt(N) = N
  34500. * sqrt(-I) = N
  34501. * sqrt(I) = I
  34502. * sqrt(0) = 0
  34503. * sqrt(-0) = -0
  34504. *
  34505. */
  34506. P.squareRoot = P.sqrt = function () {
  34507. var m,
  34508. n,
  34509. sd,
  34510. r,
  34511. rep,
  34512. t,
  34513. x = this,
  34514. d = x.d,
  34515. e = x.e,
  34516. s = x.s,
  34517. Ctor = x.constructor;
  34518. // Negative/NaN/Infinity/zero?
  34519. if (s !== 1 || !d || !d[0]) {
  34520. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  34521. }
  34522. external = false;
  34523. // Initial estimate.
  34524. s = Math.sqrt(+x);
  34525. // Math.sqrt underflow/overflow?
  34526. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  34527. if (s == 0 || s == 1 / 0) {
  34528. n = digitsToString(d);
  34529. if ((n.length + e) % 2 == 0) n += '0';
  34530. s = Math.sqrt(n);
  34531. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  34532. if (s == 1 / 0) {
  34533. n = '1e' + e;
  34534. } else {
  34535. n = s.toExponential();
  34536. n = n.slice(0, n.indexOf('e') + 1) + e;
  34537. }
  34538. r = new Ctor(n);
  34539. } else {
  34540. r = new Ctor(s.toString());
  34541. }
  34542. sd = (e = Ctor.precision) + 3;
  34543. // Newton-Raphson iteration.
  34544. for (;;) {
  34545. t = r;
  34546. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  34547. // TODO? Replace with for-loop and checkRoundingDigits.
  34548. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  34549. n = n.slice(sd - 3, sd + 1);
  34550. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  34551. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  34552. if (n == '9999' || !rep && n == '4999') {
  34553. // On the first iteration only, check to see if rounding up gives the exact result as the
  34554. // nines may infinitely repeat.
  34555. if (!rep) {
  34556. finalise(t, e + 1, 0);
  34557. if (t.times(t).eq(x)) {
  34558. r = t;
  34559. break;
  34560. }
  34561. }
  34562. sd += 4;
  34563. rep = 1;
  34564. } else {
  34565. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  34566. // If not, then there are further digits and m will be truthy.
  34567. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  34568. // Truncate to the first rounding digit.
  34569. finalise(r, e + 1, 1);
  34570. m = !r.times(r).eq(x);
  34571. }
  34572. break;
  34573. }
  34574. }
  34575. }
  34576. external = true;
  34577. return finalise(r, e, Ctor.rounding, m);
  34578. };
  34579. /*
  34580. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  34581. *
  34582. * Domain: [-Infinity, Infinity]
  34583. * Range: [-Infinity, Infinity]
  34584. *
  34585. * tan(0) = 0
  34586. * tan(-0) = -0
  34587. * tan(Infinity) = NaN
  34588. * tan(-Infinity) = NaN
  34589. * tan(NaN) = NaN
  34590. *
  34591. */
  34592. P.tangent = P.tan = function () {
  34593. var pr,
  34594. rm,
  34595. x = this,
  34596. Ctor = x.constructor;
  34597. if (!x.isFinite()) return new Ctor(NaN);
  34598. if (x.isZero()) return new Ctor(x);
  34599. pr = Ctor.precision;
  34600. rm = Ctor.rounding;
  34601. Ctor.precision = pr + 10;
  34602. Ctor.rounding = 1;
  34603. x = x.sin();
  34604. x.s = 1;
  34605. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34606. Ctor.precision = pr;
  34607. Ctor.rounding = rm;
  34608. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34609. };
  34610. /*
  34611. * n * 0 = 0
  34612. * n * N = N
  34613. * n * I = I
  34614. * 0 * n = 0
  34615. * 0 * 0 = 0
  34616. * 0 * N = N
  34617. * 0 * I = N
  34618. * N * n = N
  34619. * N * 0 = N
  34620. * N * N = N
  34621. * N * I = N
  34622. * I * n = I
  34623. * I * 0 = N
  34624. * I * N = N
  34625. * I * I = I
  34626. *
  34627. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34628. * digits using rounding mode `rounding`.
  34629. *
  34630. */
  34631. P.times = P.mul = function (y) {
  34632. var carry,
  34633. e,
  34634. i,
  34635. k,
  34636. r,
  34637. rL,
  34638. t,
  34639. xdL,
  34640. ydL,
  34641. x = this,
  34642. Ctor = x.constructor,
  34643. xd = x.d,
  34644. yd = (y = new Ctor(y)).d;
  34645. y.s *= x.s;
  34646. // If either is NaN, ±Infinity or ±0...
  34647. if (!xd || !xd[0] || !yd || !yd[0]) {
  34648. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34649. // Return NaN if either is NaN.
  34650. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34651. ? NaN
  34652. // Return ±Infinity if either is ±Infinity.
  34653. // Return ±0 if either is ±0.
  34654. : !xd || !yd ? y.s / 0 : y.s * 0);
  34655. }
  34656. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34657. xdL = xd.length;
  34658. ydL = yd.length;
  34659. // Ensure xd points to the longer array.
  34660. if (xdL < ydL) {
  34661. r = xd;
  34662. xd = yd;
  34663. yd = r;
  34664. rL = xdL;
  34665. xdL = ydL;
  34666. ydL = rL;
  34667. }
  34668. // Initialise the result array with zeros.
  34669. r = [];
  34670. rL = xdL + ydL;
  34671. for (i = rL; i--;) {
  34672. r.push(0);
  34673. } // Multiply!
  34674. for (i = ydL; --i >= 0;) {
  34675. carry = 0;
  34676. for (k = xdL + i; k > i;) {
  34677. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34678. r[k--] = t % BASE | 0;
  34679. carry = t / BASE | 0;
  34680. }
  34681. r[k] = (r[k] + carry) % BASE | 0;
  34682. }
  34683. // Remove trailing zeros.
  34684. for (; !r[--rL];) {
  34685. r.pop();
  34686. }if (carry) ++e;else r.shift();
  34687. y.d = r;
  34688. y.e = getBase10Exponent(r, e);
  34689. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34690. };
  34691. /*
  34692. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34693. * digits using rounding mode `rm`.
  34694. *
  34695. * If the optional `sd` argument is present then return binary exponential notation.
  34696. *
  34697. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34698. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34699. *
  34700. */
  34701. P.toBinary = function (sd, rm) {
  34702. return toStringBinary(this, 2, sd, rm);
  34703. };
  34704. /*
  34705. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34706. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34707. *
  34708. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34709. *
  34710. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34711. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34712. *
  34713. */
  34714. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34715. var x = this,
  34716. Ctor = x.constructor;
  34717. x = new Ctor(x);
  34718. if (dp === void 0) return x;
  34719. checkInt32(dp, 0, MAX_DIGITS);
  34720. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34721. return finalise(x, dp + x.e + 1, rm);
  34722. };
  34723. /*
  34724. * Return a string representing the value of this Decimal in exponential notation rounded to
  34725. * `dp` fixed decimal places using rounding mode `rounding`.
  34726. *
  34727. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34728. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34729. *
  34730. */
  34731. P.toExponential = function (dp, rm) {
  34732. var str,
  34733. x = this,
  34734. Ctor = x.constructor;
  34735. if (dp === void 0) {
  34736. str = finiteToString(x, true);
  34737. } else {
  34738. checkInt32(dp, 0, MAX_DIGITS);
  34739. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34740. x = finalise(new Ctor(x), dp + 1, rm);
  34741. str = finiteToString(x, true, dp + 1);
  34742. }
  34743. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34744. };
  34745. /*
  34746. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  34747. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  34748. * omitted.
  34749. *
  34750. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  34751. *
  34752. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34753. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34754. *
  34755. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  34756. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  34757. * (-0).toFixed(3) is '0.000'.
  34758. * (-0.5).toFixed(0) is '-0'.
  34759. *
  34760. */
  34761. P.toFixed = function (dp, rm) {
  34762. var str,
  34763. y,
  34764. x = this,
  34765. Ctor = x.constructor;
  34766. if (dp === void 0) {
  34767. str = finiteToString(x);
  34768. } else {
  34769. checkInt32(dp, 0, MAX_DIGITS);
  34770. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34771. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  34772. str = finiteToString(y, false, dp + y.e + 1);
  34773. }
  34774. // To determine whether to add the minus sign look at the value before it was rounded,
  34775. // i.e. look at `x` rather than `y`.
  34776. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34777. };
  34778. /*
  34779. * Return an array representing the value of this Decimal as a simple fraction with an integer
  34780. * numerator and an integer denominator.
  34781. *
  34782. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  34783. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  34784. * value necessary to represent the number exactly.
  34785. *
  34786. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  34787. *
  34788. */
  34789. P.toFraction = function (maxD) {
  34790. var d,
  34791. d0,
  34792. d1,
  34793. d2,
  34794. e,
  34795. k,
  34796. n,
  34797. n0,
  34798. n1,
  34799. pr,
  34800. q,
  34801. r,
  34802. x = this,
  34803. xd = x.d,
  34804. Ctor = x.constructor;
  34805. if (!xd) return new Ctor(x);
  34806. n1 = d0 = new Ctor(1);
  34807. d1 = n0 = new Ctor(0);
  34808. d = new Ctor(d1);
  34809. e = d.e = getPrecision(xd) - x.e - 1;
  34810. k = e % LOG_BASE;
  34811. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  34812. if (maxD == null) {
  34813. // d is 10**e, the minimum max-denominator needed.
  34814. maxD = e > 0 ? d : n1;
  34815. } else {
  34816. n = new Ctor(maxD);
  34817. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  34818. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  34819. }
  34820. external = false;
  34821. n = new Ctor(digitsToString(xd));
  34822. pr = Ctor.precision;
  34823. Ctor.precision = e = xd.length * LOG_BASE * 2;
  34824. for (;;) {
  34825. q = divide(n, d, 0, 1, 1);
  34826. d2 = d0.plus(q.times(d1));
  34827. if (d2.cmp(maxD) == 1) break;
  34828. d0 = d1;
  34829. d1 = d2;
  34830. d2 = n1;
  34831. n1 = n0.plus(q.times(d2));
  34832. n0 = d2;
  34833. d2 = d;
  34834. d = n.minus(q.times(d2));
  34835. n = d2;
  34836. }
  34837. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  34838. n0 = n0.plus(d2.times(n1));
  34839. d0 = d0.plus(d2.times(d1));
  34840. n0.s = n1.s = x.s;
  34841. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  34842. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  34843. Ctor.precision = pr;
  34844. external = true;
  34845. return r;
  34846. };
  34847. /*
  34848. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  34849. * digits using rounding mode `rm`.
  34850. *
  34851. * If the optional `sd` argument is present then return binary exponential notation.
  34852. *
  34853. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34854. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34855. *
  34856. */
  34857. P.toHexadecimal = P.toHex = function (sd, rm) {
  34858. return toStringBinary(this, 16, sd, rm);
  34859. };
  34860. /*
  34861. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  34862. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  34863. *
  34864. * The return value will always have the same sign as this Decimal, unless either this Decimal
  34865. * or `y` is NaN, in which case the return value will be also be NaN.
  34866. *
  34867. * The return value is not affected by the value of `precision`.
  34868. *
  34869. * y {number|string|Decimal} The magnitude to round to a multiple of.
  34870. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34871. *
  34872. * 'toNearest() rounding mode not an integer: {rm}'
  34873. * 'toNearest() rounding mode out of range: {rm}'
  34874. *
  34875. */
  34876. P.toNearest = function (y, rm) {
  34877. var x = this,
  34878. Ctor = x.constructor;
  34879. x = new Ctor(x);
  34880. if (y == null) {
  34881. // If x is not finite, return x.
  34882. if (!x.d) return x;
  34883. y = new Ctor(1);
  34884. rm = Ctor.rounding;
  34885. } else {
  34886. y = new Ctor(y);
  34887. if (rm === void 0) {
  34888. rm = Ctor.rounding;
  34889. } else {
  34890. checkInt32(rm, 0, 8);
  34891. }
  34892. // If x is not finite, return x if y is not NaN, else NaN.
  34893. if (!x.d) return y.s ? x : y;
  34894. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  34895. if (!y.d) {
  34896. if (y.s) y.s = x.s;
  34897. return y;
  34898. }
  34899. }
  34900. // If y is not zero, calculate the nearest multiple of y to x.
  34901. if (y.d[0]) {
  34902. external = false;
  34903. x = divide(x, y, 0, rm, 1).times(y);
  34904. external = true;
  34905. finalise(x);
  34906. // If y is zero, return zero with the sign of x.
  34907. } else {
  34908. y.s = x.s;
  34909. x = y;
  34910. }
  34911. return x;
  34912. };
  34913. /*
  34914. * Return the value of this Decimal converted to a number primitive.
  34915. * Zero keeps its sign.
  34916. *
  34917. */
  34918. P.toNumber = function () {
  34919. return +this;
  34920. };
  34921. /*
  34922. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  34923. * digits using rounding mode `rm`.
  34924. *
  34925. * If the optional `sd` argument is present then return binary exponential notation.
  34926. *
  34927. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34928. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34929. *
  34930. */
  34931. P.toOctal = function (sd, rm) {
  34932. return toStringBinary(this, 8, sd, rm);
  34933. };
  34934. /*
  34935. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  34936. * to `precision` significant digits using rounding mode `rounding`.
  34937. *
  34938. * ECMAScript compliant.
  34939. *
  34940. * pow(x, NaN) = NaN
  34941. * pow(x, ±0) = 1
  34942. * pow(NaN, non-zero) = NaN
  34943. * pow(abs(x) > 1, +Infinity) = +Infinity
  34944. * pow(abs(x) > 1, -Infinity) = +0
  34945. * pow(abs(x) == 1, ±Infinity) = NaN
  34946. * pow(abs(x) < 1, +Infinity) = +0
  34947. * pow(abs(x) < 1, -Infinity) = +Infinity
  34948. * pow(+Infinity, y > 0) = +Infinity
  34949. * pow(+Infinity, y < 0) = +0
  34950. * pow(-Infinity, odd integer > 0) = -Infinity
  34951. * pow(-Infinity, even integer > 0) = +Infinity
  34952. * pow(-Infinity, odd integer < 0) = -0
  34953. * pow(-Infinity, even integer < 0) = +0
  34954. * pow(+0, y > 0) = +0
  34955. * pow(+0, y < 0) = +Infinity
  34956. * pow(-0, odd integer > 0) = -0
  34957. * pow(-0, even integer > 0) = +0
  34958. * pow(-0, odd integer < 0) = -Infinity
  34959. * pow(-0, even integer < 0) = +Infinity
  34960. * pow(finite x < 0, finite non-integer) = NaN
  34961. *
  34962. * For non-integer or very large exponents pow(x, y) is calculated using
  34963. *
  34964. * x^y = exp(y*ln(x))
  34965. *
  34966. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  34967. * probability of an incorrectly rounded result
  34968. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  34969. * i.e. 1 in 250,000,000,000,000
  34970. *
  34971. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  34972. *
  34973. * y {number|string|Decimal} The power to which to raise this Decimal.
  34974. *
  34975. */
  34976. P.toPower = P.pow = function (y) {
  34977. var e,
  34978. k,
  34979. pr,
  34980. r,
  34981. rm,
  34982. s,
  34983. x = this,
  34984. Ctor = x.constructor,
  34985. yn = +(y = new Ctor(y));
  34986. // Either ±Infinity, NaN or ±0?
  34987. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  34988. x = new Ctor(x);
  34989. if (x.eq(1)) return x;
  34990. pr = Ctor.precision;
  34991. rm = Ctor.rounding;
  34992. if (y.eq(1)) return finalise(x, pr, rm);
  34993. // y exponent
  34994. e = mathfloor(y.e / LOG_BASE);
  34995. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  34996. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  34997. r = intPow(Ctor, x, k, pr);
  34998. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  34999. }
  35000. s = x.s;
  35001. // if x is negative
  35002. if (s < 0) {
  35003. // if y is not an integer
  35004. if (e < y.d.length - 1) return new Ctor(NaN);
  35005. // Result is positive if x is negative and the last digit of integer y is even.
  35006. if ((y.d[e] & 1) == 0) s = 1;
  35007. // if x.eq(-1)
  35008. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  35009. x.s = s;
  35010. return x;
  35011. }
  35012. }
  35013. // Estimate result exponent.
  35014. // x^y = 10^e, where e = y * log10(x)
  35015. // log10(x) = log10(x_significand) + x_exponent
  35016. // log10(x_significand) = ln(x_significand) / ln(10)
  35017. k = mathpow(+x, yn);
  35018. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  35019. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  35020. // Overflow/underflow?
  35021. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  35022. external = false;
  35023. Ctor.rounding = x.s = 1;
  35024. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  35025. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  35026. // new Decimal(2.32456).pow('2087987436534566.46411')
  35027. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  35028. k = Math.min(12, (e + '').length);
  35029. // r = x^y = exp(y*ln(x))
  35030. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  35031. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  35032. if (r.d) {
  35033. // Truncate to the required precision plus five rounding digits.
  35034. r = finalise(r, pr + 5, 1);
  35035. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  35036. // the result.
  35037. if (checkRoundingDigits(r.d, pr, rm)) {
  35038. e = pr + 10;
  35039. // Truncate to the increased precision plus five rounding digits.
  35040. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  35041. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  35042. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  35043. r = finalise(r, pr + 1, 0);
  35044. }
  35045. }
  35046. }
  35047. r.s = s;
  35048. external = true;
  35049. Ctor.rounding = rm;
  35050. return finalise(r, pr, rm);
  35051. };
  35052. /*
  35053. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  35054. * using rounding mode `rounding`.
  35055. *
  35056. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  35057. * the integer part of the value in normal notation.
  35058. *
  35059. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35060. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35061. *
  35062. */
  35063. P.toPrecision = function (sd, rm) {
  35064. var str,
  35065. x = this,
  35066. Ctor = x.constructor;
  35067. if (sd === void 0) {
  35068. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35069. } else {
  35070. checkInt32(sd, 1, MAX_DIGITS);
  35071. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35072. x = finalise(new Ctor(x), sd, rm);
  35073. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  35074. }
  35075. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35076. };
  35077. /*
  35078. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  35079. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  35080. * omitted.
  35081. *
  35082. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35083. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35084. *
  35085. * 'toSD() digits out of range: {sd}'
  35086. * 'toSD() digits not an integer: {sd}'
  35087. * 'toSD() rounding mode not an integer: {rm}'
  35088. * 'toSD() rounding mode out of range: {rm}'
  35089. *
  35090. */
  35091. P.toSignificantDigits = P.toSD = function (sd, rm) {
  35092. var x = this,
  35093. Ctor = x.constructor;
  35094. if (sd === void 0) {
  35095. sd = Ctor.precision;
  35096. rm = Ctor.rounding;
  35097. } else {
  35098. checkInt32(sd, 1, MAX_DIGITS);
  35099. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35100. }
  35101. return finalise(new Ctor(x), sd, rm);
  35102. };
  35103. /*
  35104. * Return a string representing the value of this Decimal.
  35105. *
  35106. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  35107. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  35108. *
  35109. */
  35110. P.toString = function () {
  35111. var x = this,
  35112. Ctor = x.constructor,
  35113. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35114. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35115. };
  35116. /*
  35117. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  35118. *
  35119. */
  35120. P.truncated = P.trunc = function () {
  35121. return finalise(new this.constructor(this), this.e + 1, 1);
  35122. };
  35123. /*
  35124. * Return a string representing the value of this Decimal.
  35125. * Unlike `toString`, negative zero will include the minus sign.
  35126. *
  35127. */
  35128. P.valueOf = P.toJSON = function () {
  35129. var x = this,
  35130. Ctor = x.constructor,
  35131. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35132. return x.isNeg() ? '-' + str : str;
  35133. };
  35134. /*
  35135. // Add aliases to match BigDecimal method names.
  35136. // P.add = P.plus;
  35137. P.subtract = P.minus;
  35138. P.multiply = P.times;
  35139. P.divide = P.div;
  35140. P.remainder = P.mod;
  35141. P.compareTo = P.cmp;
  35142. P.negate = P.neg;
  35143. */
  35144. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  35145. /*
  35146. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  35147. * finiteToString, naturalExponential, naturalLogarithm
  35148. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  35149. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  35150. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  35151. * convertBase toStringBinary, parseOther
  35152. * cos P.cos
  35153. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  35154. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  35155. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  35156. * taylorSeries, atan2, parseOther
  35157. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  35158. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  35159. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  35160. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  35161. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  35162. * P.truncated, divide, getLn10, getPi, naturalExponential,
  35163. * naturalLogarithm, ceil, floor, round, trunc
  35164. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  35165. * toStringBinary
  35166. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  35167. * getLn10 P.logarithm, naturalLogarithm
  35168. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  35169. * getPrecision P.precision, P.toFraction
  35170. * getZeroString digitsToString, finiteToString
  35171. * intPow P.toPower, parseOther
  35172. * isOdd toLessThanHalfPi
  35173. * maxOrMin max, min
  35174. * naturalExponential P.naturalExponential, P.toPower
  35175. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  35176. * P.toPower, naturalExponential
  35177. * nonFiniteToString finiteToString, toStringBinary
  35178. * parseDecimal Decimal
  35179. * parseOther Decimal
  35180. * sin P.sin
  35181. * taylorSeries P.cosh, P.sinh, cos, sin
  35182. * toLessThanHalfPi P.cos, P.sin
  35183. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  35184. * truncate intPow
  35185. *
  35186. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  35187. * naturalLogarithm, config, parseOther, random, Decimal
  35188. */
  35189. function digitsToString(d) {
  35190. var i,
  35191. k,
  35192. ws,
  35193. indexOfLastWord = d.length - 1,
  35194. str = '',
  35195. w = d[0];
  35196. if (indexOfLastWord > 0) {
  35197. str += w;
  35198. for (i = 1; i < indexOfLastWord; i++) {
  35199. ws = d[i] + '';
  35200. k = LOG_BASE - ws.length;
  35201. if (k) str += getZeroString(k);
  35202. str += ws;
  35203. }
  35204. w = d[i];
  35205. ws = w + '';
  35206. k = LOG_BASE - ws.length;
  35207. if (k) str += getZeroString(k);
  35208. } else if (w === 0) {
  35209. return '0';
  35210. }
  35211. // Remove trailing zeros of last w.
  35212. for (; w % 10 === 0;) {
  35213. w /= 10;
  35214. }return str + w;
  35215. }
  35216. function checkInt32(i, min, max) {
  35217. if (i !== ~~i || i < min || i > max) {
  35218. throw Error(invalidArgument + i);
  35219. }
  35220. }
  35221. /*
  35222. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  35223. * `repeating == null` if caller is `log` or `pow`,
  35224. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  35225. */
  35226. function checkRoundingDigits(d, i, rm, repeating) {
  35227. var di, k, r, rd;
  35228. // Get the length of the first word of the array d.
  35229. for (k = d[0]; k >= 10; k /= 10) {
  35230. --i;
  35231. } // Is the rounding digit in the first word of d?
  35232. if (--i < 0) {
  35233. i += LOG_BASE;
  35234. di = 0;
  35235. } else {
  35236. di = Math.ceil((i + 1) / LOG_BASE);
  35237. i %= LOG_BASE;
  35238. }
  35239. // i is the index (0 - 6) of the rounding digit.
  35240. // E.g. if within the word 3487563 the first rounding digit is 5,
  35241. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  35242. k = mathpow(10, LOG_BASE - i);
  35243. rd = d[di] % k | 0;
  35244. if (repeating == null) {
  35245. if (i < 3) {
  35246. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  35247. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  35248. } else {
  35249. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  35250. }
  35251. } else {
  35252. if (i < 4) {
  35253. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  35254. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  35255. } else {
  35256. r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  35257. }
  35258. }
  35259. return r;
  35260. }
  35261. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  35262. // Eg. convertBase('255', 10, 16) returns [15, 15].
  35263. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  35264. function convertBase(str, baseIn, baseOut) {
  35265. var j,
  35266. arr = [0],
  35267. arrL,
  35268. i = 0,
  35269. strL = str.length;
  35270. for (; i < strL;) {
  35271. for (arrL = arr.length; arrL--;) {
  35272. arr[arrL] *= baseIn;
  35273. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  35274. for (j = 0; j < arr.length; j++) {
  35275. if (arr[j] > baseOut - 1) {
  35276. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  35277. arr[j + 1] += arr[j] / baseOut | 0;
  35278. arr[j] %= baseOut;
  35279. }
  35280. }
  35281. }
  35282. return arr.reverse();
  35283. }
  35284. /*
  35285. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  35286. * |x| < pi/2
  35287. *
  35288. */
  35289. function cosine(Ctor, x) {
  35290. var k,
  35291. y,
  35292. len = x.d.length;
  35293. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  35294. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  35295. // Estimate the optimum number of times to use the argument reduction.
  35296. if (len < 32) {
  35297. k = Math.ceil(len / 3);
  35298. y = Math.pow(4, -k).toString();
  35299. } else {
  35300. k = 16;
  35301. y = '2.3283064365386962890625e-10';
  35302. }
  35303. Ctor.precision += k;
  35304. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  35305. // Reverse argument reduction
  35306. for (var i = k; i--;) {
  35307. var cos2x = x.times(x);
  35308. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  35309. }
  35310. Ctor.precision -= k;
  35311. return x;
  35312. }
  35313. /*
  35314. * Perform division in the specified base.
  35315. */
  35316. var divide = function () {
  35317. // Assumes non-zero x and k, and hence non-zero result.
  35318. function multiplyInteger(x, k, base) {
  35319. var temp,
  35320. carry = 0,
  35321. i = x.length;
  35322. for (x = x.slice(); i--;) {
  35323. temp = x[i] * k + carry;
  35324. x[i] = temp % base | 0;
  35325. carry = temp / base | 0;
  35326. }
  35327. if (carry) x.unshift(carry);
  35328. return x;
  35329. }
  35330. function compare(a, b, aL, bL) {
  35331. var i, r;
  35332. if (aL != bL) {
  35333. r = aL > bL ? 1 : -1;
  35334. } else {
  35335. for (i = r = 0; i < aL; i++) {
  35336. if (a[i] != b[i]) {
  35337. r = a[i] > b[i] ? 1 : -1;
  35338. break;
  35339. }
  35340. }
  35341. }
  35342. return r;
  35343. }
  35344. function subtract(a, b, aL, base) {
  35345. var i = 0;
  35346. // Subtract b from a.
  35347. for (; aL--;) {
  35348. a[aL] -= i;
  35349. i = a[aL] < b[aL] ? 1 : 0;
  35350. a[aL] = i * base + a[aL] - b[aL];
  35351. }
  35352. // Remove leading zeros.
  35353. for (; !a[0] && a.length > 1;) {
  35354. a.shift();
  35355. }
  35356. }
  35357. return function (x, y, pr, rm, dp, base) {
  35358. var cmp,
  35359. e,
  35360. i,
  35361. k,
  35362. logBase,
  35363. more,
  35364. prod,
  35365. prodL,
  35366. q,
  35367. qd,
  35368. rem,
  35369. remL,
  35370. rem0,
  35371. sd,
  35372. t,
  35373. xi,
  35374. xL,
  35375. yd0,
  35376. yL,
  35377. yz,
  35378. Ctor = x.constructor,
  35379. sign = x.s == y.s ? 1 : -1,
  35380. xd = x.d,
  35381. yd = y.d;
  35382. // Either NaN, Infinity or 0?
  35383. if (!xd || !xd[0] || !yd || !yd[0]) {
  35384. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  35385. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  35386. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  35387. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  35388. }
  35389. if (base) {
  35390. logBase = 1;
  35391. e = x.e - y.e;
  35392. } else {
  35393. base = BASE;
  35394. logBase = LOG_BASE;
  35395. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  35396. }
  35397. yL = yd.length;
  35398. xL = xd.length;
  35399. q = new Ctor(sign);
  35400. qd = q.d = [];
  35401. // Result exponent may be one less than e.
  35402. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  35403. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  35404. if (yd[i] > (xd[i] || 0)) e--;
  35405. if (pr == null) {
  35406. sd = pr = Ctor.precision;
  35407. rm = Ctor.rounding;
  35408. } else if (dp) {
  35409. sd = pr + (x.e - y.e) + 1;
  35410. } else {
  35411. sd = pr;
  35412. }
  35413. if (sd < 0) {
  35414. qd.push(1);
  35415. more = true;
  35416. } else {
  35417. // Convert precision in number of base 10 digits to base 1e7 digits.
  35418. sd = sd / logBase + 2 | 0;
  35419. i = 0;
  35420. // divisor < 1e7
  35421. if (yL == 1) {
  35422. k = 0;
  35423. yd = yd[0];
  35424. sd++;
  35425. // k is the carry.
  35426. for (; (i < xL || k) && sd--; i++) {
  35427. t = k * base + (xd[i] || 0);
  35428. qd[i] = t / yd | 0;
  35429. k = t % yd | 0;
  35430. }
  35431. more = k || i < xL;
  35432. // divisor >= 1e7
  35433. } else {
  35434. // Normalise xd and yd so highest order digit of yd is >= base/2
  35435. k = base / (yd[0] + 1) | 0;
  35436. if (k > 1) {
  35437. yd = multiplyInteger(yd, k, base);
  35438. xd = multiplyInteger(xd, k, base);
  35439. yL = yd.length;
  35440. xL = xd.length;
  35441. }
  35442. xi = yL;
  35443. rem = xd.slice(0, yL);
  35444. remL = rem.length;
  35445. // Add zeros to make remainder as long as divisor.
  35446. for (; remL < yL;) {
  35447. rem[remL++] = 0;
  35448. }yz = yd.slice();
  35449. yz.unshift(0);
  35450. yd0 = yd[0];
  35451. if (yd[1] >= base / 2) ++yd0;
  35452. do {
  35453. k = 0;
  35454. // Compare divisor and remainder.
  35455. cmp = compare(yd, rem, yL, remL);
  35456. // If divisor < remainder.
  35457. if (cmp < 0) {
  35458. // Calculate trial digit, k.
  35459. rem0 = rem[0];
  35460. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  35461. // k will be how many times the divisor goes into the current remainder.
  35462. k = rem0 / yd0 | 0;
  35463. // Algorithm:
  35464. // 1. product = divisor * trial digit (k)
  35465. // 2. if product > remainder: product -= divisor, k--
  35466. // 3. remainder -= product
  35467. // 4. if product was < remainder at 2:
  35468. // 5. compare new remainder and divisor
  35469. // 6. If remainder > divisor: remainder -= divisor, k++
  35470. if (k > 1) {
  35471. if (k >= base) k = base - 1;
  35472. // product = divisor * trial digit.
  35473. prod = multiplyInteger(yd, k, base);
  35474. prodL = prod.length;
  35475. remL = rem.length;
  35476. // Compare product and remainder.
  35477. cmp = compare(prod, rem, prodL, remL);
  35478. // product > remainder.
  35479. if (cmp == 1) {
  35480. k--;
  35481. // Subtract divisor from product.
  35482. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  35483. }
  35484. } else {
  35485. // cmp is -1.
  35486. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  35487. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  35488. if (k == 0) cmp = k = 1;
  35489. prod = yd.slice();
  35490. }
  35491. prodL = prod.length;
  35492. if (prodL < remL) prod.unshift(0);
  35493. // Subtract product from remainder.
  35494. subtract(rem, prod, remL, base);
  35495. // If product was < previous remainder.
  35496. if (cmp == -1) {
  35497. remL = rem.length;
  35498. // Compare divisor and new remainder.
  35499. cmp = compare(yd, rem, yL, remL);
  35500. // If divisor < new remainder, subtract divisor from remainder.
  35501. if (cmp < 1) {
  35502. k++;
  35503. // Subtract divisor from remainder.
  35504. subtract(rem, yL < remL ? yz : yd, remL, base);
  35505. }
  35506. }
  35507. remL = rem.length;
  35508. } else if (cmp === 0) {
  35509. k++;
  35510. rem = [0];
  35511. } // if cmp === 1, k will be 0
  35512. // Add the next digit, k, to the result array.
  35513. qd[i++] = k;
  35514. // Update the remainder.
  35515. if (cmp && rem[0]) {
  35516. rem[remL++] = xd[xi] || 0;
  35517. } else {
  35518. rem = [xd[xi]];
  35519. remL = 1;
  35520. }
  35521. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  35522. more = rem[0] !== void 0;
  35523. }
  35524. // Leading zero?
  35525. if (!qd[0]) qd.shift();
  35526. }
  35527. // logBase is 1 when divide is being used for base conversion.
  35528. if (logBase == 1) {
  35529. q.e = e;
  35530. inexact = more;
  35531. } else {
  35532. // To calculate q.e, first get the number of digits of qd[0].
  35533. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  35534. i++;
  35535. }q.e = i + e * logBase - 1;
  35536. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  35537. }
  35538. return q;
  35539. };
  35540. }();
  35541. /*
  35542. * Round `x` to `sd` significant digits using rounding mode `rm`.
  35543. * Check for over/under-flow.
  35544. */
  35545. function finalise(x, sd, rm, isTruncated) {
  35546. var digits,
  35547. i,
  35548. j,
  35549. k,
  35550. rd,
  35551. roundUp,
  35552. w,
  35553. xd,
  35554. xdi,
  35555. Ctor = x.constructor;
  35556. // Don't round if sd is null or undefined.
  35557. out: if (sd != null) {
  35558. xd = x.d;
  35559. // Infinity/NaN.
  35560. if (!xd) return x;
  35561. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  35562. // w: the word of xd containing rd, a base 1e7 number.
  35563. // xdi: the index of w within xd.
  35564. // digits: the number of digits of w.
  35565. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  35566. // they had leading zeros)
  35567. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  35568. // Get the length of the first word of the digits array xd.
  35569. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  35570. digits++;
  35571. }i = sd - digits;
  35572. // Is the rounding digit in the first word of xd?
  35573. if (i < 0) {
  35574. i += LOG_BASE;
  35575. j = sd;
  35576. w = xd[xdi = 0];
  35577. // Get the rounding digit at index j of w.
  35578. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  35579. } else {
  35580. xdi = Math.ceil((i + 1) / LOG_BASE);
  35581. k = xd.length;
  35582. if (xdi >= k) {
  35583. if (isTruncated) {
  35584. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  35585. for (; k++ <= xdi;) {
  35586. xd.push(0);
  35587. }w = rd = 0;
  35588. digits = 1;
  35589. i %= LOG_BASE;
  35590. j = i - LOG_BASE + 1;
  35591. } else {
  35592. break out;
  35593. }
  35594. } else {
  35595. w = k = xd[xdi];
  35596. // Get the number of digits of w.
  35597. for (digits = 1; k >= 10; k /= 10) {
  35598. digits++;
  35599. } // Get the index of rd within w.
  35600. i %= LOG_BASE;
  35601. // Get the index of rd within w, adjusted for leading zeros.
  35602. // The number of leading zeros of w is given by LOG_BASE - digits.
  35603. j = i - LOG_BASE + digits;
  35604. // Get the rounding digit at index j of w.
  35605. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35606. }
  35607. }
  35608. // Are there any non-zero digits after the rounding digit?
  35609. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35610. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35611. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35612. // will give 714.
  35613. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35614. // Check whether the digit to the left of the rounding digit is odd.
  35615. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35616. if (sd < 1 || !xd[0]) {
  35617. xd.length = 0;
  35618. if (roundUp) {
  35619. // Convert sd to decimal places.
  35620. sd -= x.e + 1;
  35621. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35622. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35623. x.e = -sd || 0;
  35624. } else {
  35625. // Zero.
  35626. xd[0] = x.e = 0;
  35627. }
  35628. return x;
  35629. }
  35630. // Remove excess digits.
  35631. if (i == 0) {
  35632. xd.length = xdi;
  35633. k = 1;
  35634. xdi--;
  35635. } else {
  35636. xd.length = xdi + 1;
  35637. k = mathpow(10, LOG_BASE - i);
  35638. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35639. // j > 0 means i > number of leading zeros of w.
  35640. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35641. }
  35642. if (roundUp) {
  35643. for (;;) {
  35644. // Is the digit to be rounded up in the first word of xd?
  35645. if (xdi == 0) {
  35646. // i will be the length of xd[0] before k is added.
  35647. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35648. i++;
  35649. }j = xd[0] += k;
  35650. for (k = 1; j >= 10; j /= 10) {
  35651. k++;
  35652. } // if i != k the length has increased.
  35653. if (i != k) {
  35654. x.e++;
  35655. if (xd[0] == BASE) xd[0] = 1;
  35656. }
  35657. break;
  35658. } else {
  35659. xd[xdi] += k;
  35660. if (xd[xdi] != BASE) break;
  35661. xd[xdi--] = 0;
  35662. k = 1;
  35663. }
  35664. }
  35665. }
  35666. // Remove trailing zeros.
  35667. for (i = xd.length; xd[--i] === 0;) {
  35668. xd.pop();
  35669. }
  35670. }
  35671. if (external) {
  35672. // Overflow?
  35673. if (x.e > Ctor.maxE) {
  35674. // Infinity.
  35675. x.d = null;
  35676. x.e = NaN;
  35677. // Underflow?
  35678. } else if (x.e < Ctor.minE) {
  35679. // Zero.
  35680. x.e = 0;
  35681. x.d = [0];
  35682. // Ctor.underflow = true;
  35683. } // else Ctor.underflow = false;
  35684. }
  35685. return x;
  35686. }
  35687. function finiteToString(x, isExp, sd) {
  35688. if (!x.isFinite()) return nonFiniteToString(x);
  35689. var k,
  35690. e = x.e,
  35691. str = digitsToString(x.d),
  35692. len = str.length;
  35693. if (isExp) {
  35694. if (sd && (k = sd - len) > 0) {
  35695. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35696. } else if (len > 1) {
  35697. str = str.charAt(0) + '.' + str.slice(1);
  35698. }
  35699. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35700. } else if (e < 0) {
  35701. str = '0.' + getZeroString(-e - 1) + str;
  35702. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35703. } else if (e >= len) {
  35704. str += getZeroString(e + 1 - len);
  35705. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35706. } else {
  35707. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35708. if (sd && (k = sd - len) > 0) {
  35709. if (e + 1 === len) str += '.';
  35710. str += getZeroString(k);
  35711. }
  35712. }
  35713. return str;
  35714. }
  35715. // Calculate the base 10 exponent from the base 1e7 exponent.
  35716. function getBase10Exponent(digits, e) {
  35717. var w = digits[0];
  35718. // Add the number of digits of the first word of the digits array.
  35719. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35720. e++;
  35721. }return e;
  35722. }
  35723. function getLn10(Ctor, sd, pr) {
  35724. if (sd > LN10_PRECISION) {
  35725. // Reset global state in case the exception is caught.
  35726. external = true;
  35727. if (pr) Ctor.precision = pr;
  35728. throw Error(precisionLimitExceeded);
  35729. }
  35730. return finalise(new Ctor(LN10), sd, 1, true);
  35731. }
  35732. function getPi(Ctor, sd, rm) {
  35733. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  35734. return finalise(new Ctor(PI), sd, rm, true);
  35735. }
  35736. function getPrecision(digits) {
  35737. var w = digits.length - 1,
  35738. len = w * LOG_BASE + 1;
  35739. w = digits[w];
  35740. // If non-zero...
  35741. if (w) {
  35742. // Subtract the number of trailing zeros of the last word.
  35743. for (; w % 10 == 0; w /= 10) {
  35744. len--;
  35745. } // Add the number of digits of the first word.
  35746. for (w = digits[0]; w >= 10; w /= 10) {
  35747. len++;
  35748. }
  35749. }
  35750. return len;
  35751. }
  35752. function getZeroString(k) {
  35753. var zs = '';
  35754. for (; k--;) {
  35755. zs += '0';
  35756. }return zs;
  35757. }
  35758. /*
  35759. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  35760. * integer of type number.
  35761. *
  35762. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  35763. *
  35764. */
  35765. function intPow(Ctor, x, n, pr) {
  35766. var isTruncated,
  35767. r = new Ctor(1),
  35768. // Max n of 9007199254740991 takes 53 loop iterations.
  35769. // Maximum digits array length; leaves [28, 34] guard digits.
  35770. k = Math.ceil(pr / LOG_BASE + 4);
  35771. external = false;
  35772. for (;;) {
  35773. if (n % 2) {
  35774. r = r.times(x);
  35775. if (truncate(r.d, k)) isTruncated = true;
  35776. }
  35777. n = mathfloor(n / 2);
  35778. if (n === 0) {
  35779. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  35780. n = r.d.length - 1;
  35781. if (isTruncated && r.d[n] === 0) ++r.d[n];
  35782. break;
  35783. }
  35784. x = x.times(x);
  35785. truncate(x.d, k);
  35786. }
  35787. external = true;
  35788. return r;
  35789. }
  35790. function isOdd(n) {
  35791. return n.d[n.d.length - 1] & 1;
  35792. }
  35793. /*
  35794. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  35795. */
  35796. function maxOrMin(Ctor, args, ltgt) {
  35797. var y,
  35798. x = new Ctor(args[0]),
  35799. i = 0;
  35800. for (; ++i < args.length;) {
  35801. y = new Ctor(args[i]);
  35802. if (!y.s) {
  35803. x = y;
  35804. break;
  35805. } else if (x[ltgt](y)) {
  35806. x = y;
  35807. }
  35808. }
  35809. return x;
  35810. }
  35811. /*
  35812. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  35813. * digits.
  35814. *
  35815. * Taylor/Maclaurin series.
  35816. *
  35817. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  35818. *
  35819. * Argument reduction:
  35820. * Repeat x = x / 32, k += 5, until |x| < 0.1
  35821. * exp(x) = exp(x / 2^k)^(2^k)
  35822. *
  35823. * Previously, the argument was initially reduced by
  35824. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  35825. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  35826. * found to be slower than just dividing repeatedly by 32 as above.
  35827. *
  35828. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  35829. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  35830. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  35831. *
  35832. * exp(Infinity) = Infinity
  35833. * exp(-Infinity) = 0
  35834. * exp(NaN) = NaN
  35835. * exp(±0) = 1
  35836. *
  35837. * exp(x) is non-terminating for any finite, non-zero x.
  35838. *
  35839. * The result will always be correctly rounded.
  35840. *
  35841. */
  35842. function naturalExponential(x, sd) {
  35843. var denominator,
  35844. guard,
  35845. j,
  35846. pow,
  35847. sum,
  35848. t,
  35849. wpr,
  35850. rep = 0,
  35851. i = 0,
  35852. k = 0,
  35853. Ctor = x.constructor,
  35854. rm = Ctor.rounding,
  35855. pr = Ctor.precision;
  35856. // 0/NaN/Infinity?
  35857. if (!x.d || !x.d[0] || x.e > 17) {
  35858. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  35859. }
  35860. if (sd == null) {
  35861. external = false;
  35862. wpr = pr;
  35863. } else {
  35864. wpr = sd;
  35865. }
  35866. t = new Ctor(0.03125);
  35867. // while abs(x) >= 0.1
  35868. while (x.e > -2) {
  35869. // x = x / 2^5
  35870. x = x.times(t);
  35871. k += 5;
  35872. }
  35873. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  35874. // necessary to ensure the first 4 rounding digits are correct.
  35875. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  35876. wpr += guard;
  35877. denominator = pow = sum = new Ctor(1);
  35878. Ctor.precision = wpr;
  35879. for (;;) {
  35880. pow = finalise(pow.times(x), wpr, 1);
  35881. denominator = denominator.times(++i);
  35882. t = sum.plus(divide(pow, denominator, wpr, 1));
  35883. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35884. j = k;
  35885. while (j--) {
  35886. sum = finalise(sum.times(sum), wpr, 1);
  35887. } // Check to see if the first 4 rounding digits are [49]999.
  35888. // If so, repeat the summation with a higher precision, otherwise
  35889. // e.g. with precision: 18, rounding: 1
  35890. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  35891. // `wpr - guard` is the index of first rounding digit.
  35892. if (sd == null) {
  35893. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35894. Ctor.precision = wpr += 10;
  35895. denominator = pow = t = new Ctor(1);
  35896. i = 0;
  35897. rep++;
  35898. } else {
  35899. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35900. }
  35901. } else {
  35902. Ctor.precision = pr;
  35903. return sum;
  35904. }
  35905. }
  35906. sum = t;
  35907. }
  35908. }
  35909. /*
  35910. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  35911. * digits.
  35912. *
  35913. * ln(-n) = NaN
  35914. * ln(0) = -Infinity
  35915. * ln(-0) = -Infinity
  35916. * ln(1) = 0
  35917. * ln(Infinity) = Infinity
  35918. * ln(-Infinity) = NaN
  35919. * ln(NaN) = NaN
  35920. *
  35921. * ln(n) (n != 1) is non-terminating.
  35922. *
  35923. */
  35924. function naturalLogarithm(y, sd) {
  35925. var c,
  35926. c0,
  35927. denominator,
  35928. e,
  35929. numerator,
  35930. rep,
  35931. sum,
  35932. t,
  35933. wpr,
  35934. x1,
  35935. x2,
  35936. n = 1,
  35937. guard = 10,
  35938. x = y,
  35939. xd = x.d,
  35940. Ctor = x.constructor,
  35941. rm = Ctor.rounding,
  35942. pr = Ctor.precision;
  35943. // Is x negative or Infinity, NaN, 0 or 1?
  35944. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  35945. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  35946. }
  35947. if (sd == null) {
  35948. external = false;
  35949. wpr = pr;
  35950. } else {
  35951. wpr = sd;
  35952. }
  35953. Ctor.precision = wpr += guard;
  35954. c = digitsToString(xd);
  35955. c0 = c.charAt(0);
  35956. if (Math.abs(e = x.e) < 1.5e15) {
  35957. // Argument reduction.
  35958. // The series converges faster the closer the argument is to 1, so using
  35959. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  35960. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  35961. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  35962. // later be divided by this number, then separate out the power of 10 using
  35963. // ln(a*10^b) = ln(a) + b*ln(10).
  35964. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  35965. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  35966. // max n is 6 (gives 0.7 - 1.3)
  35967. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  35968. x = x.times(y);
  35969. c = digitsToString(x.d);
  35970. c0 = c.charAt(0);
  35971. n++;
  35972. }
  35973. e = x.e;
  35974. if (c0 > 1) {
  35975. x = new Ctor('0.' + c);
  35976. e++;
  35977. } else {
  35978. x = new Ctor(c0 + '.' + c.slice(1));
  35979. }
  35980. } else {
  35981. // The argument reduction method above may result in overflow if the argument y is a massive
  35982. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  35983. // function using ln(x*10^e) = ln(x) + e*ln(10).
  35984. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  35985. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  35986. Ctor.precision = pr;
  35987. return sd == null ? finalise(x, pr, rm, external = true) : x;
  35988. }
  35989. // x1 is x reduced to a value near 1.
  35990. x1 = x;
  35991. // Taylor series.
  35992. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  35993. // where x = (y - 1)/(y + 1) (|x| < 1)
  35994. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  35995. x2 = finalise(x.times(x), wpr, 1);
  35996. denominator = 3;
  35997. for (;;) {
  35998. numerator = finalise(numerator.times(x2), wpr, 1);
  35999. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  36000. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  36001. sum = sum.times(2);
  36002. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  36003. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  36004. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  36005. sum = divide(sum, new Ctor(n), wpr, 1);
  36006. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  36007. // been repeated previously) and the first 4 rounding digits 9999?
  36008. // If so, restart the summation with a higher precision, otherwise
  36009. // e.g. with precision: 12, rounding: 1
  36010. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  36011. // `wpr - guard` is the index of first rounding digit.
  36012. if (sd == null) {
  36013. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  36014. Ctor.precision = wpr += guard;
  36015. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  36016. x2 = finalise(x.times(x), wpr, 1);
  36017. denominator = rep = 1;
  36018. } else {
  36019. return finalise(sum, Ctor.precision = pr, rm, external = true);
  36020. }
  36021. } else {
  36022. Ctor.precision = pr;
  36023. return sum;
  36024. }
  36025. }
  36026. sum = t;
  36027. denominator += 2;
  36028. }
  36029. }
  36030. // ±Infinity, NaN.
  36031. function nonFiniteToString(x) {
  36032. // Unsigned.
  36033. return String(x.s * x.s / 0);
  36034. }
  36035. /*
  36036. * Parse the value of a new Decimal `x` from string `str`.
  36037. */
  36038. function parseDecimal(x, str) {
  36039. var e, i, len;
  36040. // Decimal point?
  36041. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  36042. // Exponential form?
  36043. if ((i = str.search(/e/i)) > 0) {
  36044. // Determine exponent.
  36045. if (e < 0) e = i;
  36046. e += +str.slice(i + 1);
  36047. str = str.substring(0, i);
  36048. } else if (e < 0) {
  36049. // Integer.
  36050. e = str.length;
  36051. }
  36052. // Determine leading zeros.
  36053. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  36054. // Determine trailing zeros.
  36055. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  36056. str = str.slice(i, len);
  36057. if (str) {
  36058. len -= i;
  36059. x.e = e = e - i - 1;
  36060. x.d = [];
  36061. // Transform base
  36062. // e is the base 10 exponent.
  36063. // i is where to slice str to get the first word of the digits array.
  36064. i = (e + 1) % LOG_BASE;
  36065. if (e < 0) i += LOG_BASE;
  36066. if (i < len) {
  36067. if (i) x.d.push(+str.slice(0, i));
  36068. for (len -= LOG_BASE; i < len;) {
  36069. x.d.push(+str.slice(i, i += LOG_BASE));
  36070. }str = str.slice(i);
  36071. i = LOG_BASE - str.length;
  36072. } else {
  36073. i -= len;
  36074. }
  36075. for (; i--;) {
  36076. str += '0';
  36077. }x.d.push(+str);
  36078. if (external) {
  36079. // Overflow?
  36080. if (x.e > x.constructor.maxE) {
  36081. // Infinity.
  36082. x.d = null;
  36083. x.e = NaN;
  36084. // Underflow?
  36085. } else if (x.e < x.constructor.minE) {
  36086. // Zero.
  36087. x.e = 0;
  36088. x.d = [0];
  36089. // x.constructor.underflow = true;
  36090. } // else x.constructor.underflow = false;
  36091. }
  36092. } else {
  36093. // Zero.
  36094. x.e = 0;
  36095. x.d = [0];
  36096. }
  36097. return x;
  36098. }
  36099. /*
  36100. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  36101. */
  36102. function parseOther(x, str) {
  36103. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  36104. if (str === 'Infinity' || str === 'NaN') {
  36105. if (!+str) x.s = NaN;
  36106. x.e = NaN;
  36107. x.d = null;
  36108. return x;
  36109. }
  36110. if (isHex.test(str)) {
  36111. base = 16;
  36112. str = str.toLowerCase();
  36113. } else if (isBinary.test(str)) {
  36114. base = 2;
  36115. } else if (isOctal.test(str)) {
  36116. base = 8;
  36117. } else {
  36118. throw Error(invalidArgument + str);
  36119. }
  36120. // Is there a binary exponent part?
  36121. i = str.search(/p/i);
  36122. if (i > 0) {
  36123. p = +str.slice(i + 1);
  36124. str = str.substring(2, i);
  36125. } else {
  36126. str = str.slice(2);
  36127. }
  36128. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  36129. // fraction part will be restored.
  36130. i = str.indexOf('.');
  36131. isFloat = i >= 0;
  36132. Ctor = x.constructor;
  36133. if (isFloat) {
  36134. str = str.replace('.', '');
  36135. len = str.length;
  36136. i = len - i;
  36137. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  36138. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  36139. }
  36140. xd = convertBase(str, base, BASE);
  36141. xe = xd.length - 1;
  36142. // Remove trailing zeros.
  36143. for (i = xe; xd[i] === 0; --i) {
  36144. xd.pop();
  36145. }if (i < 0) return new Ctor(x.s * 0);
  36146. x.e = getBase10Exponent(xd, xe);
  36147. x.d = xd;
  36148. external = false;
  36149. // At what precision to perform the division to ensure exact conversion?
  36150. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  36151. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  36152. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  36153. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  36154. // Therefore using 4 * the number of digits of str will always be enough.
  36155. if (isFloat) x = divide(x, divisor, len * 4);
  36156. // Multiply by the binary exponent part if present.
  36157. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  36158. external = true;
  36159. return x;
  36160. }
  36161. /*
  36162. * sin(x) = x - x^3/3! + x^5/5! - ...
  36163. * |x| < pi/2
  36164. *
  36165. */
  36166. function sine(Ctor, x) {
  36167. var k,
  36168. len = x.d.length;
  36169. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  36170. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  36171. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  36172. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  36173. // Estimate the optimum number of times to use the argument reduction.
  36174. k = 1.4 * Math.sqrt(len);
  36175. k = k > 16 ? 16 : k | 0;
  36176. // Max k before Math.pow precision loss is 22
  36177. x = x.times(Math.pow(5, -k));
  36178. x = taylorSeries(Ctor, 2, x, x);
  36179. // Reverse argument reduction
  36180. var sin2_x,
  36181. d5 = new Ctor(5),
  36182. d16 = new Ctor(16),
  36183. d20 = new Ctor(20);
  36184. for (; k--;) {
  36185. sin2_x = x.times(x);
  36186. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  36187. }
  36188. return x;
  36189. }
  36190. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  36191. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  36192. var j,
  36193. t,
  36194. u,
  36195. x2,
  36196. i = 1,
  36197. pr = Ctor.precision,
  36198. k = Math.ceil(pr / LOG_BASE);
  36199. external = false;
  36200. x2 = x.times(x);
  36201. u = new Ctor(y);
  36202. for (;;) {
  36203. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  36204. u = isHyperbolic ? y.plus(t) : y.minus(t);
  36205. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  36206. t = u.plus(y);
  36207. if (t.d[k] !== void 0) {
  36208. for (j = k; t.d[j] === u.d[j] && j--;) {}
  36209. if (j == -1) break;
  36210. }
  36211. j = u;
  36212. u = y;
  36213. y = t;
  36214. t = j;
  36215. i++;
  36216. }
  36217. external = true;
  36218. t.d.length = k + 1;
  36219. return t;
  36220. }
  36221. // Return the absolute value of `x` reduced to less than or equal to half pi.
  36222. function toLessThanHalfPi(Ctor, x) {
  36223. var t,
  36224. isNeg = x.s < 0,
  36225. pi = getPi(Ctor, Ctor.precision, 1),
  36226. halfPi = pi.times(0.5);
  36227. x = x.abs();
  36228. if (x.lte(halfPi)) {
  36229. quadrant = isNeg ? 4 : 1;
  36230. return x;
  36231. }
  36232. t = x.divToInt(pi);
  36233. if (t.isZero()) {
  36234. quadrant = isNeg ? 3 : 2;
  36235. } else {
  36236. x = x.minus(t.times(pi));
  36237. // 0 <= x < pi
  36238. if (x.lte(halfPi)) {
  36239. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  36240. return x;
  36241. }
  36242. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  36243. }
  36244. return x.minus(pi).abs();
  36245. }
  36246. /*
  36247. * Return the value of Decimal `x` as a string in base `baseOut`.
  36248. *
  36249. * If the optional `sd` argument is present include a binary exponent suffix.
  36250. */
  36251. function toStringBinary(x, baseOut, sd, rm) {
  36252. var base,
  36253. e,
  36254. i,
  36255. k,
  36256. len,
  36257. roundUp,
  36258. str,
  36259. xd,
  36260. y,
  36261. Ctor = x.constructor,
  36262. isExp = sd !== void 0;
  36263. if (isExp) {
  36264. checkInt32(sd, 1, MAX_DIGITS);
  36265. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  36266. } else {
  36267. sd = Ctor.precision;
  36268. rm = Ctor.rounding;
  36269. }
  36270. if (!x.isFinite()) {
  36271. str = nonFiniteToString(x);
  36272. } else {
  36273. str = finiteToString(x);
  36274. i = str.indexOf('.');
  36275. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  36276. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  36277. // minBinaryExponent = floor(decimalExponent * log[2](10))
  36278. // log[2](10) = 3.321928094887362347870319429489390175864
  36279. if (isExp) {
  36280. base = 2;
  36281. if (baseOut == 16) {
  36282. sd = sd * 4 - 3;
  36283. } else if (baseOut == 8) {
  36284. sd = sd * 3 - 2;
  36285. }
  36286. } else {
  36287. base = baseOut;
  36288. }
  36289. // Convert the number as an integer then divide the result by its base raised to a power such
  36290. // that the fraction part will be restored.
  36291. // Non-integer.
  36292. if (i >= 0) {
  36293. str = str.replace('.', '');
  36294. y = new Ctor(1);
  36295. y.e = str.length - i;
  36296. y.d = convertBase(finiteToString(y), 10, base);
  36297. y.e = y.d.length;
  36298. }
  36299. xd = convertBase(str, 10, base);
  36300. e = len = xd.length;
  36301. // Remove trailing zeros.
  36302. for (; xd[--len] == 0;) {
  36303. xd.pop();
  36304. }if (!xd[0]) {
  36305. str = isExp ? '0p+0' : '0';
  36306. } else {
  36307. if (i < 0) {
  36308. e--;
  36309. } else {
  36310. x = new Ctor(x);
  36311. x.d = xd;
  36312. x.e = e;
  36313. x = divide(x, y, sd, rm, 0, base);
  36314. xd = x.d;
  36315. e = x.e;
  36316. roundUp = inexact;
  36317. }
  36318. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  36319. i = xd[sd];
  36320. k = base / 2;
  36321. roundUp = roundUp || xd[sd + 1] !== void 0;
  36322. roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7));
  36323. xd.length = sd;
  36324. if (roundUp) {
  36325. // Rounding up may mean the previous digit has to be rounded up and so on.
  36326. for (; ++xd[--sd] > base - 1;) {
  36327. xd[sd] = 0;
  36328. if (!sd) {
  36329. ++e;
  36330. xd.unshift(1);
  36331. }
  36332. }
  36333. }
  36334. // Determine trailing zeros.
  36335. for (len = xd.length; !xd[len - 1]; --len) {}
  36336. // E.g. [4, 11, 15] becomes 4bf.
  36337. for (i = 0, str = ''; i < len; i++) {
  36338. str += NUMERALS.charAt(xd[i]);
  36339. } // Add binary exponent suffix?
  36340. if (isExp) {
  36341. if (len > 1) {
  36342. if (baseOut == 16 || baseOut == 8) {
  36343. i = baseOut == 16 ? 4 : 3;
  36344. for (--len; len % i; len++) {
  36345. str += '0';
  36346. }xd = convertBase(str, base, baseOut);
  36347. for (len = xd.length; !xd[len - 1]; --len) {}
  36348. // xd[0] will always be be 1
  36349. for (i = 1, str = '1.'; i < len; i++) {
  36350. str += NUMERALS.charAt(xd[i]);
  36351. }
  36352. } else {
  36353. str = str.charAt(0) + '.' + str.slice(1);
  36354. }
  36355. }
  36356. str = str + (e < 0 ? 'p' : 'p+') + e;
  36357. } else if (e < 0) {
  36358. for (; ++e;) {
  36359. str = '0' + str;
  36360. }str = '0.' + str;
  36361. } else {
  36362. if (++e > len) for (e -= len; e--;) {
  36363. str += '0';
  36364. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  36365. }
  36366. }
  36367. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  36368. }
  36369. return x.s < 0 ? '-' + str : str;
  36370. }
  36371. // Does not strip trailing zeros.
  36372. function truncate(arr, len) {
  36373. if (arr.length > len) {
  36374. arr.length = len;
  36375. return true;
  36376. }
  36377. }
  36378. // Decimal methods
  36379. /*
  36380. * abs
  36381. * acos
  36382. * acosh
  36383. * add
  36384. * asin
  36385. * asinh
  36386. * atan
  36387. * atanh
  36388. * atan2
  36389. * cbrt
  36390. * ceil
  36391. * clone
  36392. * config
  36393. * cos
  36394. * cosh
  36395. * div
  36396. * exp
  36397. * floor
  36398. * hypot
  36399. * ln
  36400. * log
  36401. * log2
  36402. * log10
  36403. * max
  36404. * min
  36405. * mod
  36406. * mul
  36407. * pow
  36408. * random
  36409. * round
  36410. * set
  36411. * sign
  36412. * sin
  36413. * sinh
  36414. * sqrt
  36415. * sub
  36416. * tan
  36417. * tanh
  36418. * trunc
  36419. */
  36420. /*
  36421. * Return a new Decimal whose value is the absolute value of `x`.
  36422. *
  36423. * x {number|string|Decimal}
  36424. *
  36425. */
  36426. function abs(x) {
  36427. return new this(x).abs();
  36428. }
  36429. /*
  36430. * Return a new Decimal whose value is the arccosine in radians of `x`.
  36431. *
  36432. * x {number|string|Decimal}
  36433. *
  36434. */
  36435. function acos(x) {
  36436. return new this(x).acos();
  36437. }
  36438. /*
  36439. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  36440. * `precision` significant digits using rounding mode `rounding`.
  36441. *
  36442. * x {number|string|Decimal} A value in radians.
  36443. *
  36444. */
  36445. function acosh(x) {
  36446. return new this(x).acosh();
  36447. }
  36448. /*
  36449. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  36450. * digits using rounding mode `rounding`.
  36451. *
  36452. * x {number|string|Decimal}
  36453. * y {number|string|Decimal}
  36454. *
  36455. */
  36456. function add(x, y) {
  36457. return new this(x).plus(y);
  36458. }
  36459. /*
  36460. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  36461. * significant digits using rounding mode `rounding`.
  36462. *
  36463. * x {number|string|Decimal}
  36464. *
  36465. */
  36466. function asin(x) {
  36467. return new this(x).asin();
  36468. }
  36469. /*
  36470. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  36471. * `precision` significant digits using rounding mode `rounding`.
  36472. *
  36473. * x {number|string|Decimal} A value in radians.
  36474. *
  36475. */
  36476. function asinh(x) {
  36477. return new this(x).asinh();
  36478. }
  36479. /*
  36480. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  36481. * significant digits using rounding mode `rounding`.
  36482. *
  36483. * x {number|string|Decimal}
  36484. *
  36485. */
  36486. function atan(x) {
  36487. return new this(x).atan();
  36488. }
  36489. /*
  36490. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  36491. * `precision` significant digits using rounding mode `rounding`.
  36492. *
  36493. * x {number|string|Decimal} A value in radians.
  36494. *
  36495. */
  36496. function atanh(x) {
  36497. return new this(x).atanh();
  36498. }
  36499. /*
  36500. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  36501. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  36502. *
  36503. * Domain: [-Infinity, Infinity]
  36504. * Range: [-pi, pi]
  36505. *
  36506. * y {number|string|Decimal} The y-coordinate.
  36507. * x {number|string|Decimal} The x-coordinate.
  36508. *
  36509. * atan2(±0, -0) = ±pi
  36510. * atan2(±0, +0) = ±0
  36511. * atan2(±0, -x) = ±pi for x > 0
  36512. * atan2(±0, x) = ±0 for x > 0
  36513. * atan2(-y, ±0) = -pi/2 for y > 0
  36514. * atan2(y, ±0) = pi/2 for y > 0
  36515. * atan2(±y, -Infinity) = ±pi for finite y > 0
  36516. * atan2(±y, +Infinity) = ±0 for finite y > 0
  36517. * atan2(±Infinity, x) = ±pi/2 for finite x
  36518. * atan2(±Infinity, -Infinity) = ±3*pi/4
  36519. * atan2(±Infinity, +Infinity) = ±pi/4
  36520. * atan2(NaN, x) = NaN
  36521. * atan2(y, NaN) = NaN
  36522. *
  36523. */
  36524. function atan2(y, x) {
  36525. y = new this(y);
  36526. x = new this(x);
  36527. var r,
  36528. pr = this.precision,
  36529. rm = this.rounding,
  36530. wpr = pr + 4;
  36531. // Either NaN
  36532. if (!y.s || !x.s) {
  36533. r = new this(NaN);
  36534. // Both ±Infinity
  36535. } else if (!y.d && !x.d) {
  36536. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  36537. r.s = y.s;
  36538. // x is ±Infinity or y is ±0
  36539. } else if (!x.d || y.isZero()) {
  36540. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  36541. r.s = y.s;
  36542. // y is ±Infinity or x is ±0
  36543. } else if (!y.d || x.isZero()) {
  36544. r = getPi(this, wpr, 1).times(0.5);
  36545. r.s = y.s;
  36546. // Both non-zero and finite
  36547. } else if (x.s < 0) {
  36548. this.precision = wpr;
  36549. this.rounding = 1;
  36550. r = this.atan(divide(y, x, wpr, 1));
  36551. x = getPi(this, wpr, 1);
  36552. this.precision = pr;
  36553. this.rounding = rm;
  36554. r = y.s < 0 ? r.minus(x) : r.plus(x);
  36555. } else {
  36556. r = this.atan(divide(y, x, wpr, 1));
  36557. }
  36558. return r;
  36559. }
  36560. /*
  36561. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  36562. * digits using rounding mode `rounding`.
  36563. *
  36564. * x {number|string|Decimal}
  36565. *
  36566. */
  36567. function cbrt(x) {
  36568. return new this(x).cbrt();
  36569. }
  36570. /*
  36571. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  36572. *
  36573. * x {number|string|Decimal}
  36574. *
  36575. */
  36576. function ceil(x) {
  36577. return finalise(x = new this(x), x.e + 1, 2);
  36578. }
  36579. /*
  36580. * Configure global settings for a Decimal constructor.
  36581. *
  36582. * `obj` is an object with one or more of the following properties,
  36583. *
  36584. * precision {number}
  36585. * rounding {number}
  36586. * toExpNeg {number}
  36587. * toExpPos {number}
  36588. * maxE {number}
  36589. * minE {number}
  36590. * modulo {number}
  36591. * crypto {boolean|number}
  36592. * defaults {true}
  36593. *
  36594. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36595. *
  36596. */
  36597. function config(obj) {
  36598. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36599. var i,
  36600. p,
  36601. v,
  36602. useDefaults = obj.defaults === true,
  36603. ps = ['precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -EXP_LIMIT, 0, 'toExpPos', 0, EXP_LIMIT, 'maxE', 0, EXP_LIMIT, 'minE', -EXP_LIMIT, 0, 'modulo', 0, 9];
  36604. for (i = 0; i < ps.length; i += 3) {
  36605. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36606. if ((v = obj[p]) !== void 0) {
  36607. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36608. }
  36609. }
  36610. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36611. if ((v = obj[p]) !== void 0) {
  36612. if (v === true || v === false || v === 0 || v === 1) {
  36613. if (v) {
  36614. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36615. this[p] = true;
  36616. } else {
  36617. throw Error(cryptoUnavailable);
  36618. }
  36619. } else {
  36620. this[p] = false;
  36621. }
  36622. } else {
  36623. throw Error(invalidArgument + p + ': ' + v);
  36624. }
  36625. }
  36626. return this;
  36627. }
  36628. /*
  36629. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36630. * digits using rounding mode `rounding`.
  36631. *
  36632. * x {number|string|Decimal} A value in radians.
  36633. *
  36634. */
  36635. function cos(x) {
  36636. return new this(x).cos();
  36637. }
  36638. /*
  36639. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36640. * significant digits using rounding mode `rounding`.
  36641. *
  36642. * x {number|string|Decimal} A value in radians.
  36643. *
  36644. */
  36645. function cosh(x) {
  36646. return new this(x).cosh();
  36647. }
  36648. /*
  36649. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36650. * constructor.
  36651. *
  36652. */
  36653. function clone(obj) {
  36654. var i, p, ps;
  36655. /*
  36656. * The Decimal constructor and exported function.
  36657. * Return a new Decimal instance.
  36658. *
  36659. * v {number|string|Decimal} A numeric value.
  36660. *
  36661. */
  36662. function Decimal(v) {
  36663. var e,
  36664. i,
  36665. t,
  36666. x = this;
  36667. // Decimal called without new.
  36668. if (!(x instanceof Decimal)) return new Decimal(v);
  36669. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36670. // which points to Object.
  36671. x.constructor = Decimal;
  36672. // Duplicate.
  36673. if (v instanceof Decimal) {
  36674. x.s = v.s;
  36675. x.e = v.e;
  36676. x.d = (v = v.d) ? v.slice() : v;
  36677. return;
  36678. }
  36679. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36680. if (t === 'number') {
  36681. if (v === 0) {
  36682. x.s = 1 / v < 0 ? -1 : 1;
  36683. x.e = 0;
  36684. x.d = [0];
  36685. return;
  36686. }
  36687. if (v < 0) {
  36688. v = -v;
  36689. x.s = -1;
  36690. } else {
  36691. x.s = 1;
  36692. }
  36693. // Fast path for small integers.
  36694. if (v === ~~v && v < 1e7) {
  36695. for (e = 0, i = v; i >= 10; i /= 10) {
  36696. e++;
  36697. }x.e = e;
  36698. x.d = [v];
  36699. return;
  36700. // Infinity, NaN.
  36701. } else if (v * 0 !== 0) {
  36702. if (!v) x.s = NaN;
  36703. x.e = NaN;
  36704. x.d = null;
  36705. return;
  36706. }
  36707. return parseDecimal(x, v.toString());
  36708. } else if (t !== 'string') {
  36709. throw Error(invalidArgument + v);
  36710. }
  36711. // Minus sign?
  36712. if (v.charCodeAt(0) === 45) {
  36713. v = v.slice(1);
  36714. x.s = -1;
  36715. } else {
  36716. x.s = 1;
  36717. }
  36718. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36719. }
  36720. Decimal.prototype = P;
  36721. Decimal.ROUND_UP = 0;
  36722. Decimal.ROUND_DOWN = 1;
  36723. Decimal.ROUND_CEIL = 2;
  36724. Decimal.ROUND_FLOOR = 3;
  36725. Decimal.ROUND_HALF_UP = 4;
  36726. Decimal.ROUND_HALF_DOWN = 5;
  36727. Decimal.ROUND_HALF_EVEN = 6;
  36728. Decimal.ROUND_HALF_CEIL = 7;
  36729. Decimal.ROUND_HALF_FLOOR = 8;
  36730. Decimal.EUCLID = 9;
  36731. Decimal.config = Decimal.set = config;
  36732. Decimal.clone = clone;
  36733. Decimal.isDecimal = isDecimalInstance;
  36734. Decimal.abs = abs;
  36735. Decimal.acos = acos;
  36736. Decimal.acosh = acosh; // ES6
  36737. Decimal.add = add;
  36738. Decimal.asin = asin;
  36739. Decimal.asinh = asinh; // ES6
  36740. Decimal.atan = atan;
  36741. Decimal.atanh = atanh; // ES6
  36742. Decimal.atan2 = atan2;
  36743. Decimal.cbrt = cbrt; // ES6
  36744. Decimal.ceil = ceil;
  36745. Decimal.cos = cos;
  36746. Decimal.cosh = cosh; // ES6
  36747. Decimal.div = div;
  36748. Decimal.exp = exp;
  36749. Decimal.floor = floor;
  36750. Decimal.hypot = hypot; // ES6
  36751. Decimal.ln = ln;
  36752. Decimal.log = log;
  36753. Decimal.log10 = log10; // ES6
  36754. Decimal.log2 = log2; // ES6
  36755. Decimal.max = max;
  36756. Decimal.min = min;
  36757. Decimal.mod = mod;
  36758. Decimal.mul = mul;
  36759. Decimal.pow = pow;
  36760. Decimal.random = random;
  36761. Decimal.round = round;
  36762. Decimal.sign = sign; // ES6
  36763. Decimal.sin = sin;
  36764. Decimal.sinh = sinh; // ES6
  36765. Decimal.sqrt = sqrt;
  36766. Decimal.sub = sub;
  36767. Decimal.tan = tan;
  36768. Decimal.tanh = tanh; // ES6
  36769. Decimal.trunc = trunc; // ES6
  36770. if (obj === void 0) obj = {};
  36771. if (obj) {
  36772. if (obj.defaults !== true) {
  36773. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  36774. for (i = 0; i < ps.length;) {
  36775. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  36776. }
  36777. }
  36778. }
  36779. Decimal.config(obj);
  36780. return Decimal;
  36781. }
  36782. /*
  36783. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  36784. * digits using rounding mode `rounding`.
  36785. *
  36786. * x {number|string|Decimal}
  36787. * y {number|string|Decimal}
  36788. *
  36789. */
  36790. function div(x, y) {
  36791. return new this(x).div(y);
  36792. }
  36793. /*
  36794. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  36795. * significant digits using rounding mode `rounding`.
  36796. *
  36797. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  36798. *
  36799. */
  36800. function exp(x) {
  36801. return new this(x).exp();
  36802. }
  36803. /*
  36804. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  36805. *
  36806. * x {number|string|Decimal}
  36807. *
  36808. */
  36809. function floor(x) {
  36810. return finalise(x = new this(x), x.e + 1, 3);
  36811. }
  36812. /*
  36813. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  36814. * rounded to `precision` significant digits using rounding mode `rounding`.
  36815. *
  36816. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  36817. *
  36818. */
  36819. function hypot() {
  36820. var i,
  36821. n,
  36822. t = new this(0);
  36823. external = false;
  36824. for (i = 0; i < arguments.length;) {
  36825. n = new this(arguments[i++]);
  36826. if (!n.d) {
  36827. if (n.s) {
  36828. external = true;
  36829. return new this(1 / 0);
  36830. }
  36831. t = n;
  36832. } else if (t.d) {
  36833. t = t.plus(n.times(n));
  36834. }
  36835. }
  36836. external = true;
  36837. return t.sqrt();
  36838. }
  36839. /*
  36840. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  36841. * otherwise return false.
  36842. *
  36843. */
  36844. function isDecimalInstance(obj) {
  36845. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  36846. }
  36847. /*
  36848. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  36849. * significant digits using rounding mode `rounding`.
  36850. *
  36851. * x {number|string|Decimal}
  36852. *
  36853. */
  36854. function ln(x) {
  36855. return new this(x).ln();
  36856. }
  36857. /*
  36858. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  36859. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  36860. *
  36861. * log[y](x)
  36862. *
  36863. * x {number|string|Decimal} The argument of the logarithm.
  36864. * y {number|string|Decimal} The base of the logarithm.
  36865. *
  36866. */
  36867. function log(x, y) {
  36868. return new this(x).log(y);
  36869. }
  36870. /*
  36871. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  36872. * significant digits using rounding mode `rounding`.
  36873. *
  36874. * x {number|string|Decimal}
  36875. *
  36876. */
  36877. function log2(x) {
  36878. return new this(x).log(2);
  36879. }
  36880. /*
  36881. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  36882. * significant digits using rounding mode `rounding`.
  36883. *
  36884. * x {number|string|Decimal}
  36885. *
  36886. */
  36887. function log10(x) {
  36888. return new this(x).log(10);
  36889. }
  36890. /*
  36891. * Return a new Decimal whose value is the maximum of the arguments.
  36892. *
  36893. * arguments {number|string|Decimal}
  36894. *
  36895. */
  36896. function max() {
  36897. return maxOrMin(this, arguments, 'lt');
  36898. }
  36899. /*
  36900. * Return a new Decimal whose value is the minimum of the arguments.
  36901. *
  36902. * arguments {number|string|Decimal}
  36903. *
  36904. */
  36905. function min() {
  36906. return maxOrMin(this, arguments, 'gt');
  36907. }
  36908. /*
  36909. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  36910. * using rounding mode `rounding`.
  36911. *
  36912. * x {number|string|Decimal}
  36913. * y {number|string|Decimal}
  36914. *
  36915. */
  36916. function mod(x, y) {
  36917. return new this(x).mod(y);
  36918. }
  36919. /*
  36920. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  36921. * digits using rounding mode `rounding`.
  36922. *
  36923. * x {number|string|Decimal}
  36924. * y {number|string|Decimal}
  36925. *
  36926. */
  36927. function mul(x, y) {
  36928. return new this(x).mul(y);
  36929. }
  36930. /*
  36931. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  36932. * significant digits using rounding mode `rounding`.
  36933. *
  36934. * x {number|string|Decimal} The base.
  36935. * y {number|string|Decimal} The exponent.
  36936. *
  36937. */
  36938. function pow(x, y) {
  36939. return new this(x).pow(y);
  36940. }
  36941. /*
  36942. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  36943. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  36944. * are produced).
  36945. *
  36946. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  36947. *
  36948. */
  36949. function random(sd) {
  36950. var d,
  36951. e,
  36952. k,
  36953. n,
  36954. i = 0,
  36955. r = new this(1),
  36956. rd = [];
  36957. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  36958. k = Math.ceil(sd / LOG_BASE);
  36959. if (!this.crypto) {
  36960. for (; i < k;) {
  36961. rd[i++] = Math.random() * 1e7 | 0;
  36962. } // Browsers supporting crypto.getRandomValues.
  36963. } else if (crypto.getRandomValues) {
  36964. d = crypto.getRandomValues(new Uint32Array(k));
  36965. for (; i < k;) {
  36966. n = d[i];
  36967. // 0 <= n < 4294967296
  36968. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  36969. if (n >= 4.29e9) {
  36970. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  36971. } else {
  36972. // 0 <= n <= 4289999999
  36973. // 0 <= (n % 1e7) <= 9999999
  36974. rd[i++] = n % 1e7;
  36975. }
  36976. }
  36977. // Node.js supporting crypto.randomBytes.
  36978. } else if (crypto.randomBytes) {
  36979. // buffer
  36980. d = crypto.randomBytes(k *= 4);
  36981. for (; i < k;) {
  36982. // 0 <= n < 2147483648
  36983. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  36984. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  36985. if (n >= 2.14e9) {
  36986. crypto.randomBytes(4).copy(d, i);
  36987. } else {
  36988. // 0 <= n <= 2139999999
  36989. // 0 <= (n % 1e7) <= 9999999
  36990. rd.push(n % 1e7);
  36991. i += 4;
  36992. }
  36993. }
  36994. i = k / 4;
  36995. } else {
  36996. throw Error(cryptoUnavailable);
  36997. }
  36998. k = rd[--i];
  36999. sd %= LOG_BASE;
  37000. // Convert trailing digits to zeros according to sd.
  37001. if (k && sd) {
  37002. n = mathpow(10, LOG_BASE - sd);
  37003. rd[i] = (k / n | 0) * n;
  37004. }
  37005. // Remove trailing words which are zero.
  37006. for (; rd[i] === 0; i--) {
  37007. rd.pop();
  37008. } // Zero?
  37009. if (i < 0) {
  37010. e = 0;
  37011. rd = [0];
  37012. } else {
  37013. e = -1;
  37014. // Remove leading words which are zero and adjust exponent accordingly.
  37015. for (; rd[0] === 0; e -= LOG_BASE) {
  37016. rd.shift();
  37017. } // Count the digits of the first word of rd to determine leading zeros.
  37018. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  37019. k++;
  37020. } // Adjust the exponent for leading zeros of the first word of rd.
  37021. if (k < LOG_BASE) e -= LOG_BASE - k;
  37022. }
  37023. r.e = e;
  37024. r.d = rd;
  37025. return r;
  37026. }
  37027. /*
  37028. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  37029. *
  37030. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  37031. *
  37032. * x {number|string|Decimal}
  37033. *
  37034. */
  37035. function round(x) {
  37036. return finalise(x = new this(x), x.e + 1, this.rounding);
  37037. }
  37038. /*
  37039. * Return
  37040. * 1 if x > 0,
  37041. * -1 if x < 0,
  37042. * 0 if x is 0,
  37043. * -0 if x is -0,
  37044. * NaN otherwise
  37045. *
  37046. */
  37047. function sign(x) {
  37048. x = new this(x);
  37049. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  37050. }
  37051. /*
  37052. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  37053. * using rounding mode `rounding`.
  37054. *
  37055. * x {number|string|Decimal} A value in radians.
  37056. *
  37057. */
  37058. function sin(x) {
  37059. return new this(x).sin();
  37060. }
  37061. /*
  37062. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  37063. * significant digits using rounding mode `rounding`.
  37064. *
  37065. * x {number|string|Decimal} A value in radians.
  37066. *
  37067. */
  37068. function sinh(x) {
  37069. return new this(x).sinh();
  37070. }
  37071. /*
  37072. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  37073. * digits using rounding mode `rounding`.
  37074. *
  37075. * x {number|string|Decimal}
  37076. *
  37077. */
  37078. function sqrt(x) {
  37079. return new this(x).sqrt();
  37080. }
  37081. /*
  37082. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  37083. * using rounding mode `rounding`.
  37084. *
  37085. * x {number|string|Decimal}
  37086. * y {number|string|Decimal}
  37087. *
  37088. */
  37089. function sub(x, y) {
  37090. return new this(x).sub(y);
  37091. }
  37092. /*
  37093. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  37094. * digits using rounding mode `rounding`.
  37095. *
  37096. * x {number|string|Decimal} A value in radians.
  37097. *
  37098. */
  37099. function tan(x) {
  37100. return new this(x).tan();
  37101. }
  37102. /*
  37103. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  37104. * significant digits using rounding mode `rounding`.
  37105. *
  37106. * x {number|string|Decimal} A value in radians.
  37107. *
  37108. */
  37109. function tanh(x) {
  37110. return new this(x).tanh();
  37111. }
  37112. /*
  37113. * Return a new Decimal whose value is `x` truncated to an integer.
  37114. *
  37115. * x {number|string|Decimal}
  37116. *
  37117. */
  37118. function trunc(x) {
  37119. return finalise(x = new this(x), x.e + 1, 1);
  37120. }
  37121. // Create and configure initial Decimal constructor.
  37122. Decimal = clone(DEFAULTS);
  37123. Decimal['default'] = Decimal.Decimal = Decimal;
  37124. // Create the internal constants from their string values.
  37125. LN10 = new Decimal(LN10);
  37126. PI = new Decimal(PI);
  37127. // Export.
  37128. // AMD.
  37129. if (true) {
  37130. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  37131. return Decimal;
  37132. }).call(exports, __webpack_require__, exports, module),
  37133. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  37134. // Node and other environments that support module.exports.
  37135. } else {}
  37136. })(undefined);
  37137. /***/ }),
  37138. /***/ "./node_modules/jquery/dist/jquery.js":
  37139. /*!********************************************!*\
  37140. !*** ./node_modules/jquery/dist/jquery.js ***!
  37141. \********************************************/
  37142. /*! no static exports found */
  37143. /***/ (function(module, exports, __webpack_require__) {
  37144. "use strict";
  37145. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  37146. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  37147. /*!
  37148. * jQuery JavaScript Library v3.3.1
  37149. * https://jquery.com/
  37150. *
  37151. * Includes Sizzle.js
  37152. * https://sizzlejs.com/
  37153. *
  37154. * Copyright JS Foundation and other contributors
  37155. * Released under the MIT license
  37156. * https://jquery.org/license
  37157. *
  37158. * Date: 2018-01-20T17:24Z
  37159. */
  37160. (function (global, factory) {
  37161. "use strict";
  37162. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  37163. // For CommonJS and CommonJS-like environments where a proper `window`
  37164. // is present, execute the factory and get jQuery.
  37165. // For environments that do not have a `window` with a `document`
  37166. // (such as Node.js), expose a factory as module.exports.
  37167. // This accentuates the need for the creation of a real `window`.
  37168. // e.g. var jQuery = require("jquery")(window);
  37169. // See ticket #14549 for more info.
  37170. module.exports = global.document ? factory(global, true) : function (w) {
  37171. if (!w.document) {
  37172. throw new Error("jQuery requires a window with a document");
  37173. }
  37174. return factory(w);
  37175. };
  37176. } else {
  37177. factory(global);
  37178. }
  37179. // Pass this if window is not defined yet
  37180. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  37181. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  37182. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  37183. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  37184. // enough that all such attempts are guarded in a try block.
  37185. "use strict";
  37186. var arr = [];
  37187. var document = window.document;
  37188. var getProto = Object.getPrototypeOf;
  37189. var _slice = arr.slice;
  37190. var concat = arr.concat;
  37191. var push = arr.push;
  37192. var indexOf = arr.indexOf;
  37193. var class2type = {};
  37194. var toString = class2type.toString;
  37195. var hasOwn = class2type.hasOwnProperty;
  37196. var fnToString = hasOwn.toString;
  37197. var ObjectFunctionString = fnToString.call(Object);
  37198. var support = {};
  37199. var isFunction = function isFunction(obj) {
  37200. // Support: Chrome <=57, Firefox <=52
  37201. // In some browsers, typeof returns "function" for HTML <object> elements
  37202. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  37203. // We don't want to classify *any* DOM node as a function.
  37204. return typeof obj === "function" && typeof obj.nodeType !== "number";
  37205. };
  37206. var isWindow = function isWindow(obj) {
  37207. return obj != null && obj === obj.window;
  37208. };
  37209. var preservedScriptAttributes = {
  37210. type: true,
  37211. src: true,
  37212. noModule: true
  37213. };
  37214. function DOMEval(code, doc, node) {
  37215. doc = doc || document;
  37216. var i,
  37217. script = doc.createElement("script");
  37218. script.text = code;
  37219. if (node) {
  37220. for (i in preservedScriptAttributes) {
  37221. if (node[i]) {
  37222. script[i] = node[i];
  37223. }
  37224. }
  37225. }
  37226. doc.head.appendChild(script).parentNode.removeChild(script);
  37227. }
  37228. function toType(obj) {
  37229. if (obj == null) {
  37230. return obj + "";
  37231. }
  37232. // Support: Android <=2.3 only (functionish RegExp)
  37233. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  37234. }
  37235. /* global Symbol */
  37236. // Defining this global in .eslintrc.json would create a danger of using the global
  37237. // unguarded in another place, it seems safer to define global only for this module
  37238. var version = "3.3.1",
  37239. // Define a local copy of jQuery
  37240. jQuery = function jQuery(selector, context) {
  37241. // The jQuery object is actually just the init constructor 'enhanced'
  37242. // Need init if jQuery is called (just allow error to be thrown if not included)
  37243. return new jQuery.fn.init(selector, context);
  37244. },
  37245. // Support: Android <=4.0 only
  37246. // Make sure we trim BOM and NBSP
  37247. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  37248. jQuery.fn = jQuery.prototype = {
  37249. // The current version of jQuery being used
  37250. jquery: version,
  37251. constructor: jQuery,
  37252. // The default length of a jQuery object is 0
  37253. length: 0,
  37254. toArray: function toArray() {
  37255. return _slice.call(this);
  37256. },
  37257. // Get the Nth element in the matched element set OR
  37258. // Get the whole matched element set as a clean array
  37259. get: function get(num) {
  37260. // Return all the elements in a clean array
  37261. if (num == null) {
  37262. return _slice.call(this);
  37263. }
  37264. // Return just the one element from the set
  37265. return num < 0 ? this[num + this.length] : this[num];
  37266. },
  37267. // Take an array of elements and push it onto the stack
  37268. // (returning the new matched element set)
  37269. pushStack: function pushStack(elems) {
  37270. // Build a new jQuery matched element set
  37271. var ret = jQuery.merge(this.constructor(), elems);
  37272. // Add the old object onto the stack (as a reference)
  37273. ret.prevObject = this;
  37274. // Return the newly-formed element set
  37275. return ret;
  37276. },
  37277. // Execute a callback for every element in the matched set.
  37278. each: function each(callback) {
  37279. return jQuery.each(this, callback);
  37280. },
  37281. map: function map(callback) {
  37282. return this.pushStack(jQuery.map(this, function (elem, i) {
  37283. return callback.call(elem, i, elem);
  37284. }));
  37285. },
  37286. slice: function slice() {
  37287. return this.pushStack(_slice.apply(this, arguments));
  37288. },
  37289. first: function first() {
  37290. return this.eq(0);
  37291. },
  37292. last: function last() {
  37293. return this.eq(-1);
  37294. },
  37295. eq: function eq(i) {
  37296. var len = this.length,
  37297. j = +i + (i < 0 ? len : 0);
  37298. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  37299. },
  37300. end: function end() {
  37301. return this.prevObject || this.constructor();
  37302. },
  37303. // For internal use only.
  37304. // Behaves like an Array's method, not like a jQuery method.
  37305. push: push,
  37306. sort: arr.sort,
  37307. splice: arr.splice
  37308. };
  37309. jQuery.extend = jQuery.fn.extend = function () {
  37310. var options,
  37311. name,
  37312. src,
  37313. copy,
  37314. copyIsArray,
  37315. clone,
  37316. target = arguments[0] || {},
  37317. i = 1,
  37318. length = arguments.length,
  37319. deep = false;
  37320. // Handle a deep copy situation
  37321. if (typeof target === "boolean") {
  37322. deep = target;
  37323. // Skip the boolean and the target
  37324. target = arguments[i] || {};
  37325. i++;
  37326. }
  37327. // Handle case when target is a string or something (possible in deep copy)
  37328. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  37329. target = {};
  37330. }
  37331. // Extend jQuery itself if only one argument is passed
  37332. if (i === length) {
  37333. target = this;
  37334. i--;
  37335. }
  37336. for (; i < length; i++) {
  37337. // Only deal with non-null/undefined values
  37338. if ((options = arguments[i]) != null) {
  37339. // Extend the base object
  37340. for (name in options) {
  37341. src = target[name];
  37342. copy = options[name];
  37343. // Prevent never-ending loop
  37344. if (target === copy) {
  37345. continue;
  37346. }
  37347. // Recurse if we're merging plain objects or arrays
  37348. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  37349. if (copyIsArray) {
  37350. copyIsArray = false;
  37351. clone = src && Array.isArray(src) ? src : [];
  37352. } else {
  37353. clone = src && jQuery.isPlainObject(src) ? src : {};
  37354. }
  37355. // Never move original objects, clone them
  37356. target[name] = jQuery.extend(deep, clone, copy);
  37357. // Don't bring in undefined values
  37358. } else if (copy !== undefined) {
  37359. target[name] = copy;
  37360. }
  37361. }
  37362. }
  37363. }
  37364. // Return the modified object
  37365. return target;
  37366. };
  37367. jQuery.extend({
  37368. // Unique for each copy of jQuery on the page
  37369. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  37370. // Assume jQuery is ready without the ready module
  37371. isReady: true,
  37372. error: function error(msg) {
  37373. throw new Error(msg);
  37374. },
  37375. noop: function noop() {},
  37376. isPlainObject: function isPlainObject(obj) {
  37377. var proto, Ctor;
  37378. // Detect obvious negatives
  37379. // Use toString instead of jQuery.type to catch host objects
  37380. if (!obj || toString.call(obj) !== "[object Object]") {
  37381. return false;
  37382. }
  37383. proto = getProto(obj);
  37384. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  37385. if (!proto) {
  37386. return true;
  37387. }
  37388. // Objects with prototype are plain iff they were constructed by a global Object function
  37389. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  37390. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  37391. },
  37392. isEmptyObject: function isEmptyObject(obj) {
  37393. /* eslint-disable no-unused-vars */
  37394. // See https://github.com/eslint/eslint/issues/6125
  37395. var name;
  37396. for (name in obj) {
  37397. return false;
  37398. }
  37399. return true;
  37400. },
  37401. // Evaluates a script in a global context
  37402. globalEval: function globalEval(code) {
  37403. DOMEval(code);
  37404. },
  37405. each: function each(obj, callback) {
  37406. var length,
  37407. i = 0;
  37408. if (isArrayLike(obj)) {
  37409. length = obj.length;
  37410. for (; i < length; i++) {
  37411. if (callback.call(obj[i], i, obj[i]) === false) {
  37412. break;
  37413. }
  37414. }
  37415. } else {
  37416. for (i in obj) {
  37417. if (callback.call(obj[i], i, obj[i]) === false) {
  37418. break;
  37419. }
  37420. }
  37421. }
  37422. return obj;
  37423. },
  37424. // Support: Android <=4.0 only
  37425. trim: function trim(text) {
  37426. return text == null ? "" : (text + "").replace(rtrim, "");
  37427. },
  37428. // results is for internal usage only
  37429. makeArray: function makeArray(arr, results) {
  37430. var ret = results || [];
  37431. if (arr != null) {
  37432. if (isArrayLike(Object(arr))) {
  37433. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  37434. } else {
  37435. push.call(ret, arr);
  37436. }
  37437. }
  37438. return ret;
  37439. },
  37440. inArray: function inArray(elem, arr, i) {
  37441. return arr == null ? -1 : indexOf.call(arr, elem, i);
  37442. },
  37443. // Support: Android <=4.0 only, PhantomJS 1 only
  37444. // push.apply(_, arraylike) throws on ancient WebKit
  37445. merge: function merge(first, second) {
  37446. var len = +second.length,
  37447. j = 0,
  37448. i = first.length;
  37449. for (; j < len; j++) {
  37450. first[i++] = second[j];
  37451. }
  37452. first.length = i;
  37453. return first;
  37454. },
  37455. grep: function grep(elems, callback, invert) {
  37456. var callbackInverse,
  37457. matches = [],
  37458. i = 0,
  37459. length = elems.length,
  37460. callbackExpect = !invert;
  37461. // Go through the array, only saving the items
  37462. // that pass the validator function
  37463. for (; i < length; i++) {
  37464. callbackInverse = !callback(elems[i], i);
  37465. if (callbackInverse !== callbackExpect) {
  37466. matches.push(elems[i]);
  37467. }
  37468. }
  37469. return matches;
  37470. },
  37471. // arg is for internal usage only
  37472. map: function map(elems, callback, arg) {
  37473. var length,
  37474. value,
  37475. i = 0,
  37476. ret = [];
  37477. // Go through the array, translating each of the items to their new values
  37478. if (isArrayLike(elems)) {
  37479. length = elems.length;
  37480. for (; i < length; i++) {
  37481. value = callback(elems[i], i, arg);
  37482. if (value != null) {
  37483. ret.push(value);
  37484. }
  37485. }
  37486. // Go through every key on the object,
  37487. } else {
  37488. for (i in elems) {
  37489. value = callback(elems[i], i, arg);
  37490. if (value != null) {
  37491. ret.push(value);
  37492. }
  37493. }
  37494. }
  37495. // Flatten any nested arrays
  37496. return concat.apply([], ret);
  37497. },
  37498. // A global GUID counter for objects
  37499. guid: 1,
  37500. // jQuery.support is not used in Core but other projects attach their
  37501. // properties to it so it needs to exist.
  37502. support: support
  37503. });
  37504. if (typeof Symbol === "function") {
  37505. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  37506. }
  37507. // Populate the class2type map
  37508. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  37509. class2type["[object " + name + "]"] = name.toLowerCase();
  37510. });
  37511. function isArrayLike(obj) {
  37512. // Support: real iOS 8.2 only (not reproducible in simulator)
  37513. // `in` check used to prevent JIT error (gh-2145)
  37514. // hasOwn isn't used here due to false negatives
  37515. // regarding Nodelist length in IE
  37516. var length = !!obj && "length" in obj && obj.length,
  37517. type = toType(obj);
  37518. if (isFunction(obj) || isWindow(obj)) {
  37519. return false;
  37520. }
  37521. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  37522. }
  37523. var Sizzle =
  37524. /*!
  37525. * Sizzle CSS Selector Engine v2.3.3
  37526. * https://sizzlejs.com/
  37527. *
  37528. * Copyright jQuery Foundation and other contributors
  37529. * Released under the MIT license
  37530. * http://jquery.org/license
  37531. *
  37532. * Date: 2016-08-08
  37533. */
  37534. function (window) {
  37535. var i,
  37536. support,
  37537. Expr,
  37538. getText,
  37539. isXML,
  37540. tokenize,
  37541. compile,
  37542. select,
  37543. outermostContext,
  37544. sortInput,
  37545. hasDuplicate,
  37546. // Local document vars
  37547. setDocument,
  37548. document,
  37549. docElem,
  37550. documentIsHTML,
  37551. rbuggyQSA,
  37552. rbuggyMatches,
  37553. matches,
  37554. contains,
  37555. // Instance-specific data
  37556. expando = "sizzle" + 1 * new Date(),
  37557. preferredDoc = window.document,
  37558. dirruns = 0,
  37559. done = 0,
  37560. classCache = createCache(),
  37561. tokenCache = createCache(),
  37562. compilerCache = createCache(),
  37563. sortOrder = function sortOrder(a, b) {
  37564. if (a === b) {
  37565. hasDuplicate = true;
  37566. }
  37567. return 0;
  37568. },
  37569. // Instance methods
  37570. hasOwn = {}.hasOwnProperty,
  37571. arr = [],
  37572. pop = arr.pop,
  37573. push_native = arr.push,
  37574. push = arr.push,
  37575. slice = arr.slice,
  37576. // Use a stripped-down indexOf as it's faster than native
  37577. // https://jsperf.com/thor-indexof-vs-for/5
  37578. indexOf = function indexOf(list, elem) {
  37579. var i = 0,
  37580. len = list.length;
  37581. for (; i < len; i++) {
  37582. if (list[i] === elem) {
  37583. return i;
  37584. }
  37585. }
  37586. return -1;
  37587. },
  37588. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  37589. // Regular expressions
  37590. // http://www.w3.org/TR/css3-selectors/#whitespace
  37591. whitespace = "[\\x20\\t\\r\\n\\f]",
  37592. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37593. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37594. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37595. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37596. // Operator (capture 2)
  37597. "*([*^$|!~]?=)" + whitespace +
  37598. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37599. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37600. pseudos = ":(" + identifier + ")(?:\\((" +
  37601. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37602. // 1. quoted (capture 3; capture 4 or capture 5)
  37603. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37604. // 2. simple (capture 6)
  37605. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37606. // 3. anything else (capture 2)
  37607. ".*" + ")\\)|)",
  37608. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37609. rwhitespace = new RegExp(whitespace + "+", "g"),
  37610. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37611. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37612. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37613. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37614. rpseudo = new RegExp(pseudos),
  37615. ridentifier = new RegExp("^" + identifier + "$"),
  37616. matchExpr = {
  37617. "ID": new RegExp("^#(" + identifier + ")"),
  37618. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37619. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37620. "ATTR": new RegExp("^" + attributes),
  37621. "PSEUDO": new RegExp("^" + pseudos),
  37622. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37623. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37624. // For use in libraries implementing .is()
  37625. // We use this for POS matching in `select`
  37626. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37627. },
  37628. rinputs = /^(?:input|select|textarea|button)$/i,
  37629. rheader = /^h\d$/i,
  37630. rnative = /^[^{]+\{\s*\[native \w/,
  37631. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37632. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37633. rsibling = /[+~]/,
  37634. // CSS escapes
  37635. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37636. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37637. funescape = function funescape(_, escaped, escapedWhitespace) {
  37638. var high = "0x" + escaped - 0x10000;
  37639. // NaN means non-codepoint
  37640. // Support: Firefox<24
  37641. // Workaround erroneous numeric interpretation of +"0x"
  37642. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37643. // BMP codepoint
  37644. String.fromCharCode(high + 0x10000) :
  37645. // Supplemental Plane codepoint (surrogate pair)
  37646. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37647. },
  37648. // CSS string/identifier serialization
  37649. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37650. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37651. fcssescape = function fcssescape(ch, asCodePoint) {
  37652. if (asCodePoint) {
  37653. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37654. if (ch === "\0") {
  37655. return "\uFFFD";
  37656. }
  37657. // Control characters and (dependent upon position) numbers get escaped as code points
  37658. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37659. }
  37660. // Other potentially-special ASCII characters get backslash-escaped
  37661. return "\\" + ch;
  37662. },
  37663. // Used for iframes
  37664. // See setDocument()
  37665. // Removing the function wrapper causes a "Permission Denied"
  37666. // error in IE
  37667. unloadHandler = function unloadHandler() {
  37668. setDocument();
  37669. },
  37670. disabledAncestor = addCombinator(function (elem) {
  37671. return elem.disabled === true && ("form" in elem || "label" in elem);
  37672. }, { dir: "parentNode", next: "legend" });
  37673. // Optimize for push.apply( _, NodeList )
  37674. try {
  37675. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37676. // Support: Android<4.0
  37677. // Detect silently failing push.apply
  37678. arr[preferredDoc.childNodes.length].nodeType;
  37679. } catch (e) {
  37680. push = { apply: arr.length ?
  37681. // Leverage slice if possible
  37682. function (target, els) {
  37683. push_native.apply(target, slice.call(els));
  37684. } :
  37685. // Support: IE<9
  37686. // Otherwise append directly
  37687. function (target, els) {
  37688. var j = target.length,
  37689. i = 0;
  37690. // Can't trust NodeList.length
  37691. while (target[j++] = els[i++]) {}
  37692. target.length = j - 1;
  37693. }
  37694. };
  37695. }
  37696. function Sizzle(selector, context, results, seed) {
  37697. var m,
  37698. i,
  37699. elem,
  37700. nid,
  37701. match,
  37702. groups,
  37703. newSelector,
  37704. newContext = context && context.ownerDocument,
  37705. // nodeType defaults to 9, since context defaults to document
  37706. nodeType = context ? context.nodeType : 9;
  37707. results = results || [];
  37708. // Return early from calls with invalid selector or context
  37709. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37710. return results;
  37711. }
  37712. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37713. if (!seed) {
  37714. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37715. setDocument(context);
  37716. }
  37717. context = context || document;
  37718. if (documentIsHTML) {
  37719. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37720. // (excepting DocumentFragment context, where the methods don't exist)
  37721. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37722. // ID selector
  37723. if (m = match[1]) {
  37724. // Document context
  37725. if (nodeType === 9) {
  37726. if (elem = context.getElementById(m)) {
  37727. // Support: IE, Opera, Webkit
  37728. // TODO: identify versions
  37729. // getElementById can match elements by name instead of ID
  37730. if (elem.id === m) {
  37731. results.push(elem);
  37732. return results;
  37733. }
  37734. } else {
  37735. return results;
  37736. }
  37737. // Element context
  37738. } else {
  37739. // Support: IE, Opera, Webkit
  37740. // TODO: identify versions
  37741. // getElementById can match elements by name instead of ID
  37742. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  37743. results.push(elem);
  37744. return results;
  37745. }
  37746. }
  37747. // Type selector
  37748. } else if (match[2]) {
  37749. push.apply(results, context.getElementsByTagName(selector));
  37750. return results;
  37751. // Class selector
  37752. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  37753. push.apply(results, context.getElementsByClassName(m));
  37754. return results;
  37755. }
  37756. }
  37757. // Take advantage of querySelectorAll
  37758. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  37759. if (nodeType !== 1) {
  37760. newContext = context;
  37761. newSelector = selector;
  37762. // qSA looks outside Element context, which is not what we want
  37763. // Thanks to Andrew Dupont for this workaround technique
  37764. // Support: IE <=8
  37765. // Exclude object elements
  37766. } else if (context.nodeName.toLowerCase() !== "object") {
  37767. // Capture the context ID, setting it first if necessary
  37768. if (nid = context.getAttribute("id")) {
  37769. nid = nid.replace(rcssescape, fcssescape);
  37770. } else {
  37771. context.setAttribute("id", nid = expando);
  37772. }
  37773. // Prefix every selector in the list
  37774. groups = tokenize(selector);
  37775. i = groups.length;
  37776. while (i--) {
  37777. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  37778. }
  37779. newSelector = groups.join(",");
  37780. // Expand context for sibling selectors
  37781. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  37782. }
  37783. if (newSelector) {
  37784. try {
  37785. push.apply(results, newContext.querySelectorAll(newSelector));
  37786. return results;
  37787. } catch (qsaError) {} finally {
  37788. if (nid === expando) {
  37789. context.removeAttribute("id");
  37790. }
  37791. }
  37792. }
  37793. }
  37794. }
  37795. }
  37796. // All others
  37797. return select(selector.replace(rtrim, "$1"), context, results, seed);
  37798. }
  37799. /**
  37800. * Create key-value caches of limited size
  37801. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  37802. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  37803. * deleting the oldest entry
  37804. */
  37805. function createCache() {
  37806. var keys = [];
  37807. function cache(key, value) {
  37808. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  37809. if (keys.push(key + " ") > Expr.cacheLength) {
  37810. // Only keep the most recent entries
  37811. delete cache[keys.shift()];
  37812. }
  37813. return cache[key + " "] = value;
  37814. }
  37815. return cache;
  37816. }
  37817. /**
  37818. * Mark a function for special use by Sizzle
  37819. * @param {Function} fn The function to mark
  37820. */
  37821. function markFunction(fn) {
  37822. fn[expando] = true;
  37823. return fn;
  37824. }
  37825. /**
  37826. * Support testing using an element
  37827. * @param {Function} fn Passed the created element and returns a boolean result
  37828. */
  37829. function assert(fn) {
  37830. var el = document.createElement("fieldset");
  37831. try {
  37832. return !!fn(el);
  37833. } catch (e) {
  37834. return false;
  37835. } finally {
  37836. // Remove from its parent by default
  37837. if (el.parentNode) {
  37838. el.parentNode.removeChild(el);
  37839. }
  37840. // release memory in IE
  37841. el = null;
  37842. }
  37843. }
  37844. /**
  37845. * Adds the same handler for all of the specified attrs
  37846. * @param {String} attrs Pipe-separated list of attributes
  37847. * @param {Function} handler The method that will be applied
  37848. */
  37849. function addHandle(attrs, handler) {
  37850. var arr = attrs.split("|"),
  37851. i = arr.length;
  37852. while (i--) {
  37853. Expr.attrHandle[arr[i]] = handler;
  37854. }
  37855. }
  37856. /**
  37857. * Checks document order of two siblings
  37858. * @param {Element} a
  37859. * @param {Element} b
  37860. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  37861. */
  37862. function siblingCheck(a, b) {
  37863. var cur = b && a,
  37864. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  37865. // Use IE sourceIndex if available on both nodes
  37866. if (diff) {
  37867. return diff;
  37868. }
  37869. // Check if b follows a
  37870. if (cur) {
  37871. while (cur = cur.nextSibling) {
  37872. if (cur === b) {
  37873. return -1;
  37874. }
  37875. }
  37876. }
  37877. return a ? 1 : -1;
  37878. }
  37879. /**
  37880. * Returns a function to use in pseudos for input types
  37881. * @param {String} type
  37882. */
  37883. function createInputPseudo(type) {
  37884. return function (elem) {
  37885. var name = elem.nodeName.toLowerCase();
  37886. return name === "input" && elem.type === type;
  37887. };
  37888. }
  37889. /**
  37890. * Returns a function to use in pseudos for buttons
  37891. * @param {String} type
  37892. */
  37893. function createButtonPseudo(type) {
  37894. return function (elem) {
  37895. var name = elem.nodeName.toLowerCase();
  37896. return (name === "input" || name === "button") && elem.type === type;
  37897. };
  37898. }
  37899. /**
  37900. * Returns a function to use in pseudos for :enabled/:disabled
  37901. * @param {Boolean} disabled true for :disabled; false for :enabled
  37902. */
  37903. function createDisabledPseudo(disabled) {
  37904. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  37905. return function (elem) {
  37906. // Only certain elements can match :enabled or :disabled
  37907. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  37908. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  37909. if ("form" in elem) {
  37910. // Check for inherited disabledness on relevant non-disabled elements:
  37911. // * listed form-associated elements in a disabled fieldset
  37912. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  37913. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  37914. // * option elements in a disabled optgroup
  37915. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  37916. // All such elements have a "form" property.
  37917. if (elem.parentNode && elem.disabled === false) {
  37918. // Option elements defer to a parent optgroup if present
  37919. if ("label" in elem) {
  37920. if ("label" in elem.parentNode) {
  37921. return elem.parentNode.disabled === disabled;
  37922. } else {
  37923. return elem.disabled === disabled;
  37924. }
  37925. }
  37926. // Support: IE 6 - 11
  37927. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  37928. return elem.isDisabled === disabled ||
  37929. // Where there is no isDisabled, check manually
  37930. /* jshint -W018 */
  37931. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  37932. }
  37933. return elem.disabled === disabled;
  37934. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  37935. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  37936. // even exist on them, let alone have a boolean value.
  37937. } else if ("label" in elem) {
  37938. return elem.disabled === disabled;
  37939. }
  37940. // Remaining elements are neither :enabled nor :disabled
  37941. return false;
  37942. };
  37943. }
  37944. /**
  37945. * Returns a function to use in pseudos for positionals
  37946. * @param {Function} fn
  37947. */
  37948. function createPositionalPseudo(fn) {
  37949. return markFunction(function (argument) {
  37950. argument = +argument;
  37951. return markFunction(function (seed, matches) {
  37952. var j,
  37953. matchIndexes = fn([], seed.length, argument),
  37954. i = matchIndexes.length;
  37955. // Match elements found at the specified indexes
  37956. while (i--) {
  37957. if (seed[j = matchIndexes[i]]) {
  37958. seed[j] = !(matches[j] = seed[j]);
  37959. }
  37960. }
  37961. });
  37962. });
  37963. }
  37964. /**
  37965. * Checks a node for validity as a Sizzle context
  37966. * @param {Element|Object=} context
  37967. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  37968. */
  37969. function testContext(context) {
  37970. return context && typeof context.getElementsByTagName !== "undefined" && context;
  37971. }
  37972. // Expose support vars for convenience
  37973. support = Sizzle.support = {};
  37974. /**
  37975. * Detects XML nodes
  37976. * @param {Element|Object} elem An element or a document
  37977. * @returns {Boolean} True iff elem is a non-HTML XML node
  37978. */
  37979. isXML = Sizzle.isXML = function (elem) {
  37980. // documentElement is verified for cases where it doesn't yet exist
  37981. // (such as loading iframes in IE - #4833)
  37982. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  37983. return documentElement ? documentElement.nodeName !== "HTML" : false;
  37984. };
  37985. /**
  37986. * Sets document-related variables once based on the current document
  37987. * @param {Element|Object} [doc] An element or document object to use to set the document
  37988. * @returns {Object} Returns the current document
  37989. */
  37990. setDocument = Sizzle.setDocument = function (node) {
  37991. var hasCompare,
  37992. subWindow,
  37993. doc = node ? node.ownerDocument || node : preferredDoc;
  37994. // Return early if doc is invalid or already selected
  37995. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  37996. return document;
  37997. }
  37998. // Update global variables
  37999. document = doc;
  38000. docElem = document.documentElement;
  38001. documentIsHTML = !isXML(document);
  38002. // Support: IE 9-11, Edge
  38003. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  38004. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  38005. // Support: IE 11, Edge
  38006. if (subWindow.addEventListener) {
  38007. subWindow.addEventListener("unload", unloadHandler, false);
  38008. // Support: IE 9 - 10 only
  38009. } else if (subWindow.attachEvent) {
  38010. subWindow.attachEvent("onunload", unloadHandler);
  38011. }
  38012. }
  38013. /* Attributes
  38014. ---------------------------------------------------------------------- */
  38015. // Support: IE<8
  38016. // Verify that getAttribute really returns attributes and not properties
  38017. // (excepting IE8 booleans)
  38018. support.attributes = assert(function (el) {
  38019. el.className = "i";
  38020. return !el.getAttribute("className");
  38021. });
  38022. /* getElement(s)By*
  38023. ---------------------------------------------------------------------- */
  38024. // Check if getElementsByTagName("*") returns only elements
  38025. support.getElementsByTagName = assert(function (el) {
  38026. el.appendChild(document.createComment(""));
  38027. return !el.getElementsByTagName("*").length;
  38028. });
  38029. // Support: IE<9
  38030. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  38031. // Support: IE<10
  38032. // Check if getElementById returns elements by name
  38033. // The broken getElementById methods don't pick up programmatically-set names,
  38034. // so use a roundabout getElementsByName test
  38035. support.getById = assert(function (el) {
  38036. docElem.appendChild(el).id = expando;
  38037. return !document.getElementsByName || !document.getElementsByName(expando).length;
  38038. });
  38039. // ID filter and find
  38040. if (support.getById) {
  38041. Expr.filter["ID"] = function (id) {
  38042. var attrId = id.replace(runescape, funescape);
  38043. return function (elem) {
  38044. return elem.getAttribute("id") === attrId;
  38045. };
  38046. };
  38047. Expr.find["ID"] = function (id, context) {
  38048. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  38049. var elem = context.getElementById(id);
  38050. return elem ? [elem] : [];
  38051. }
  38052. };
  38053. } else {
  38054. Expr.filter["ID"] = function (id) {
  38055. var attrId = id.replace(runescape, funescape);
  38056. return function (elem) {
  38057. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  38058. return node && node.value === attrId;
  38059. };
  38060. };
  38061. // Support: IE 6 - 7 only
  38062. // getElementById is not reliable as a find shortcut
  38063. Expr.find["ID"] = function (id, context) {
  38064. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  38065. var node,
  38066. i,
  38067. elems,
  38068. elem = context.getElementById(id);
  38069. if (elem) {
  38070. // Verify the id attribute
  38071. node = elem.getAttributeNode("id");
  38072. if (node && node.value === id) {
  38073. return [elem];
  38074. }
  38075. // Fall back on getElementsByName
  38076. elems = context.getElementsByName(id);
  38077. i = 0;
  38078. while (elem = elems[i++]) {
  38079. node = elem.getAttributeNode("id");
  38080. if (node && node.value === id) {
  38081. return [elem];
  38082. }
  38083. }
  38084. }
  38085. return [];
  38086. }
  38087. };
  38088. }
  38089. // Tag
  38090. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  38091. if (typeof context.getElementsByTagName !== "undefined") {
  38092. return context.getElementsByTagName(tag);
  38093. // DocumentFragment nodes don't have gEBTN
  38094. } else if (support.qsa) {
  38095. return context.querySelectorAll(tag);
  38096. }
  38097. } : function (tag, context) {
  38098. var elem,
  38099. tmp = [],
  38100. i = 0,
  38101. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  38102. results = context.getElementsByTagName(tag);
  38103. // Filter out possible comments
  38104. if (tag === "*") {
  38105. while (elem = results[i++]) {
  38106. if (elem.nodeType === 1) {
  38107. tmp.push(elem);
  38108. }
  38109. }
  38110. return tmp;
  38111. }
  38112. return results;
  38113. };
  38114. // Class
  38115. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  38116. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  38117. return context.getElementsByClassName(className);
  38118. }
  38119. };
  38120. /* QSA/matchesSelector
  38121. ---------------------------------------------------------------------- */
  38122. // QSA and matchesSelector support
  38123. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  38124. rbuggyMatches = [];
  38125. // qSa(:focus) reports false when true (Chrome 21)
  38126. // We allow this because of a bug in IE8/9 that throws an error
  38127. // whenever `document.activeElement` is accessed on an iframe
  38128. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  38129. // See https://bugs.jquery.com/ticket/13378
  38130. rbuggyQSA = [];
  38131. if (support.qsa = rnative.test(document.querySelectorAll)) {
  38132. // Build QSA regex
  38133. // Regex strategy adopted from Diego Perini
  38134. assert(function (el) {
  38135. // Select is set to empty string on purpose
  38136. // This is to test IE's treatment of not explicitly
  38137. // setting a boolean content attribute,
  38138. // since its presence should be enough
  38139. // https://bugs.jquery.com/ticket/12359
  38140. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  38141. // Support: IE8, Opera 11-12.16
  38142. // Nothing should be selected when empty strings follow ^= or $= or *=
  38143. // The test attribute must be unknown in Opera but "safe" for WinRT
  38144. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  38145. if (el.querySelectorAll("[msallowcapture^='']").length) {
  38146. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  38147. }
  38148. // Support: IE8
  38149. // Boolean attributes and "value" are not treated correctly
  38150. if (!el.querySelectorAll("[selected]").length) {
  38151. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  38152. }
  38153. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  38154. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  38155. rbuggyQSA.push("~=");
  38156. }
  38157. // Webkit/Opera - :checked should return selected option elements
  38158. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38159. // IE8 throws error here and will not see later tests
  38160. if (!el.querySelectorAll(":checked").length) {
  38161. rbuggyQSA.push(":checked");
  38162. }
  38163. // Support: Safari 8+, iOS 8+
  38164. // https://bugs.webkit.org/show_bug.cgi?id=136851
  38165. // In-page `selector#id sibling-combinator selector` fails
  38166. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  38167. rbuggyQSA.push(".#.+[+~]");
  38168. }
  38169. });
  38170. assert(function (el) {
  38171. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  38172. // Support: Windows 8 Native Apps
  38173. // The type and name attributes are restricted during .innerHTML assignment
  38174. var input = document.createElement("input");
  38175. input.setAttribute("type", "hidden");
  38176. el.appendChild(input).setAttribute("name", "D");
  38177. // Support: IE8
  38178. // Enforce case-sensitivity of name attribute
  38179. if (el.querySelectorAll("[name=d]").length) {
  38180. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  38181. }
  38182. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  38183. // IE8 throws error here and will not see later tests
  38184. if (el.querySelectorAll(":enabled").length !== 2) {
  38185. rbuggyQSA.push(":enabled", ":disabled");
  38186. }
  38187. // Support: IE9-11+
  38188. // IE's :disabled selector does not pick up the children of disabled fieldsets
  38189. docElem.appendChild(el).disabled = true;
  38190. if (el.querySelectorAll(":disabled").length !== 2) {
  38191. rbuggyQSA.push(":enabled", ":disabled");
  38192. }
  38193. // Opera 10-11 does not throw on post-comma invalid pseudos
  38194. el.querySelectorAll("*,:x");
  38195. rbuggyQSA.push(",.*:");
  38196. });
  38197. }
  38198. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  38199. assert(function (el) {
  38200. // Check to see if it's possible to do matchesSelector
  38201. // on a disconnected node (IE 9)
  38202. support.disconnectedMatch = matches.call(el, "*");
  38203. // This should fail with an exception
  38204. // Gecko does not error, returns false instead
  38205. matches.call(el, "[s!='']:x");
  38206. rbuggyMatches.push("!=", pseudos);
  38207. });
  38208. }
  38209. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  38210. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  38211. /* Contains
  38212. ---------------------------------------------------------------------- */
  38213. hasCompare = rnative.test(docElem.compareDocumentPosition);
  38214. // Element contains another
  38215. // Purposefully self-exclusive
  38216. // As in, an element does not contain itself
  38217. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  38218. var adown = a.nodeType === 9 ? a.documentElement : a,
  38219. bup = b && b.parentNode;
  38220. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  38221. } : function (a, b) {
  38222. if (b) {
  38223. while (b = b.parentNode) {
  38224. if (b === a) {
  38225. return true;
  38226. }
  38227. }
  38228. }
  38229. return false;
  38230. };
  38231. /* Sorting
  38232. ---------------------------------------------------------------------- */
  38233. // Document order sorting
  38234. sortOrder = hasCompare ? function (a, b) {
  38235. // Flag for duplicate removal
  38236. if (a === b) {
  38237. hasDuplicate = true;
  38238. return 0;
  38239. }
  38240. // Sort on method existence if only one input has compareDocumentPosition
  38241. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  38242. if (compare) {
  38243. return compare;
  38244. }
  38245. // Calculate position if both inputs belong to the same document
  38246. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  38247. // Otherwise we know they are disconnected
  38248. 1;
  38249. // Disconnected nodes
  38250. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  38251. // Choose the first element that is related to our preferred document
  38252. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  38253. return -1;
  38254. }
  38255. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  38256. return 1;
  38257. }
  38258. // Maintain original order
  38259. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  38260. }
  38261. return compare & 4 ? -1 : 1;
  38262. } : function (a, b) {
  38263. // Exit early if the nodes are identical
  38264. if (a === b) {
  38265. hasDuplicate = true;
  38266. return 0;
  38267. }
  38268. var cur,
  38269. i = 0,
  38270. aup = a.parentNode,
  38271. bup = b.parentNode,
  38272. ap = [a],
  38273. bp = [b];
  38274. // Parentless nodes are either documents or disconnected
  38275. if (!aup || !bup) {
  38276. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  38277. // If the nodes are siblings, we can do a quick check
  38278. } else if (aup === bup) {
  38279. return siblingCheck(a, b);
  38280. }
  38281. // Otherwise we need full lists of their ancestors for comparison
  38282. cur = a;
  38283. while (cur = cur.parentNode) {
  38284. ap.unshift(cur);
  38285. }
  38286. cur = b;
  38287. while (cur = cur.parentNode) {
  38288. bp.unshift(cur);
  38289. }
  38290. // Walk down the tree looking for a discrepancy
  38291. while (ap[i] === bp[i]) {
  38292. i++;
  38293. }
  38294. return i ?
  38295. // Do a sibling check if the nodes have a common ancestor
  38296. siblingCheck(ap[i], bp[i]) :
  38297. // Otherwise nodes in our document sort first
  38298. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  38299. };
  38300. return document;
  38301. };
  38302. Sizzle.matches = function (expr, elements) {
  38303. return Sizzle(expr, null, null, elements);
  38304. };
  38305. Sizzle.matchesSelector = function (elem, expr) {
  38306. // Set document vars if needed
  38307. if ((elem.ownerDocument || elem) !== document) {
  38308. setDocument(elem);
  38309. }
  38310. // Make sure that attribute selectors are quoted
  38311. expr = expr.replace(rattributeQuotes, "='$1']");
  38312. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  38313. try {
  38314. var ret = matches.call(elem, expr);
  38315. // IE 9's matchesSelector returns false on disconnected nodes
  38316. if (ret || support.disconnectedMatch ||
  38317. // As well, disconnected nodes are said to be in a document
  38318. // fragment in IE 9
  38319. elem.document && elem.document.nodeType !== 11) {
  38320. return ret;
  38321. }
  38322. } catch (e) {}
  38323. }
  38324. return Sizzle(expr, document, null, [elem]).length > 0;
  38325. };
  38326. Sizzle.contains = function (context, elem) {
  38327. // Set document vars if needed
  38328. if ((context.ownerDocument || context) !== document) {
  38329. setDocument(context);
  38330. }
  38331. return contains(context, elem);
  38332. };
  38333. Sizzle.attr = function (elem, name) {
  38334. // Set document vars if needed
  38335. if ((elem.ownerDocument || elem) !== document) {
  38336. setDocument(elem);
  38337. }
  38338. var fn = Expr.attrHandle[name.toLowerCase()],
  38339. // Don't get fooled by Object.prototype properties (jQuery #13807)
  38340. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  38341. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38342. };
  38343. Sizzle.escape = function (sel) {
  38344. return (sel + "").replace(rcssescape, fcssescape);
  38345. };
  38346. Sizzle.error = function (msg) {
  38347. throw new Error("Syntax error, unrecognized expression: " + msg);
  38348. };
  38349. /**
  38350. * Document sorting and removing duplicates
  38351. * @param {ArrayLike} results
  38352. */
  38353. Sizzle.uniqueSort = function (results) {
  38354. var elem,
  38355. duplicates = [],
  38356. j = 0,
  38357. i = 0;
  38358. // Unless we *know* we can detect duplicates, assume their presence
  38359. hasDuplicate = !support.detectDuplicates;
  38360. sortInput = !support.sortStable && results.slice(0);
  38361. results.sort(sortOrder);
  38362. if (hasDuplicate) {
  38363. while (elem = results[i++]) {
  38364. if (elem === results[i]) {
  38365. j = duplicates.push(i);
  38366. }
  38367. }
  38368. while (j--) {
  38369. results.splice(duplicates[j], 1);
  38370. }
  38371. }
  38372. // Clear input after sorting to release objects
  38373. // See https://github.com/jquery/sizzle/pull/225
  38374. sortInput = null;
  38375. return results;
  38376. };
  38377. /**
  38378. * Utility function for retrieving the text value of an array of DOM nodes
  38379. * @param {Array|Element} elem
  38380. */
  38381. getText = Sizzle.getText = function (elem) {
  38382. var node,
  38383. ret = "",
  38384. i = 0,
  38385. nodeType = elem.nodeType;
  38386. if (!nodeType) {
  38387. // If no nodeType, this is expected to be an array
  38388. while (node = elem[i++]) {
  38389. // Do not traverse comment nodes
  38390. ret += getText(node);
  38391. }
  38392. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  38393. // Use textContent for elements
  38394. // innerText usage removed for consistency of new lines (jQuery #11153)
  38395. if (typeof elem.textContent === "string") {
  38396. return elem.textContent;
  38397. } else {
  38398. // Traverse its children
  38399. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38400. ret += getText(elem);
  38401. }
  38402. }
  38403. } else if (nodeType === 3 || nodeType === 4) {
  38404. return elem.nodeValue;
  38405. }
  38406. // Do not include comment or processing instruction nodes
  38407. return ret;
  38408. };
  38409. Expr = Sizzle.selectors = {
  38410. // Can be adjusted by the user
  38411. cacheLength: 50,
  38412. createPseudo: markFunction,
  38413. match: matchExpr,
  38414. attrHandle: {},
  38415. find: {},
  38416. relative: {
  38417. ">": { dir: "parentNode", first: true },
  38418. " ": { dir: "parentNode" },
  38419. "+": { dir: "previousSibling", first: true },
  38420. "~": { dir: "previousSibling" }
  38421. },
  38422. preFilter: {
  38423. "ATTR": function ATTR(match) {
  38424. match[1] = match[1].replace(runescape, funescape);
  38425. // Move the given value to match[3] whether quoted or unquoted
  38426. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  38427. if (match[2] === "~=") {
  38428. match[3] = " " + match[3] + " ";
  38429. }
  38430. return match.slice(0, 4);
  38431. },
  38432. "CHILD": function CHILD(match) {
  38433. /* matches from matchExpr["CHILD"]
  38434. 1 type (only|nth|...)
  38435. 2 what (child|of-type)
  38436. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  38437. 4 xn-component of xn+y argument ([+-]?\d*n|)
  38438. 5 sign of xn-component
  38439. 6 x of xn-component
  38440. 7 sign of y-component
  38441. 8 y of y-component
  38442. */
  38443. match[1] = match[1].toLowerCase();
  38444. if (match[1].slice(0, 3) === "nth") {
  38445. // nth-* requires argument
  38446. if (!match[3]) {
  38447. Sizzle.error(match[0]);
  38448. }
  38449. // numeric x and y parameters for Expr.filter.CHILD
  38450. // remember that false/true cast respectively to 0/1
  38451. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  38452. match[5] = +(match[7] + match[8] || match[3] === "odd");
  38453. // other types prohibit arguments
  38454. } else if (match[3]) {
  38455. Sizzle.error(match[0]);
  38456. }
  38457. return match;
  38458. },
  38459. "PSEUDO": function PSEUDO(match) {
  38460. var excess,
  38461. unquoted = !match[6] && match[2];
  38462. if (matchExpr["CHILD"].test(match[0])) {
  38463. return null;
  38464. }
  38465. // Accept quoted arguments as-is
  38466. if (match[3]) {
  38467. match[2] = match[4] || match[5] || "";
  38468. // Strip excess characters from unquoted arguments
  38469. } else if (unquoted && rpseudo.test(unquoted) && (
  38470. // Get excess from tokenize (recursively)
  38471. excess = tokenize(unquoted, true)) && (
  38472. // advance to the next closing parenthesis
  38473. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  38474. // excess is a negative index
  38475. match[0] = match[0].slice(0, excess);
  38476. match[2] = unquoted.slice(0, excess);
  38477. }
  38478. // Return only captures needed by the pseudo filter method (type and argument)
  38479. return match.slice(0, 3);
  38480. }
  38481. },
  38482. filter: {
  38483. "TAG": function TAG(nodeNameSelector) {
  38484. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  38485. return nodeNameSelector === "*" ? function () {
  38486. return true;
  38487. } : function (elem) {
  38488. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  38489. };
  38490. },
  38491. "CLASS": function CLASS(className) {
  38492. var pattern = classCache[className + " "];
  38493. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  38494. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  38495. });
  38496. },
  38497. "ATTR": function ATTR(name, operator, check) {
  38498. return function (elem) {
  38499. var result = Sizzle.attr(elem, name);
  38500. if (result == null) {
  38501. return operator === "!=";
  38502. }
  38503. if (!operator) {
  38504. return true;
  38505. }
  38506. result += "";
  38507. return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
  38508. };
  38509. },
  38510. "CHILD": function CHILD(type, what, argument, first, last) {
  38511. var simple = type.slice(0, 3) !== "nth",
  38512. forward = type.slice(-4) !== "last",
  38513. ofType = what === "of-type";
  38514. return first === 1 && last === 0 ?
  38515. // Shortcut for :nth-*(n)
  38516. function (elem) {
  38517. return !!elem.parentNode;
  38518. } : function (elem, context, xml) {
  38519. var cache,
  38520. uniqueCache,
  38521. outerCache,
  38522. node,
  38523. nodeIndex,
  38524. start,
  38525. dir = simple !== forward ? "nextSibling" : "previousSibling",
  38526. parent = elem.parentNode,
  38527. name = ofType && elem.nodeName.toLowerCase(),
  38528. useCache = !xml && !ofType,
  38529. diff = false;
  38530. if (parent) {
  38531. // :(first|last|only)-(child|of-type)
  38532. if (simple) {
  38533. while (dir) {
  38534. node = elem;
  38535. while (node = node[dir]) {
  38536. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  38537. return false;
  38538. }
  38539. }
  38540. // Reverse direction for :only-* (if we haven't yet done so)
  38541. start = dir = type === "only" && !start && "nextSibling";
  38542. }
  38543. return true;
  38544. }
  38545. start = [forward ? parent.firstChild : parent.lastChild];
  38546. // non-xml :nth-child(...) stores cache data on `parent`
  38547. if (forward && useCache) {
  38548. // Seek `elem` from a previously-cached index
  38549. // ...in a gzip-friendly way
  38550. node = parent;
  38551. outerCache = node[expando] || (node[expando] = {});
  38552. // Support: IE <9 only
  38553. // Defend against cloned attroperties (jQuery gh-1709)
  38554. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38555. cache = uniqueCache[type] || [];
  38556. nodeIndex = cache[0] === dirruns && cache[1];
  38557. diff = nodeIndex && cache[2];
  38558. node = nodeIndex && parent.childNodes[nodeIndex];
  38559. while (node = ++nodeIndex && node && node[dir] || (
  38560. // Fallback to seeking `elem` from the start
  38561. diff = nodeIndex = 0) || start.pop()) {
  38562. // When found, cache indexes on `parent` and break
  38563. if (node.nodeType === 1 && ++diff && node === elem) {
  38564. uniqueCache[type] = [dirruns, nodeIndex, diff];
  38565. break;
  38566. }
  38567. }
  38568. } else {
  38569. // Use previously-cached element index if available
  38570. if (useCache) {
  38571. // ...in a gzip-friendly way
  38572. node = elem;
  38573. outerCache = node[expando] || (node[expando] = {});
  38574. // Support: IE <9 only
  38575. // Defend against cloned attroperties (jQuery gh-1709)
  38576. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38577. cache = uniqueCache[type] || [];
  38578. nodeIndex = cache[0] === dirruns && cache[1];
  38579. diff = nodeIndex;
  38580. }
  38581. // xml :nth-child(...)
  38582. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  38583. if (diff === false) {
  38584. // Use the same loop as above to seek `elem` from the start
  38585. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  38586. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  38587. // Cache the index of each encountered element
  38588. if (useCache) {
  38589. outerCache = node[expando] || (node[expando] = {});
  38590. // Support: IE <9 only
  38591. // Defend against cloned attroperties (jQuery gh-1709)
  38592. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38593. uniqueCache[type] = [dirruns, diff];
  38594. }
  38595. if (node === elem) {
  38596. break;
  38597. }
  38598. }
  38599. }
  38600. }
  38601. }
  38602. // Incorporate the offset, then check against cycle size
  38603. diff -= last;
  38604. return diff === first || diff % first === 0 && diff / first >= 0;
  38605. }
  38606. };
  38607. },
  38608. "PSEUDO": function PSEUDO(pseudo, argument) {
  38609. // pseudo-class names are case-insensitive
  38610. // http://www.w3.org/TR/selectors/#pseudo-classes
  38611. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38612. // Remember that setFilters inherits from pseudos
  38613. var args,
  38614. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38615. // The user may use createPseudo to indicate that
  38616. // arguments are needed to create the filter function
  38617. // just as Sizzle does
  38618. if (fn[expando]) {
  38619. return fn(argument);
  38620. }
  38621. // But maintain support for old signatures
  38622. if (fn.length > 1) {
  38623. args = [pseudo, pseudo, "", argument];
  38624. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38625. var idx,
  38626. matched = fn(seed, argument),
  38627. i = matched.length;
  38628. while (i--) {
  38629. idx = indexOf(seed, matched[i]);
  38630. seed[idx] = !(matches[idx] = matched[i]);
  38631. }
  38632. }) : function (elem) {
  38633. return fn(elem, 0, args);
  38634. };
  38635. }
  38636. return fn;
  38637. }
  38638. },
  38639. pseudos: {
  38640. // Potentially complex pseudos
  38641. "not": markFunction(function (selector) {
  38642. // Trim the selector passed to compile
  38643. // to avoid treating leading and trailing
  38644. // spaces as combinators
  38645. var input = [],
  38646. results = [],
  38647. matcher = compile(selector.replace(rtrim, "$1"));
  38648. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38649. var elem,
  38650. unmatched = matcher(seed, null, xml, []),
  38651. i = seed.length;
  38652. // Match elements unmatched by `matcher`
  38653. while (i--) {
  38654. if (elem = unmatched[i]) {
  38655. seed[i] = !(matches[i] = elem);
  38656. }
  38657. }
  38658. }) : function (elem, context, xml) {
  38659. input[0] = elem;
  38660. matcher(input, null, xml, results);
  38661. // Don't keep the element (issue #299)
  38662. input[0] = null;
  38663. return !results.pop();
  38664. };
  38665. }),
  38666. "has": markFunction(function (selector) {
  38667. return function (elem) {
  38668. return Sizzle(selector, elem).length > 0;
  38669. };
  38670. }),
  38671. "contains": markFunction(function (text) {
  38672. text = text.replace(runescape, funescape);
  38673. return function (elem) {
  38674. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38675. };
  38676. }),
  38677. // "Whether an element is represented by a :lang() selector
  38678. // is based solely on the element's language value
  38679. // being equal to the identifier C,
  38680. // or beginning with the identifier C immediately followed by "-".
  38681. // The matching of C against the element's language value is performed case-insensitively.
  38682. // The identifier C does not have to be a valid language name."
  38683. // http://www.w3.org/TR/selectors/#lang-pseudo
  38684. "lang": markFunction(function (lang) {
  38685. // lang value must be a valid identifier
  38686. if (!ridentifier.test(lang || "")) {
  38687. Sizzle.error("unsupported lang: " + lang);
  38688. }
  38689. lang = lang.replace(runescape, funescape).toLowerCase();
  38690. return function (elem) {
  38691. var elemLang;
  38692. do {
  38693. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38694. elemLang = elemLang.toLowerCase();
  38695. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38696. }
  38697. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38698. return false;
  38699. };
  38700. }),
  38701. // Miscellaneous
  38702. "target": function target(elem) {
  38703. var hash = window.location && window.location.hash;
  38704. return hash && hash.slice(1) === elem.id;
  38705. },
  38706. "root": function root(elem) {
  38707. return elem === docElem;
  38708. },
  38709. "focus": function focus(elem) {
  38710. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38711. },
  38712. // Boolean properties
  38713. "enabled": createDisabledPseudo(false),
  38714. "disabled": createDisabledPseudo(true),
  38715. "checked": function checked(elem) {
  38716. // In CSS3, :checked should return both checked and selected elements
  38717. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38718. var nodeName = elem.nodeName.toLowerCase();
  38719. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38720. },
  38721. "selected": function selected(elem) {
  38722. // Accessing this property makes selected-by-default
  38723. // options in Safari work properly
  38724. if (elem.parentNode) {
  38725. elem.parentNode.selectedIndex;
  38726. }
  38727. return elem.selected === true;
  38728. },
  38729. // Contents
  38730. "empty": function empty(elem) {
  38731. // http://www.w3.org/TR/selectors/#empty-pseudo
  38732. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  38733. // but not by others (comment: 8; processing instruction: 7; etc.)
  38734. // nodeType < 6 works because attributes (2) do not appear as children
  38735. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38736. if (elem.nodeType < 6) {
  38737. return false;
  38738. }
  38739. }
  38740. return true;
  38741. },
  38742. "parent": function parent(elem) {
  38743. return !Expr.pseudos["empty"](elem);
  38744. },
  38745. // Element/input types
  38746. "header": function header(elem) {
  38747. return rheader.test(elem.nodeName);
  38748. },
  38749. "input": function input(elem) {
  38750. return rinputs.test(elem.nodeName);
  38751. },
  38752. "button": function button(elem) {
  38753. var name = elem.nodeName.toLowerCase();
  38754. return name === "input" && elem.type === "button" || name === "button";
  38755. },
  38756. "text": function text(elem) {
  38757. var attr;
  38758. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  38759. // Support: IE<8
  38760. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  38761. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  38762. },
  38763. // Position-in-collection
  38764. "first": createPositionalPseudo(function () {
  38765. return [0];
  38766. }),
  38767. "last": createPositionalPseudo(function (matchIndexes, length) {
  38768. return [length - 1];
  38769. }),
  38770. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  38771. return [argument < 0 ? argument + length : argument];
  38772. }),
  38773. "even": createPositionalPseudo(function (matchIndexes, length) {
  38774. var i = 0;
  38775. for (; i < length; i += 2) {
  38776. matchIndexes.push(i);
  38777. }
  38778. return matchIndexes;
  38779. }),
  38780. "odd": createPositionalPseudo(function (matchIndexes, length) {
  38781. var i = 1;
  38782. for (; i < length; i += 2) {
  38783. matchIndexes.push(i);
  38784. }
  38785. return matchIndexes;
  38786. }),
  38787. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38788. var i = argument < 0 ? argument + length : argument;
  38789. for (; --i >= 0;) {
  38790. matchIndexes.push(i);
  38791. }
  38792. return matchIndexes;
  38793. }),
  38794. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38795. var i = argument < 0 ? argument + length : argument;
  38796. for (; ++i < length;) {
  38797. matchIndexes.push(i);
  38798. }
  38799. return matchIndexes;
  38800. })
  38801. }
  38802. };
  38803. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  38804. // Add button/input type pseudos
  38805. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  38806. Expr.pseudos[i] = createInputPseudo(i);
  38807. }
  38808. for (i in { submit: true, reset: true }) {
  38809. Expr.pseudos[i] = createButtonPseudo(i);
  38810. }
  38811. // Easy API for creating new setFilters
  38812. function setFilters() {}
  38813. setFilters.prototype = Expr.filters = Expr.pseudos;
  38814. Expr.setFilters = new setFilters();
  38815. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  38816. var matched,
  38817. match,
  38818. tokens,
  38819. type,
  38820. soFar,
  38821. groups,
  38822. preFilters,
  38823. cached = tokenCache[selector + " "];
  38824. if (cached) {
  38825. return parseOnly ? 0 : cached.slice(0);
  38826. }
  38827. soFar = selector;
  38828. groups = [];
  38829. preFilters = Expr.preFilter;
  38830. while (soFar) {
  38831. // Comma and first run
  38832. if (!matched || (match = rcomma.exec(soFar))) {
  38833. if (match) {
  38834. // Don't consume trailing commas as valid
  38835. soFar = soFar.slice(match[0].length) || soFar;
  38836. }
  38837. groups.push(tokens = []);
  38838. }
  38839. matched = false;
  38840. // Combinators
  38841. if (match = rcombinators.exec(soFar)) {
  38842. matched = match.shift();
  38843. tokens.push({
  38844. value: matched,
  38845. // Cast descendant combinators to space
  38846. type: match[0].replace(rtrim, " ")
  38847. });
  38848. soFar = soFar.slice(matched.length);
  38849. }
  38850. // Filters
  38851. for (type in Expr.filter) {
  38852. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  38853. matched = match.shift();
  38854. tokens.push({
  38855. value: matched,
  38856. type: type,
  38857. matches: match
  38858. });
  38859. soFar = soFar.slice(matched.length);
  38860. }
  38861. }
  38862. if (!matched) {
  38863. break;
  38864. }
  38865. }
  38866. // Return the length of the invalid excess
  38867. // if we're just parsing
  38868. // Otherwise, throw an error or return tokens
  38869. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  38870. // Cache the tokens
  38871. tokenCache(selector, groups).slice(0);
  38872. };
  38873. function toSelector(tokens) {
  38874. var i = 0,
  38875. len = tokens.length,
  38876. selector = "";
  38877. for (; i < len; i++) {
  38878. selector += tokens[i].value;
  38879. }
  38880. return selector;
  38881. }
  38882. function addCombinator(matcher, combinator, base) {
  38883. var dir = combinator.dir,
  38884. skip = combinator.next,
  38885. key = skip || dir,
  38886. checkNonElements = base && key === "parentNode",
  38887. doneName = done++;
  38888. return combinator.first ?
  38889. // Check against closest ancestor/preceding element
  38890. function (elem, context, xml) {
  38891. while (elem = elem[dir]) {
  38892. if (elem.nodeType === 1 || checkNonElements) {
  38893. return matcher(elem, context, xml);
  38894. }
  38895. }
  38896. return false;
  38897. } :
  38898. // Check against all ancestor/preceding elements
  38899. function (elem, context, xml) {
  38900. var oldCache,
  38901. uniqueCache,
  38902. outerCache,
  38903. newCache = [dirruns, doneName];
  38904. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  38905. if (xml) {
  38906. while (elem = elem[dir]) {
  38907. if (elem.nodeType === 1 || checkNonElements) {
  38908. if (matcher(elem, context, xml)) {
  38909. return true;
  38910. }
  38911. }
  38912. }
  38913. } else {
  38914. while (elem = elem[dir]) {
  38915. if (elem.nodeType === 1 || checkNonElements) {
  38916. outerCache = elem[expando] || (elem[expando] = {});
  38917. // Support: IE <9 only
  38918. // Defend against cloned attroperties (jQuery gh-1709)
  38919. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  38920. if (skip && skip === elem.nodeName.toLowerCase()) {
  38921. elem = elem[dir] || elem;
  38922. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  38923. // Assign to newCache so results back-propagate to previous elements
  38924. return newCache[2] = oldCache[2];
  38925. } else {
  38926. // Reuse newcache so results back-propagate to previous elements
  38927. uniqueCache[key] = newCache;
  38928. // A match means we're done; a fail means we have to keep checking
  38929. if (newCache[2] = matcher(elem, context, xml)) {
  38930. return true;
  38931. }
  38932. }
  38933. }
  38934. }
  38935. }
  38936. return false;
  38937. };
  38938. }
  38939. function elementMatcher(matchers) {
  38940. return matchers.length > 1 ? function (elem, context, xml) {
  38941. var i = matchers.length;
  38942. while (i--) {
  38943. if (!matchers[i](elem, context, xml)) {
  38944. return false;
  38945. }
  38946. }
  38947. return true;
  38948. } : matchers[0];
  38949. }
  38950. function multipleContexts(selector, contexts, results) {
  38951. var i = 0,
  38952. len = contexts.length;
  38953. for (; i < len; i++) {
  38954. Sizzle(selector, contexts[i], results);
  38955. }
  38956. return results;
  38957. }
  38958. function condense(unmatched, map, filter, context, xml) {
  38959. var elem,
  38960. newUnmatched = [],
  38961. i = 0,
  38962. len = unmatched.length,
  38963. mapped = map != null;
  38964. for (; i < len; i++) {
  38965. if (elem = unmatched[i]) {
  38966. if (!filter || filter(elem, context, xml)) {
  38967. newUnmatched.push(elem);
  38968. if (mapped) {
  38969. map.push(i);
  38970. }
  38971. }
  38972. }
  38973. }
  38974. return newUnmatched;
  38975. }
  38976. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  38977. if (postFilter && !postFilter[expando]) {
  38978. postFilter = setMatcher(postFilter);
  38979. }
  38980. if (postFinder && !postFinder[expando]) {
  38981. postFinder = setMatcher(postFinder, postSelector);
  38982. }
  38983. return markFunction(function (seed, results, context, xml) {
  38984. var temp,
  38985. i,
  38986. elem,
  38987. preMap = [],
  38988. postMap = [],
  38989. preexisting = results.length,
  38990. // Get initial elements from seed or context
  38991. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  38992. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  38993. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  38994. matcherOut = matcher ?
  38995. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  38996. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  38997. // ...intermediate processing is necessary
  38998. [] :
  38999. // ...otherwise use results directly
  39000. results : matcherIn;
  39001. // Find primary matches
  39002. if (matcher) {
  39003. matcher(matcherIn, matcherOut, context, xml);
  39004. }
  39005. // Apply postFilter
  39006. if (postFilter) {
  39007. temp = condense(matcherOut, postMap);
  39008. postFilter(temp, [], context, xml);
  39009. // Un-match failing elements by moving them back to matcherIn
  39010. i = temp.length;
  39011. while (i--) {
  39012. if (elem = temp[i]) {
  39013. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  39014. }
  39015. }
  39016. }
  39017. if (seed) {
  39018. if (postFinder || preFilter) {
  39019. if (postFinder) {
  39020. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  39021. temp = [];
  39022. i = matcherOut.length;
  39023. while (i--) {
  39024. if (elem = matcherOut[i]) {
  39025. // Restore matcherIn since elem is not yet a final match
  39026. temp.push(matcherIn[i] = elem);
  39027. }
  39028. }
  39029. postFinder(null, matcherOut = [], temp, xml);
  39030. }
  39031. // Move matched elements from seed to results to keep them synchronized
  39032. i = matcherOut.length;
  39033. while (i--) {
  39034. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  39035. seed[temp] = !(results[temp] = elem);
  39036. }
  39037. }
  39038. }
  39039. // Add elements to results, through postFinder if defined
  39040. } else {
  39041. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  39042. if (postFinder) {
  39043. postFinder(null, results, matcherOut, xml);
  39044. } else {
  39045. push.apply(results, matcherOut);
  39046. }
  39047. }
  39048. });
  39049. }
  39050. function matcherFromTokens(tokens) {
  39051. var checkContext,
  39052. matcher,
  39053. j,
  39054. len = tokens.length,
  39055. leadingRelative = Expr.relative[tokens[0].type],
  39056. implicitRelative = leadingRelative || Expr.relative[" "],
  39057. i = leadingRelative ? 1 : 0,
  39058. // The foundational matcher ensures that elements are reachable from top-level context(s)
  39059. matchContext = addCombinator(function (elem) {
  39060. return elem === checkContext;
  39061. }, implicitRelative, true),
  39062. matchAnyContext = addCombinator(function (elem) {
  39063. return indexOf(checkContext, elem) > -1;
  39064. }, implicitRelative, true),
  39065. matchers = [function (elem, context, xml) {
  39066. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  39067. // Avoid hanging onto element (issue #299)
  39068. checkContext = null;
  39069. return ret;
  39070. }];
  39071. for (; i < len; i++) {
  39072. if (matcher = Expr.relative[tokens[i].type]) {
  39073. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  39074. } else {
  39075. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  39076. // Return special upon seeing a positional matcher
  39077. if (matcher[expando]) {
  39078. // Find the next relative operator (if any) for proper handling
  39079. j = ++i;
  39080. for (; j < len; j++) {
  39081. if (Expr.relative[tokens[j].type]) {
  39082. break;
  39083. }
  39084. }
  39085. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  39086. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  39087. tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
  39088. }
  39089. matchers.push(matcher);
  39090. }
  39091. }
  39092. return elementMatcher(matchers);
  39093. }
  39094. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  39095. var bySet = setMatchers.length > 0,
  39096. byElement = elementMatchers.length > 0,
  39097. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  39098. var elem,
  39099. j,
  39100. matcher,
  39101. matchedCount = 0,
  39102. i = "0",
  39103. unmatched = seed && [],
  39104. setMatched = [],
  39105. contextBackup = outermostContext,
  39106. // We must always have either seed elements or outermost context
  39107. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  39108. // Use integer dirruns iff this is the outermost matcher
  39109. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  39110. len = elems.length;
  39111. if (outermost) {
  39112. outermostContext = context === document || context || outermost;
  39113. }
  39114. // Add elements passing elementMatchers directly to results
  39115. // Support: IE<9, Safari
  39116. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  39117. for (; i !== len && (elem = elems[i]) != null; i++) {
  39118. if (byElement && elem) {
  39119. j = 0;
  39120. if (!context && elem.ownerDocument !== document) {
  39121. setDocument(elem);
  39122. xml = !documentIsHTML;
  39123. }
  39124. while (matcher = elementMatchers[j++]) {
  39125. if (matcher(elem, context || document, xml)) {
  39126. results.push(elem);
  39127. break;
  39128. }
  39129. }
  39130. if (outermost) {
  39131. dirruns = dirrunsUnique;
  39132. }
  39133. }
  39134. // Track unmatched elements for set filters
  39135. if (bySet) {
  39136. // They will have gone through all possible matchers
  39137. if (elem = !matcher && elem) {
  39138. matchedCount--;
  39139. }
  39140. // Lengthen the array for every element, matched or not
  39141. if (seed) {
  39142. unmatched.push(elem);
  39143. }
  39144. }
  39145. }
  39146. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  39147. // makes the latter nonnegative.
  39148. matchedCount += i;
  39149. // Apply set filters to unmatched elements
  39150. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  39151. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  39152. // no element matchers and no seed.
  39153. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  39154. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  39155. // numerically zero.
  39156. if (bySet && i !== matchedCount) {
  39157. j = 0;
  39158. while (matcher = setMatchers[j++]) {
  39159. matcher(unmatched, setMatched, context, xml);
  39160. }
  39161. if (seed) {
  39162. // Reintegrate element matches to eliminate the need for sorting
  39163. if (matchedCount > 0) {
  39164. while (i--) {
  39165. if (!(unmatched[i] || setMatched[i])) {
  39166. setMatched[i] = pop.call(results);
  39167. }
  39168. }
  39169. }
  39170. // Discard index placeholder values to get only actual matches
  39171. setMatched = condense(setMatched);
  39172. }
  39173. // Add matches to results
  39174. push.apply(results, setMatched);
  39175. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  39176. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  39177. Sizzle.uniqueSort(results);
  39178. }
  39179. }
  39180. // Override manipulation of globals by nested matchers
  39181. if (outermost) {
  39182. dirruns = dirrunsUnique;
  39183. outermostContext = contextBackup;
  39184. }
  39185. return unmatched;
  39186. };
  39187. return bySet ? markFunction(superMatcher) : superMatcher;
  39188. }
  39189. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  39190. var i,
  39191. setMatchers = [],
  39192. elementMatchers = [],
  39193. cached = compilerCache[selector + " "];
  39194. if (!cached) {
  39195. // Generate a function of recursive functions that can be used to check each element
  39196. if (!match) {
  39197. match = tokenize(selector);
  39198. }
  39199. i = match.length;
  39200. while (i--) {
  39201. cached = matcherFromTokens(match[i]);
  39202. if (cached[expando]) {
  39203. setMatchers.push(cached);
  39204. } else {
  39205. elementMatchers.push(cached);
  39206. }
  39207. }
  39208. // Cache the compiled function
  39209. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  39210. // Save selector and tokenization
  39211. cached.selector = selector;
  39212. }
  39213. return cached;
  39214. };
  39215. /**
  39216. * A low-level selection function that works with Sizzle's compiled
  39217. * selector functions
  39218. * @param {String|Function} selector A selector or a pre-compiled
  39219. * selector function built with Sizzle.compile
  39220. * @param {Element} context
  39221. * @param {Array} [results]
  39222. * @param {Array} [seed] A set of elements to match against
  39223. */
  39224. select = Sizzle.select = function (selector, context, results, seed) {
  39225. var i,
  39226. tokens,
  39227. token,
  39228. type,
  39229. find,
  39230. compiled = typeof selector === "function" && selector,
  39231. match = !seed && tokenize(selector = compiled.selector || selector);
  39232. results = results || [];
  39233. // Try to minimize operations if there is only one selector in the list and no seed
  39234. // (the latter of which guarantees us context)
  39235. if (match.length === 1) {
  39236. // Reduce context if the leading compound selector is an ID
  39237. tokens = match[0] = match[0].slice(0);
  39238. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  39239. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  39240. if (!context) {
  39241. return results;
  39242. // Precompiled matchers will still verify ancestry, so step up a level
  39243. } else if (compiled) {
  39244. context = context.parentNode;
  39245. }
  39246. selector = selector.slice(tokens.shift().value.length);
  39247. }
  39248. // Fetch a seed set for right-to-left matching
  39249. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  39250. while (i--) {
  39251. token = tokens[i];
  39252. // Abort if we hit a combinator
  39253. if (Expr.relative[type = token.type]) {
  39254. break;
  39255. }
  39256. if (find = Expr.find[type]) {
  39257. // Search, expanding context for leading sibling combinators
  39258. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  39259. // If seed is empty or no tokens remain, we can return early
  39260. tokens.splice(i, 1);
  39261. selector = seed.length && toSelector(tokens);
  39262. if (!selector) {
  39263. push.apply(results, seed);
  39264. return results;
  39265. }
  39266. break;
  39267. }
  39268. }
  39269. }
  39270. }
  39271. // Compile and execute a filtering function if one is not provided
  39272. // Provide `match` to avoid retokenization if we modified the selector above
  39273. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  39274. return results;
  39275. };
  39276. // One-time assignments
  39277. // Sort stability
  39278. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  39279. // Support: Chrome 14-35+
  39280. // Always assume duplicates if they aren't passed to the comparison function
  39281. support.detectDuplicates = !!hasDuplicate;
  39282. // Initialize against the default document
  39283. setDocument();
  39284. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  39285. // Detached nodes confoundingly follow *each other*
  39286. support.sortDetached = assert(function (el) {
  39287. // Should return 1, but returns 4 (following)
  39288. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  39289. });
  39290. // Support: IE<8
  39291. // Prevent attribute/property "interpolation"
  39292. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  39293. if (!assert(function (el) {
  39294. el.innerHTML = "<a href='#'></a>";
  39295. return el.firstChild.getAttribute("href") === "#";
  39296. })) {
  39297. addHandle("type|href|height|width", function (elem, name, isXML) {
  39298. if (!isXML) {
  39299. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  39300. }
  39301. });
  39302. }
  39303. // Support: IE<9
  39304. // Use defaultValue in place of getAttribute("value")
  39305. if (!support.attributes || !assert(function (el) {
  39306. el.innerHTML = "<input/>";
  39307. el.firstChild.setAttribute("value", "");
  39308. return el.firstChild.getAttribute("value") === "";
  39309. })) {
  39310. addHandle("value", function (elem, name, isXML) {
  39311. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  39312. return elem.defaultValue;
  39313. }
  39314. });
  39315. }
  39316. // Support: IE<9
  39317. // Use getAttributeNode to fetch booleans when getAttribute lies
  39318. if (!assert(function (el) {
  39319. return el.getAttribute("disabled") == null;
  39320. })) {
  39321. addHandle(booleans, function (elem, name, isXML) {
  39322. var val;
  39323. if (!isXML) {
  39324. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  39325. }
  39326. });
  39327. }
  39328. return Sizzle;
  39329. }(window);
  39330. jQuery.find = Sizzle;
  39331. jQuery.expr = Sizzle.selectors;
  39332. // Deprecated
  39333. jQuery.expr[":"] = jQuery.expr.pseudos;
  39334. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  39335. jQuery.text = Sizzle.getText;
  39336. jQuery.isXMLDoc = Sizzle.isXML;
  39337. jQuery.contains = Sizzle.contains;
  39338. jQuery.escapeSelector = Sizzle.escape;
  39339. var dir = function dir(elem, _dir, until) {
  39340. var matched = [],
  39341. truncate = until !== undefined;
  39342. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  39343. if (elem.nodeType === 1) {
  39344. if (truncate && jQuery(elem).is(until)) {
  39345. break;
  39346. }
  39347. matched.push(elem);
  39348. }
  39349. }
  39350. return matched;
  39351. };
  39352. var _siblings = function _siblings(n, elem) {
  39353. var matched = [];
  39354. for (; n; n = n.nextSibling) {
  39355. if (n.nodeType === 1 && n !== elem) {
  39356. matched.push(n);
  39357. }
  39358. }
  39359. return matched;
  39360. };
  39361. var rneedsContext = jQuery.expr.match.needsContext;
  39362. function nodeName(elem, name) {
  39363. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  39364. };
  39365. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  39366. // Implement the identical functionality for filter and not
  39367. function winnow(elements, qualifier, not) {
  39368. if (isFunction(qualifier)) {
  39369. return jQuery.grep(elements, function (elem, i) {
  39370. return !!qualifier.call(elem, i, elem) !== not;
  39371. });
  39372. }
  39373. // Single element
  39374. if (qualifier.nodeType) {
  39375. return jQuery.grep(elements, function (elem) {
  39376. return elem === qualifier !== not;
  39377. });
  39378. }
  39379. // Arraylike of elements (jQuery, arguments, Array)
  39380. if (typeof qualifier !== "string") {
  39381. return jQuery.grep(elements, function (elem) {
  39382. return indexOf.call(qualifier, elem) > -1 !== not;
  39383. });
  39384. }
  39385. // Filtered directly for both simple and complex selectors
  39386. return jQuery.filter(qualifier, elements, not);
  39387. }
  39388. jQuery.filter = function (expr, elems, not) {
  39389. var elem = elems[0];
  39390. if (not) {
  39391. expr = ":not(" + expr + ")";
  39392. }
  39393. if (elems.length === 1 && elem.nodeType === 1) {
  39394. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  39395. }
  39396. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  39397. return elem.nodeType === 1;
  39398. }));
  39399. };
  39400. jQuery.fn.extend({
  39401. find: function find(selector) {
  39402. var i,
  39403. ret,
  39404. len = this.length,
  39405. self = this;
  39406. if (typeof selector !== "string") {
  39407. return this.pushStack(jQuery(selector).filter(function () {
  39408. for (i = 0; i < len; i++) {
  39409. if (jQuery.contains(self[i], this)) {
  39410. return true;
  39411. }
  39412. }
  39413. }));
  39414. }
  39415. ret = this.pushStack([]);
  39416. for (i = 0; i < len; i++) {
  39417. jQuery.find(selector, self[i], ret);
  39418. }
  39419. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  39420. },
  39421. filter: function filter(selector) {
  39422. return this.pushStack(winnow(this, selector || [], false));
  39423. },
  39424. not: function not(selector) {
  39425. return this.pushStack(winnow(this, selector || [], true));
  39426. },
  39427. is: function is(selector) {
  39428. return !!winnow(this,
  39429. // If this is a positional/relative selector, check membership in the returned set
  39430. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  39431. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  39432. }
  39433. });
  39434. // Initialize a jQuery object
  39435. // A central reference to the root jQuery(document)
  39436. var rootjQuery,
  39437. // A simple way to check for HTML strings
  39438. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  39439. // Strict HTML recognition (#11290: must start with <)
  39440. // Shortcut simple #id case for speed
  39441. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  39442. init = jQuery.fn.init = function (selector, context, root) {
  39443. var match, elem;
  39444. // HANDLE: $(""), $(null), $(undefined), $(false)
  39445. if (!selector) {
  39446. return this;
  39447. }
  39448. // Method init() accepts an alternate rootjQuery
  39449. // so migrate can support jQuery.sub (gh-2101)
  39450. root = root || rootjQuery;
  39451. // Handle HTML strings
  39452. if (typeof selector === "string") {
  39453. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  39454. // Assume that strings that start and end with <> are HTML and skip the regex check
  39455. match = [null, selector, null];
  39456. } else {
  39457. match = rquickExpr.exec(selector);
  39458. }
  39459. // Match html or make sure no context is specified for #id
  39460. if (match && (match[1] || !context)) {
  39461. // HANDLE: $(html) -> $(array)
  39462. if (match[1]) {
  39463. context = context instanceof jQuery ? context[0] : context;
  39464. // Option to run scripts is true for back-compat
  39465. // Intentionally let the error be thrown if parseHTML is not present
  39466. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  39467. // HANDLE: $(html, props)
  39468. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  39469. for (match in context) {
  39470. // Properties of context are called as methods if possible
  39471. if (isFunction(this[match])) {
  39472. this[match](context[match]);
  39473. // ...and otherwise set as attributes
  39474. } else {
  39475. this.attr(match, context[match]);
  39476. }
  39477. }
  39478. }
  39479. return this;
  39480. // HANDLE: $(#id)
  39481. } else {
  39482. elem = document.getElementById(match[2]);
  39483. if (elem) {
  39484. // Inject the element directly into the jQuery object
  39485. this[0] = elem;
  39486. this.length = 1;
  39487. }
  39488. return this;
  39489. }
  39490. // HANDLE: $(expr, $(...))
  39491. } else if (!context || context.jquery) {
  39492. return (context || root).find(selector);
  39493. // HANDLE: $(expr, context)
  39494. // (which is just equivalent to: $(context).find(expr)
  39495. } else {
  39496. return this.constructor(context).find(selector);
  39497. }
  39498. // HANDLE: $(DOMElement)
  39499. } else if (selector.nodeType) {
  39500. this[0] = selector;
  39501. this.length = 1;
  39502. return this;
  39503. // HANDLE: $(function)
  39504. // Shortcut for document ready
  39505. } else if (isFunction(selector)) {
  39506. return root.ready !== undefined ? root.ready(selector) :
  39507. // Execute immediately if ready is not present
  39508. selector(jQuery);
  39509. }
  39510. return jQuery.makeArray(selector, this);
  39511. };
  39512. // Give the init function the jQuery prototype for later instantiation
  39513. init.prototype = jQuery.fn;
  39514. // Initialize central reference
  39515. rootjQuery = jQuery(document);
  39516. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  39517. // Methods guaranteed to produce a unique set when starting from a unique set
  39518. guaranteedUnique = {
  39519. children: true,
  39520. contents: true,
  39521. next: true,
  39522. prev: true
  39523. };
  39524. jQuery.fn.extend({
  39525. has: function has(target) {
  39526. var targets = jQuery(target, this),
  39527. l = targets.length;
  39528. return this.filter(function () {
  39529. var i = 0;
  39530. for (; i < l; i++) {
  39531. if (jQuery.contains(this, targets[i])) {
  39532. return true;
  39533. }
  39534. }
  39535. });
  39536. },
  39537. closest: function closest(selectors, context) {
  39538. var cur,
  39539. i = 0,
  39540. l = this.length,
  39541. matched = [],
  39542. targets = typeof selectors !== "string" && jQuery(selectors);
  39543. // Positional selectors never match, since there's no _selection_ context
  39544. if (!rneedsContext.test(selectors)) {
  39545. for (; i < l; i++) {
  39546. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  39547. // Always skip document fragments
  39548. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  39549. // Don't pass non-elements to Sizzle
  39550. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  39551. matched.push(cur);
  39552. break;
  39553. }
  39554. }
  39555. }
  39556. }
  39557. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  39558. },
  39559. // Determine the position of an element within the set
  39560. index: function index(elem) {
  39561. // No argument, return index in parent
  39562. if (!elem) {
  39563. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  39564. }
  39565. // Index in selector
  39566. if (typeof elem === "string") {
  39567. return indexOf.call(jQuery(elem), this[0]);
  39568. }
  39569. // Locate the position of the desired element
  39570. return indexOf.call(this,
  39571. // If it receives a jQuery object, the first element is used
  39572. elem.jquery ? elem[0] : elem);
  39573. },
  39574. add: function add(selector, context) {
  39575. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  39576. },
  39577. addBack: function addBack(selector) {
  39578. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  39579. }
  39580. });
  39581. function sibling(cur, dir) {
  39582. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  39583. return cur;
  39584. }
  39585. jQuery.each({
  39586. parent: function parent(elem) {
  39587. var parent = elem.parentNode;
  39588. return parent && parent.nodeType !== 11 ? parent : null;
  39589. },
  39590. parents: function parents(elem) {
  39591. return dir(elem, "parentNode");
  39592. },
  39593. parentsUntil: function parentsUntil(elem, i, until) {
  39594. return dir(elem, "parentNode", until);
  39595. },
  39596. next: function next(elem) {
  39597. return sibling(elem, "nextSibling");
  39598. },
  39599. prev: function prev(elem) {
  39600. return sibling(elem, "previousSibling");
  39601. },
  39602. nextAll: function nextAll(elem) {
  39603. return dir(elem, "nextSibling");
  39604. },
  39605. prevAll: function prevAll(elem) {
  39606. return dir(elem, "previousSibling");
  39607. },
  39608. nextUntil: function nextUntil(elem, i, until) {
  39609. return dir(elem, "nextSibling", until);
  39610. },
  39611. prevUntil: function prevUntil(elem, i, until) {
  39612. return dir(elem, "previousSibling", until);
  39613. },
  39614. siblings: function siblings(elem) {
  39615. return _siblings((elem.parentNode || {}).firstChild, elem);
  39616. },
  39617. children: function children(elem) {
  39618. return _siblings(elem.firstChild);
  39619. },
  39620. contents: function contents(elem) {
  39621. if (nodeName(elem, "iframe")) {
  39622. return elem.contentDocument;
  39623. }
  39624. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39625. // Treat the template element as a regular one in browsers that
  39626. // don't support it.
  39627. if (nodeName(elem, "template")) {
  39628. elem = elem.content || elem;
  39629. }
  39630. return jQuery.merge([], elem.childNodes);
  39631. }
  39632. }, function (name, fn) {
  39633. jQuery.fn[name] = function (until, selector) {
  39634. var matched = jQuery.map(this, fn, until);
  39635. if (name.slice(-5) !== "Until") {
  39636. selector = until;
  39637. }
  39638. if (selector && typeof selector === "string") {
  39639. matched = jQuery.filter(selector, matched);
  39640. }
  39641. if (this.length > 1) {
  39642. // Remove duplicates
  39643. if (!guaranteedUnique[name]) {
  39644. jQuery.uniqueSort(matched);
  39645. }
  39646. // Reverse order for parents* and prev-derivatives
  39647. if (rparentsprev.test(name)) {
  39648. matched.reverse();
  39649. }
  39650. }
  39651. return this.pushStack(matched);
  39652. };
  39653. });
  39654. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39655. // Convert String-formatted options into Object-formatted ones
  39656. function createOptions(options) {
  39657. var object = {};
  39658. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39659. object[flag] = true;
  39660. });
  39661. return object;
  39662. }
  39663. /*
  39664. * Create a callback list using the following parameters:
  39665. *
  39666. * options: an optional list of space-separated options that will change how
  39667. * the callback list behaves or a more traditional option object
  39668. *
  39669. * By default a callback list will act like an event callback list and can be
  39670. * "fired" multiple times.
  39671. *
  39672. * Possible options:
  39673. *
  39674. * once: will ensure the callback list can only be fired once (like a Deferred)
  39675. *
  39676. * memory: will keep track of previous values and will call any callback added
  39677. * after the list has been fired right away with the latest "memorized"
  39678. * values (like a Deferred)
  39679. *
  39680. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39681. *
  39682. * stopOnFalse: interrupt callings when a callback returns false
  39683. *
  39684. */
  39685. jQuery.Callbacks = function (options) {
  39686. // Convert options from String-formatted to Object-formatted if needed
  39687. // (we check in cache first)
  39688. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39689. var // Flag to know if list is currently firing
  39690. firing,
  39691. // Last fire value for non-forgettable lists
  39692. memory,
  39693. // Flag to know if list was already fired
  39694. _fired,
  39695. // Flag to prevent firing
  39696. _locked,
  39697. // Actual callback list
  39698. list = [],
  39699. // Queue of execution data for repeatable lists
  39700. queue = [],
  39701. // Index of currently firing callback (modified by add/remove as needed)
  39702. firingIndex = -1,
  39703. // Fire callbacks
  39704. fire = function fire() {
  39705. // Enforce single-firing
  39706. _locked = _locked || options.once;
  39707. // Execute callbacks for all pending executions,
  39708. // respecting firingIndex overrides and runtime changes
  39709. _fired = firing = true;
  39710. for (; queue.length; firingIndex = -1) {
  39711. memory = queue.shift();
  39712. while (++firingIndex < list.length) {
  39713. // Run callback and check for early termination
  39714. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39715. // Jump to end and forget the data so .add doesn't re-fire
  39716. firingIndex = list.length;
  39717. memory = false;
  39718. }
  39719. }
  39720. }
  39721. // Forget the data if we're done with it
  39722. if (!options.memory) {
  39723. memory = false;
  39724. }
  39725. firing = false;
  39726. // Clean up if we're done firing for good
  39727. if (_locked) {
  39728. // Keep an empty list if we have data for future add calls
  39729. if (memory) {
  39730. list = [];
  39731. // Otherwise, this object is spent
  39732. } else {
  39733. list = "";
  39734. }
  39735. }
  39736. },
  39737. // Actual Callbacks object
  39738. self = {
  39739. // Add a callback or a collection of callbacks to the list
  39740. add: function add() {
  39741. if (list) {
  39742. // If we have memory from a past run, we should fire after adding
  39743. if (memory && !firing) {
  39744. firingIndex = list.length - 1;
  39745. queue.push(memory);
  39746. }
  39747. (function add(args) {
  39748. jQuery.each(args, function (_, arg) {
  39749. if (isFunction(arg)) {
  39750. if (!options.unique || !self.has(arg)) {
  39751. list.push(arg);
  39752. }
  39753. } else if (arg && arg.length && toType(arg) !== "string") {
  39754. // Inspect recursively
  39755. add(arg);
  39756. }
  39757. });
  39758. })(arguments);
  39759. if (memory && !firing) {
  39760. fire();
  39761. }
  39762. }
  39763. return this;
  39764. },
  39765. // Remove a callback from the list
  39766. remove: function remove() {
  39767. jQuery.each(arguments, function (_, arg) {
  39768. var index;
  39769. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  39770. list.splice(index, 1);
  39771. // Handle firing indexes
  39772. if (index <= firingIndex) {
  39773. firingIndex--;
  39774. }
  39775. }
  39776. });
  39777. return this;
  39778. },
  39779. // Check if a given callback is in the list.
  39780. // If no argument is given, return whether or not list has callbacks attached.
  39781. has: function has(fn) {
  39782. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  39783. },
  39784. // Remove all callbacks from the list
  39785. empty: function empty() {
  39786. if (list) {
  39787. list = [];
  39788. }
  39789. return this;
  39790. },
  39791. // Disable .fire and .add
  39792. // Abort any current/pending executions
  39793. // Clear all callbacks and values
  39794. disable: function disable() {
  39795. _locked = queue = [];
  39796. list = memory = "";
  39797. return this;
  39798. },
  39799. disabled: function disabled() {
  39800. return !list;
  39801. },
  39802. // Disable .fire
  39803. // Also disable .add unless we have memory (since it would have no effect)
  39804. // Abort any pending executions
  39805. lock: function lock() {
  39806. _locked = queue = [];
  39807. if (!memory && !firing) {
  39808. list = memory = "";
  39809. }
  39810. return this;
  39811. },
  39812. locked: function locked() {
  39813. return !!_locked;
  39814. },
  39815. // Call all callbacks with the given context and arguments
  39816. fireWith: function fireWith(context, args) {
  39817. if (!_locked) {
  39818. args = args || [];
  39819. args = [context, args.slice ? args.slice() : args];
  39820. queue.push(args);
  39821. if (!firing) {
  39822. fire();
  39823. }
  39824. }
  39825. return this;
  39826. },
  39827. // Call all the callbacks with the given arguments
  39828. fire: function fire() {
  39829. self.fireWith(this, arguments);
  39830. return this;
  39831. },
  39832. // To know if the callbacks have already been called at least once
  39833. fired: function fired() {
  39834. return !!_fired;
  39835. }
  39836. };
  39837. return self;
  39838. };
  39839. function Identity(v) {
  39840. return v;
  39841. }
  39842. function Thrower(ex) {
  39843. throw ex;
  39844. }
  39845. function adoptValue(value, resolve, reject, noValue) {
  39846. var method;
  39847. try {
  39848. // Check for promise aspect first to privilege synchronous behavior
  39849. if (value && isFunction(method = value.promise)) {
  39850. method.call(value).done(resolve).fail(reject);
  39851. // Other thenables
  39852. } else if (value && isFunction(method = value.then)) {
  39853. method.call(value, resolve, reject);
  39854. // Other non-thenables
  39855. } else {
  39856. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  39857. // * false: [ value ].slice( 0 ) => resolve( value )
  39858. // * true: [ value ].slice( 1 ) => resolve()
  39859. resolve.apply(undefined, [value].slice(noValue));
  39860. }
  39861. // For Promises/A+, convert exceptions into rejections
  39862. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  39863. // Deferred#then to conditionally suppress rejection.
  39864. } catch (value) {
  39865. // Support: Android 4.0 only
  39866. // Strict mode functions invoked without .call/.apply get global-object context
  39867. reject.apply(undefined, [value]);
  39868. }
  39869. }
  39870. jQuery.extend({
  39871. Deferred: function Deferred(func) {
  39872. var tuples = [
  39873. // action, add listener, callbacks,
  39874. // ... .then handlers, argument index, [final state]
  39875. ["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
  39876. _state = "pending",
  39877. _promise = {
  39878. state: function state() {
  39879. return _state;
  39880. },
  39881. always: function always() {
  39882. deferred.done(arguments).fail(arguments);
  39883. return this;
  39884. },
  39885. "catch": function _catch(fn) {
  39886. return _promise.then(null, fn);
  39887. },
  39888. // Keep pipe for back-compat
  39889. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  39890. var fns = arguments;
  39891. return jQuery.Deferred(function (newDefer) {
  39892. jQuery.each(tuples, function (i, tuple) {
  39893. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  39894. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  39895. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  39896. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  39897. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  39898. deferred[tuple[1]](function () {
  39899. var returned = fn && fn.apply(this, arguments);
  39900. if (returned && isFunction(returned.promise)) {
  39901. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  39902. } else {
  39903. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  39904. }
  39905. });
  39906. });
  39907. fns = null;
  39908. }).promise();
  39909. },
  39910. then: function then(onFulfilled, onRejected, onProgress) {
  39911. var maxDepth = 0;
  39912. function resolve(depth, deferred, handler, special) {
  39913. return function () {
  39914. var that = this,
  39915. args = arguments,
  39916. mightThrow = function mightThrow() {
  39917. var returned, then;
  39918. // Support: Promises/A+ section 2.3.3.3.3
  39919. // https://promisesaplus.com/#point-59
  39920. // Ignore double-resolution attempts
  39921. if (depth < maxDepth) {
  39922. return;
  39923. }
  39924. returned = handler.apply(that, args);
  39925. // Support: Promises/A+ section 2.3.1
  39926. // https://promisesaplus.com/#point-48
  39927. if (returned === deferred.promise()) {
  39928. throw new TypeError("Thenable self-resolution");
  39929. }
  39930. // Support: Promises/A+ sections 2.3.3.1, 3.5
  39931. // https://promisesaplus.com/#point-54
  39932. // https://promisesaplus.com/#point-75
  39933. // Retrieve `then` only once
  39934. then = returned && (
  39935. // Support: Promises/A+ section 2.3.4
  39936. // https://promisesaplus.com/#point-64
  39937. // Only check objects and functions for thenability
  39938. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  39939. // Handle a returned thenable
  39940. if (isFunction(then)) {
  39941. // Special processors (notify) just wait for resolution
  39942. if (special) {
  39943. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  39944. // Normal processors (resolve) also hook into progress
  39945. } else {
  39946. // ...and disregard older resolution values
  39947. maxDepth++;
  39948. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  39949. }
  39950. // Handle all other returned values
  39951. } else {
  39952. // Only substitute handlers pass on context
  39953. // and multiple values (non-spec behavior)
  39954. if (handler !== Identity) {
  39955. that = undefined;
  39956. args = [returned];
  39957. }
  39958. // Process the value(s)
  39959. // Default process is resolve
  39960. (special || deferred.resolveWith)(that, args);
  39961. }
  39962. },
  39963. // Only normal processors (resolve) catch and reject exceptions
  39964. process = special ? mightThrow : function () {
  39965. try {
  39966. mightThrow();
  39967. } catch (e) {
  39968. if (jQuery.Deferred.exceptionHook) {
  39969. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  39970. }
  39971. // Support: Promises/A+ section 2.3.3.3.4.1
  39972. // https://promisesaplus.com/#point-61
  39973. // Ignore post-resolution exceptions
  39974. if (depth + 1 >= maxDepth) {
  39975. // Only substitute handlers pass on context
  39976. // and multiple values (non-spec behavior)
  39977. if (handler !== Thrower) {
  39978. that = undefined;
  39979. args = [e];
  39980. }
  39981. deferred.rejectWith(that, args);
  39982. }
  39983. }
  39984. };
  39985. // Support: Promises/A+ section 2.3.3.3.1
  39986. // https://promisesaplus.com/#point-57
  39987. // Re-resolve promises immediately to dodge false rejection from
  39988. // subsequent errors
  39989. if (depth) {
  39990. process();
  39991. } else {
  39992. // Call an optional hook to record the stack, in case of exception
  39993. // since it's otherwise lost when execution goes async
  39994. if (jQuery.Deferred.getStackHook) {
  39995. process.stackTrace = jQuery.Deferred.getStackHook();
  39996. }
  39997. window.setTimeout(process);
  39998. }
  39999. };
  40000. }
  40001. return jQuery.Deferred(function (newDefer) {
  40002. // progress_handlers.add( ... )
  40003. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  40004. // fulfilled_handlers.add( ... )
  40005. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  40006. // rejected_handlers.add( ... )
  40007. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  40008. }).promise();
  40009. },
  40010. // Get a promise for this deferred
  40011. // If obj is provided, the promise aspect is added to the object
  40012. promise: function promise(obj) {
  40013. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  40014. }
  40015. },
  40016. deferred = {};
  40017. // Add list-specific methods
  40018. jQuery.each(tuples, function (i, tuple) {
  40019. var list = tuple[2],
  40020. stateString = tuple[5];
  40021. // promise.progress = list.add
  40022. // promise.done = list.add
  40023. // promise.fail = list.add
  40024. _promise[tuple[1]] = list.add;
  40025. // Handle state
  40026. if (stateString) {
  40027. list.add(function () {
  40028. // state = "resolved" (i.e., fulfilled)
  40029. // state = "rejected"
  40030. _state = stateString;
  40031. },
  40032. // rejected_callbacks.disable
  40033. // fulfilled_callbacks.disable
  40034. tuples[3 - i][2].disable,
  40035. // rejected_handlers.disable
  40036. // fulfilled_handlers.disable
  40037. tuples[3 - i][3].disable,
  40038. // progress_callbacks.lock
  40039. tuples[0][2].lock,
  40040. // progress_handlers.lock
  40041. tuples[0][3].lock);
  40042. }
  40043. // progress_handlers.fire
  40044. // fulfilled_handlers.fire
  40045. // rejected_handlers.fire
  40046. list.add(tuple[3].fire);
  40047. // deferred.notify = function() { deferred.notifyWith(...) }
  40048. // deferred.resolve = function() { deferred.resolveWith(...) }
  40049. // deferred.reject = function() { deferred.rejectWith(...) }
  40050. deferred[tuple[0]] = function () {
  40051. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  40052. return this;
  40053. };
  40054. // deferred.notifyWith = list.fireWith
  40055. // deferred.resolveWith = list.fireWith
  40056. // deferred.rejectWith = list.fireWith
  40057. deferred[tuple[0] + "With"] = list.fireWith;
  40058. });
  40059. // Make the deferred a promise
  40060. _promise.promise(deferred);
  40061. // Call given func if any
  40062. if (func) {
  40063. func.call(deferred, deferred);
  40064. }
  40065. // All done!
  40066. return deferred;
  40067. },
  40068. // Deferred helper
  40069. when: function when(singleValue) {
  40070. var
  40071. // count of uncompleted subordinates
  40072. remaining = arguments.length,
  40073. // count of unprocessed arguments
  40074. i = remaining,
  40075. // subordinate fulfillment data
  40076. resolveContexts = Array(i),
  40077. resolveValues = _slice.call(arguments),
  40078. // the master Deferred
  40079. master = jQuery.Deferred(),
  40080. // subordinate callback factory
  40081. updateFunc = function updateFunc(i) {
  40082. return function (value) {
  40083. resolveContexts[i] = this;
  40084. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  40085. if (! --remaining) {
  40086. master.resolveWith(resolveContexts, resolveValues);
  40087. }
  40088. };
  40089. };
  40090. // Single- and empty arguments are adopted like Promise.resolve
  40091. if (remaining <= 1) {
  40092. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  40093. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  40094. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  40095. return master.then();
  40096. }
  40097. }
  40098. // Multiple arguments are aggregated like Promise.all array elements
  40099. while (i--) {
  40100. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  40101. }
  40102. return master.promise();
  40103. }
  40104. });
  40105. // These usually indicate a programmer mistake during development,
  40106. // warn about them ASAP rather than swallowing them by default.
  40107. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  40108. jQuery.Deferred.exceptionHook = function (error, stack) {
  40109. // Support: IE 8 - 9 only
  40110. // Console exists when dev tools are open, which can happen at any time
  40111. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  40112. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  40113. }
  40114. };
  40115. jQuery.readyException = function (error) {
  40116. window.setTimeout(function () {
  40117. throw error;
  40118. });
  40119. };
  40120. // The deferred used on DOM ready
  40121. var readyList = jQuery.Deferred();
  40122. jQuery.fn.ready = function (fn) {
  40123. readyList.then(fn)
  40124. // Wrap jQuery.readyException in a function so that the lookup
  40125. // happens at the time of error handling instead of callback
  40126. // registration.
  40127. .catch(function (error) {
  40128. jQuery.readyException(error);
  40129. });
  40130. return this;
  40131. };
  40132. jQuery.extend({
  40133. // Is the DOM ready to be used? Set to true once it occurs.
  40134. isReady: false,
  40135. // A counter to track how many items to wait for before
  40136. // the ready event fires. See #6781
  40137. readyWait: 1,
  40138. // Handle when the DOM is ready
  40139. ready: function ready(wait) {
  40140. // Abort if there are pending holds or we're already ready
  40141. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  40142. return;
  40143. }
  40144. // Remember that the DOM is ready
  40145. jQuery.isReady = true;
  40146. // If a normal DOM Ready event fired, decrement, and wait if need be
  40147. if (wait !== true && --jQuery.readyWait > 0) {
  40148. return;
  40149. }
  40150. // If there are functions bound, to execute
  40151. readyList.resolveWith(document, [jQuery]);
  40152. }
  40153. });
  40154. jQuery.ready.then = readyList.then;
  40155. // The ready event handler and self cleanup method
  40156. function completed() {
  40157. document.removeEventListener("DOMContentLoaded", completed);
  40158. window.removeEventListener("load", completed);
  40159. jQuery.ready();
  40160. }
  40161. // Catch cases where $(document).ready() is called
  40162. // after the browser event has already occurred.
  40163. // Support: IE <=9 - 10 only
  40164. // Older IE sometimes signals "interactive" too soon
  40165. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  40166. // Handle it asynchronously to allow scripts the opportunity to delay ready
  40167. window.setTimeout(jQuery.ready);
  40168. } else {
  40169. // Use the handy event callback
  40170. document.addEventListener("DOMContentLoaded", completed);
  40171. // A fallback to window.onload, that will always work
  40172. window.addEventListener("load", completed);
  40173. }
  40174. // Multifunctional method to get and set values of a collection
  40175. // The value/s can optionally be executed if it's a function
  40176. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  40177. var i = 0,
  40178. len = elems.length,
  40179. bulk = key == null;
  40180. // Sets many values
  40181. if (toType(key) === "object") {
  40182. chainable = true;
  40183. for (i in key) {
  40184. access(elems, fn, i, key[i], true, emptyGet, raw);
  40185. }
  40186. // Sets one value
  40187. } else if (value !== undefined) {
  40188. chainable = true;
  40189. if (!isFunction(value)) {
  40190. raw = true;
  40191. }
  40192. if (bulk) {
  40193. // Bulk operations run against the entire set
  40194. if (raw) {
  40195. fn.call(elems, value);
  40196. fn = null;
  40197. // ...except when executing function values
  40198. } else {
  40199. bulk = fn;
  40200. fn = function fn(elem, key, value) {
  40201. return bulk.call(jQuery(elem), value);
  40202. };
  40203. }
  40204. }
  40205. if (fn) {
  40206. for (; i < len; i++) {
  40207. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  40208. }
  40209. }
  40210. }
  40211. if (chainable) {
  40212. return elems;
  40213. }
  40214. // Gets
  40215. if (bulk) {
  40216. return fn.call(elems);
  40217. }
  40218. return len ? fn(elems[0], key) : emptyGet;
  40219. };
  40220. // Matches dashed string for camelizing
  40221. var rmsPrefix = /^-ms-/,
  40222. rdashAlpha = /-([a-z])/g;
  40223. // Used by camelCase as callback to replace()
  40224. function fcamelCase(all, letter) {
  40225. return letter.toUpperCase();
  40226. }
  40227. // Convert dashed to camelCase; used by the css and data modules
  40228. // Support: IE <=9 - 11, Edge 12 - 15
  40229. // Microsoft forgot to hump their vendor prefix (#9572)
  40230. function camelCase(string) {
  40231. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  40232. }
  40233. var acceptData = function acceptData(owner) {
  40234. // Accepts only:
  40235. // - Node
  40236. // - Node.ELEMENT_NODE
  40237. // - Node.DOCUMENT_NODE
  40238. // - Object
  40239. // - Any
  40240. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  40241. };
  40242. function Data() {
  40243. this.expando = jQuery.expando + Data.uid++;
  40244. }
  40245. Data.uid = 1;
  40246. Data.prototype = {
  40247. cache: function cache(owner) {
  40248. // Check if the owner object already has a cache
  40249. var value = owner[this.expando];
  40250. // If not, create one
  40251. if (!value) {
  40252. value = {};
  40253. // We can accept data for non-element nodes in modern browsers,
  40254. // but we should not, see #8335.
  40255. // Always return an empty object.
  40256. if (acceptData(owner)) {
  40257. // If it is a node unlikely to be stringify-ed or looped over
  40258. // use plain assignment
  40259. if (owner.nodeType) {
  40260. owner[this.expando] = value;
  40261. // Otherwise secure it in a non-enumerable property
  40262. // configurable must be true to allow the property to be
  40263. // deleted when data is removed
  40264. } else {
  40265. Object.defineProperty(owner, this.expando, {
  40266. value: value,
  40267. configurable: true
  40268. });
  40269. }
  40270. }
  40271. }
  40272. return value;
  40273. },
  40274. set: function set(owner, data, value) {
  40275. var prop,
  40276. cache = this.cache(owner);
  40277. // Handle: [ owner, key, value ] args
  40278. // Always use camelCase key (gh-2257)
  40279. if (typeof data === "string") {
  40280. cache[camelCase(data)] = value;
  40281. // Handle: [ owner, { properties } ] args
  40282. } else {
  40283. // Copy the properties one-by-one to the cache object
  40284. for (prop in data) {
  40285. cache[camelCase(prop)] = data[prop];
  40286. }
  40287. }
  40288. return cache;
  40289. },
  40290. get: function get(owner, key) {
  40291. return key === undefined ? this.cache(owner) :
  40292. // Always use camelCase key (gh-2257)
  40293. owner[this.expando] && owner[this.expando][camelCase(key)];
  40294. },
  40295. access: function access(owner, key, value) {
  40296. // In cases where either:
  40297. //
  40298. // 1. No key was specified
  40299. // 2. A string key was specified, but no value provided
  40300. //
  40301. // Take the "read" path and allow the get method to determine
  40302. // which value to return, respectively either:
  40303. //
  40304. // 1. The entire cache object
  40305. // 2. The data stored at the key
  40306. //
  40307. if (key === undefined || key && typeof key === "string" && value === undefined) {
  40308. return this.get(owner, key);
  40309. }
  40310. // When the key is not a string, or both a key and value
  40311. // are specified, set or extend (existing objects) with either:
  40312. //
  40313. // 1. An object of properties
  40314. // 2. A key and value
  40315. //
  40316. this.set(owner, key, value);
  40317. // Since the "set" path can have two possible entry points
  40318. // return the expected data based on which path was taken[*]
  40319. return value !== undefined ? value : key;
  40320. },
  40321. remove: function remove(owner, key) {
  40322. var i,
  40323. cache = owner[this.expando];
  40324. if (cache === undefined) {
  40325. return;
  40326. }
  40327. if (key !== undefined) {
  40328. // Support array or space separated string of keys
  40329. if (Array.isArray(key)) {
  40330. // If key is an array of keys...
  40331. // We always set camelCase keys, so remove that.
  40332. key = key.map(camelCase);
  40333. } else {
  40334. key = camelCase(key);
  40335. // If a key with the spaces exists, use it.
  40336. // Otherwise, create an array by matching non-whitespace
  40337. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  40338. }
  40339. i = key.length;
  40340. while (i--) {
  40341. delete cache[key[i]];
  40342. }
  40343. }
  40344. // Remove the expando if there's no more data
  40345. if (key === undefined || jQuery.isEmptyObject(cache)) {
  40346. // Support: Chrome <=35 - 45
  40347. // Webkit & Blink performance suffers when deleting properties
  40348. // from DOM nodes, so set to undefined instead
  40349. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  40350. if (owner.nodeType) {
  40351. owner[this.expando] = undefined;
  40352. } else {
  40353. delete owner[this.expando];
  40354. }
  40355. }
  40356. },
  40357. hasData: function hasData(owner) {
  40358. var cache = owner[this.expando];
  40359. return cache !== undefined && !jQuery.isEmptyObject(cache);
  40360. }
  40361. };
  40362. var dataPriv = new Data();
  40363. var dataUser = new Data();
  40364. // Implementation Summary
  40365. //
  40366. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  40367. // 2. Improve the module's maintainability by reducing the storage
  40368. // paths to a single mechanism.
  40369. // 3. Use the same single mechanism to support "private" and "user" data.
  40370. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  40371. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  40372. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  40373. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  40374. rmultiDash = /[A-Z]/g;
  40375. function getData(data) {
  40376. if (data === "true") {
  40377. return true;
  40378. }
  40379. if (data === "false") {
  40380. return false;
  40381. }
  40382. if (data === "null") {
  40383. return null;
  40384. }
  40385. // Only convert to a number if it doesn't change the string
  40386. if (data === +data + "") {
  40387. return +data;
  40388. }
  40389. if (rbrace.test(data)) {
  40390. return JSON.parse(data);
  40391. }
  40392. return data;
  40393. }
  40394. function dataAttr(elem, key, data) {
  40395. var name;
  40396. // If nothing was found internally, try to fetch any
  40397. // data from the HTML5 data-* attribute
  40398. if (data === undefined && elem.nodeType === 1) {
  40399. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  40400. data = elem.getAttribute(name);
  40401. if (typeof data === "string") {
  40402. try {
  40403. data = getData(data);
  40404. } catch (e) {}
  40405. // Make sure we set the data so it isn't changed later
  40406. dataUser.set(elem, key, data);
  40407. } else {
  40408. data = undefined;
  40409. }
  40410. }
  40411. return data;
  40412. }
  40413. jQuery.extend({
  40414. hasData: function hasData(elem) {
  40415. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  40416. },
  40417. data: function data(elem, name, _data) {
  40418. return dataUser.access(elem, name, _data);
  40419. },
  40420. removeData: function removeData(elem, name) {
  40421. dataUser.remove(elem, name);
  40422. },
  40423. // TODO: Now that all calls to _data and _removeData have been replaced
  40424. // with direct calls to dataPriv methods, these can be deprecated.
  40425. _data: function _data(elem, name, data) {
  40426. return dataPriv.access(elem, name, data);
  40427. },
  40428. _removeData: function _removeData(elem, name) {
  40429. dataPriv.remove(elem, name);
  40430. }
  40431. });
  40432. jQuery.fn.extend({
  40433. data: function data(key, value) {
  40434. var i,
  40435. name,
  40436. data,
  40437. elem = this[0],
  40438. attrs = elem && elem.attributes;
  40439. // Gets all values
  40440. if (key === undefined) {
  40441. if (this.length) {
  40442. data = dataUser.get(elem);
  40443. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  40444. i = attrs.length;
  40445. while (i--) {
  40446. // Support: IE 11 only
  40447. // The attrs elements can be null (#14894)
  40448. if (attrs[i]) {
  40449. name = attrs[i].name;
  40450. if (name.indexOf("data-") === 0) {
  40451. name = camelCase(name.slice(5));
  40452. dataAttr(elem, name, data[name]);
  40453. }
  40454. }
  40455. }
  40456. dataPriv.set(elem, "hasDataAttrs", true);
  40457. }
  40458. }
  40459. return data;
  40460. }
  40461. // Sets multiple values
  40462. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  40463. return this.each(function () {
  40464. dataUser.set(this, key);
  40465. });
  40466. }
  40467. return access(this, function (value) {
  40468. var data;
  40469. // The calling jQuery object (element matches) is not empty
  40470. // (and therefore has an element appears at this[ 0 ]) and the
  40471. // `value` parameter was not undefined. An empty jQuery object
  40472. // will result in `undefined` for elem = this[ 0 ] which will
  40473. // throw an exception if an attempt to read a data cache is made.
  40474. if (elem && value === undefined) {
  40475. // Attempt to get data from the cache
  40476. // The key will always be camelCased in Data
  40477. data = dataUser.get(elem, key);
  40478. if (data !== undefined) {
  40479. return data;
  40480. }
  40481. // Attempt to "discover" the data in
  40482. // HTML5 custom data-* attrs
  40483. data = dataAttr(elem, key);
  40484. if (data !== undefined) {
  40485. return data;
  40486. }
  40487. // We tried really hard, but the data doesn't exist.
  40488. return;
  40489. }
  40490. // Set the data...
  40491. this.each(function () {
  40492. // We always store the camelCased key
  40493. dataUser.set(this, key, value);
  40494. });
  40495. }, null, value, arguments.length > 1, null, true);
  40496. },
  40497. removeData: function removeData(key) {
  40498. return this.each(function () {
  40499. dataUser.remove(this, key);
  40500. });
  40501. }
  40502. });
  40503. jQuery.extend({
  40504. queue: function queue(elem, type, data) {
  40505. var queue;
  40506. if (elem) {
  40507. type = (type || "fx") + "queue";
  40508. queue = dataPriv.get(elem, type);
  40509. // Speed up dequeue by getting out quickly if this is just a lookup
  40510. if (data) {
  40511. if (!queue || Array.isArray(data)) {
  40512. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  40513. } else {
  40514. queue.push(data);
  40515. }
  40516. }
  40517. return queue || [];
  40518. }
  40519. },
  40520. dequeue: function dequeue(elem, type) {
  40521. type = type || "fx";
  40522. var queue = jQuery.queue(elem, type),
  40523. startLength = queue.length,
  40524. fn = queue.shift(),
  40525. hooks = jQuery._queueHooks(elem, type),
  40526. next = function next() {
  40527. jQuery.dequeue(elem, type);
  40528. };
  40529. // If the fx queue is dequeued, always remove the progress sentinel
  40530. if (fn === "inprogress") {
  40531. fn = queue.shift();
  40532. startLength--;
  40533. }
  40534. if (fn) {
  40535. // Add a progress sentinel to prevent the fx queue from being
  40536. // automatically dequeued
  40537. if (type === "fx") {
  40538. queue.unshift("inprogress");
  40539. }
  40540. // Clear up the last queue stop function
  40541. delete hooks.stop;
  40542. fn.call(elem, next, hooks);
  40543. }
  40544. if (!startLength && hooks) {
  40545. hooks.empty.fire();
  40546. }
  40547. },
  40548. // Not public - generate a queueHooks object, or return the current one
  40549. _queueHooks: function _queueHooks(elem, type) {
  40550. var key = type + "queueHooks";
  40551. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  40552. empty: jQuery.Callbacks("once memory").add(function () {
  40553. dataPriv.remove(elem, [type + "queue", key]);
  40554. })
  40555. });
  40556. }
  40557. });
  40558. jQuery.fn.extend({
  40559. queue: function queue(type, data) {
  40560. var setter = 2;
  40561. if (typeof type !== "string") {
  40562. data = type;
  40563. type = "fx";
  40564. setter--;
  40565. }
  40566. if (arguments.length < setter) {
  40567. return jQuery.queue(this[0], type);
  40568. }
  40569. return data === undefined ? this : this.each(function () {
  40570. var queue = jQuery.queue(this, type, data);
  40571. // Ensure a hooks for this queue
  40572. jQuery._queueHooks(this, type);
  40573. if (type === "fx" && queue[0] !== "inprogress") {
  40574. jQuery.dequeue(this, type);
  40575. }
  40576. });
  40577. },
  40578. dequeue: function dequeue(type) {
  40579. return this.each(function () {
  40580. jQuery.dequeue(this, type);
  40581. });
  40582. },
  40583. clearQueue: function clearQueue(type) {
  40584. return this.queue(type || "fx", []);
  40585. },
  40586. // Get a promise resolved when queues of a certain type
  40587. // are emptied (fx is the type by default)
  40588. promise: function promise(type, obj) {
  40589. var tmp,
  40590. count = 1,
  40591. defer = jQuery.Deferred(),
  40592. elements = this,
  40593. i = this.length,
  40594. resolve = function resolve() {
  40595. if (! --count) {
  40596. defer.resolveWith(elements, [elements]);
  40597. }
  40598. };
  40599. if (typeof type !== "string") {
  40600. obj = type;
  40601. type = undefined;
  40602. }
  40603. type = type || "fx";
  40604. while (i--) {
  40605. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40606. if (tmp && tmp.empty) {
  40607. count++;
  40608. tmp.empty.add(resolve);
  40609. }
  40610. }
  40611. resolve();
  40612. return defer.promise(obj);
  40613. }
  40614. });
  40615. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40616. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40617. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40618. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40619. // isHiddenWithinTree might be called from jQuery#filter function;
  40620. // in that case, element will be second argument
  40621. elem = el || elem;
  40622. // Inline style trumps all
  40623. return elem.style.display === "none" || elem.style.display === "" &&
  40624. // Otherwise, check computed style
  40625. // Support: Firefox <=43 - 45
  40626. // Disconnected elements can have computed display: none, so first confirm that elem is
  40627. // in the document.
  40628. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40629. };
  40630. var swap = function swap(elem, options, callback, args) {
  40631. var ret,
  40632. name,
  40633. old = {};
  40634. // Remember the old values, and insert the new ones
  40635. for (name in options) {
  40636. old[name] = elem.style[name];
  40637. elem.style[name] = options[name];
  40638. }
  40639. ret = callback.apply(elem, args || []);
  40640. // Revert the old values
  40641. for (name in options) {
  40642. elem.style[name] = old[name];
  40643. }
  40644. return ret;
  40645. };
  40646. function adjustCSS(elem, prop, valueParts, tween) {
  40647. var adjusted,
  40648. scale,
  40649. maxIterations = 20,
  40650. currentValue = tween ? function () {
  40651. return tween.cur();
  40652. } : function () {
  40653. return jQuery.css(elem, prop, "");
  40654. },
  40655. initial = currentValue(),
  40656. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40657. // Starting value computation is required for potential unit mismatches
  40658. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40659. if (initialInUnit && initialInUnit[3] !== unit) {
  40660. // Support: Firefox <=54
  40661. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40662. initial = initial / 2;
  40663. // Trust units reported by jQuery.css
  40664. unit = unit || initialInUnit[3];
  40665. // Iteratively approximate from a nonzero starting point
  40666. initialInUnit = +initial || 1;
  40667. while (maxIterations--) {
  40668. // Evaluate and update our best guess (doubling guesses that zero out).
  40669. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40670. jQuery.style(elem, prop, initialInUnit + unit);
  40671. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40672. maxIterations = 0;
  40673. }
  40674. initialInUnit = initialInUnit / scale;
  40675. }
  40676. initialInUnit = initialInUnit * 2;
  40677. jQuery.style(elem, prop, initialInUnit + unit);
  40678. // Make sure we update the tween properties later on
  40679. valueParts = valueParts || [];
  40680. }
  40681. if (valueParts) {
  40682. initialInUnit = +initialInUnit || +initial || 0;
  40683. // Apply relative offset (+=/-=) if specified
  40684. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40685. if (tween) {
  40686. tween.unit = unit;
  40687. tween.start = initialInUnit;
  40688. tween.end = adjusted;
  40689. }
  40690. }
  40691. return adjusted;
  40692. }
  40693. var defaultDisplayMap = {};
  40694. function getDefaultDisplay(elem) {
  40695. var temp,
  40696. doc = elem.ownerDocument,
  40697. nodeName = elem.nodeName,
  40698. display = defaultDisplayMap[nodeName];
  40699. if (display) {
  40700. return display;
  40701. }
  40702. temp = doc.body.appendChild(doc.createElement(nodeName));
  40703. display = jQuery.css(temp, "display");
  40704. temp.parentNode.removeChild(temp);
  40705. if (display === "none") {
  40706. display = "block";
  40707. }
  40708. defaultDisplayMap[nodeName] = display;
  40709. return display;
  40710. }
  40711. function showHide(elements, show) {
  40712. var display,
  40713. elem,
  40714. values = [],
  40715. index = 0,
  40716. length = elements.length;
  40717. // Determine new display value for elements that need to change
  40718. for (; index < length; index++) {
  40719. elem = elements[index];
  40720. if (!elem.style) {
  40721. continue;
  40722. }
  40723. display = elem.style.display;
  40724. if (show) {
  40725. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  40726. // check is required in this first loop unless we have a nonempty display value (either
  40727. // inline or about-to-be-restored)
  40728. if (display === "none") {
  40729. values[index] = dataPriv.get(elem, "display") || null;
  40730. if (!values[index]) {
  40731. elem.style.display = "";
  40732. }
  40733. }
  40734. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  40735. values[index] = getDefaultDisplay(elem);
  40736. }
  40737. } else {
  40738. if (display !== "none") {
  40739. values[index] = "none";
  40740. // Remember what we're overwriting
  40741. dataPriv.set(elem, "display", display);
  40742. }
  40743. }
  40744. }
  40745. // Set the display of the elements in a second loop to avoid constant reflow
  40746. for (index = 0; index < length; index++) {
  40747. if (values[index] != null) {
  40748. elements[index].style.display = values[index];
  40749. }
  40750. }
  40751. return elements;
  40752. }
  40753. jQuery.fn.extend({
  40754. show: function show() {
  40755. return showHide(this, true);
  40756. },
  40757. hide: function hide() {
  40758. return showHide(this);
  40759. },
  40760. toggle: function toggle(state) {
  40761. if (typeof state === "boolean") {
  40762. return state ? this.show() : this.hide();
  40763. }
  40764. return this.each(function () {
  40765. if (isHiddenWithinTree(this)) {
  40766. jQuery(this).show();
  40767. } else {
  40768. jQuery(this).hide();
  40769. }
  40770. });
  40771. }
  40772. });
  40773. var rcheckableType = /^(?:checkbox|radio)$/i;
  40774. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  40775. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  40776. // We have to close these tags to support XHTML (#13200)
  40777. var wrapMap = {
  40778. // Support: IE <=9 only
  40779. option: [1, "<select multiple='multiple'>", "</select>"],
  40780. // XHTML parsers do not magically insert elements in the
  40781. // same way that tag soup parsers do. So we cannot shorten
  40782. // this by omitting <tbody> or other required elements.
  40783. thead: [1, "<table>", "</table>"],
  40784. col: [2, "<table><colgroup>", "</colgroup></table>"],
  40785. tr: [2, "<table><tbody>", "</tbody></table>"],
  40786. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  40787. _default: [0, "", ""]
  40788. };
  40789. // Support: IE <=9 only
  40790. wrapMap.optgroup = wrapMap.option;
  40791. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  40792. wrapMap.th = wrapMap.td;
  40793. function getAll(context, tag) {
  40794. // Support: IE <=9 - 11 only
  40795. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  40796. var ret;
  40797. if (typeof context.getElementsByTagName !== "undefined") {
  40798. ret = context.getElementsByTagName(tag || "*");
  40799. } else if (typeof context.querySelectorAll !== "undefined") {
  40800. ret = context.querySelectorAll(tag || "*");
  40801. } else {
  40802. ret = [];
  40803. }
  40804. if (tag === undefined || tag && nodeName(context, tag)) {
  40805. return jQuery.merge([context], ret);
  40806. }
  40807. return ret;
  40808. }
  40809. // Mark scripts as having already been evaluated
  40810. function setGlobalEval(elems, refElements) {
  40811. var i = 0,
  40812. l = elems.length;
  40813. for (; i < l; i++) {
  40814. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  40815. }
  40816. }
  40817. var rhtml = /<|&#?\w+;/;
  40818. function buildFragment(elems, context, scripts, selection, ignored) {
  40819. var elem,
  40820. tmp,
  40821. tag,
  40822. wrap,
  40823. contains,
  40824. j,
  40825. fragment = context.createDocumentFragment(),
  40826. nodes = [],
  40827. i = 0,
  40828. l = elems.length;
  40829. for (; i < l; i++) {
  40830. elem = elems[i];
  40831. if (elem || elem === 0) {
  40832. // Add nodes directly
  40833. if (toType(elem) === "object") {
  40834. // Support: Android <=4.0 only, PhantomJS 1 only
  40835. // push.apply(_, arraylike) throws on ancient WebKit
  40836. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  40837. // Convert non-html into a text node
  40838. } else if (!rhtml.test(elem)) {
  40839. nodes.push(context.createTextNode(elem));
  40840. // Convert html into DOM nodes
  40841. } else {
  40842. tmp = tmp || fragment.appendChild(context.createElement("div"));
  40843. // Deserialize a standard representation
  40844. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  40845. wrap = wrapMap[tag] || wrapMap._default;
  40846. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  40847. // Descend through wrappers to the right content
  40848. j = wrap[0];
  40849. while (j--) {
  40850. tmp = tmp.lastChild;
  40851. }
  40852. // Support: Android <=4.0 only, PhantomJS 1 only
  40853. // push.apply(_, arraylike) throws on ancient WebKit
  40854. jQuery.merge(nodes, tmp.childNodes);
  40855. // Remember the top-level container
  40856. tmp = fragment.firstChild;
  40857. // Ensure the created nodes are orphaned (#12392)
  40858. tmp.textContent = "";
  40859. }
  40860. }
  40861. }
  40862. // Remove wrapper from fragment
  40863. fragment.textContent = "";
  40864. i = 0;
  40865. while (elem = nodes[i++]) {
  40866. // Skip elements already in the context collection (trac-4087)
  40867. if (selection && jQuery.inArray(elem, selection) > -1) {
  40868. if (ignored) {
  40869. ignored.push(elem);
  40870. }
  40871. continue;
  40872. }
  40873. contains = jQuery.contains(elem.ownerDocument, elem);
  40874. // Append to fragment
  40875. tmp = getAll(fragment.appendChild(elem), "script");
  40876. // Preserve script evaluation history
  40877. if (contains) {
  40878. setGlobalEval(tmp);
  40879. }
  40880. // Capture executables
  40881. if (scripts) {
  40882. j = 0;
  40883. while (elem = tmp[j++]) {
  40884. if (rscriptType.test(elem.type || "")) {
  40885. scripts.push(elem);
  40886. }
  40887. }
  40888. }
  40889. }
  40890. return fragment;
  40891. }
  40892. (function () {
  40893. var fragment = document.createDocumentFragment(),
  40894. div = fragment.appendChild(document.createElement("div")),
  40895. input = document.createElement("input");
  40896. // Support: Android 4.0 - 4.3 only
  40897. // Check state lost if the name is set (#11217)
  40898. // Support: Windows Web Apps (WWA)
  40899. // `name` and `type` must use .setAttribute for WWA (#14901)
  40900. input.setAttribute("type", "radio");
  40901. input.setAttribute("checked", "checked");
  40902. input.setAttribute("name", "t");
  40903. div.appendChild(input);
  40904. // Support: Android <=4.1 only
  40905. // Older WebKit doesn't clone checked state correctly in fragments
  40906. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  40907. // Support: IE <=11 only
  40908. // Make sure textarea (and checkbox) defaultValue is properly cloned
  40909. div.innerHTML = "<textarea>x</textarea>";
  40910. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  40911. })();
  40912. var documentElement = document.documentElement;
  40913. var rkeyEvent = /^key/,
  40914. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  40915. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  40916. function returnTrue() {
  40917. return true;
  40918. }
  40919. function returnFalse() {
  40920. return false;
  40921. }
  40922. // Support: IE <=9 only
  40923. // See #13393 for more info
  40924. function safeActiveElement() {
  40925. try {
  40926. return document.activeElement;
  40927. } catch (err) {}
  40928. }
  40929. function _on(elem, types, selector, data, fn, one) {
  40930. var origFn, type;
  40931. // Types can be a map of types/handlers
  40932. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40933. // ( types-Object, selector, data )
  40934. if (typeof selector !== "string") {
  40935. // ( types-Object, data )
  40936. data = data || selector;
  40937. selector = undefined;
  40938. }
  40939. for (type in types) {
  40940. _on(elem, type, selector, data, types[type], one);
  40941. }
  40942. return elem;
  40943. }
  40944. if (data == null && fn == null) {
  40945. // ( types, fn )
  40946. fn = selector;
  40947. data = selector = undefined;
  40948. } else if (fn == null) {
  40949. if (typeof selector === "string") {
  40950. // ( types, selector, fn )
  40951. fn = data;
  40952. data = undefined;
  40953. } else {
  40954. // ( types, data, fn )
  40955. fn = data;
  40956. data = selector;
  40957. selector = undefined;
  40958. }
  40959. }
  40960. if (fn === false) {
  40961. fn = returnFalse;
  40962. } else if (!fn) {
  40963. return elem;
  40964. }
  40965. if (one === 1) {
  40966. origFn = fn;
  40967. fn = function fn(event) {
  40968. // Can use an empty set, since event contains the info
  40969. jQuery().off(event);
  40970. return origFn.apply(this, arguments);
  40971. };
  40972. // Use same guid so caller can remove using origFn
  40973. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  40974. }
  40975. return elem.each(function () {
  40976. jQuery.event.add(this, types, fn, data, selector);
  40977. });
  40978. }
  40979. /*
  40980. * Helper functions for managing events -- not part of the public interface.
  40981. * Props to Dean Edwards' addEvent library for many of the ideas.
  40982. */
  40983. jQuery.event = {
  40984. global: {},
  40985. add: function add(elem, types, handler, data, selector) {
  40986. var handleObjIn,
  40987. eventHandle,
  40988. tmp,
  40989. events,
  40990. t,
  40991. handleObj,
  40992. special,
  40993. handlers,
  40994. type,
  40995. namespaces,
  40996. origType,
  40997. elemData = dataPriv.get(elem);
  40998. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  40999. if (!elemData) {
  41000. return;
  41001. }
  41002. // Caller can pass in an object of custom data in lieu of the handler
  41003. if (handler.handler) {
  41004. handleObjIn = handler;
  41005. handler = handleObjIn.handler;
  41006. selector = handleObjIn.selector;
  41007. }
  41008. // Ensure that invalid selectors throw exceptions at attach time
  41009. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  41010. if (selector) {
  41011. jQuery.find.matchesSelector(documentElement, selector);
  41012. }
  41013. // Make sure that the handler has a unique ID, used to find/remove it later
  41014. if (!handler.guid) {
  41015. handler.guid = jQuery.guid++;
  41016. }
  41017. // Init the element's event structure and main handler, if this is the first
  41018. if (!(events = elemData.events)) {
  41019. events = elemData.events = {};
  41020. }
  41021. if (!(eventHandle = elemData.handle)) {
  41022. eventHandle = elemData.handle = function (e) {
  41023. // Discard the second event of a jQuery.event.trigger() and
  41024. // when an event is called after a page has unloaded
  41025. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  41026. };
  41027. }
  41028. // Handle multiple events separated by a space
  41029. types = (types || "").match(rnothtmlwhite) || [""];
  41030. t = types.length;
  41031. while (t--) {
  41032. tmp = rtypenamespace.exec(types[t]) || [];
  41033. type = origType = tmp[1];
  41034. namespaces = (tmp[2] || "").split(".").sort();
  41035. // There *must* be a type, no attaching namespace-only handlers
  41036. if (!type) {
  41037. continue;
  41038. }
  41039. // If event changes its type, use the special event handlers for the changed type
  41040. special = jQuery.event.special[type] || {};
  41041. // If selector defined, determine special event api type, otherwise given type
  41042. type = (selector ? special.delegateType : special.bindType) || type;
  41043. // Update special based on newly reset type
  41044. special = jQuery.event.special[type] || {};
  41045. // handleObj is passed to all event handlers
  41046. handleObj = jQuery.extend({
  41047. type: type,
  41048. origType: origType,
  41049. data: data,
  41050. handler: handler,
  41051. guid: handler.guid,
  41052. selector: selector,
  41053. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  41054. namespace: namespaces.join(".")
  41055. }, handleObjIn);
  41056. // Init the event handler queue if we're the first
  41057. if (!(handlers = events[type])) {
  41058. handlers = events[type] = [];
  41059. handlers.delegateCount = 0;
  41060. // Only use addEventListener if the special events handler returns false
  41061. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  41062. if (elem.addEventListener) {
  41063. elem.addEventListener(type, eventHandle);
  41064. }
  41065. }
  41066. }
  41067. if (special.add) {
  41068. special.add.call(elem, handleObj);
  41069. if (!handleObj.handler.guid) {
  41070. handleObj.handler.guid = handler.guid;
  41071. }
  41072. }
  41073. // Add to the element's handler list, delegates in front
  41074. if (selector) {
  41075. handlers.splice(handlers.delegateCount++, 0, handleObj);
  41076. } else {
  41077. handlers.push(handleObj);
  41078. }
  41079. // Keep track of which events have ever been used, for event optimization
  41080. jQuery.event.global[type] = true;
  41081. }
  41082. },
  41083. // Detach an event or set of events from an element
  41084. remove: function remove(elem, types, handler, selector, mappedTypes) {
  41085. var j,
  41086. origCount,
  41087. tmp,
  41088. events,
  41089. t,
  41090. handleObj,
  41091. special,
  41092. handlers,
  41093. type,
  41094. namespaces,
  41095. origType,
  41096. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  41097. if (!elemData || !(events = elemData.events)) {
  41098. return;
  41099. }
  41100. // Once for each type.namespace in types; type may be omitted
  41101. types = (types || "").match(rnothtmlwhite) || [""];
  41102. t = types.length;
  41103. while (t--) {
  41104. tmp = rtypenamespace.exec(types[t]) || [];
  41105. type = origType = tmp[1];
  41106. namespaces = (tmp[2] || "").split(".").sort();
  41107. // Unbind all events (on this namespace, if provided) for the element
  41108. if (!type) {
  41109. for (type in events) {
  41110. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  41111. }
  41112. continue;
  41113. }
  41114. special = jQuery.event.special[type] || {};
  41115. type = (selector ? special.delegateType : special.bindType) || type;
  41116. handlers = events[type] || [];
  41117. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  41118. // Remove matching events
  41119. origCount = j = handlers.length;
  41120. while (j--) {
  41121. handleObj = handlers[j];
  41122. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  41123. handlers.splice(j, 1);
  41124. if (handleObj.selector) {
  41125. handlers.delegateCount--;
  41126. }
  41127. if (special.remove) {
  41128. special.remove.call(elem, handleObj);
  41129. }
  41130. }
  41131. }
  41132. // Remove generic event handler if we removed something and no more handlers exist
  41133. // (avoids potential for endless recursion during removal of special event handlers)
  41134. if (origCount && !handlers.length) {
  41135. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  41136. jQuery.removeEvent(elem, type, elemData.handle);
  41137. }
  41138. delete events[type];
  41139. }
  41140. }
  41141. // Remove data and the expando if it's no longer used
  41142. if (jQuery.isEmptyObject(events)) {
  41143. dataPriv.remove(elem, "handle events");
  41144. }
  41145. },
  41146. dispatch: function dispatch(nativeEvent) {
  41147. // Make a writable jQuery.Event from the native event object
  41148. var event = jQuery.event.fix(nativeEvent);
  41149. var i,
  41150. j,
  41151. ret,
  41152. matched,
  41153. handleObj,
  41154. handlerQueue,
  41155. args = new Array(arguments.length),
  41156. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  41157. special = jQuery.event.special[event.type] || {};
  41158. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  41159. args[0] = event;
  41160. for (i = 1; i < arguments.length; i++) {
  41161. args[i] = arguments[i];
  41162. }
  41163. event.delegateTarget = this;
  41164. // Call the preDispatch hook for the mapped type, and let it bail if desired
  41165. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  41166. return;
  41167. }
  41168. // Determine handlers
  41169. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  41170. // Run delegates first; they may want to stop propagation beneath us
  41171. i = 0;
  41172. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  41173. event.currentTarget = matched.elem;
  41174. j = 0;
  41175. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  41176. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  41177. // a subset or equal to those in the bound event (both can have no namespace).
  41178. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  41179. event.handleObj = handleObj;
  41180. event.data = handleObj.data;
  41181. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  41182. if (ret !== undefined) {
  41183. if ((event.result = ret) === false) {
  41184. event.preventDefault();
  41185. event.stopPropagation();
  41186. }
  41187. }
  41188. }
  41189. }
  41190. }
  41191. // Call the postDispatch hook for the mapped type
  41192. if (special.postDispatch) {
  41193. special.postDispatch.call(this, event);
  41194. }
  41195. return event.result;
  41196. },
  41197. handlers: function handlers(event, _handlers) {
  41198. var i,
  41199. handleObj,
  41200. sel,
  41201. matchedHandlers,
  41202. matchedSelectors,
  41203. handlerQueue = [],
  41204. delegateCount = _handlers.delegateCount,
  41205. cur = event.target;
  41206. // Find delegate handlers
  41207. if (delegateCount &&
  41208. // Support: IE <=9
  41209. // Black-hole SVG <use> instance trees (trac-13180)
  41210. cur.nodeType &&
  41211. // Support: Firefox <=42
  41212. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  41213. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  41214. // Support: IE 11 only
  41215. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  41216. !(event.type === "click" && event.button >= 1)) {
  41217. for (; cur !== this; cur = cur.parentNode || this) {
  41218. // Don't check non-elements (#13208)
  41219. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  41220. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  41221. matchedHandlers = [];
  41222. matchedSelectors = {};
  41223. for (i = 0; i < delegateCount; i++) {
  41224. handleObj = _handlers[i];
  41225. // Don't conflict with Object.prototype properties (#13203)
  41226. sel = handleObj.selector + " ";
  41227. if (matchedSelectors[sel] === undefined) {
  41228. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  41229. }
  41230. if (matchedSelectors[sel]) {
  41231. matchedHandlers.push(handleObj);
  41232. }
  41233. }
  41234. if (matchedHandlers.length) {
  41235. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  41236. }
  41237. }
  41238. }
  41239. }
  41240. // Add the remaining (directly-bound) handlers
  41241. cur = this;
  41242. if (delegateCount < _handlers.length) {
  41243. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  41244. }
  41245. return handlerQueue;
  41246. },
  41247. addProp: function addProp(name, hook) {
  41248. Object.defineProperty(jQuery.Event.prototype, name, {
  41249. enumerable: true,
  41250. configurable: true,
  41251. get: isFunction(hook) ? function () {
  41252. if (this.originalEvent) {
  41253. return hook(this.originalEvent);
  41254. }
  41255. } : function () {
  41256. if (this.originalEvent) {
  41257. return this.originalEvent[name];
  41258. }
  41259. },
  41260. set: function set(value) {
  41261. Object.defineProperty(this, name, {
  41262. enumerable: true,
  41263. configurable: true,
  41264. writable: true,
  41265. value: value
  41266. });
  41267. }
  41268. });
  41269. },
  41270. fix: function fix(originalEvent) {
  41271. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  41272. },
  41273. special: {
  41274. load: {
  41275. // Prevent triggered image.load events from bubbling to window.load
  41276. noBubble: true
  41277. },
  41278. focus: {
  41279. // Fire native event if possible so blur/focus sequence is correct
  41280. trigger: function trigger() {
  41281. if (this !== safeActiveElement() && this.focus) {
  41282. this.focus();
  41283. return false;
  41284. }
  41285. },
  41286. delegateType: "focusin"
  41287. },
  41288. blur: {
  41289. trigger: function trigger() {
  41290. if (this === safeActiveElement() && this.blur) {
  41291. this.blur();
  41292. return false;
  41293. }
  41294. },
  41295. delegateType: "focusout"
  41296. },
  41297. click: {
  41298. // For checkbox, fire native event so checked state will be right
  41299. trigger: function trigger() {
  41300. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  41301. this.click();
  41302. return false;
  41303. }
  41304. },
  41305. // For cross-browser consistency, don't fire native .click() on links
  41306. _default: function _default(event) {
  41307. return nodeName(event.target, "a");
  41308. }
  41309. },
  41310. beforeunload: {
  41311. postDispatch: function postDispatch(event) {
  41312. // Support: Firefox 20+
  41313. // Firefox doesn't alert if the returnValue field is not set.
  41314. if (event.result !== undefined && event.originalEvent) {
  41315. event.originalEvent.returnValue = event.result;
  41316. }
  41317. }
  41318. }
  41319. }
  41320. };
  41321. jQuery.removeEvent = function (elem, type, handle) {
  41322. // This "if" is needed for plain objects
  41323. if (elem.removeEventListener) {
  41324. elem.removeEventListener(type, handle);
  41325. }
  41326. };
  41327. jQuery.Event = function (src, props) {
  41328. // Allow instantiation without the 'new' keyword
  41329. if (!(this instanceof jQuery.Event)) {
  41330. return new jQuery.Event(src, props);
  41331. }
  41332. // Event object
  41333. if (src && src.type) {
  41334. this.originalEvent = src;
  41335. this.type = src.type;
  41336. // Events bubbling up the document may have been marked as prevented
  41337. // by a handler lower down the tree; reflect the correct value.
  41338. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  41339. // Support: Android <=2.3 only
  41340. src.returnValue === false ? returnTrue : returnFalse;
  41341. // Create target properties
  41342. // Support: Safari <=6 - 7 only
  41343. // Target should not be a text node (#504, #13143)
  41344. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  41345. this.currentTarget = src.currentTarget;
  41346. this.relatedTarget = src.relatedTarget;
  41347. // Event type
  41348. } else {
  41349. this.type = src;
  41350. }
  41351. // Put explicitly provided properties onto the event object
  41352. if (props) {
  41353. jQuery.extend(this, props);
  41354. }
  41355. // Create a timestamp if incoming event doesn't have one
  41356. this.timeStamp = src && src.timeStamp || Date.now();
  41357. // Mark it as fixed
  41358. this[jQuery.expando] = true;
  41359. };
  41360. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  41361. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  41362. jQuery.Event.prototype = {
  41363. constructor: jQuery.Event,
  41364. isDefaultPrevented: returnFalse,
  41365. isPropagationStopped: returnFalse,
  41366. isImmediatePropagationStopped: returnFalse,
  41367. isSimulated: false,
  41368. preventDefault: function preventDefault() {
  41369. var e = this.originalEvent;
  41370. this.isDefaultPrevented = returnTrue;
  41371. if (e && !this.isSimulated) {
  41372. e.preventDefault();
  41373. }
  41374. },
  41375. stopPropagation: function stopPropagation() {
  41376. var e = this.originalEvent;
  41377. this.isPropagationStopped = returnTrue;
  41378. if (e && !this.isSimulated) {
  41379. e.stopPropagation();
  41380. }
  41381. },
  41382. stopImmediatePropagation: function stopImmediatePropagation() {
  41383. var e = this.originalEvent;
  41384. this.isImmediatePropagationStopped = returnTrue;
  41385. if (e && !this.isSimulated) {
  41386. e.stopImmediatePropagation();
  41387. }
  41388. this.stopPropagation();
  41389. }
  41390. };
  41391. // Includes all common event props including KeyEvent and MouseEvent specific props
  41392. jQuery.each({
  41393. altKey: true,
  41394. bubbles: true,
  41395. cancelable: true,
  41396. changedTouches: true,
  41397. ctrlKey: true,
  41398. detail: true,
  41399. eventPhase: true,
  41400. metaKey: true,
  41401. pageX: true,
  41402. pageY: true,
  41403. shiftKey: true,
  41404. view: true,
  41405. "char": true,
  41406. charCode: true,
  41407. key: true,
  41408. keyCode: true,
  41409. button: true,
  41410. buttons: true,
  41411. clientX: true,
  41412. clientY: true,
  41413. offsetX: true,
  41414. offsetY: true,
  41415. pointerId: true,
  41416. pointerType: true,
  41417. screenX: true,
  41418. screenY: true,
  41419. targetTouches: true,
  41420. toElement: true,
  41421. touches: true,
  41422. which: function which(event) {
  41423. var button = event.button;
  41424. // Add which for key events
  41425. if (event.which == null && rkeyEvent.test(event.type)) {
  41426. return event.charCode != null ? event.charCode : event.keyCode;
  41427. }
  41428. // Add which for click: 1 === left; 2 === middle; 3 === right
  41429. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  41430. if (button & 1) {
  41431. return 1;
  41432. }
  41433. if (button & 2) {
  41434. return 3;
  41435. }
  41436. if (button & 4) {
  41437. return 2;
  41438. }
  41439. return 0;
  41440. }
  41441. return event.which;
  41442. }
  41443. }, jQuery.event.addProp);
  41444. // Create mouseenter/leave events using mouseover/out and event-time checks
  41445. // so that event delegation works in jQuery.
  41446. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  41447. //
  41448. // Support: Safari 7 only
  41449. // Safari sends mouseenter too often; see:
  41450. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  41451. // for the description of the bug (it existed in older Chrome versions as well).
  41452. jQuery.each({
  41453. mouseenter: "mouseover",
  41454. mouseleave: "mouseout",
  41455. pointerenter: "pointerover",
  41456. pointerleave: "pointerout"
  41457. }, function (orig, fix) {
  41458. jQuery.event.special[orig] = {
  41459. delegateType: fix,
  41460. bindType: fix,
  41461. handle: function handle(event) {
  41462. var ret,
  41463. target = this,
  41464. related = event.relatedTarget,
  41465. handleObj = event.handleObj;
  41466. // For mouseenter/leave call the handler if related is outside the target.
  41467. // NB: No relatedTarget if the mouse left/entered the browser window
  41468. if (!related || related !== target && !jQuery.contains(target, related)) {
  41469. event.type = handleObj.origType;
  41470. ret = handleObj.handler.apply(this, arguments);
  41471. event.type = fix;
  41472. }
  41473. return ret;
  41474. }
  41475. };
  41476. });
  41477. jQuery.fn.extend({
  41478. on: function on(types, selector, data, fn) {
  41479. return _on(this, types, selector, data, fn);
  41480. },
  41481. one: function one(types, selector, data, fn) {
  41482. return _on(this, types, selector, data, fn, 1);
  41483. },
  41484. off: function off(types, selector, fn) {
  41485. var handleObj, type;
  41486. if (types && types.preventDefault && types.handleObj) {
  41487. // ( event ) dispatched jQuery.Event
  41488. handleObj = types.handleObj;
  41489. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  41490. return this;
  41491. }
  41492. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  41493. // ( types-object [, selector] )
  41494. for (type in types) {
  41495. this.off(type, selector, types[type]);
  41496. }
  41497. return this;
  41498. }
  41499. if (selector === false || typeof selector === "function") {
  41500. // ( types [, fn] )
  41501. fn = selector;
  41502. selector = undefined;
  41503. }
  41504. if (fn === false) {
  41505. fn = returnFalse;
  41506. }
  41507. return this.each(function () {
  41508. jQuery.event.remove(this, types, fn, selector);
  41509. });
  41510. }
  41511. });
  41512. var
  41513. /* eslint-disable max-len */
  41514. // See https://github.com/eslint/eslint/issues/3229
  41515. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  41516. /* eslint-enable */
  41517. // Support: IE <=10 - 11, Edge 12 - 13 only
  41518. // In IE/Edge using regex groups here causes severe slowdowns.
  41519. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  41520. rnoInnerhtml = /<script|<style|<link/i,
  41521. // checked="checked" or checked
  41522. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  41523. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  41524. // Prefer a tbody over its parent table for containing new rows
  41525. function manipulationTarget(elem, content) {
  41526. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  41527. return jQuery(elem).children("tbody")[0] || elem;
  41528. }
  41529. return elem;
  41530. }
  41531. // Replace/restore the type attribute of script elements for safe DOM manipulation
  41532. function disableScript(elem) {
  41533. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  41534. return elem;
  41535. }
  41536. function restoreScript(elem) {
  41537. if ((elem.type || "").slice(0, 5) === "true/") {
  41538. elem.type = elem.type.slice(5);
  41539. } else {
  41540. elem.removeAttribute("type");
  41541. }
  41542. return elem;
  41543. }
  41544. function cloneCopyEvent(src, dest) {
  41545. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  41546. if (dest.nodeType !== 1) {
  41547. return;
  41548. }
  41549. // 1. Copy private data: events, handlers, etc.
  41550. if (dataPriv.hasData(src)) {
  41551. pdataOld = dataPriv.access(src);
  41552. pdataCur = dataPriv.set(dest, pdataOld);
  41553. events = pdataOld.events;
  41554. if (events) {
  41555. delete pdataCur.handle;
  41556. pdataCur.events = {};
  41557. for (type in events) {
  41558. for (i = 0, l = events[type].length; i < l; i++) {
  41559. jQuery.event.add(dest, type, events[type][i]);
  41560. }
  41561. }
  41562. }
  41563. }
  41564. // 2. Copy user data
  41565. if (dataUser.hasData(src)) {
  41566. udataOld = dataUser.access(src);
  41567. udataCur = jQuery.extend({}, udataOld);
  41568. dataUser.set(dest, udataCur);
  41569. }
  41570. }
  41571. // Fix IE bugs, see support tests
  41572. function fixInput(src, dest) {
  41573. var nodeName = dest.nodeName.toLowerCase();
  41574. // Fails to persist the checked state of a cloned checkbox or radio button.
  41575. if (nodeName === "input" && rcheckableType.test(src.type)) {
  41576. dest.checked = src.checked;
  41577. // Fails to return the selected option to the default selected state when cloning options
  41578. } else if (nodeName === "input" || nodeName === "textarea") {
  41579. dest.defaultValue = src.defaultValue;
  41580. }
  41581. }
  41582. function domManip(collection, args, callback, ignored) {
  41583. // Flatten any nested arrays
  41584. args = concat.apply([], args);
  41585. var fragment,
  41586. first,
  41587. scripts,
  41588. hasScripts,
  41589. node,
  41590. doc,
  41591. i = 0,
  41592. l = collection.length,
  41593. iNoClone = l - 1,
  41594. value = args[0],
  41595. valueIsFunction = isFunction(value);
  41596. // We can't cloneNode fragments that contain checked, in WebKit
  41597. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41598. return collection.each(function (index) {
  41599. var self = collection.eq(index);
  41600. if (valueIsFunction) {
  41601. args[0] = value.call(this, index, self.html());
  41602. }
  41603. domManip(self, args, callback, ignored);
  41604. });
  41605. }
  41606. if (l) {
  41607. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41608. first = fragment.firstChild;
  41609. if (fragment.childNodes.length === 1) {
  41610. fragment = first;
  41611. }
  41612. // Require either new content or an interest in ignored elements to invoke the callback
  41613. if (first || ignored) {
  41614. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41615. hasScripts = scripts.length;
  41616. // Use the original fragment for the last item
  41617. // instead of the first because it can end up
  41618. // being emptied incorrectly in certain situations (#8070).
  41619. for (; i < l; i++) {
  41620. node = fragment;
  41621. if (i !== iNoClone) {
  41622. node = jQuery.clone(node, true, true);
  41623. // Keep references to cloned scripts for later restoration
  41624. if (hasScripts) {
  41625. // Support: Android <=4.0 only, PhantomJS 1 only
  41626. // push.apply(_, arraylike) throws on ancient WebKit
  41627. jQuery.merge(scripts, getAll(node, "script"));
  41628. }
  41629. }
  41630. callback.call(collection[i], node, i);
  41631. }
  41632. if (hasScripts) {
  41633. doc = scripts[scripts.length - 1].ownerDocument;
  41634. // Reenable scripts
  41635. jQuery.map(scripts, restoreScript);
  41636. // Evaluate executable scripts on first document insertion
  41637. for (i = 0; i < hasScripts; i++) {
  41638. node = scripts[i];
  41639. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41640. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41641. // Optional AJAX dependency, but won't run scripts if not present
  41642. if (jQuery._evalUrl) {
  41643. jQuery._evalUrl(node.src);
  41644. }
  41645. } else {
  41646. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41647. }
  41648. }
  41649. }
  41650. }
  41651. }
  41652. }
  41653. return collection;
  41654. }
  41655. function _remove(elem, selector, keepData) {
  41656. var node,
  41657. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41658. i = 0;
  41659. for (; (node = nodes[i]) != null; i++) {
  41660. if (!keepData && node.nodeType === 1) {
  41661. jQuery.cleanData(getAll(node));
  41662. }
  41663. if (node.parentNode) {
  41664. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41665. setGlobalEval(getAll(node, "script"));
  41666. }
  41667. node.parentNode.removeChild(node);
  41668. }
  41669. }
  41670. return elem;
  41671. }
  41672. jQuery.extend({
  41673. htmlPrefilter: function htmlPrefilter(html) {
  41674. return html.replace(rxhtmlTag, "<$1></$2>");
  41675. },
  41676. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41677. var i,
  41678. l,
  41679. srcElements,
  41680. destElements,
  41681. clone = elem.cloneNode(true),
  41682. inPage = jQuery.contains(elem.ownerDocument, elem);
  41683. // Fix IE cloning issues
  41684. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41685. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41686. destElements = getAll(clone);
  41687. srcElements = getAll(elem);
  41688. for (i = 0, l = srcElements.length; i < l; i++) {
  41689. fixInput(srcElements[i], destElements[i]);
  41690. }
  41691. }
  41692. // Copy the events from the original to the clone
  41693. if (dataAndEvents) {
  41694. if (deepDataAndEvents) {
  41695. srcElements = srcElements || getAll(elem);
  41696. destElements = destElements || getAll(clone);
  41697. for (i = 0, l = srcElements.length; i < l; i++) {
  41698. cloneCopyEvent(srcElements[i], destElements[i]);
  41699. }
  41700. } else {
  41701. cloneCopyEvent(elem, clone);
  41702. }
  41703. }
  41704. // Preserve script evaluation history
  41705. destElements = getAll(clone, "script");
  41706. if (destElements.length > 0) {
  41707. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41708. }
  41709. // Return the cloned set
  41710. return clone;
  41711. },
  41712. cleanData: function cleanData(elems) {
  41713. var data,
  41714. elem,
  41715. type,
  41716. special = jQuery.event.special,
  41717. i = 0;
  41718. for (; (elem = elems[i]) !== undefined; i++) {
  41719. if (acceptData(elem)) {
  41720. if (data = elem[dataPriv.expando]) {
  41721. if (data.events) {
  41722. for (type in data.events) {
  41723. if (special[type]) {
  41724. jQuery.event.remove(elem, type);
  41725. // This is a shortcut to avoid jQuery.event.remove's overhead
  41726. } else {
  41727. jQuery.removeEvent(elem, type, data.handle);
  41728. }
  41729. }
  41730. }
  41731. // Support: Chrome <=35 - 45+
  41732. // Assign undefined instead of using delete, see Data#remove
  41733. elem[dataPriv.expando] = undefined;
  41734. }
  41735. if (elem[dataUser.expando]) {
  41736. // Support: Chrome <=35 - 45+
  41737. // Assign undefined instead of using delete, see Data#remove
  41738. elem[dataUser.expando] = undefined;
  41739. }
  41740. }
  41741. }
  41742. }
  41743. });
  41744. jQuery.fn.extend({
  41745. detach: function detach(selector) {
  41746. return _remove(this, selector, true);
  41747. },
  41748. remove: function remove(selector) {
  41749. return _remove(this, selector);
  41750. },
  41751. text: function text(value) {
  41752. return access(this, function (value) {
  41753. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  41754. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41755. this.textContent = value;
  41756. }
  41757. });
  41758. }, null, value, arguments.length);
  41759. },
  41760. append: function append() {
  41761. return domManip(this, arguments, function (elem) {
  41762. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41763. var target = manipulationTarget(this, elem);
  41764. target.appendChild(elem);
  41765. }
  41766. });
  41767. },
  41768. prepend: function prepend() {
  41769. return domManip(this, arguments, function (elem) {
  41770. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41771. var target = manipulationTarget(this, elem);
  41772. target.insertBefore(elem, target.firstChild);
  41773. }
  41774. });
  41775. },
  41776. before: function before() {
  41777. return domManip(this, arguments, function (elem) {
  41778. if (this.parentNode) {
  41779. this.parentNode.insertBefore(elem, this);
  41780. }
  41781. });
  41782. },
  41783. after: function after() {
  41784. return domManip(this, arguments, function (elem) {
  41785. if (this.parentNode) {
  41786. this.parentNode.insertBefore(elem, this.nextSibling);
  41787. }
  41788. });
  41789. },
  41790. empty: function empty() {
  41791. var elem,
  41792. i = 0;
  41793. for (; (elem = this[i]) != null; i++) {
  41794. if (elem.nodeType === 1) {
  41795. // Prevent memory leaks
  41796. jQuery.cleanData(getAll(elem, false));
  41797. // Remove any remaining nodes
  41798. elem.textContent = "";
  41799. }
  41800. }
  41801. return this;
  41802. },
  41803. clone: function clone(dataAndEvents, deepDataAndEvents) {
  41804. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  41805. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  41806. return this.map(function () {
  41807. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  41808. });
  41809. },
  41810. html: function html(value) {
  41811. return access(this, function (value) {
  41812. var elem = this[0] || {},
  41813. i = 0,
  41814. l = this.length;
  41815. if (value === undefined && elem.nodeType === 1) {
  41816. return elem.innerHTML;
  41817. }
  41818. // See if we can take a shortcut and just use innerHTML
  41819. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  41820. value = jQuery.htmlPrefilter(value);
  41821. try {
  41822. for (; i < l; i++) {
  41823. elem = this[i] || {};
  41824. // Remove element nodes and prevent memory leaks
  41825. if (elem.nodeType === 1) {
  41826. jQuery.cleanData(getAll(elem, false));
  41827. elem.innerHTML = value;
  41828. }
  41829. }
  41830. elem = 0;
  41831. // If using innerHTML throws an exception, use the fallback method
  41832. } catch (e) {}
  41833. }
  41834. if (elem) {
  41835. this.empty().append(value);
  41836. }
  41837. }, null, value, arguments.length);
  41838. },
  41839. replaceWith: function replaceWith() {
  41840. var ignored = [];
  41841. // Make the changes, replacing each non-ignored context element with the new content
  41842. return domManip(this, arguments, function (elem) {
  41843. var parent = this.parentNode;
  41844. if (jQuery.inArray(this, ignored) < 0) {
  41845. jQuery.cleanData(getAll(this));
  41846. if (parent) {
  41847. parent.replaceChild(elem, this);
  41848. }
  41849. }
  41850. // Force callback invocation
  41851. }, ignored);
  41852. }
  41853. });
  41854. jQuery.each({
  41855. appendTo: "append",
  41856. prependTo: "prepend",
  41857. insertBefore: "before",
  41858. insertAfter: "after",
  41859. replaceAll: "replaceWith"
  41860. }, function (name, original) {
  41861. jQuery.fn[name] = function (selector) {
  41862. var elems,
  41863. ret = [],
  41864. insert = jQuery(selector),
  41865. last = insert.length - 1,
  41866. i = 0;
  41867. for (; i <= last; i++) {
  41868. elems = i === last ? this : this.clone(true);
  41869. jQuery(insert[i])[original](elems);
  41870. // Support: Android <=4.0 only, PhantomJS 1 only
  41871. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  41872. push.apply(ret, elems.get());
  41873. }
  41874. return this.pushStack(ret);
  41875. };
  41876. });
  41877. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  41878. var getStyles = function getStyles(elem) {
  41879. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  41880. // IE throws on elements created in popups
  41881. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  41882. var view = elem.ownerDocument.defaultView;
  41883. if (!view || !view.opener) {
  41884. view = window;
  41885. }
  41886. return view.getComputedStyle(elem);
  41887. };
  41888. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  41889. (function () {
  41890. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  41891. // so they're executed at the same time to save the second computation.
  41892. function computeStyleTests() {
  41893. // This is a singleton, we need to execute it only once
  41894. if (!div) {
  41895. return;
  41896. }
  41897. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  41898. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  41899. documentElement.appendChild(container).appendChild(div);
  41900. var divStyle = window.getComputedStyle(div);
  41901. pixelPositionVal = divStyle.top !== "1%";
  41902. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  41903. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  41904. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  41905. // Some styles come back with percentage values, even though they shouldn't
  41906. div.style.right = "60%";
  41907. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  41908. // Support: IE 9 - 11 only
  41909. // Detect misreporting of content dimensions for box-sizing:border-box elements
  41910. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  41911. // Support: IE 9 only
  41912. // Detect overflow:scroll screwiness (gh-3699)
  41913. div.style.position = "absolute";
  41914. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  41915. documentElement.removeChild(container);
  41916. // Nullify the div so it wouldn't be stored in the memory and
  41917. // it will also be a sign that checks already performed
  41918. div = null;
  41919. }
  41920. function roundPixelMeasures(measure) {
  41921. return Math.round(parseFloat(measure));
  41922. }
  41923. var pixelPositionVal,
  41924. boxSizingReliableVal,
  41925. scrollboxSizeVal,
  41926. pixelBoxStylesVal,
  41927. reliableMarginLeftVal,
  41928. container = document.createElement("div"),
  41929. div = document.createElement("div");
  41930. // Finish early in limited (non-browser) environments
  41931. if (!div.style) {
  41932. return;
  41933. }
  41934. // Support: IE <=9 - 11 only
  41935. // Style of cloned element affects source element cloned (#8908)
  41936. div.style.backgroundClip = "content-box";
  41937. div.cloneNode(true).style.backgroundClip = "";
  41938. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  41939. jQuery.extend(support, {
  41940. boxSizingReliable: function boxSizingReliable() {
  41941. computeStyleTests();
  41942. return boxSizingReliableVal;
  41943. },
  41944. pixelBoxStyles: function pixelBoxStyles() {
  41945. computeStyleTests();
  41946. return pixelBoxStylesVal;
  41947. },
  41948. pixelPosition: function pixelPosition() {
  41949. computeStyleTests();
  41950. return pixelPositionVal;
  41951. },
  41952. reliableMarginLeft: function reliableMarginLeft() {
  41953. computeStyleTests();
  41954. return reliableMarginLeftVal;
  41955. },
  41956. scrollboxSize: function scrollboxSize() {
  41957. computeStyleTests();
  41958. return scrollboxSizeVal;
  41959. }
  41960. });
  41961. })();
  41962. function curCSS(elem, name, computed) {
  41963. var width,
  41964. minWidth,
  41965. maxWidth,
  41966. ret,
  41967. // Support: Firefox 51+
  41968. // Retrieving style before computed somehow
  41969. // fixes an issue with getting wrong values
  41970. // on detached elements
  41971. style = elem.style;
  41972. computed = computed || getStyles(elem);
  41973. // getPropertyValue is needed for:
  41974. // .css('filter') (IE 9 only, #12537)
  41975. // .css('--customProperty) (#3144)
  41976. if (computed) {
  41977. ret = computed.getPropertyValue(name) || computed[name];
  41978. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  41979. ret = jQuery.style(elem, name);
  41980. }
  41981. // A tribute to the "awesome hack by Dean Edwards"
  41982. // Android Browser returns percentage for some values,
  41983. // but width seems to be reliably pixels.
  41984. // This is against the CSSOM draft spec:
  41985. // https://drafts.csswg.org/cssom/#resolved-values
  41986. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  41987. // Remember the original values
  41988. width = style.width;
  41989. minWidth = style.minWidth;
  41990. maxWidth = style.maxWidth;
  41991. // Put in the new values to get a computed value out
  41992. style.minWidth = style.maxWidth = style.width = ret;
  41993. ret = computed.width;
  41994. // Revert the changed values
  41995. style.width = width;
  41996. style.minWidth = minWidth;
  41997. style.maxWidth = maxWidth;
  41998. }
  41999. }
  42000. return ret !== undefined ?
  42001. // Support: IE <=9 - 11 only
  42002. // IE returns zIndex value as an integer.
  42003. ret + "" : ret;
  42004. }
  42005. function addGetHookIf(conditionFn, hookFn) {
  42006. // Define the hook, we'll check on the first run if it's really needed.
  42007. return {
  42008. get: function get() {
  42009. if (conditionFn()) {
  42010. // Hook not needed (or it's not possible to use it due
  42011. // to missing dependency), remove it.
  42012. delete this.get;
  42013. return;
  42014. }
  42015. // Hook needed; redefine it so that the support test is not executed again.
  42016. return (this.get = hookFn).apply(this, arguments);
  42017. }
  42018. };
  42019. }
  42020. var
  42021. // Swappable if display is none or starts with table
  42022. // except "table", "table-cell", or "table-caption"
  42023. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  42024. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  42025. rcustomProp = /^--/,
  42026. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  42027. cssNormalTransform = {
  42028. letterSpacing: "0",
  42029. fontWeight: "400"
  42030. },
  42031. cssPrefixes = ["Webkit", "Moz", "ms"],
  42032. emptyStyle = document.createElement("div").style;
  42033. // Return a css property mapped to a potentially vendor prefixed property
  42034. function vendorPropName(name) {
  42035. // Shortcut for names that are not vendor prefixed
  42036. if (name in emptyStyle) {
  42037. return name;
  42038. }
  42039. // Check for vendor prefixed names
  42040. var capName = name[0].toUpperCase() + name.slice(1),
  42041. i = cssPrefixes.length;
  42042. while (i--) {
  42043. name = cssPrefixes[i] + capName;
  42044. if (name in emptyStyle) {
  42045. return name;
  42046. }
  42047. }
  42048. }
  42049. // Return a property mapped along what jQuery.cssProps suggests or to
  42050. // a vendor prefixed property.
  42051. function finalPropName(name) {
  42052. var ret = jQuery.cssProps[name];
  42053. if (!ret) {
  42054. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  42055. }
  42056. return ret;
  42057. }
  42058. function setPositiveNumber(elem, value, subtract) {
  42059. // Any relative (+/-) values have already been
  42060. // normalized at this point
  42061. var matches = rcssNum.exec(value);
  42062. return matches ?
  42063. // Guard against undefined "subtract", e.g., when used as in cssHooks
  42064. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  42065. }
  42066. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  42067. var i = dimension === "width" ? 1 : 0,
  42068. extra = 0,
  42069. delta = 0;
  42070. // Adjustment may not be necessary
  42071. if (box === (isBorderBox ? "border" : "content")) {
  42072. return 0;
  42073. }
  42074. for (; i < 4; i += 2) {
  42075. // Both box models exclude margin
  42076. if (box === "margin") {
  42077. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  42078. }
  42079. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  42080. if (!isBorderBox) {
  42081. // Add padding
  42082. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  42083. // For "border" or "margin", add border
  42084. if (box !== "padding") {
  42085. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42086. // But still keep track of it otherwise
  42087. } else {
  42088. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42089. }
  42090. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  42091. // "padding" or "margin"
  42092. } else {
  42093. // For "content", subtract padding
  42094. if (box === "content") {
  42095. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  42096. }
  42097. // For "content" or "padding", subtract border
  42098. if (box !== "margin") {
  42099. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42100. }
  42101. }
  42102. }
  42103. // Account for positive content-box scroll gutter when requested by providing computedVal
  42104. if (!isBorderBox && computedVal >= 0) {
  42105. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  42106. // Assuming integer scroll gutter, subtract the rest and round down
  42107. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  42108. }
  42109. return delta;
  42110. }
  42111. function getWidthOrHeight(elem, dimension, extra) {
  42112. // Start with computed style
  42113. var styles = getStyles(elem),
  42114. val = curCSS(elem, dimension, styles),
  42115. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  42116. valueIsBorderBox = isBorderBox;
  42117. // Support: Firefox <=54
  42118. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  42119. if (rnumnonpx.test(val)) {
  42120. if (!extra) {
  42121. return val;
  42122. }
  42123. val = "auto";
  42124. }
  42125. // Check for style in case a browser which returns unreliable values
  42126. // for getComputedStyle silently falls back to the reliable elem.style
  42127. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  42128. // Fall back to offsetWidth/offsetHeight when value is "auto"
  42129. // This happens for inline elements with no explicit setting (gh-3571)
  42130. // Support: Android <=4.1 - 4.3 only
  42131. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  42132. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  42133. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  42134. // offsetWidth/offsetHeight provide border-box values
  42135. valueIsBorderBox = true;
  42136. }
  42137. // Normalize "" and auto
  42138. val = parseFloat(val) || 0;
  42139. // Adjust for the element's box model
  42140. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  42141. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  42142. val) + "px";
  42143. }
  42144. jQuery.extend({
  42145. // Add in style property hooks for overriding the default
  42146. // behavior of getting and setting a style property
  42147. cssHooks: {
  42148. opacity: {
  42149. get: function get(elem, computed) {
  42150. if (computed) {
  42151. // We should always get a number back from opacity
  42152. var ret = curCSS(elem, "opacity");
  42153. return ret === "" ? "1" : ret;
  42154. }
  42155. }
  42156. }
  42157. },
  42158. // Don't automatically add "px" to these possibly-unitless properties
  42159. cssNumber: {
  42160. "animationIterationCount": true,
  42161. "columnCount": true,
  42162. "fillOpacity": true,
  42163. "flexGrow": true,
  42164. "flexShrink": true,
  42165. "fontWeight": true,
  42166. "lineHeight": true,
  42167. "opacity": true,
  42168. "order": true,
  42169. "orphans": true,
  42170. "widows": true,
  42171. "zIndex": true,
  42172. "zoom": true
  42173. },
  42174. // Add in properties whose names you wish to fix before
  42175. // setting or getting the value
  42176. cssProps: {},
  42177. // Get and set the style property on a DOM Node
  42178. style: function style(elem, name, value, extra) {
  42179. // Don't set styles on text and comment nodes
  42180. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  42181. return;
  42182. }
  42183. // Make sure that we're working with the right name
  42184. var ret,
  42185. type,
  42186. hooks,
  42187. origName = camelCase(name),
  42188. isCustomProp = rcustomProp.test(name),
  42189. style = elem.style;
  42190. // Make sure that we're working with the right name. We don't
  42191. // want to query the value if it is a CSS custom property
  42192. // since they are user-defined.
  42193. if (!isCustomProp) {
  42194. name = finalPropName(origName);
  42195. }
  42196. // Gets hook for the prefixed version, then unprefixed version
  42197. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  42198. // Check if we're setting a value
  42199. if (value !== undefined) {
  42200. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  42201. // Convert "+=" or "-=" to relative numbers (#7345)
  42202. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  42203. value = adjustCSS(elem, name, ret);
  42204. // Fixes bug #9237
  42205. type = "number";
  42206. }
  42207. // Make sure that null and NaN values aren't set (#7116)
  42208. if (value == null || value !== value) {
  42209. return;
  42210. }
  42211. // If a number was passed in, add the unit (except for certain CSS properties)
  42212. if (type === "number") {
  42213. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  42214. }
  42215. // background-* props affect original clone's values
  42216. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  42217. style[name] = "inherit";
  42218. }
  42219. // If a hook was provided, use that value, otherwise just set the specified value
  42220. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  42221. if (isCustomProp) {
  42222. style.setProperty(name, value);
  42223. } else {
  42224. style[name] = value;
  42225. }
  42226. }
  42227. } else {
  42228. // If a hook was provided get the non-computed value from there
  42229. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  42230. return ret;
  42231. }
  42232. // Otherwise just get the value from the style object
  42233. return style[name];
  42234. }
  42235. },
  42236. css: function css(elem, name, extra, styles) {
  42237. var val,
  42238. num,
  42239. hooks,
  42240. origName = camelCase(name),
  42241. isCustomProp = rcustomProp.test(name);
  42242. // Make sure that we're working with the right name. We don't
  42243. // want to modify the value if it is a CSS custom property
  42244. // since they are user-defined.
  42245. if (!isCustomProp) {
  42246. name = finalPropName(origName);
  42247. }
  42248. // Try prefixed name followed by the unprefixed name
  42249. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  42250. // If a hook was provided get the computed value from there
  42251. if (hooks && "get" in hooks) {
  42252. val = hooks.get(elem, true, extra);
  42253. }
  42254. // Otherwise, if a way to get the computed value exists, use that
  42255. if (val === undefined) {
  42256. val = curCSS(elem, name, styles);
  42257. }
  42258. // Convert "normal" to computed value
  42259. if (val === "normal" && name in cssNormalTransform) {
  42260. val = cssNormalTransform[name];
  42261. }
  42262. // Make numeric if forced or a qualifier was provided and val looks numeric
  42263. if (extra === "" || extra) {
  42264. num = parseFloat(val);
  42265. return extra === true || isFinite(num) ? num || 0 : val;
  42266. }
  42267. return val;
  42268. }
  42269. });
  42270. jQuery.each(["height", "width"], function (i, dimension) {
  42271. jQuery.cssHooks[dimension] = {
  42272. get: function get(elem, computed, extra) {
  42273. if (computed) {
  42274. // Certain elements can have dimension info if we invisibly show them
  42275. // but it must have a current display style that would benefit
  42276. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  42277. // Support: Safari 8+
  42278. // Table columns in Safari have non-zero offsetWidth & zero
  42279. // getBoundingClientRect().width unless display is changed.
  42280. // Support: IE <=11 only
  42281. // Running getBoundingClientRect on a disconnected node
  42282. // in IE throws an error.
  42283. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  42284. return getWidthOrHeight(elem, dimension, extra);
  42285. }) : getWidthOrHeight(elem, dimension, extra);
  42286. }
  42287. },
  42288. set: function set(elem, value, extra) {
  42289. var matches,
  42290. styles = getStyles(elem),
  42291. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  42292. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  42293. // Account for unreliable border-box dimensions by comparing offset* to computed and
  42294. // faking a content-box to get border and padding (gh-3699)
  42295. if (isBorderBox && support.scrollboxSize() === styles.position) {
  42296. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  42297. }
  42298. // Convert to pixels if value adjustment is needed
  42299. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  42300. elem.style[dimension] = value;
  42301. value = jQuery.css(elem, dimension);
  42302. }
  42303. return setPositiveNumber(elem, value, subtract);
  42304. }
  42305. };
  42306. });
  42307. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  42308. if (computed) {
  42309. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  42310. return elem.getBoundingClientRect().left;
  42311. })) + "px";
  42312. }
  42313. });
  42314. // These hooks are used by animate to expand properties
  42315. jQuery.each({
  42316. margin: "",
  42317. padding: "",
  42318. border: "Width"
  42319. }, function (prefix, suffix) {
  42320. jQuery.cssHooks[prefix + suffix] = {
  42321. expand: function expand(value) {
  42322. var i = 0,
  42323. expanded = {},
  42324. // Assumes a single number if not a string
  42325. parts = typeof value === "string" ? value.split(" ") : [value];
  42326. for (; i < 4; i++) {
  42327. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  42328. }
  42329. return expanded;
  42330. }
  42331. };
  42332. if (prefix !== "margin") {
  42333. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  42334. }
  42335. });
  42336. jQuery.fn.extend({
  42337. css: function css(name, value) {
  42338. return access(this, function (elem, name, value) {
  42339. var styles,
  42340. len,
  42341. map = {},
  42342. i = 0;
  42343. if (Array.isArray(name)) {
  42344. styles = getStyles(elem);
  42345. len = name.length;
  42346. for (; i < len; i++) {
  42347. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  42348. }
  42349. return map;
  42350. }
  42351. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  42352. }, name, value, arguments.length > 1);
  42353. }
  42354. });
  42355. function Tween(elem, options, prop, end, easing) {
  42356. return new Tween.prototype.init(elem, options, prop, end, easing);
  42357. }
  42358. jQuery.Tween = Tween;
  42359. Tween.prototype = {
  42360. constructor: Tween,
  42361. init: function init(elem, options, prop, end, easing, unit) {
  42362. this.elem = elem;
  42363. this.prop = prop;
  42364. this.easing = easing || jQuery.easing._default;
  42365. this.options = options;
  42366. this.start = this.now = this.cur();
  42367. this.end = end;
  42368. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  42369. },
  42370. cur: function cur() {
  42371. var hooks = Tween.propHooks[this.prop];
  42372. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  42373. },
  42374. run: function run(percent) {
  42375. var eased,
  42376. hooks = Tween.propHooks[this.prop];
  42377. if (this.options.duration) {
  42378. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  42379. } else {
  42380. this.pos = eased = percent;
  42381. }
  42382. this.now = (this.end - this.start) * eased + this.start;
  42383. if (this.options.step) {
  42384. this.options.step.call(this.elem, this.now, this);
  42385. }
  42386. if (hooks && hooks.set) {
  42387. hooks.set(this);
  42388. } else {
  42389. Tween.propHooks._default.set(this);
  42390. }
  42391. return this;
  42392. }
  42393. };
  42394. Tween.prototype.init.prototype = Tween.prototype;
  42395. Tween.propHooks = {
  42396. _default: {
  42397. get: function get(tween) {
  42398. var result;
  42399. // Use a property on the element directly when it is not a DOM element,
  42400. // or when there is no matching style property that exists.
  42401. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  42402. return tween.elem[tween.prop];
  42403. }
  42404. // Passing an empty string as a 3rd parameter to .css will automatically
  42405. // attempt a parseFloat and fallback to a string if the parse fails.
  42406. // Simple values such as "10px" are parsed to Float;
  42407. // complex values such as "rotate(1rad)" are returned as-is.
  42408. result = jQuery.css(tween.elem, tween.prop, "");
  42409. // Empty strings, null, undefined and "auto" are converted to 0.
  42410. return !result || result === "auto" ? 0 : result;
  42411. },
  42412. set: function set(tween) {
  42413. // Use step hook for back compat.
  42414. // Use cssHook if its there.
  42415. // Use .style if available and use plain properties where available.
  42416. if (jQuery.fx.step[tween.prop]) {
  42417. jQuery.fx.step[tween.prop](tween);
  42418. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  42419. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  42420. } else {
  42421. tween.elem[tween.prop] = tween.now;
  42422. }
  42423. }
  42424. }
  42425. };
  42426. // Support: IE <=9 only
  42427. // Panic based approach to setting things on disconnected nodes
  42428. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  42429. set: function set(tween) {
  42430. if (tween.elem.nodeType && tween.elem.parentNode) {
  42431. tween.elem[tween.prop] = tween.now;
  42432. }
  42433. }
  42434. };
  42435. jQuery.easing = {
  42436. linear: function linear(p) {
  42437. return p;
  42438. },
  42439. swing: function swing(p) {
  42440. return 0.5 - Math.cos(p * Math.PI) / 2;
  42441. },
  42442. _default: "swing"
  42443. };
  42444. jQuery.fx = Tween.prototype.init;
  42445. // Back compat <1.8 extension point
  42446. jQuery.fx.step = {};
  42447. var fxNow,
  42448. inProgress,
  42449. rfxtypes = /^(?:toggle|show|hide)$/,
  42450. rrun = /queueHooks$/;
  42451. function schedule() {
  42452. if (inProgress) {
  42453. if (document.hidden === false && window.requestAnimationFrame) {
  42454. window.requestAnimationFrame(schedule);
  42455. } else {
  42456. window.setTimeout(schedule, jQuery.fx.interval);
  42457. }
  42458. jQuery.fx.tick();
  42459. }
  42460. }
  42461. // Animations created synchronously will run synchronously
  42462. function createFxNow() {
  42463. window.setTimeout(function () {
  42464. fxNow = undefined;
  42465. });
  42466. return fxNow = Date.now();
  42467. }
  42468. // Generate parameters to create a standard animation
  42469. function genFx(type, includeWidth) {
  42470. var which,
  42471. i = 0,
  42472. attrs = { height: type };
  42473. // If we include width, step value is 1 to do all cssExpand values,
  42474. // otherwise step value is 2 to skip over Left and Right
  42475. includeWidth = includeWidth ? 1 : 0;
  42476. for (; i < 4; i += 2 - includeWidth) {
  42477. which = cssExpand[i];
  42478. attrs["margin" + which] = attrs["padding" + which] = type;
  42479. }
  42480. if (includeWidth) {
  42481. attrs.opacity = attrs.width = type;
  42482. }
  42483. return attrs;
  42484. }
  42485. function createTween(value, prop, animation) {
  42486. var tween,
  42487. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  42488. index = 0,
  42489. length = collection.length;
  42490. for (; index < length; index++) {
  42491. if (tween = collection[index].call(animation, prop, value)) {
  42492. // We're done with this property
  42493. return tween;
  42494. }
  42495. }
  42496. }
  42497. function defaultPrefilter(elem, props, opts) {
  42498. var prop,
  42499. value,
  42500. toggle,
  42501. hooks,
  42502. oldfire,
  42503. propTween,
  42504. restoreDisplay,
  42505. display,
  42506. isBox = "width" in props || "height" in props,
  42507. anim = this,
  42508. orig = {},
  42509. style = elem.style,
  42510. hidden = elem.nodeType && isHiddenWithinTree(elem),
  42511. dataShow = dataPriv.get(elem, "fxshow");
  42512. // Queue-skipping animations hijack the fx hooks
  42513. if (!opts.queue) {
  42514. hooks = jQuery._queueHooks(elem, "fx");
  42515. if (hooks.unqueued == null) {
  42516. hooks.unqueued = 0;
  42517. oldfire = hooks.empty.fire;
  42518. hooks.empty.fire = function () {
  42519. if (!hooks.unqueued) {
  42520. oldfire();
  42521. }
  42522. };
  42523. }
  42524. hooks.unqueued++;
  42525. anim.always(function () {
  42526. // Ensure the complete handler is called before this completes
  42527. anim.always(function () {
  42528. hooks.unqueued--;
  42529. if (!jQuery.queue(elem, "fx").length) {
  42530. hooks.empty.fire();
  42531. }
  42532. });
  42533. });
  42534. }
  42535. // Detect show/hide animations
  42536. for (prop in props) {
  42537. value = props[prop];
  42538. if (rfxtypes.test(value)) {
  42539. delete props[prop];
  42540. toggle = toggle || value === "toggle";
  42541. if (value === (hidden ? "hide" : "show")) {
  42542. // Pretend to be hidden if this is a "show" and
  42543. // there is still data from a stopped show/hide
  42544. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  42545. hidden = true;
  42546. // Ignore all other no-op show/hide data
  42547. } else {
  42548. continue;
  42549. }
  42550. }
  42551. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  42552. }
  42553. }
  42554. // Bail out if this is a no-op like .hide().hide()
  42555. propTween = !jQuery.isEmptyObject(props);
  42556. if (!propTween && jQuery.isEmptyObject(orig)) {
  42557. return;
  42558. }
  42559. // Restrict "overflow" and "display" styles during box animations
  42560. if (isBox && elem.nodeType === 1) {
  42561. // Support: IE <=9 - 11, Edge 12 - 15
  42562. // Record all 3 overflow attributes because IE does not infer the shorthand
  42563. // from identically-valued overflowX and overflowY and Edge just mirrors
  42564. // the overflowX value there.
  42565. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  42566. // Identify a display type, preferring old show/hide data over the CSS cascade
  42567. restoreDisplay = dataShow && dataShow.display;
  42568. if (restoreDisplay == null) {
  42569. restoreDisplay = dataPriv.get(elem, "display");
  42570. }
  42571. display = jQuery.css(elem, "display");
  42572. if (display === "none") {
  42573. if (restoreDisplay) {
  42574. display = restoreDisplay;
  42575. } else {
  42576. // Get nonempty value(s) by temporarily forcing visibility
  42577. showHide([elem], true);
  42578. restoreDisplay = elem.style.display || restoreDisplay;
  42579. display = jQuery.css(elem, "display");
  42580. showHide([elem]);
  42581. }
  42582. }
  42583. // Animate inline elements as inline-block
  42584. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  42585. if (jQuery.css(elem, "float") === "none") {
  42586. // Restore the original display value at the end of pure show/hide animations
  42587. if (!propTween) {
  42588. anim.done(function () {
  42589. style.display = restoreDisplay;
  42590. });
  42591. if (restoreDisplay == null) {
  42592. display = style.display;
  42593. restoreDisplay = display === "none" ? "" : display;
  42594. }
  42595. }
  42596. style.display = "inline-block";
  42597. }
  42598. }
  42599. }
  42600. if (opts.overflow) {
  42601. style.overflow = "hidden";
  42602. anim.always(function () {
  42603. style.overflow = opts.overflow[0];
  42604. style.overflowX = opts.overflow[1];
  42605. style.overflowY = opts.overflow[2];
  42606. });
  42607. }
  42608. // Implement show/hide animations
  42609. propTween = false;
  42610. for (prop in orig) {
  42611. // General show/hide setup for this element animation
  42612. if (!propTween) {
  42613. if (dataShow) {
  42614. if ("hidden" in dataShow) {
  42615. hidden = dataShow.hidden;
  42616. }
  42617. } else {
  42618. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42619. }
  42620. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42621. if (toggle) {
  42622. dataShow.hidden = !hidden;
  42623. }
  42624. // Show elements before animating them
  42625. if (hidden) {
  42626. showHide([elem], true);
  42627. }
  42628. /* eslint-disable no-loop-func */
  42629. anim.done(function () {
  42630. /* eslint-enable no-loop-func */
  42631. // The final step of a "hide" animation is actually hiding the element
  42632. if (!hidden) {
  42633. showHide([elem]);
  42634. }
  42635. dataPriv.remove(elem, "fxshow");
  42636. for (prop in orig) {
  42637. jQuery.style(elem, prop, orig[prop]);
  42638. }
  42639. });
  42640. }
  42641. // Per-property setup
  42642. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42643. if (!(prop in dataShow)) {
  42644. dataShow[prop] = propTween.start;
  42645. if (hidden) {
  42646. propTween.end = propTween.start;
  42647. propTween.start = 0;
  42648. }
  42649. }
  42650. }
  42651. }
  42652. function propFilter(props, specialEasing) {
  42653. var index, name, easing, value, hooks;
  42654. // camelCase, specialEasing and expand cssHook pass
  42655. for (index in props) {
  42656. name = camelCase(index);
  42657. easing = specialEasing[name];
  42658. value = props[index];
  42659. if (Array.isArray(value)) {
  42660. easing = value[1];
  42661. value = props[index] = value[0];
  42662. }
  42663. if (index !== name) {
  42664. props[name] = value;
  42665. delete props[index];
  42666. }
  42667. hooks = jQuery.cssHooks[name];
  42668. if (hooks && "expand" in hooks) {
  42669. value = hooks.expand(value);
  42670. delete props[name];
  42671. // Not quite $.extend, this won't overwrite existing keys.
  42672. // Reusing 'index' because we have the correct "name"
  42673. for (index in value) {
  42674. if (!(index in props)) {
  42675. props[index] = value[index];
  42676. specialEasing[index] = easing;
  42677. }
  42678. }
  42679. } else {
  42680. specialEasing[name] = easing;
  42681. }
  42682. }
  42683. }
  42684. function Animation(elem, properties, options) {
  42685. var result,
  42686. stopped,
  42687. index = 0,
  42688. length = Animation.prefilters.length,
  42689. deferred = jQuery.Deferred().always(function () {
  42690. // Don't match elem in the :animated selector
  42691. delete tick.elem;
  42692. }),
  42693. tick = function tick() {
  42694. if (stopped) {
  42695. return false;
  42696. }
  42697. var currentTime = fxNow || createFxNow(),
  42698. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42699. // Support: Android 2.3 only
  42700. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42701. temp = remaining / animation.duration || 0,
  42702. percent = 1 - temp,
  42703. index = 0,
  42704. length = animation.tweens.length;
  42705. for (; index < length; index++) {
  42706. animation.tweens[index].run(percent);
  42707. }
  42708. deferred.notifyWith(elem, [animation, percent, remaining]);
  42709. // If there's more to do, yield
  42710. if (percent < 1 && length) {
  42711. return remaining;
  42712. }
  42713. // If this was an empty animation, synthesize a final progress notification
  42714. if (!length) {
  42715. deferred.notifyWith(elem, [animation, 1, 0]);
  42716. }
  42717. // Resolve the animation and report its conclusion
  42718. deferred.resolveWith(elem, [animation]);
  42719. return false;
  42720. },
  42721. animation = deferred.promise({
  42722. elem: elem,
  42723. props: jQuery.extend({}, properties),
  42724. opts: jQuery.extend(true, {
  42725. specialEasing: {},
  42726. easing: jQuery.easing._default
  42727. }, options),
  42728. originalProperties: properties,
  42729. originalOptions: options,
  42730. startTime: fxNow || createFxNow(),
  42731. duration: options.duration,
  42732. tweens: [],
  42733. createTween: function createTween(prop, end) {
  42734. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  42735. animation.tweens.push(tween);
  42736. return tween;
  42737. },
  42738. stop: function stop(gotoEnd) {
  42739. var index = 0,
  42740. // If we are going to the end, we want to run all the tweens
  42741. // otherwise we skip this part
  42742. length = gotoEnd ? animation.tweens.length : 0;
  42743. if (stopped) {
  42744. return this;
  42745. }
  42746. stopped = true;
  42747. for (; index < length; index++) {
  42748. animation.tweens[index].run(1);
  42749. }
  42750. // Resolve when we played the last frame; otherwise, reject
  42751. if (gotoEnd) {
  42752. deferred.notifyWith(elem, [animation, 1, 0]);
  42753. deferred.resolveWith(elem, [animation, gotoEnd]);
  42754. } else {
  42755. deferred.rejectWith(elem, [animation, gotoEnd]);
  42756. }
  42757. return this;
  42758. }
  42759. }),
  42760. props = animation.props;
  42761. propFilter(props, animation.opts.specialEasing);
  42762. for (; index < length; index++) {
  42763. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  42764. if (result) {
  42765. if (isFunction(result.stop)) {
  42766. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  42767. }
  42768. return result;
  42769. }
  42770. }
  42771. jQuery.map(props, createTween, animation);
  42772. if (isFunction(animation.opts.start)) {
  42773. animation.opts.start.call(elem, animation);
  42774. }
  42775. // Attach callbacks from options
  42776. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  42777. jQuery.fx.timer(jQuery.extend(tick, {
  42778. elem: elem,
  42779. anim: animation,
  42780. queue: animation.opts.queue
  42781. }));
  42782. return animation;
  42783. }
  42784. jQuery.Animation = jQuery.extend(Animation, {
  42785. tweeners: {
  42786. "*": [function (prop, value) {
  42787. var tween = this.createTween(prop, value);
  42788. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  42789. return tween;
  42790. }]
  42791. },
  42792. tweener: function tweener(props, callback) {
  42793. if (isFunction(props)) {
  42794. callback = props;
  42795. props = ["*"];
  42796. } else {
  42797. props = props.match(rnothtmlwhite);
  42798. }
  42799. var prop,
  42800. index = 0,
  42801. length = props.length;
  42802. for (; index < length; index++) {
  42803. prop = props[index];
  42804. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  42805. Animation.tweeners[prop].unshift(callback);
  42806. }
  42807. },
  42808. prefilters: [defaultPrefilter],
  42809. prefilter: function prefilter(callback, prepend) {
  42810. if (prepend) {
  42811. Animation.prefilters.unshift(callback);
  42812. } else {
  42813. Animation.prefilters.push(callback);
  42814. }
  42815. }
  42816. });
  42817. jQuery.speed = function (speed, easing, fn) {
  42818. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  42819. complete: fn || !fn && easing || isFunction(speed) && speed,
  42820. duration: speed,
  42821. easing: fn && easing || easing && !isFunction(easing) && easing
  42822. };
  42823. // Go to the end state if fx are off
  42824. if (jQuery.fx.off) {
  42825. opt.duration = 0;
  42826. } else {
  42827. if (typeof opt.duration !== "number") {
  42828. if (opt.duration in jQuery.fx.speeds) {
  42829. opt.duration = jQuery.fx.speeds[opt.duration];
  42830. } else {
  42831. opt.duration = jQuery.fx.speeds._default;
  42832. }
  42833. }
  42834. }
  42835. // Normalize opt.queue - true/undefined/null -> "fx"
  42836. if (opt.queue == null || opt.queue === true) {
  42837. opt.queue = "fx";
  42838. }
  42839. // Queueing
  42840. opt.old = opt.complete;
  42841. opt.complete = function () {
  42842. if (isFunction(opt.old)) {
  42843. opt.old.call(this);
  42844. }
  42845. if (opt.queue) {
  42846. jQuery.dequeue(this, opt.queue);
  42847. }
  42848. };
  42849. return opt;
  42850. };
  42851. jQuery.fn.extend({
  42852. fadeTo: function fadeTo(speed, to, easing, callback) {
  42853. // Show any hidden elements after setting opacity to 0
  42854. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  42855. // Animate to the value specified
  42856. .end().animate({ opacity: to }, speed, easing, callback);
  42857. },
  42858. animate: function animate(prop, speed, easing, callback) {
  42859. var empty = jQuery.isEmptyObject(prop),
  42860. optall = jQuery.speed(speed, easing, callback),
  42861. doAnimation = function doAnimation() {
  42862. // Operate on a copy of prop so per-property easing won't be lost
  42863. var anim = Animation(this, jQuery.extend({}, prop), optall);
  42864. // Empty animations, or finishing resolves immediately
  42865. if (empty || dataPriv.get(this, "finish")) {
  42866. anim.stop(true);
  42867. }
  42868. };
  42869. doAnimation.finish = doAnimation;
  42870. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  42871. },
  42872. stop: function stop(type, clearQueue, gotoEnd) {
  42873. var stopQueue = function stopQueue(hooks) {
  42874. var stop = hooks.stop;
  42875. delete hooks.stop;
  42876. stop(gotoEnd);
  42877. };
  42878. if (typeof type !== "string") {
  42879. gotoEnd = clearQueue;
  42880. clearQueue = type;
  42881. type = undefined;
  42882. }
  42883. if (clearQueue && type !== false) {
  42884. this.queue(type || "fx", []);
  42885. }
  42886. return this.each(function () {
  42887. var dequeue = true,
  42888. index = type != null && type + "queueHooks",
  42889. timers = jQuery.timers,
  42890. data = dataPriv.get(this);
  42891. if (index) {
  42892. if (data[index] && data[index].stop) {
  42893. stopQueue(data[index]);
  42894. }
  42895. } else {
  42896. for (index in data) {
  42897. if (data[index] && data[index].stop && rrun.test(index)) {
  42898. stopQueue(data[index]);
  42899. }
  42900. }
  42901. }
  42902. for (index = timers.length; index--;) {
  42903. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  42904. timers[index].anim.stop(gotoEnd);
  42905. dequeue = false;
  42906. timers.splice(index, 1);
  42907. }
  42908. }
  42909. // Start the next in the queue if the last step wasn't forced.
  42910. // Timers currently will call their complete callbacks, which
  42911. // will dequeue but only if they were gotoEnd.
  42912. if (dequeue || !gotoEnd) {
  42913. jQuery.dequeue(this, type);
  42914. }
  42915. });
  42916. },
  42917. finish: function finish(type) {
  42918. if (type !== false) {
  42919. type = type || "fx";
  42920. }
  42921. return this.each(function () {
  42922. var index,
  42923. data = dataPriv.get(this),
  42924. queue = data[type + "queue"],
  42925. hooks = data[type + "queueHooks"],
  42926. timers = jQuery.timers,
  42927. length = queue ? queue.length : 0;
  42928. // Enable finishing flag on private data
  42929. data.finish = true;
  42930. // Empty the queue first
  42931. jQuery.queue(this, type, []);
  42932. if (hooks && hooks.stop) {
  42933. hooks.stop.call(this, true);
  42934. }
  42935. // Look for any active animations, and finish them
  42936. for (index = timers.length; index--;) {
  42937. if (timers[index].elem === this && timers[index].queue === type) {
  42938. timers[index].anim.stop(true);
  42939. timers.splice(index, 1);
  42940. }
  42941. }
  42942. // Look for any animations in the old queue and finish them
  42943. for (index = 0; index < length; index++) {
  42944. if (queue[index] && queue[index].finish) {
  42945. queue[index].finish.call(this);
  42946. }
  42947. }
  42948. // Turn off finishing flag
  42949. delete data.finish;
  42950. });
  42951. }
  42952. });
  42953. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  42954. var cssFn = jQuery.fn[name];
  42955. jQuery.fn[name] = function (speed, easing, callback) {
  42956. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  42957. };
  42958. });
  42959. // Generate shortcuts for custom animations
  42960. jQuery.each({
  42961. slideDown: genFx("show"),
  42962. slideUp: genFx("hide"),
  42963. slideToggle: genFx("toggle"),
  42964. fadeIn: { opacity: "show" },
  42965. fadeOut: { opacity: "hide" },
  42966. fadeToggle: { opacity: "toggle" }
  42967. }, function (name, props) {
  42968. jQuery.fn[name] = function (speed, easing, callback) {
  42969. return this.animate(props, speed, easing, callback);
  42970. };
  42971. });
  42972. jQuery.timers = [];
  42973. jQuery.fx.tick = function () {
  42974. var timer,
  42975. i = 0,
  42976. timers = jQuery.timers;
  42977. fxNow = Date.now();
  42978. for (; i < timers.length; i++) {
  42979. timer = timers[i];
  42980. // Run the timer and safely remove it when done (allowing for external removal)
  42981. if (!timer() && timers[i] === timer) {
  42982. timers.splice(i--, 1);
  42983. }
  42984. }
  42985. if (!timers.length) {
  42986. jQuery.fx.stop();
  42987. }
  42988. fxNow = undefined;
  42989. };
  42990. jQuery.fx.timer = function (timer) {
  42991. jQuery.timers.push(timer);
  42992. jQuery.fx.start();
  42993. };
  42994. jQuery.fx.interval = 13;
  42995. jQuery.fx.start = function () {
  42996. if (inProgress) {
  42997. return;
  42998. }
  42999. inProgress = true;
  43000. schedule();
  43001. };
  43002. jQuery.fx.stop = function () {
  43003. inProgress = null;
  43004. };
  43005. jQuery.fx.speeds = {
  43006. slow: 600,
  43007. fast: 200,
  43008. // Default speed
  43009. _default: 400
  43010. };
  43011. // Based off of the plugin by Clint Helfers, with permission.
  43012. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  43013. jQuery.fn.delay = function (time, type) {
  43014. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  43015. type = type || "fx";
  43016. return this.queue(type, function (next, hooks) {
  43017. var timeout = window.setTimeout(next, time);
  43018. hooks.stop = function () {
  43019. window.clearTimeout(timeout);
  43020. };
  43021. });
  43022. };
  43023. (function () {
  43024. var input = document.createElement("input"),
  43025. select = document.createElement("select"),
  43026. opt = select.appendChild(document.createElement("option"));
  43027. input.type = "checkbox";
  43028. // Support: Android <=4.3 only
  43029. // Default value for a checkbox should be "on"
  43030. support.checkOn = input.value !== "";
  43031. // Support: IE <=11 only
  43032. // Must access selectedIndex to make default options select
  43033. support.optSelected = opt.selected;
  43034. // Support: IE <=11 only
  43035. // An input loses its value after becoming a radio
  43036. input = document.createElement("input");
  43037. input.value = "t";
  43038. input.type = "radio";
  43039. support.radioValue = input.value === "t";
  43040. })();
  43041. var boolHook,
  43042. attrHandle = jQuery.expr.attrHandle;
  43043. jQuery.fn.extend({
  43044. attr: function attr(name, value) {
  43045. return access(this, jQuery.attr, name, value, arguments.length > 1);
  43046. },
  43047. removeAttr: function removeAttr(name) {
  43048. return this.each(function () {
  43049. jQuery.removeAttr(this, name);
  43050. });
  43051. }
  43052. });
  43053. jQuery.extend({
  43054. attr: function attr(elem, name, value) {
  43055. var ret,
  43056. hooks,
  43057. nType = elem.nodeType;
  43058. // Don't get/set attributes on text, comment and attribute nodes
  43059. if (nType === 3 || nType === 8 || nType === 2) {
  43060. return;
  43061. }
  43062. // Fallback to prop when attributes are not supported
  43063. if (typeof elem.getAttribute === "undefined") {
  43064. return jQuery.prop(elem, name, value);
  43065. }
  43066. // Attribute hooks are determined by the lowercase version
  43067. // Grab necessary hook if one is defined
  43068. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  43069. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  43070. }
  43071. if (value !== undefined) {
  43072. if (value === null) {
  43073. jQuery.removeAttr(elem, name);
  43074. return;
  43075. }
  43076. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  43077. return ret;
  43078. }
  43079. elem.setAttribute(name, value + "");
  43080. return value;
  43081. }
  43082. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  43083. return ret;
  43084. }
  43085. ret = jQuery.find.attr(elem, name);
  43086. // Non-existent attributes return null, we normalize to undefined
  43087. return ret == null ? undefined : ret;
  43088. },
  43089. attrHooks: {
  43090. type: {
  43091. set: function set(elem, value) {
  43092. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  43093. var val = elem.value;
  43094. elem.setAttribute("type", value);
  43095. if (val) {
  43096. elem.value = val;
  43097. }
  43098. return value;
  43099. }
  43100. }
  43101. }
  43102. },
  43103. removeAttr: function removeAttr(elem, value) {
  43104. var name,
  43105. i = 0,
  43106. // Attribute names can contain non-HTML whitespace characters
  43107. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  43108. attrNames = value && value.match(rnothtmlwhite);
  43109. if (attrNames && elem.nodeType === 1) {
  43110. while (name = attrNames[i++]) {
  43111. elem.removeAttribute(name);
  43112. }
  43113. }
  43114. }
  43115. });
  43116. // Hooks for boolean attributes
  43117. boolHook = {
  43118. set: function set(elem, value, name) {
  43119. if (value === false) {
  43120. // Remove boolean attributes when set to false
  43121. jQuery.removeAttr(elem, name);
  43122. } else {
  43123. elem.setAttribute(name, name);
  43124. }
  43125. return name;
  43126. }
  43127. };
  43128. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  43129. var getter = attrHandle[name] || jQuery.find.attr;
  43130. attrHandle[name] = function (elem, name, isXML) {
  43131. var ret,
  43132. handle,
  43133. lowercaseName = name.toLowerCase();
  43134. if (!isXML) {
  43135. // Avoid an infinite loop by temporarily removing this function from the getter
  43136. handle = attrHandle[lowercaseName];
  43137. attrHandle[lowercaseName] = ret;
  43138. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  43139. attrHandle[lowercaseName] = handle;
  43140. }
  43141. return ret;
  43142. };
  43143. });
  43144. var rfocusable = /^(?:input|select|textarea|button)$/i,
  43145. rclickable = /^(?:a|area)$/i;
  43146. jQuery.fn.extend({
  43147. prop: function prop(name, value) {
  43148. return access(this, jQuery.prop, name, value, arguments.length > 1);
  43149. },
  43150. removeProp: function removeProp(name) {
  43151. return this.each(function () {
  43152. delete this[jQuery.propFix[name] || name];
  43153. });
  43154. }
  43155. });
  43156. jQuery.extend({
  43157. prop: function prop(elem, name, value) {
  43158. var ret,
  43159. hooks,
  43160. nType = elem.nodeType;
  43161. // Don't get/set properties on text, comment and attribute nodes
  43162. if (nType === 3 || nType === 8 || nType === 2) {
  43163. return;
  43164. }
  43165. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  43166. // Fix name and attach hooks
  43167. name = jQuery.propFix[name] || name;
  43168. hooks = jQuery.propHooks[name];
  43169. }
  43170. if (value !== undefined) {
  43171. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  43172. return ret;
  43173. }
  43174. return elem[name] = value;
  43175. }
  43176. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  43177. return ret;
  43178. }
  43179. return elem[name];
  43180. },
  43181. propHooks: {
  43182. tabIndex: {
  43183. get: function get(elem) {
  43184. // Support: IE <=9 - 11 only
  43185. // elem.tabIndex doesn't always return the
  43186. // correct value when it hasn't been explicitly set
  43187. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  43188. // Use proper attribute retrieval(#12072)
  43189. var tabindex = jQuery.find.attr(elem, "tabindex");
  43190. if (tabindex) {
  43191. return parseInt(tabindex, 10);
  43192. }
  43193. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  43194. return 0;
  43195. }
  43196. return -1;
  43197. }
  43198. }
  43199. },
  43200. propFix: {
  43201. "for": "htmlFor",
  43202. "class": "className"
  43203. }
  43204. });
  43205. // Support: IE <=11 only
  43206. // Accessing the selectedIndex property
  43207. // forces the browser to respect setting selected
  43208. // on the option
  43209. // The getter ensures a default option is selected
  43210. // when in an optgroup
  43211. // eslint rule "no-unused-expressions" is disabled for this code
  43212. // since it considers such accessions noop
  43213. if (!support.optSelected) {
  43214. jQuery.propHooks.selected = {
  43215. get: function get(elem) {
  43216. /* eslint no-unused-expressions: "off" */
  43217. var parent = elem.parentNode;
  43218. if (parent && parent.parentNode) {
  43219. parent.parentNode.selectedIndex;
  43220. }
  43221. return null;
  43222. },
  43223. set: function set(elem) {
  43224. /* eslint no-unused-expressions: "off" */
  43225. var parent = elem.parentNode;
  43226. if (parent) {
  43227. parent.selectedIndex;
  43228. if (parent.parentNode) {
  43229. parent.parentNode.selectedIndex;
  43230. }
  43231. }
  43232. }
  43233. };
  43234. }
  43235. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  43236. jQuery.propFix[this.toLowerCase()] = this;
  43237. });
  43238. // Strip and collapse whitespace according to HTML spec
  43239. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  43240. function stripAndCollapse(value) {
  43241. var tokens = value.match(rnothtmlwhite) || [];
  43242. return tokens.join(" ");
  43243. }
  43244. function getClass(elem) {
  43245. return elem.getAttribute && elem.getAttribute("class") || "";
  43246. }
  43247. function classesToArray(value) {
  43248. if (Array.isArray(value)) {
  43249. return value;
  43250. }
  43251. if (typeof value === "string") {
  43252. return value.match(rnothtmlwhite) || [];
  43253. }
  43254. return [];
  43255. }
  43256. jQuery.fn.extend({
  43257. addClass: function addClass(value) {
  43258. var classes,
  43259. elem,
  43260. cur,
  43261. curValue,
  43262. clazz,
  43263. j,
  43264. finalValue,
  43265. i = 0;
  43266. if (isFunction(value)) {
  43267. return this.each(function (j) {
  43268. jQuery(this).addClass(value.call(this, j, getClass(this)));
  43269. });
  43270. }
  43271. classes = classesToArray(value);
  43272. if (classes.length) {
  43273. while (elem = this[i++]) {
  43274. curValue = getClass(elem);
  43275. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  43276. if (cur) {
  43277. j = 0;
  43278. while (clazz = classes[j++]) {
  43279. if (cur.indexOf(" " + clazz + " ") < 0) {
  43280. cur += clazz + " ";
  43281. }
  43282. }
  43283. // Only assign if different to avoid unneeded rendering.
  43284. finalValue = stripAndCollapse(cur);
  43285. if (curValue !== finalValue) {
  43286. elem.setAttribute("class", finalValue);
  43287. }
  43288. }
  43289. }
  43290. }
  43291. return this;
  43292. },
  43293. removeClass: function removeClass(value) {
  43294. var classes,
  43295. elem,
  43296. cur,
  43297. curValue,
  43298. clazz,
  43299. j,
  43300. finalValue,
  43301. i = 0;
  43302. if (isFunction(value)) {
  43303. return this.each(function (j) {
  43304. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  43305. });
  43306. }
  43307. if (!arguments.length) {
  43308. return this.attr("class", "");
  43309. }
  43310. classes = classesToArray(value);
  43311. if (classes.length) {
  43312. while (elem = this[i++]) {
  43313. curValue = getClass(elem);
  43314. // This expression is here for better compressibility (see addClass)
  43315. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  43316. if (cur) {
  43317. j = 0;
  43318. while (clazz = classes[j++]) {
  43319. // Remove *all* instances
  43320. while (cur.indexOf(" " + clazz + " ") > -1) {
  43321. cur = cur.replace(" " + clazz + " ", " ");
  43322. }
  43323. }
  43324. // Only assign if different to avoid unneeded rendering.
  43325. finalValue = stripAndCollapse(cur);
  43326. if (curValue !== finalValue) {
  43327. elem.setAttribute("class", finalValue);
  43328. }
  43329. }
  43330. }
  43331. }
  43332. return this;
  43333. },
  43334. toggleClass: function toggleClass(value, stateVal) {
  43335. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  43336. isValidValue = type === "string" || Array.isArray(value);
  43337. if (typeof stateVal === "boolean" && isValidValue) {
  43338. return stateVal ? this.addClass(value) : this.removeClass(value);
  43339. }
  43340. if (isFunction(value)) {
  43341. return this.each(function (i) {
  43342. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  43343. });
  43344. }
  43345. return this.each(function () {
  43346. var className, i, self, classNames;
  43347. if (isValidValue) {
  43348. // Toggle individual class names
  43349. i = 0;
  43350. self = jQuery(this);
  43351. classNames = classesToArray(value);
  43352. while (className = classNames[i++]) {
  43353. // Check each className given, space separated list
  43354. if (self.hasClass(className)) {
  43355. self.removeClass(className);
  43356. } else {
  43357. self.addClass(className);
  43358. }
  43359. }
  43360. // Toggle whole class name
  43361. } else if (value === undefined || type === "boolean") {
  43362. className = getClass(this);
  43363. if (className) {
  43364. // Store className if set
  43365. dataPriv.set(this, "__className__", className);
  43366. }
  43367. // If the element has a class name or if we're passed `false`,
  43368. // then remove the whole classname (if there was one, the above saved it).
  43369. // Otherwise bring back whatever was previously saved (if anything),
  43370. // falling back to the empty string if nothing was stored.
  43371. if (this.setAttribute) {
  43372. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  43373. }
  43374. }
  43375. });
  43376. },
  43377. hasClass: function hasClass(selector) {
  43378. var className,
  43379. elem,
  43380. i = 0;
  43381. className = " " + selector + " ";
  43382. while (elem = this[i++]) {
  43383. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  43384. return true;
  43385. }
  43386. }
  43387. return false;
  43388. }
  43389. });
  43390. var rreturn = /\r/g;
  43391. jQuery.fn.extend({
  43392. val: function val(value) {
  43393. var hooks,
  43394. ret,
  43395. valueIsFunction,
  43396. elem = this[0];
  43397. if (!arguments.length) {
  43398. if (elem) {
  43399. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  43400. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  43401. return ret;
  43402. }
  43403. ret = elem.value;
  43404. // Handle most common string cases
  43405. if (typeof ret === "string") {
  43406. return ret.replace(rreturn, "");
  43407. }
  43408. // Handle cases where value is null/undef or number
  43409. return ret == null ? "" : ret;
  43410. }
  43411. return;
  43412. }
  43413. valueIsFunction = isFunction(value);
  43414. return this.each(function (i) {
  43415. var val;
  43416. if (this.nodeType !== 1) {
  43417. return;
  43418. }
  43419. if (valueIsFunction) {
  43420. val = value.call(this, i, jQuery(this).val());
  43421. } else {
  43422. val = value;
  43423. }
  43424. // Treat null/undefined as ""; convert numbers to string
  43425. if (val == null) {
  43426. val = "";
  43427. } else if (typeof val === "number") {
  43428. val += "";
  43429. } else if (Array.isArray(val)) {
  43430. val = jQuery.map(val, function (value) {
  43431. return value == null ? "" : value + "";
  43432. });
  43433. }
  43434. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  43435. // If set returns undefined, fall back to normal setting
  43436. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  43437. this.value = val;
  43438. }
  43439. });
  43440. }
  43441. });
  43442. jQuery.extend({
  43443. valHooks: {
  43444. option: {
  43445. get: function get(elem) {
  43446. var val = jQuery.find.attr(elem, "value");
  43447. return val != null ? val :
  43448. // Support: IE <=10 - 11 only
  43449. // option.text throws exceptions (#14686, #14858)
  43450. // Strip and collapse whitespace
  43451. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  43452. stripAndCollapse(jQuery.text(elem));
  43453. }
  43454. },
  43455. select: {
  43456. get: function get(elem) {
  43457. var value,
  43458. option,
  43459. i,
  43460. options = elem.options,
  43461. index = elem.selectedIndex,
  43462. one = elem.type === "select-one",
  43463. values = one ? null : [],
  43464. max = one ? index + 1 : options.length;
  43465. if (index < 0) {
  43466. i = max;
  43467. } else {
  43468. i = one ? index : 0;
  43469. }
  43470. // Loop through all the selected options
  43471. for (; i < max; i++) {
  43472. option = options[i];
  43473. // Support: IE <=9 only
  43474. // IE8-9 doesn't update selected after form reset (#2551)
  43475. if ((option.selected || i === index) &&
  43476. // Don't return options that are disabled or in a disabled optgroup
  43477. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  43478. // Get the specific value for the option
  43479. value = jQuery(option).val();
  43480. // We don't need an array for one selects
  43481. if (one) {
  43482. return value;
  43483. }
  43484. // Multi-Selects return an array
  43485. values.push(value);
  43486. }
  43487. }
  43488. return values;
  43489. },
  43490. set: function set(elem, value) {
  43491. var optionSet,
  43492. option,
  43493. options = elem.options,
  43494. values = jQuery.makeArray(value),
  43495. i = options.length;
  43496. while (i--) {
  43497. option = options[i];
  43498. /* eslint-disable no-cond-assign */
  43499. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  43500. optionSet = true;
  43501. }
  43502. /* eslint-enable no-cond-assign */
  43503. }
  43504. // Force browsers to behave consistently when non-matching value is set
  43505. if (!optionSet) {
  43506. elem.selectedIndex = -1;
  43507. }
  43508. return values;
  43509. }
  43510. }
  43511. }
  43512. });
  43513. // Radios and checkboxes getter/setter
  43514. jQuery.each(["radio", "checkbox"], function () {
  43515. jQuery.valHooks[this] = {
  43516. set: function set(elem, value) {
  43517. if (Array.isArray(value)) {
  43518. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  43519. }
  43520. }
  43521. };
  43522. if (!support.checkOn) {
  43523. jQuery.valHooks[this].get = function (elem) {
  43524. return elem.getAttribute("value") === null ? "on" : elem.value;
  43525. };
  43526. }
  43527. });
  43528. // Return jQuery for attributes-only inclusion
  43529. support.focusin = "onfocusin" in window;
  43530. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  43531. stopPropagationCallback = function stopPropagationCallback(e) {
  43532. e.stopPropagation();
  43533. };
  43534. jQuery.extend(jQuery.event, {
  43535. trigger: function trigger(event, data, elem, onlyHandlers) {
  43536. var i,
  43537. cur,
  43538. tmp,
  43539. bubbleType,
  43540. ontype,
  43541. handle,
  43542. special,
  43543. lastElement,
  43544. eventPath = [elem || document],
  43545. type = hasOwn.call(event, "type") ? event.type : event,
  43546. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  43547. cur = lastElement = tmp = elem = elem || document;
  43548. // Don't do events on text and comment nodes
  43549. if (elem.nodeType === 3 || elem.nodeType === 8) {
  43550. return;
  43551. }
  43552. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  43553. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  43554. return;
  43555. }
  43556. if (type.indexOf(".") > -1) {
  43557. // Namespaced trigger; create a regexp to match event type in handle()
  43558. namespaces = type.split(".");
  43559. type = namespaces.shift();
  43560. namespaces.sort();
  43561. }
  43562. ontype = type.indexOf(":") < 0 && "on" + type;
  43563. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  43564. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  43565. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  43566. event.isTrigger = onlyHandlers ? 2 : 3;
  43567. event.namespace = namespaces.join(".");
  43568. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  43569. // Clean up the event in case it is being reused
  43570. event.result = undefined;
  43571. if (!event.target) {
  43572. event.target = elem;
  43573. }
  43574. // Clone any incoming data and prepend the event, creating the handler arg list
  43575. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  43576. // Allow special events to draw outside the lines
  43577. special = jQuery.event.special[type] || {};
  43578. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  43579. return;
  43580. }
  43581. // Determine event propagation path in advance, per W3C events spec (#9951)
  43582. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  43583. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  43584. bubbleType = special.delegateType || type;
  43585. if (!rfocusMorph.test(bubbleType + type)) {
  43586. cur = cur.parentNode;
  43587. }
  43588. for (; cur; cur = cur.parentNode) {
  43589. eventPath.push(cur);
  43590. tmp = cur;
  43591. }
  43592. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43593. if (tmp === (elem.ownerDocument || document)) {
  43594. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43595. }
  43596. }
  43597. // Fire handlers on the event path
  43598. i = 0;
  43599. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43600. lastElement = cur;
  43601. event.type = i > 1 ? bubbleType : special.bindType || type;
  43602. // jQuery handler
  43603. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43604. if (handle) {
  43605. handle.apply(cur, data);
  43606. }
  43607. // Native handler
  43608. handle = ontype && cur[ontype];
  43609. if (handle && handle.apply && acceptData(cur)) {
  43610. event.result = handle.apply(cur, data);
  43611. if (event.result === false) {
  43612. event.preventDefault();
  43613. }
  43614. }
  43615. }
  43616. event.type = type;
  43617. // If nobody prevented the default action, do it now
  43618. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43619. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43620. // Call a native DOM method on the target with the same name as the event.
  43621. // Don't do default actions on window, that's where global variables be (#6170)
  43622. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43623. // Don't re-trigger an onFOO event when we call its FOO() method
  43624. tmp = elem[ontype];
  43625. if (tmp) {
  43626. elem[ontype] = null;
  43627. }
  43628. // Prevent re-triggering of the same event, since we already bubbled it above
  43629. jQuery.event.triggered = type;
  43630. if (event.isPropagationStopped()) {
  43631. lastElement.addEventListener(type, stopPropagationCallback);
  43632. }
  43633. elem[type]();
  43634. if (event.isPropagationStopped()) {
  43635. lastElement.removeEventListener(type, stopPropagationCallback);
  43636. }
  43637. jQuery.event.triggered = undefined;
  43638. if (tmp) {
  43639. elem[ontype] = tmp;
  43640. }
  43641. }
  43642. }
  43643. }
  43644. return event.result;
  43645. },
  43646. // Piggyback on a donor event to simulate a different one
  43647. // Used only for `focus(in | out)` events
  43648. simulate: function simulate(type, elem, event) {
  43649. var e = jQuery.extend(new jQuery.Event(), event, {
  43650. type: type,
  43651. isSimulated: true
  43652. });
  43653. jQuery.event.trigger(e, null, elem);
  43654. }
  43655. });
  43656. jQuery.fn.extend({
  43657. trigger: function trigger(type, data) {
  43658. return this.each(function () {
  43659. jQuery.event.trigger(type, data, this);
  43660. });
  43661. },
  43662. triggerHandler: function triggerHandler(type, data) {
  43663. var elem = this[0];
  43664. if (elem) {
  43665. return jQuery.event.trigger(type, data, elem, true);
  43666. }
  43667. }
  43668. });
  43669. // Support: Firefox <=44
  43670. // Firefox doesn't have focus(in | out) events
  43671. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43672. //
  43673. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43674. // focus(in | out) events fire after focus & blur events,
  43675. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43676. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43677. if (!support.focusin) {
  43678. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43679. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43680. var handler = function handler(event) {
  43681. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43682. };
  43683. jQuery.event.special[fix] = {
  43684. setup: function setup() {
  43685. var doc = this.ownerDocument || this,
  43686. attaches = dataPriv.access(doc, fix);
  43687. if (!attaches) {
  43688. doc.addEventListener(orig, handler, true);
  43689. }
  43690. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43691. },
  43692. teardown: function teardown() {
  43693. var doc = this.ownerDocument || this,
  43694. attaches = dataPriv.access(doc, fix) - 1;
  43695. if (!attaches) {
  43696. doc.removeEventListener(orig, handler, true);
  43697. dataPriv.remove(doc, fix);
  43698. } else {
  43699. dataPriv.access(doc, fix, attaches);
  43700. }
  43701. }
  43702. };
  43703. });
  43704. }
  43705. var location = window.location;
  43706. var nonce = Date.now();
  43707. var rquery = /\?/;
  43708. // Cross-browser xml parsing
  43709. jQuery.parseXML = function (data) {
  43710. var xml;
  43711. if (!data || typeof data !== "string") {
  43712. return null;
  43713. }
  43714. // Support: IE 9 - 11 only
  43715. // IE throws on parseFromString with invalid input.
  43716. try {
  43717. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43718. } catch (e) {
  43719. xml = undefined;
  43720. }
  43721. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43722. jQuery.error("Invalid XML: " + data);
  43723. }
  43724. return xml;
  43725. };
  43726. var rbracket = /\[\]$/,
  43727. rCRLF = /\r?\n/g,
  43728. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  43729. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  43730. function buildParams(prefix, obj, traditional, add) {
  43731. var name;
  43732. if (Array.isArray(obj)) {
  43733. // Serialize array item.
  43734. jQuery.each(obj, function (i, v) {
  43735. if (traditional || rbracket.test(prefix)) {
  43736. // Treat each array item as a scalar.
  43737. add(prefix, v);
  43738. } else {
  43739. // Item is non-scalar (array or object), encode its numeric index.
  43740. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  43741. }
  43742. });
  43743. } else if (!traditional && toType(obj) === "object") {
  43744. // Serialize object item.
  43745. for (name in obj) {
  43746. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  43747. }
  43748. } else {
  43749. // Serialize scalar item.
  43750. add(prefix, obj);
  43751. }
  43752. }
  43753. // Serialize an array of form elements or a set of
  43754. // key/values into a query string
  43755. jQuery.param = function (a, traditional) {
  43756. var prefix,
  43757. s = [],
  43758. add = function add(key, valueOrFunction) {
  43759. // If value is a function, invoke it and use its return value
  43760. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  43761. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  43762. };
  43763. // If an array was passed in, assume that it is an array of form elements.
  43764. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  43765. // Serialize the form elements
  43766. jQuery.each(a, function () {
  43767. add(this.name, this.value);
  43768. });
  43769. } else {
  43770. // If traditional, encode the "old" way (the way 1.3.2 or older
  43771. // did it), otherwise encode params recursively.
  43772. for (prefix in a) {
  43773. buildParams(prefix, a[prefix], traditional, add);
  43774. }
  43775. }
  43776. // Return the resulting serialization
  43777. return s.join("&");
  43778. };
  43779. jQuery.fn.extend({
  43780. serialize: function serialize() {
  43781. return jQuery.param(this.serializeArray());
  43782. },
  43783. serializeArray: function serializeArray() {
  43784. return this.map(function () {
  43785. // Can add propHook for "elements" to filter or add form elements
  43786. var elements = jQuery.prop(this, "elements");
  43787. return elements ? jQuery.makeArray(elements) : this;
  43788. }).filter(function () {
  43789. var type = this.type;
  43790. // Use .is( ":disabled" ) so that fieldset[disabled] works
  43791. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  43792. }).map(function (i, elem) {
  43793. var val = jQuery(this).val();
  43794. if (val == null) {
  43795. return null;
  43796. }
  43797. if (Array.isArray(val)) {
  43798. return jQuery.map(val, function (val) {
  43799. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43800. });
  43801. }
  43802. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43803. }).get();
  43804. }
  43805. });
  43806. var r20 = /%20/g,
  43807. rhash = /#.*$/,
  43808. rantiCache = /([?&])_=[^&]*/,
  43809. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  43810. // #7653, #8125, #8152: local protocol detection
  43811. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  43812. rnoContent = /^(?:GET|HEAD)$/,
  43813. rprotocol = /^\/\//,
  43814. /* Prefilters
  43815. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  43816. * 2) These are called:
  43817. * - BEFORE asking for a transport
  43818. * - AFTER param serialization (s.data is a string if s.processData is true)
  43819. * 3) key is the dataType
  43820. * 4) the catchall symbol "*" can be used
  43821. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  43822. */
  43823. prefilters = {},
  43824. /* Transports bindings
  43825. * 1) key is the dataType
  43826. * 2) the catchall symbol "*" can be used
  43827. * 3) selection will start with transport dataType and THEN go to "*" if needed
  43828. */
  43829. transports = {},
  43830. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  43831. allTypes = "*/".concat("*"),
  43832. // Anchor tag for parsing the document origin
  43833. originAnchor = document.createElement("a");
  43834. originAnchor.href = location.href;
  43835. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  43836. function addToPrefiltersOrTransports(structure) {
  43837. // dataTypeExpression is optional and defaults to "*"
  43838. return function (dataTypeExpression, func) {
  43839. if (typeof dataTypeExpression !== "string") {
  43840. func = dataTypeExpression;
  43841. dataTypeExpression = "*";
  43842. }
  43843. var dataType,
  43844. i = 0,
  43845. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  43846. if (isFunction(func)) {
  43847. // For each dataType in the dataTypeExpression
  43848. while (dataType = dataTypes[i++]) {
  43849. // Prepend if requested
  43850. if (dataType[0] === "+") {
  43851. dataType = dataType.slice(1) || "*";
  43852. (structure[dataType] = structure[dataType] || []).unshift(func);
  43853. // Otherwise append
  43854. } else {
  43855. (structure[dataType] = structure[dataType] || []).push(func);
  43856. }
  43857. }
  43858. }
  43859. };
  43860. }
  43861. // Base inspection function for prefilters and transports
  43862. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  43863. var inspected = {},
  43864. seekingTransport = structure === transports;
  43865. function inspect(dataType) {
  43866. var selected;
  43867. inspected[dataType] = true;
  43868. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  43869. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  43870. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  43871. options.dataTypes.unshift(dataTypeOrTransport);
  43872. inspect(dataTypeOrTransport);
  43873. return false;
  43874. } else if (seekingTransport) {
  43875. return !(selected = dataTypeOrTransport);
  43876. }
  43877. });
  43878. return selected;
  43879. }
  43880. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  43881. }
  43882. // A special extend for ajax options
  43883. // that takes "flat" options (not to be deep extended)
  43884. // Fixes #9887
  43885. function ajaxExtend(target, src) {
  43886. var key,
  43887. deep,
  43888. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  43889. for (key in src) {
  43890. if (src[key] !== undefined) {
  43891. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  43892. }
  43893. }
  43894. if (deep) {
  43895. jQuery.extend(true, target, deep);
  43896. }
  43897. return target;
  43898. }
  43899. /* Handles responses to an ajax request:
  43900. * - finds the right dataType (mediates between content-type and expected dataType)
  43901. * - returns the corresponding response
  43902. */
  43903. function ajaxHandleResponses(s, jqXHR, responses) {
  43904. var ct,
  43905. type,
  43906. finalDataType,
  43907. firstDataType,
  43908. contents = s.contents,
  43909. dataTypes = s.dataTypes;
  43910. // Remove auto dataType and get content-type in the process
  43911. while (dataTypes[0] === "*") {
  43912. dataTypes.shift();
  43913. if (ct === undefined) {
  43914. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  43915. }
  43916. }
  43917. // Check if we're dealing with a known content-type
  43918. if (ct) {
  43919. for (type in contents) {
  43920. if (contents[type] && contents[type].test(ct)) {
  43921. dataTypes.unshift(type);
  43922. break;
  43923. }
  43924. }
  43925. }
  43926. // Check to see if we have a response for the expected dataType
  43927. if (dataTypes[0] in responses) {
  43928. finalDataType = dataTypes[0];
  43929. } else {
  43930. // Try convertible dataTypes
  43931. for (type in responses) {
  43932. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  43933. finalDataType = type;
  43934. break;
  43935. }
  43936. if (!firstDataType) {
  43937. firstDataType = type;
  43938. }
  43939. }
  43940. // Or just use first one
  43941. finalDataType = finalDataType || firstDataType;
  43942. }
  43943. // If we found a dataType
  43944. // We add the dataType to the list if needed
  43945. // and return the corresponding response
  43946. if (finalDataType) {
  43947. if (finalDataType !== dataTypes[0]) {
  43948. dataTypes.unshift(finalDataType);
  43949. }
  43950. return responses[finalDataType];
  43951. }
  43952. }
  43953. /* Chain conversions given the request and the original response
  43954. * Also sets the responseXXX fields on the jqXHR instance
  43955. */
  43956. function ajaxConvert(s, response, jqXHR, isSuccess) {
  43957. var conv2,
  43958. current,
  43959. conv,
  43960. tmp,
  43961. prev,
  43962. converters = {},
  43963. // Work with a copy of dataTypes in case we need to modify it for conversion
  43964. dataTypes = s.dataTypes.slice();
  43965. // Create converters map with lowercased keys
  43966. if (dataTypes[1]) {
  43967. for (conv in s.converters) {
  43968. converters[conv.toLowerCase()] = s.converters[conv];
  43969. }
  43970. }
  43971. current = dataTypes.shift();
  43972. // Convert to each sequential dataType
  43973. while (current) {
  43974. if (s.responseFields[current]) {
  43975. jqXHR[s.responseFields[current]] = response;
  43976. }
  43977. // Apply the dataFilter if provided
  43978. if (!prev && isSuccess && s.dataFilter) {
  43979. response = s.dataFilter(response, s.dataType);
  43980. }
  43981. prev = current;
  43982. current = dataTypes.shift();
  43983. if (current) {
  43984. // There's only work to do if current dataType is non-auto
  43985. if (current === "*") {
  43986. current = prev;
  43987. // Convert response if prev dataType is non-auto and differs from current
  43988. } else if (prev !== "*" && prev !== current) {
  43989. // Seek a direct converter
  43990. conv = converters[prev + " " + current] || converters["* " + current];
  43991. // If none found, seek a pair
  43992. if (!conv) {
  43993. for (conv2 in converters) {
  43994. // If conv2 outputs current
  43995. tmp = conv2.split(" ");
  43996. if (tmp[1] === current) {
  43997. // If prev can be converted to accepted input
  43998. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  43999. if (conv) {
  44000. // Condense equivalence converters
  44001. if (conv === true) {
  44002. conv = converters[conv2];
  44003. // Otherwise, insert the intermediate dataType
  44004. } else if (converters[conv2] !== true) {
  44005. current = tmp[0];
  44006. dataTypes.unshift(tmp[1]);
  44007. }
  44008. break;
  44009. }
  44010. }
  44011. }
  44012. }
  44013. // Apply converter (if not an equivalence)
  44014. if (conv !== true) {
  44015. // Unless errors are allowed to bubble, catch and return them
  44016. if (conv && s.throws) {
  44017. response = conv(response);
  44018. } else {
  44019. try {
  44020. response = conv(response);
  44021. } catch (e) {
  44022. return {
  44023. state: "parsererror",
  44024. error: conv ? e : "No conversion from " + prev + " to " + current
  44025. };
  44026. }
  44027. }
  44028. }
  44029. }
  44030. }
  44031. }
  44032. return { state: "success", data: response };
  44033. }
  44034. jQuery.extend({
  44035. // Counter for holding the number of active queries
  44036. active: 0,
  44037. // Last-Modified header cache for next request
  44038. lastModified: {},
  44039. etag: {},
  44040. ajaxSettings: {
  44041. url: location.href,
  44042. type: "GET",
  44043. isLocal: rlocalProtocol.test(location.protocol),
  44044. global: true,
  44045. processData: true,
  44046. async: true,
  44047. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  44048. /*
  44049. timeout: 0,
  44050. data: null,
  44051. dataType: null,
  44052. username: null,
  44053. password: null,
  44054. cache: null,
  44055. throws: false,
  44056. traditional: false,
  44057. headers: {},
  44058. */
  44059. accepts: {
  44060. "*": allTypes,
  44061. text: "text/plain",
  44062. html: "text/html",
  44063. xml: "application/xml, text/xml",
  44064. json: "application/json, text/javascript"
  44065. },
  44066. contents: {
  44067. xml: /\bxml\b/,
  44068. html: /\bhtml/,
  44069. json: /\bjson\b/
  44070. },
  44071. responseFields: {
  44072. xml: "responseXML",
  44073. text: "responseText",
  44074. json: "responseJSON"
  44075. },
  44076. // Data converters
  44077. // Keys separate source (or catchall "*") and destination types with a single space
  44078. converters: {
  44079. // Convert anything to text
  44080. "* text": String,
  44081. // Text to html (true = no transformation)
  44082. "text html": true,
  44083. // Evaluate text as a json expression
  44084. "text json": JSON.parse,
  44085. // Parse text as xml
  44086. "text xml": jQuery.parseXML
  44087. },
  44088. // For options that shouldn't be deep extended:
  44089. // you can add your own custom options here if
  44090. // and when you create one that shouldn't be
  44091. // deep extended (see ajaxExtend)
  44092. flatOptions: {
  44093. url: true,
  44094. context: true
  44095. }
  44096. },
  44097. // Creates a full fledged settings object into target
  44098. // with both ajaxSettings and settings fields.
  44099. // If target is omitted, writes into ajaxSettings.
  44100. ajaxSetup: function ajaxSetup(target, settings) {
  44101. return settings ?
  44102. // Building a settings object
  44103. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  44104. // Extending ajaxSettings
  44105. ajaxExtend(jQuery.ajaxSettings, target);
  44106. },
  44107. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  44108. ajaxTransport: addToPrefiltersOrTransports(transports),
  44109. // Main method
  44110. ajax: function ajax(url, options) {
  44111. // If url is an object, simulate pre-1.5 signature
  44112. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  44113. options = url;
  44114. url = undefined;
  44115. }
  44116. // Force options to be an object
  44117. options = options || {};
  44118. var transport,
  44119. // URL without anti-cache param
  44120. cacheURL,
  44121. // Response headers
  44122. responseHeadersString,
  44123. responseHeaders,
  44124. // timeout handle
  44125. timeoutTimer,
  44126. // Url cleanup var
  44127. urlAnchor,
  44128. // Request state (becomes false upon send and true upon completion)
  44129. completed,
  44130. // To know if global events are to be dispatched
  44131. fireGlobals,
  44132. // Loop variable
  44133. i,
  44134. // uncached part of the url
  44135. uncached,
  44136. // Create the final options object
  44137. s = jQuery.ajaxSetup({}, options),
  44138. // Callbacks context
  44139. callbackContext = s.context || s,
  44140. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  44141. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  44142. // Deferreds
  44143. deferred = jQuery.Deferred(),
  44144. completeDeferred = jQuery.Callbacks("once memory"),
  44145. // Status-dependent callbacks
  44146. _statusCode = s.statusCode || {},
  44147. // Headers (they are sent all at once)
  44148. requestHeaders = {},
  44149. requestHeadersNames = {},
  44150. // Default abort message
  44151. strAbort = "canceled",
  44152. // Fake xhr
  44153. jqXHR = {
  44154. readyState: 0,
  44155. // Builds headers hashtable if needed
  44156. getResponseHeader: function getResponseHeader(key) {
  44157. var match;
  44158. if (completed) {
  44159. if (!responseHeaders) {
  44160. responseHeaders = {};
  44161. while (match = rheaders.exec(responseHeadersString)) {
  44162. responseHeaders[match[1].toLowerCase()] = match[2];
  44163. }
  44164. }
  44165. match = responseHeaders[key.toLowerCase()];
  44166. }
  44167. return match == null ? null : match;
  44168. },
  44169. // Raw string
  44170. getAllResponseHeaders: function getAllResponseHeaders() {
  44171. return completed ? responseHeadersString : null;
  44172. },
  44173. // Caches the header
  44174. setRequestHeader: function setRequestHeader(name, value) {
  44175. if (completed == null) {
  44176. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  44177. requestHeaders[name] = value;
  44178. }
  44179. return this;
  44180. },
  44181. // Overrides response content-type header
  44182. overrideMimeType: function overrideMimeType(type) {
  44183. if (completed == null) {
  44184. s.mimeType = type;
  44185. }
  44186. return this;
  44187. },
  44188. // Status-dependent callbacks
  44189. statusCode: function statusCode(map) {
  44190. var code;
  44191. if (map) {
  44192. if (completed) {
  44193. // Execute the appropriate callbacks
  44194. jqXHR.always(map[jqXHR.status]);
  44195. } else {
  44196. // Lazy-add the new callbacks in a way that preserves old ones
  44197. for (code in map) {
  44198. _statusCode[code] = [_statusCode[code], map[code]];
  44199. }
  44200. }
  44201. }
  44202. return this;
  44203. },
  44204. // Cancel the request
  44205. abort: function abort(statusText) {
  44206. var finalText = statusText || strAbort;
  44207. if (transport) {
  44208. transport.abort(finalText);
  44209. }
  44210. done(0, finalText);
  44211. return this;
  44212. }
  44213. };
  44214. // Attach deferreds
  44215. deferred.promise(jqXHR);
  44216. // Add protocol if not provided (prefilters might expect it)
  44217. // Handle falsy url in the settings object (#10093: consistency with old signature)
  44218. // We also use the url parameter if available
  44219. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  44220. // Alias method option to type as per ticket #12004
  44221. s.type = options.method || options.type || s.method || s.type;
  44222. // Extract dataTypes list
  44223. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  44224. // A cross-domain request is in order when the origin doesn't match the current origin.
  44225. if (s.crossDomain == null) {
  44226. urlAnchor = document.createElement("a");
  44227. // Support: IE <=8 - 11, Edge 12 - 15
  44228. // IE throws exception on accessing the href property if url is malformed,
  44229. // e.g. http://example.com:80x/
  44230. try {
  44231. urlAnchor.href = s.url;
  44232. // Support: IE <=8 - 11 only
  44233. // Anchor's host property isn't correctly set when s.url is relative
  44234. urlAnchor.href = urlAnchor.href;
  44235. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  44236. } catch (e) {
  44237. // If there is an error parsing the URL, assume it is crossDomain,
  44238. // it can be rejected by the transport if it is invalid
  44239. s.crossDomain = true;
  44240. }
  44241. }
  44242. // Convert data if not already a string
  44243. if (s.data && s.processData && typeof s.data !== "string") {
  44244. s.data = jQuery.param(s.data, s.traditional);
  44245. }
  44246. // Apply prefilters
  44247. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  44248. // If request was aborted inside a prefilter, stop there
  44249. if (completed) {
  44250. return jqXHR;
  44251. }
  44252. // We can fire global events as of now if asked to
  44253. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  44254. fireGlobals = jQuery.event && s.global;
  44255. // Watch for a new set of requests
  44256. if (fireGlobals && jQuery.active++ === 0) {
  44257. jQuery.event.trigger("ajaxStart");
  44258. }
  44259. // Uppercase the type
  44260. s.type = s.type.toUpperCase();
  44261. // Determine if request has content
  44262. s.hasContent = !rnoContent.test(s.type);
  44263. // Save the URL in case we're toying with the If-Modified-Since
  44264. // and/or If-None-Match header later on
  44265. // Remove hash to simplify url manipulation
  44266. cacheURL = s.url.replace(rhash, "");
  44267. // More options handling for requests with no content
  44268. if (!s.hasContent) {
  44269. // Remember the hash so we can put it back
  44270. uncached = s.url.slice(cacheURL.length);
  44271. // If data is available and should be processed, append data to url
  44272. if (s.data && (s.processData || typeof s.data === "string")) {
  44273. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  44274. // #9682: remove data so that it's not used in an eventual retry
  44275. delete s.data;
  44276. }
  44277. // Add or update anti-cache param if needed
  44278. if (s.cache === false) {
  44279. cacheURL = cacheURL.replace(rantiCache, "$1");
  44280. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  44281. }
  44282. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  44283. s.url = cacheURL + uncached;
  44284. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  44285. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  44286. s.data = s.data.replace(r20, "+");
  44287. }
  44288. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  44289. if (s.ifModified) {
  44290. if (jQuery.lastModified[cacheURL]) {
  44291. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  44292. }
  44293. if (jQuery.etag[cacheURL]) {
  44294. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  44295. }
  44296. }
  44297. // Set the correct header, if data is being sent
  44298. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  44299. jqXHR.setRequestHeader("Content-Type", s.contentType);
  44300. }
  44301. // Set the Accepts header for the server, depending on the dataType
  44302. jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
  44303. // Check for headers option
  44304. for (i in s.headers) {
  44305. jqXHR.setRequestHeader(i, s.headers[i]);
  44306. }
  44307. // Allow custom headers/mimetypes and early abort
  44308. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  44309. // Abort if not done already and return
  44310. return jqXHR.abort();
  44311. }
  44312. // Aborting is no longer a cancellation
  44313. strAbort = "abort";
  44314. // Install callbacks on deferreds
  44315. completeDeferred.add(s.complete);
  44316. jqXHR.done(s.success);
  44317. jqXHR.fail(s.error);
  44318. // Get transport
  44319. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  44320. // If no transport, we auto-abort
  44321. if (!transport) {
  44322. done(-1, "No Transport");
  44323. } else {
  44324. jqXHR.readyState = 1;
  44325. // Send global event
  44326. if (fireGlobals) {
  44327. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  44328. }
  44329. // If request was aborted inside ajaxSend, stop there
  44330. if (completed) {
  44331. return jqXHR;
  44332. }
  44333. // Timeout
  44334. if (s.async && s.timeout > 0) {
  44335. timeoutTimer = window.setTimeout(function () {
  44336. jqXHR.abort("timeout");
  44337. }, s.timeout);
  44338. }
  44339. try {
  44340. completed = false;
  44341. transport.send(requestHeaders, done);
  44342. } catch (e) {
  44343. // Rethrow post-completion exceptions
  44344. if (completed) {
  44345. throw e;
  44346. }
  44347. // Propagate others as results
  44348. done(-1, e);
  44349. }
  44350. }
  44351. // Callback for when everything is done
  44352. function done(status, nativeStatusText, responses, headers) {
  44353. var isSuccess,
  44354. success,
  44355. error,
  44356. response,
  44357. modified,
  44358. statusText = nativeStatusText;
  44359. // Ignore repeat invocations
  44360. if (completed) {
  44361. return;
  44362. }
  44363. completed = true;
  44364. // Clear timeout if it exists
  44365. if (timeoutTimer) {
  44366. window.clearTimeout(timeoutTimer);
  44367. }
  44368. // Dereference transport for early garbage collection
  44369. // (no matter how long the jqXHR object will be used)
  44370. transport = undefined;
  44371. // Cache response headers
  44372. responseHeadersString = headers || "";
  44373. // Set readyState
  44374. jqXHR.readyState = status > 0 ? 4 : 0;
  44375. // Determine if successful
  44376. isSuccess = status >= 200 && status < 300 || status === 304;
  44377. // Get response data
  44378. if (responses) {
  44379. response = ajaxHandleResponses(s, jqXHR, responses);
  44380. }
  44381. // Convert no matter what (that way responseXXX fields are always set)
  44382. response = ajaxConvert(s, response, jqXHR, isSuccess);
  44383. // If successful, handle type chaining
  44384. if (isSuccess) {
  44385. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  44386. if (s.ifModified) {
  44387. modified = jqXHR.getResponseHeader("Last-Modified");
  44388. if (modified) {
  44389. jQuery.lastModified[cacheURL] = modified;
  44390. }
  44391. modified = jqXHR.getResponseHeader("etag");
  44392. if (modified) {
  44393. jQuery.etag[cacheURL] = modified;
  44394. }
  44395. }
  44396. // if no content
  44397. if (status === 204 || s.type === "HEAD") {
  44398. statusText = "nocontent";
  44399. // if not modified
  44400. } else if (status === 304) {
  44401. statusText = "notmodified";
  44402. // If we have data, let's convert it
  44403. } else {
  44404. statusText = response.state;
  44405. success = response.data;
  44406. error = response.error;
  44407. isSuccess = !error;
  44408. }
  44409. } else {
  44410. // Extract error from statusText and normalize for non-aborts
  44411. error = statusText;
  44412. if (status || !statusText) {
  44413. statusText = "error";
  44414. if (status < 0) {
  44415. status = 0;
  44416. }
  44417. }
  44418. }
  44419. // Set data for the fake xhr object
  44420. jqXHR.status = status;
  44421. jqXHR.statusText = (nativeStatusText || statusText) + "";
  44422. // Success/Error
  44423. if (isSuccess) {
  44424. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  44425. } else {
  44426. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  44427. }
  44428. // Status-dependent callbacks
  44429. jqXHR.statusCode(_statusCode);
  44430. _statusCode = undefined;
  44431. if (fireGlobals) {
  44432. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  44433. }
  44434. // Complete
  44435. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  44436. if (fireGlobals) {
  44437. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  44438. // Handle the global AJAX counter
  44439. if (! --jQuery.active) {
  44440. jQuery.event.trigger("ajaxStop");
  44441. }
  44442. }
  44443. }
  44444. return jqXHR;
  44445. },
  44446. getJSON: function getJSON(url, data, callback) {
  44447. return jQuery.get(url, data, callback, "json");
  44448. },
  44449. getScript: function getScript(url, callback) {
  44450. return jQuery.get(url, undefined, callback, "script");
  44451. }
  44452. });
  44453. jQuery.each(["get", "post"], function (i, method) {
  44454. jQuery[method] = function (url, data, callback, type) {
  44455. // Shift arguments if data argument was omitted
  44456. if (isFunction(data)) {
  44457. type = type || callback;
  44458. callback = data;
  44459. data = undefined;
  44460. }
  44461. // The url can be an options object (which then must have .url)
  44462. return jQuery.ajax(jQuery.extend({
  44463. url: url,
  44464. type: method,
  44465. dataType: type,
  44466. data: data,
  44467. success: callback
  44468. }, jQuery.isPlainObject(url) && url));
  44469. };
  44470. });
  44471. jQuery._evalUrl = function (url) {
  44472. return jQuery.ajax({
  44473. url: url,
  44474. // Make this explicit, since user can override this through ajaxSetup (#11264)
  44475. type: "GET",
  44476. dataType: "script",
  44477. cache: true,
  44478. async: false,
  44479. global: false,
  44480. "throws": true
  44481. });
  44482. };
  44483. jQuery.fn.extend({
  44484. wrapAll: function wrapAll(html) {
  44485. var wrap;
  44486. if (this[0]) {
  44487. if (isFunction(html)) {
  44488. html = html.call(this[0]);
  44489. }
  44490. // The elements to wrap the target around
  44491. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  44492. if (this[0].parentNode) {
  44493. wrap.insertBefore(this[0]);
  44494. }
  44495. wrap.map(function () {
  44496. var elem = this;
  44497. while (elem.firstElementChild) {
  44498. elem = elem.firstElementChild;
  44499. }
  44500. return elem;
  44501. }).append(this);
  44502. }
  44503. return this;
  44504. },
  44505. wrapInner: function wrapInner(html) {
  44506. if (isFunction(html)) {
  44507. return this.each(function (i) {
  44508. jQuery(this).wrapInner(html.call(this, i));
  44509. });
  44510. }
  44511. return this.each(function () {
  44512. var self = jQuery(this),
  44513. contents = self.contents();
  44514. if (contents.length) {
  44515. contents.wrapAll(html);
  44516. } else {
  44517. self.append(html);
  44518. }
  44519. });
  44520. },
  44521. wrap: function wrap(html) {
  44522. var htmlIsFunction = isFunction(html);
  44523. return this.each(function (i) {
  44524. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  44525. });
  44526. },
  44527. unwrap: function unwrap(selector) {
  44528. this.parent(selector).not("body").each(function () {
  44529. jQuery(this).replaceWith(this.childNodes);
  44530. });
  44531. return this;
  44532. }
  44533. });
  44534. jQuery.expr.pseudos.hidden = function (elem) {
  44535. return !jQuery.expr.pseudos.visible(elem);
  44536. };
  44537. jQuery.expr.pseudos.visible = function (elem) {
  44538. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  44539. };
  44540. jQuery.ajaxSettings.xhr = function () {
  44541. try {
  44542. return new window.XMLHttpRequest();
  44543. } catch (e) {}
  44544. };
  44545. var xhrSuccessStatus = {
  44546. // File protocol always yields status code 0, assume 200
  44547. 0: 200,
  44548. // Support: IE <=9 only
  44549. // #1450: sometimes IE returns 1223 when it should be 204
  44550. 1223: 204
  44551. },
  44552. xhrSupported = jQuery.ajaxSettings.xhr();
  44553. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  44554. support.ajax = xhrSupported = !!xhrSupported;
  44555. jQuery.ajaxTransport(function (options) {
  44556. var _callback, errorCallback;
  44557. // Cross domain only allowed if supported through XMLHttpRequest
  44558. if (support.cors || xhrSupported && !options.crossDomain) {
  44559. return {
  44560. send: function send(headers, complete) {
  44561. var i,
  44562. xhr = options.xhr();
  44563. xhr.open(options.type, options.url, options.async, options.username, options.password);
  44564. // Apply custom fields if provided
  44565. if (options.xhrFields) {
  44566. for (i in options.xhrFields) {
  44567. xhr[i] = options.xhrFields[i];
  44568. }
  44569. }
  44570. // Override mime type if needed
  44571. if (options.mimeType && xhr.overrideMimeType) {
  44572. xhr.overrideMimeType(options.mimeType);
  44573. }
  44574. // X-Requested-With header
  44575. // For cross-domain requests, seeing as conditions for a preflight are
  44576. // akin to a jigsaw puzzle, we simply never set it to be sure.
  44577. // (it can always be set on a per-request basis or even using ajaxSetup)
  44578. // For same-domain requests, won't change header if already provided.
  44579. if (!options.crossDomain && !headers["X-Requested-With"]) {
  44580. headers["X-Requested-With"] = "XMLHttpRequest";
  44581. }
  44582. // Set headers
  44583. for (i in headers) {
  44584. xhr.setRequestHeader(i, headers[i]);
  44585. }
  44586. // Callback
  44587. _callback = function callback(type) {
  44588. return function () {
  44589. if (_callback) {
  44590. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  44591. if (type === "abort") {
  44592. xhr.abort();
  44593. } else if (type === "error") {
  44594. // Support: IE <=9 only
  44595. // On a manual native abort, IE9 throws
  44596. // errors on any property access that is not readyState
  44597. if (typeof xhr.status !== "number") {
  44598. complete(0, "error");
  44599. } else {
  44600. complete(
  44601. // File: protocol always yields status 0; see #8605, #14207
  44602. xhr.status, xhr.statusText);
  44603. }
  44604. } else {
  44605. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44606. // Support: IE <=9 only
  44607. // IE9 has no XHR2 but throws on binary (trac-11426)
  44608. // For XHR2 non-text, let the caller handle it (gh-2498)
  44609. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44610. }
  44611. }
  44612. };
  44613. };
  44614. // Listen to events
  44615. xhr.onload = _callback();
  44616. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44617. // Support: IE 9 only
  44618. // Use onreadystatechange to replace onabort
  44619. // to handle uncaught aborts
  44620. if (xhr.onabort !== undefined) {
  44621. xhr.onabort = errorCallback;
  44622. } else {
  44623. xhr.onreadystatechange = function () {
  44624. // Check readyState before timeout as it changes
  44625. if (xhr.readyState === 4) {
  44626. // Allow onerror to be called first,
  44627. // but that will not handle a native abort
  44628. // Also, save errorCallback to a variable
  44629. // as xhr.onerror cannot be accessed
  44630. window.setTimeout(function () {
  44631. if (_callback) {
  44632. errorCallback();
  44633. }
  44634. });
  44635. }
  44636. };
  44637. }
  44638. // Create the abort callback
  44639. _callback = _callback("abort");
  44640. try {
  44641. // Do send the request (this may raise an exception)
  44642. xhr.send(options.hasContent && options.data || null);
  44643. } catch (e) {
  44644. // #14683: Only rethrow if this hasn't been notified as an error yet
  44645. if (_callback) {
  44646. throw e;
  44647. }
  44648. }
  44649. },
  44650. abort: function abort() {
  44651. if (_callback) {
  44652. _callback();
  44653. }
  44654. }
  44655. };
  44656. }
  44657. });
  44658. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44659. jQuery.ajaxPrefilter(function (s) {
  44660. if (s.crossDomain) {
  44661. s.contents.script = false;
  44662. }
  44663. });
  44664. // Install script dataType
  44665. jQuery.ajaxSetup({
  44666. accepts: {
  44667. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44668. },
  44669. contents: {
  44670. script: /\b(?:java|ecma)script\b/
  44671. },
  44672. converters: {
  44673. "text script": function textScript(text) {
  44674. jQuery.globalEval(text);
  44675. return text;
  44676. }
  44677. }
  44678. });
  44679. // Handle cache's special case and crossDomain
  44680. jQuery.ajaxPrefilter("script", function (s) {
  44681. if (s.cache === undefined) {
  44682. s.cache = false;
  44683. }
  44684. if (s.crossDomain) {
  44685. s.type = "GET";
  44686. }
  44687. });
  44688. // Bind script tag hack transport
  44689. jQuery.ajaxTransport("script", function (s) {
  44690. // This transport only deals with cross domain requests
  44691. if (s.crossDomain) {
  44692. var script, _callback2;
  44693. return {
  44694. send: function send(_, complete) {
  44695. script = jQuery("<script>").prop({
  44696. charset: s.scriptCharset,
  44697. src: s.url
  44698. }).on("load error", _callback2 = function callback(evt) {
  44699. script.remove();
  44700. _callback2 = null;
  44701. if (evt) {
  44702. complete(evt.type === "error" ? 404 : 200, evt.type);
  44703. }
  44704. });
  44705. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44706. document.head.appendChild(script[0]);
  44707. },
  44708. abort: function abort() {
  44709. if (_callback2) {
  44710. _callback2();
  44711. }
  44712. }
  44713. };
  44714. }
  44715. });
  44716. var oldCallbacks = [],
  44717. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44718. // Default jsonp settings
  44719. jQuery.ajaxSetup({
  44720. jsonp: "callback",
  44721. jsonpCallback: function jsonpCallback() {
  44722. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44723. this[callback] = true;
  44724. return callback;
  44725. }
  44726. });
  44727. // Detect, normalize options and install callbacks for jsonp requests
  44728. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  44729. var callbackName,
  44730. overwritten,
  44731. responseContainer,
  44732. jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  44733. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  44734. if (jsonProp || s.dataTypes[0] === "jsonp") {
  44735. // Get callback name, remembering preexisting value associated with it
  44736. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  44737. // Insert callback into url or form data
  44738. if (jsonProp) {
  44739. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  44740. } else if (s.jsonp !== false) {
  44741. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  44742. }
  44743. // Use data converter to retrieve json after script execution
  44744. s.converters["script json"] = function () {
  44745. if (!responseContainer) {
  44746. jQuery.error(callbackName + " was not called");
  44747. }
  44748. return responseContainer[0];
  44749. };
  44750. // Force json dataType
  44751. s.dataTypes[0] = "json";
  44752. // Install callback
  44753. overwritten = window[callbackName];
  44754. window[callbackName] = function () {
  44755. responseContainer = arguments;
  44756. };
  44757. // Clean-up function (fires after converters)
  44758. jqXHR.always(function () {
  44759. // If previous value didn't exist - remove it
  44760. if (overwritten === undefined) {
  44761. jQuery(window).removeProp(callbackName);
  44762. // Otherwise restore preexisting value
  44763. } else {
  44764. window[callbackName] = overwritten;
  44765. }
  44766. // Save back as free
  44767. if (s[callbackName]) {
  44768. // Make sure that re-using the options doesn't screw things around
  44769. s.jsonpCallback = originalSettings.jsonpCallback;
  44770. // Save the callback name for future use
  44771. oldCallbacks.push(callbackName);
  44772. }
  44773. // Call if it was a function and we have a response
  44774. if (responseContainer && isFunction(overwritten)) {
  44775. overwritten(responseContainer[0]);
  44776. }
  44777. responseContainer = overwritten = undefined;
  44778. });
  44779. // Delegate to script
  44780. return "script";
  44781. }
  44782. });
  44783. // Support: Safari 8 only
  44784. // In Safari 8 documents created via document.implementation.createHTMLDocument
  44785. // collapse sibling forms: the second one becomes a child of the first one.
  44786. // Because of that, this security measure has to be disabled in Safari 8.
  44787. // https://bugs.webkit.org/show_bug.cgi?id=137337
  44788. support.createHTMLDocument = function () {
  44789. var body = document.implementation.createHTMLDocument("").body;
  44790. body.innerHTML = "<form></form><form></form>";
  44791. return body.childNodes.length === 2;
  44792. }();
  44793. // Argument "data" should be string of html
  44794. // context (optional): If specified, the fragment will be created in this context,
  44795. // defaults to document
  44796. // keepScripts (optional): If true, will include scripts passed in the html string
  44797. jQuery.parseHTML = function (data, context, keepScripts) {
  44798. if (typeof data !== "string") {
  44799. return [];
  44800. }
  44801. if (typeof context === "boolean") {
  44802. keepScripts = context;
  44803. context = false;
  44804. }
  44805. var base, parsed, scripts;
  44806. if (!context) {
  44807. // Stop scripts or inline event handlers from being executed immediately
  44808. // by using document.implementation
  44809. if (support.createHTMLDocument) {
  44810. context = document.implementation.createHTMLDocument("");
  44811. // Set the base href for the created document
  44812. // so any parsed elements with URLs
  44813. // are based on the document's URL (gh-2965)
  44814. base = context.createElement("base");
  44815. base.href = document.location.href;
  44816. context.head.appendChild(base);
  44817. } else {
  44818. context = document;
  44819. }
  44820. }
  44821. parsed = rsingleTag.exec(data);
  44822. scripts = !keepScripts && [];
  44823. // Single tag
  44824. if (parsed) {
  44825. return [context.createElement(parsed[1])];
  44826. }
  44827. parsed = buildFragment([data], context, scripts);
  44828. if (scripts && scripts.length) {
  44829. jQuery(scripts).remove();
  44830. }
  44831. return jQuery.merge([], parsed.childNodes);
  44832. };
  44833. /**
  44834. * Load a url into a page
  44835. */
  44836. jQuery.fn.load = function (url, params, callback) {
  44837. var selector,
  44838. type,
  44839. response,
  44840. self = this,
  44841. off = url.indexOf(" ");
  44842. if (off > -1) {
  44843. selector = stripAndCollapse(url.slice(off));
  44844. url = url.slice(0, off);
  44845. }
  44846. // If it's a function
  44847. if (isFunction(params)) {
  44848. // We assume that it's the callback
  44849. callback = params;
  44850. params = undefined;
  44851. // Otherwise, build a param string
  44852. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  44853. type = "POST";
  44854. }
  44855. // If we have elements to modify, make the request
  44856. if (self.length > 0) {
  44857. jQuery.ajax({
  44858. url: url,
  44859. // If "type" variable is undefined, then "GET" method will be used.
  44860. // Make value of this field explicit since
  44861. // user can override it through ajaxSetup method
  44862. type: type || "GET",
  44863. dataType: "html",
  44864. data: params
  44865. }).done(function (responseText) {
  44866. // Save response for use in complete callback
  44867. response = arguments;
  44868. self.html(selector ?
  44869. // If a selector was specified, locate the right elements in a dummy div
  44870. // Exclude scripts to avoid IE 'Permission Denied' errors
  44871. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  44872. // Otherwise use the full result
  44873. responseText);
  44874. // If the request succeeds, this function gets "data", "status", "jqXHR"
  44875. // but they are ignored because response was set above.
  44876. // If it fails, this function gets "jqXHR", "status", "error"
  44877. }).always(callback && function (jqXHR, status) {
  44878. self.each(function () {
  44879. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  44880. });
  44881. });
  44882. }
  44883. return this;
  44884. };
  44885. // Attach a bunch of functions for handling common AJAX events
  44886. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  44887. jQuery.fn[type] = function (fn) {
  44888. return this.on(type, fn);
  44889. };
  44890. });
  44891. jQuery.expr.pseudos.animated = function (elem) {
  44892. return jQuery.grep(jQuery.timers, function (fn) {
  44893. return elem === fn.elem;
  44894. }).length;
  44895. };
  44896. jQuery.offset = {
  44897. setOffset: function setOffset(elem, options, i) {
  44898. var curPosition,
  44899. curLeft,
  44900. curCSSTop,
  44901. curTop,
  44902. curOffset,
  44903. curCSSLeft,
  44904. calculatePosition,
  44905. position = jQuery.css(elem, "position"),
  44906. curElem = jQuery(elem),
  44907. props = {};
  44908. // Set position first, in-case top/left are set even on static elem
  44909. if (position === "static") {
  44910. elem.style.position = "relative";
  44911. }
  44912. curOffset = curElem.offset();
  44913. curCSSTop = jQuery.css(elem, "top");
  44914. curCSSLeft = jQuery.css(elem, "left");
  44915. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  44916. // Need to be able to calculate position if either
  44917. // top or left is auto and position is either absolute or fixed
  44918. if (calculatePosition) {
  44919. curPosition = curElem.position();
  44920. curTop = curPosition.top;
  44921. curLeft = curPosition.left;
  44922. } else {
  44923. curTop = parseFloat(curCSSTop) || 0;
  44924. curLeft = parseFloat(curCSSLeft) || 0;
  44925. }
  44926. if (isFunction(options)) {
  44927. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  44928. options = options.call(elem, i, jQuery.extend({}, curOffset));
  44929. }
  44930. if (options.top != null) {
  44931. props.top = options.top - curOffset.top + curTop;
  44932. }
  44933. if (options.left != null) {
  44934. props.left = options.left - curOffset.left + curLeft;
  44935. }
  44936. if ("using" in options) {
  44937. options.using.call(elem, props);
  44938. } else {
  44939. curElem.css(props);
  44940. }
  44941. }
  44942. };
  44943. jQuery.fn.extend({
  44944. // offset() relates an element's border box to the document origin
  44945. offset: function offset(options) {
  44946. // Preserve chaining for setter
  44947. if (arguments.length) {
  44948. return options === undefined ? this : this.each(function (i) {
  44949. jQuery.offset.setOffset(this, options, i);
  44950. });
  44951. }
  44952. var rect,
  44953. win,
  44954. elem = this[0];
  44955. if (!elem) {
  44956. return;
  44957. }
  44958. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  44959. // Support: IE <=11 only
  44960. // Running getBoundingClientRect on a
  44961. // disconnected node in IE throws an error
  44962. if (!elem.getClientRects().length) {
  44963. return { top: 0, left: 0 };
  44964. }
  44965. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  44966. rect = elem.getBoundingClientRect();
  44967. win = elem.ownerDocument.defaultView;
  44968. return {
  44969. top: rect.top + win.pageYOffset,
  44970. left: rect.left + win.pageXOffset
  44971. };
  44972. },
  44973. // position() relates an element's margin box to its offset parent's padding box
  44974. // This corresponds to the behavior of CSS absolute positioning
  44975. position: function position() {
  44976. if (!this[0]) {
  44977. return;
  44978. }
  44979. var offsetParent,
  44980. offset,
  44981. doc,
  44982. elem = this[0],
  44983. parentOffset = { top: 0, left: 0 };
  44984. // position:fixed elements are offset from the viewport, which itself always has zero offset
  44985. if (jQuery.css(elem, "position") === "fixed") {
  44986. // Assume position:fixed implies availability of getBoundingClientRect
  44987. offset = elem.getBoundingClientRect();
  44988. } else {
  44989. offset = this.offset();
  44990. // Account for the *real* offset parent, which can be the document or its root element
  44991. // when a statically positioned element is identified
  44992. doc = elem.ownerDocument;
  44993. offsetParent = elem.offsetParent || doc.documentElement;
  44994. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  44995. offsetParent = offsetParent.parentNode;
  44996. }
  44997. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  44998. // Incorporate borders into its offset, since they are outside its content origin
  44999. parentOffset = jQuery(offsetParent).offset();
  45000. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  45001. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  45002. }
  45003. }
  45004. // Subtract parent offsets and element margins
  45005. return {
  45006. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  45007. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  45008. };
  45009. },
  45010. // This method will return documentElement in the following cases:
  45011. // 1) For the element inside the iframe without offsetParent, this method will return
  45012. // documentElement of the parent window
  45013. // 2) For the hidden or detached element
  45014. // 3) For body or html element, i.e. in case of the html node - it will return itself
  45015. //
  45016. // but those exceptions were never presented as a real life use-cases
  45017. // and might be considered as more preferable results.
  45018. //
  45019. // This logic, however, is not guaranteed and can change at any point in the future
  45020. offsetParent: function offsetParent() {
  45021. return this.map(function () {
  45022. var offsetParent = this.offsetParent;
  45023. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  45024. offsetParent = offsetParent.offsetParent;
  45025. }
  45026. return offsetParent || documentElement;
  45027. });
  45028. }
  45029. });
  45030. // Create scrollLeft and scrollTop methods
  45031. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  45032. var top = "pageYOffset" === prop;
  45033. jQuery.fn[method] = function (val) {
  45034. return access(this, function (elem, method, val) {
  45035. // Coalesce documents and windows
  45036. var win;
  45037. if (isWindow(elem)) {
  45038. win = elem;
  45039. } else if (elem.nodeType === 9) {
  45040. win = elem.defaultView;
  45041. }
  45042. if (val === undefined) {
  45043. return win ? win[prop] : elem[method];
  45044. }
  45045. if (win) {
  45046. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  45047. } else {
  45048. elem[method] = val;
  45049. }
  45050. }, method, val, arguments.length);
  45051. };
  45052. });
  45053. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  45054. // Add the top/left cssHooks using jQuery.fn.position
  45055. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  45056. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  45057. // getComputedStyle returns percent when specified for top/left/bottom/right;
  45058. // rather than make the css module depend on the offset module, just check for it here
  45059. jQuery.each(["top", "left"], function (i, prop) {
  45060. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  45061. if (computed) {
  45062. computed = curCSS(elem, prop);
  45063. // If curCSS returns percentage, fallback to offset
  45064. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  45065. }
  45066. });
  45067. });
  45068. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  45069. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  45070. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  45071. // Margin is only for outerHeight, outerWidth
  45072. jQuery.fn[funcName] = function (margin, value) {
  45073. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  45074. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  45075. return access(this, function (elem, type, value) {
  45076. var doc;
  45077. if (isWindow(elem)) {
  45078. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  45079. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  45080. }
  45081. // Get document width or height
  45082. if (elem.nodeType === 9) {
  45083. doc = elem.documentElement;
  45084. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  45085. // whichever is greatest
  45086. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  45087. }
  45088. return value === undefined ?
  45089. // Get width or height on the element, requesting but not forcing parseFloat
  45090. jQuery.css(elem, type, extra) :
  45091. // Set width or height on the element
  45092. jQuery.style(elem, type, value, extra);
  45093. }, type, chainable ? margin : undefined, chainable);
  45094. };
  45095. });
  45096. });
  45097. jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (i, name) {
  45098. // Handle event binding
  45099. jQuery.fn[name] = function (data, fn) {
  45100. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  45101. };
  45102. });
  45103. jQuery.fn.extend({
  45104. hover: function hover(fnOver, fnOut) {
  45105. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  45106. }
  45107. });
  45108. jQuery.fn.extend({
  45109. bind: function bind(types, data, fn) {
  45110. return this.on(types, null, data, fn);
  45111. },
  45112. unbind: function unbind(types, fn) {
  45113. return this.off(types, null, fn);
  45114. },
  45115. delegate: function delegate(selector, types, data, fn) {
  45116. return this.on(types, selector, data, fn);
  45117. },
  45118. undelegate: function undelegate(selector, types, fn) {
  45119. // ( namespace ) or ( selector, types [, fn] )
  45120. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  45121. }
  45122. });
  45123. // Bind a function to a context, optionally partially applying any
  45124. // arguments.
  45125. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  45126. // However, it is not slated for removal any time soon
  45127. jQuery.proxy = function (fn, context) {
  45128. var tmp, args, proxy;
  45129. if (typeof context === "string") {
  45130. tmp = fn[context];
  45131. context = fn;
  45132. fn = tmp;
  45133. }
  45134. // Quick check to determine if target is callable, in the spec
  45135. // this throws a TypeError, but we will just return undefined.
  45136. if (!isFunction(fn)) {
  45137. return undefined;
  45138. }
  45139. // Simulated bind
  45140. args = _slice.call(arguments, 2);
  45141. proxy = function proxy() {
  45142. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  45143. };
  45144. // Set the guid of unique handler to the same of original handler, so it can be removed
  45145. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  45146. return proxy;
  45147. };
  45148. jQuery.holdReady = function (hold) {
  45149. if (hold) {
  45150. jQuery.readyWait++;
  45151. } else {
  45152. jQuery.ready(true);
  45153. }
  45154. };
  45155. jQuery.isArray = Array.isArray;
  45156. jQuery.parseJSON = JSON.parse;
  45157. jQuery.nodeName = nodeName;
  45158. jQuery.isFunction = isFunction;
  45159. jQuery.isWindow = isWindow;
  45160. jQuery.camelCase = camelCase;
  45161. jQuery.type = toType;
  45162. jQuery.now = Date.now;
  45163. jQuery.isNumeric = function (obj) {
  45164. // As of jQuery 3.0, isNumeric is limited to
  45165. // strings and numbers (primitives or objects)
  45166. // that can be coerced to finite numbers (gh-2662)
  45167. var type = jQuery.type(obj);
  45168. return (type === "number" || type === "string") &&
  45169. // parseFloat NaNs numeric-cast false positives ("")
  45170. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  45171. // subtraction forces infinities to NaN
  45172. !isNaN(obj - parseFloat(obj));
  45173. };
  45174. // Register as a named AMD module, since jQuery can be concatenated with other
  45175. // files that may use define, but not via a proper concatenation script that
  45176. // understands anonymous AMD modules. A named AMD is safest and most robust
  45177. // way to register. Lowercase jquery is used because AMD module names are
  45178. // derived from file names, and jQuery is normally delivered in a lowercase
  45179. // file name. Do this after creating the global so that if an AMD module wants
  45180. // to call noConflict to hide this version of jQuery, it will work.
  45181. // Note that for maximum portability, libraries that are not jQuery should
  45182. // declare themselves as anonymous modules, and avoid setting a global if an
  45183. // AMD loader is present. jQuery is a special case. For more information, see
  45184. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  45185. if (true) {
  45186. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  45187. return jQuery;
  45188. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  45189. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45190. }
  45191. var
  45192. // Map over jQuery in case of overwrite
  45193. _jQuery = window.jQuery,
  45194. // Map over the $ in case of overwrite
  45195. _$ = window.$;
  45196. jQuery.noConflict = function (deep) {
  45197. if (window.$ === jQuery) {
  45198. window.$ = _$;
  45199. }
  45200. if (deep && window.jQuery === jQuery) {
  45201. window.jQuery = _jQuery;
  45202. }
  45203. return jQuery;
  45204. };
  45205. // Expose jQuery and $ identifiers, even in AMD
  45206. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  45207. // and CommonJS for browser emulators (#13566)
  45208. if (!noGlobal) {
  45209. window.jQuery = window.$ = jQuery;
  45210. }
  45211. return jQuery;
  45212. });
  45213. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  45214. /***/ }),
  45215. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  45216. /*!********************************************************!*\
  45217. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  45218. \********************************************************/
  45219. /*! no static exports found */
  45220. /***/ (function(module, exports, __webpack_require__) {
  45221. "use strict";
  45222. Object.defineProperty(exports, "__esModule", {
  45223. value: true
  45224. });
  45225. var LanguageService = /** @class */function () {
  45226. function LanguageService(lsKey, defaultLang) {
  45227. if (defaultLang === void 0) {
  45228. defaultLang = 'pt';
  45229. }
  45230. this.lsKey = lsKey;
  45231. this.defaultLang = defaultLang;
  45232. this.listeners = [];
  45233. this.document = document;
  45234. this.setupListener();
  45235. }
  45236. LanguageService.prototype.setupListener = function () {
  45237. var _this = this;
  45238. if (this.document !== null) {
  45239. this.document.addEventListener("storage", function (event) {
  45240. var e = event;
  45241. if (e.key === _this.lsKey) {
  45242. _this.listeners.forEach(function (l) {
  45243. return l();
  45244. });
  45245. }
  45246. });
  45247. }
  45248. };
  45249. LanguageService.prototype.getLang = function () {
  45250. var lang = localStorage.getItem(this.lsKey);
  45251. if (lang === null || lang === undefined) {
  45252. console.warn("Internal Error: User language information has not been set. Returning default...");
  45253. return this.getDefaultLang();
  45254. }
  45255. return lang;
  45256. };
  45257. LanguageService.prototype.getDefaultLang = function () {
  45258. return this.defaultLang;
  45259. };
  45260. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  45261. this.listeners.push(listener);
  45262. };
  45263. return LanguageService;
  45264. }();
  45265. exports.LanguageService = LanguageService;
  45266. /***/ }),
  45267. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  45268. /*!************************************************************!*\
  45269. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  45270. \************************************************************/
  45271. /*! no static exports found */
  45272. /***/ (function(module, exports, __webpack_require__) {
  45273. "use strict";
  45274. Object.defineProperty(exports, "__esModule", {
  45275. value: true
  45276. });
  45277. var LanguageServiceNoLS = /** @class */function () {
  45278. function LanguageServiceNoLS(lang) {
  45279. this.lang = lang;
  45280. this.listeners = [];
  45281. }
  45282. LanguageServiceNoLS.prototype.setupListener = function () {};
  45283. LanguageServiceNoLS.prototype.notifyChange = function () {
  45284. this.listeners.forEach(function (l) {
  45285. return l();
  45286. });
  45287. };
  45288. LanguageServiceNoLS.prototype.setLang = function (lang) {
  45289. this.lang = lang;
  45290. this.notifyChange();
  45291. };
  45292. LanguageServiceNoLS.prototype.getLang = function () {
  45293. return this.lang;
  45294. };
  45295. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  45296. return this.lang;
  45297. };
  45298. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  45299. this.listeners.push(listener);
  45300. };
  45301. return LanguageServiceNoLS;
  45302. }();
  45303. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  45304. /***/ }),
  45305. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  45306. /*!*********************************************************!*\
  45307. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  45308. \*********************************************************/
  45309. /*! no static exports found */
  45310. /***/ (function(module, exports, __webpack_require__) {
  45311. "use strict";
  45312. Object.defineProperty(exports, "__esModule", {
  45313. value: true
  45314. });
  45315. exports.LocalizedStrings = undefined;
  45316. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45317. var LocalizedStrings = /** @class */function () {
  45318. function LocalizedStrings(service, i18nData, listenToChange) {
  45319. if (listenToChange === void 0) {
  45320. listenToChange = false;
  45321. }
  45322. var _this = this;
  45323. this.service = service;
  45324. this.i18nData = i18nData;
  45325. this.listenToChange = listenToChange;
  45326. this.document = document;
  45327. if (this.listenToChange) {
  45328. service.registerLanguageChangeListener(function () {
  45329. _this.updateTagText();
  45330. });
  45331. }
  45332. }
  45333. LocalizedStrings.prototype.getString = function (id, type) {
  45334. var i18nObj = this.i18nData[this.service.getLang()];
  45335. if (!!!i18nObj) {
  45336. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  45337. i18nObj = this.i18nData[this.service.getDefaultLang()];
  45338. }
  45339. if (!!!i18nObj[type]) {
  45340. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  45341. } else if (!!!i18nObj[type][id]) {
  45342. return "{MISSING_I18N_IDENTIFIER}";
  45343. } else {
  45344. return i18nObj[type][id];
  45345. }
  45346. };
  45347. LocalizedStrings.prototype.getOR = function () {
  45348. return this.getUI('join_or');
  45349. };
  45350. LocalizedStrings.prototype.getError = function (id, context) {
  45351. if (context === void 0) {
  45352. context = [];
  45353. }
  45354. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  45355. return this.processString(text, context);
  45356. };
  45357. LocalizedStrings.prototype.getMessage = function (id, context) {
  45358. if (context === void 0) {
  45359. context = [];
  45360. }
  45361. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  45362. return this.processString(text, context);
  45363. };
  45364. LocalizedStrings.prototype.getUI = function (id, context) {
  45365. if (context === void 0) {
  45366. context = [];
  45367. }
  45368. var text = this.getString(id, _StringTypes.StringTypes.UI);
  45369. return this.processString(text, context);
  45370. };
  45371. LocalizedStrings.prototype.processString = function (text, context) {
  45372. for (var i = 0; i < context.length; i++) {
  45373. var v = context[i];
  45374. text = text.replace('\$' + i, v);
  45375. }
  45376. return text;
  45377. };
  45378. LocalizedStrings.prototype.updateTagText = function (func) {
  45379. var _this = this;
  45380. if (func === void 0) {
  45381. func = null;
  45382. }
  45383. if (this.document !== null) {
  45384. var list = this.document.querySelectorAll("data.i18n");
  45385. list.forEach(function (node) {
  45386. if (func === null) {
  45387. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  45388. } else {
  45389. node.innerHTML = func(node.getAttribute("value"));
  45390. }
  45391. });
  45392. }
  45393. };
  45394. LocalizedStrings.prototype.processTagTex = function (text) {
  45395. if (text === null) {
  45396. return "<Invalid i18n identifier>";
  45397. }
  45398. var opts = text.split(':');
  45399. var type = opts[0].toLowerCase();
  45400. var id = opts[1];
  45401. if (_StringTypes.StringTypes.ERROR === type) {
  45402. return this.getError(id);
  45403. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  45404. return this.getMessage(id);
  45405. } else if (_StringTypes.StringTypes.UI === type) {
  45406. return this.getUI(id);
  45407. } else {
  45408. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  45409. return this.getString(id, type);
  45410. }
  45411. };
  45412. return LocalizedStrings;
  45413. }();
  45414. exports.LocalizedStrings = LocalizedStrings;
  45415. /***/ }),
  45416. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  45417. /*!****************************************************!*\
  45418. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  45419. \****************************************************/
  45420. /*! no static exports found */
  45421. /***/ (function(module, exports, __webpack_require__) {
  45422. "use strict";
  45423. Object.defineProperty(exports, "__esModule", {
  45424. value: true
  45425. });
  45426. var StringTypes = exports.StringTypes = undefined;
  45427. (function (StringTypes) {
  45428. StringTypes["ERROR"] = "error";
  45429. StringTypes["MESSAGE"] = "message";
  45430. StringTypes["UI"] = "ui";
  45431. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  45432. /***/ }),
  45433. /***/ "./node_modules/line-i18n/dist/index.js":
  45434. /*!**********************************************!*\
  45435. !*** ./node_modules/line-i18n/dist/index.js ***!
  45436. \**********************************************/
  45437. /*! no static exports found */
  45438. /***/ (function(module, exports, __webpack_require__) {
  45439. "use strict";
  45440. Object.defineProperty(exports, "__esModule", {
  45441. value: true
  45442. });
  45443. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  45444. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  45445. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45446. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  45447. exports.default = {
  45448. LanguageService: _LanguageService.LanguageService,
  45449. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  45450. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  45451. StringTypes: _StringTypes.StringTypes
  45452. };
  45453. /***/ }),
  45454. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  45455. /*!***************************************************!*\
  45456. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  45457. \***************************************************/
  45458. /*! no static exports found */
  45459. /***/ (function(module, exports, __webpack_require__) {
  45460. "use strict";
  45461. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  45462. * DEVELOPED BY
  45463. * GIL LOPES BUENO
  45464. * gilbueno.mail@gmail.com
  45465. *
  45466. * WORKS WITH:
  45467. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  45468. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  45469. *
  45470. * FORK:
  45471. * https://github.com/melanke/Watch.JS
  45472. *
  45473. * LICENSE: MIT
  45474. */
  45475. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  45476. (function (factory) {
  45477. if (( false ? undefined : _typeof(exports)) === 'object') {
  45478. // Node. Does not work with strict CommonJS, but
  45479. // only CommonJS-like enviroments that support module.exports,
  45480. // like Node.
  45481. module.exports = factory();
  45482. } else if (true) {
  45483. // AMD. Register as an anonymous module.
  45484. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  45485. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  45486. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  45487. __WEBPACK_AMD_DEFINE_FACTORY__),
  45488. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45489. } else {}
  45490. })(function () {
  45491. var WatchJS = {
  45492. noMore: false, // use WatchJS.suspend(obj) instead
  45493. useDirtyCheck: false, // use only dirty checking to track changes.
  45494. preserveExistingSetters: false
  45495. },
  45496. lengthsubjects = [];
  45497. var dirtyChecklist = [];
  45498. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  45499. var supportDefineProperty = false;
  45500. try {
  45501. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  45502. } catch (ex) {/* not supported */}
  45503. var isFunction = function isFunction(functionToCheck) {
  45504. var getType = {};
  45505. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  45506. };
  45507. var isInt = function isInt(x) {
  45508. return x % 1 === 0;
  45509. };
  45510. var isArray = function isArray(obj) {
  45511. return Object.prototype.toString.call(obj) === '[object Array]';
  45512. };
  45513. var isObject = function isObject(obj) {
  45514. return {}.toString.apply(obj) === '[object Object]';
  45515. };
  45516. var getObjDiff = function getObjDiff(a, b) {
  45517. var aplus = [],
  45518. bplus = [];
  45519. if (!(typeof a == "string") && !(typeof b == "string")) {
  45520. if (isArray(a) && b) {
  45521. for (var i = 0; i < a.length; i++) {
  45522. if (b[i] === undefined) aplus.push(i);
  45523. }
  45524. } else {
  45525. for (var i in a) {
  45526. if (a.hasOwnProperty(i)) {
  45527. if (b && !b.hasOwnProperty(i)) {
  45528. aplus.push(i);
  45529. }
  45530. }
  45531. }
  45532. }
  45533. if (isArray(b) && a) {
  45534. for (var j = 0; j < b.length; j++) {
  45535. if (a[j] === undefined) bplus.push(j);
  45536. }
  45537. } else {
  45538. for (var j in b) {
  45539. if (b.hasOwnProperty(j)) {
  45540. if (a && !a.hasOwnProperty(j)) {
  45541. bplus.push(j);
  45542. }
  45543. }
  45544. }
  45545. }
  45546. }
  45547. return {
  45548. added: aplus,
  45549. removed: bplus
  45550. };
  45551. };
  45552. var clone = function clone(obj) {
  45553. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  45554. return obj;
  45555. }
  45556. var copy = obj.constructor();
  45557. for (var attr in obj) {
  45558. copy[attr] = obj[attr];
  45559. }
  45560. return copy;
  45561. };
  45562. var getExistingSetter = function getExistingSetter(obj, propName) {
  45563. if (WatchJS.preserveExistingSetters) {
  45564. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  45565. return existing.set;
  45566. }
  45567. return undefined;
  45568. };
  45569. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  45570. try {
  45571. var existingSetter = getExistingSetter(obj, propName);
  45572. Object.defineProperty(obj, propName, {
  45573. get: getter,
  45574. set: function set(value) {
  45575. setter.call(this, value, true); // coalesce changes
  45576. if (existingSetter) {
  45577. existingSetter(value);
  45578. }
  45579. },
  45580. enumerable: true,
  45581. configurable: true
  45582. });
  45583. } catch (e1) {
  45584. try {
  45585. Object.prototype.__defineGetter__.call(obj, propName, getter);
  45586. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  45587. setter.call(this, value, true); // coalesce changes
  45588. });
  45589. } catch (e2) {
  45590. observeDirtyChanges(obj, propName, setter);
  45591. //throw new Error("watchJS error: browser not supported :/")
  45592. }
  45593. }
  45594. };
  45595. var defineProp = function defineProp(obj, propName, value) {
  45596. try {
  45597. Object.defineProperty(obj, propName, {
  45598. enumerable: false,
  45599. configurable: true,
  45600. writable: false,
  45601. value: value
  45602. });
  45603. } catch (error) {
  45604. obj[propName] = value;
  45605. }
  45606. };
  45607. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45608. dirtyChecklist[dirtyChecklist.length] = {
  45609. prop: propName,
  45610. object: obj,
  45611. orig: clone(obj[propName]),
  45612. callback: setter
  45613. };
  45614. };
  45615. var watch = function watch() {
  45616. if (isFunction(arguments[1])) {
  45617. watchAll.apply(this, arguments);
  45618. } else if (isArray(arguments[1])) {
  45619. watchMany.apply(this, arguments);
  45620. } else {
  45621. watchOne.apply(this, arguments);
  45622. }
  45623. };
  45624. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45625. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45626. //accepts only objects and array (not string)
  45627. return;
  45628. }
  45629. if (isArray(obj)) {
  45630. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45631. if (level === undefined || level > 0) {
  45632. for (var prop = 0; prop < obj.length; prop++) {
  45633. // watch objects in array
  45634. watchAll(obj[prop], watcher, level, addNRemove);
  45635. }
  45636. }
  45637. } else {
  45638. var prop,
  45639. props = [];
  45640. for (prop in obj) {
  45641. //for each attribute if obj is an object
  45642. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45643. continue;
  45644. }
  45645. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45646. props.push(prop); //put in the props
  45647. }
  45648. }
  45649. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45650. }
  45651. if (addNRemove) {
  45652. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45653. }
  45654. };
  45655. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45656. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45657. //accepts only objects and array (not string)
  45658. return;
  45659. }
  45660. for (var i = 0; i < props.length; i++) {
  45661. //watch each property
  45662. var prop = props[i];
  45663. watchOne(obj, prop, watcher, level, addNRemove);
  45664. }
  45665. };
  45666. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45667. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45668. //accepts only objects and array (not string)
  45669. return;
  45670. }
  45671. if (isFunction(obj[prop])) {
  45672. //dont watch if it is a function
  45673. return;
  45674. }
  45675. if (obj[prop] != null && (level === undefined || level > 0)) {
  45676. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45677. }
  45678. defineWatcher(obj, prop, watcher, level);
  45679. if (addNRemove && (level === undefined || level > 0)) {
  45680. pushToLengthSubjects(obj, prop, watcher, level);
  45681. }
  45682. };
  45683. var unwatch = function unwatch() {
  45684. if (isFunction(arguments[1])) {
  45685. unwatchAll.apply(this, arguments);
  45686. } else if (isArray(arguments[1])) {
  45687. unwatchMany.apply(this, arguments);
  45688. } else {
  45689. unwatchOne.apply(this, arguments);
  45690. }
  45691. };
  45692. var unwatchAll = function unwatchAll(obj, watcher) {
  45693. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45694. //accepts only objects and array (not string)
  45695. return;
  45696. }
  45697. if (isArray(obj)) {
  45698. var props = ['__watchall__'];
  45699. for (var prop = 0; prop < obj.length; prop++) {
  45700. //for each item if obj is an array
  45701. props.push(prop); //put in the props
  45702. }
  45703. unwatchMany(obj, props, watcher); //watch all itens of the props
  45704. } else {
  45705. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45706. var props = [];
  45707. for (var prop2 in obj2) {
  45708. //for each attribute if obj is an object
  45709. if (obj2.hasOwnProperty(prop2)) {
  45710. if (obj2[prop2] instanceof Object) {
  45711. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45712. } else {
  45713. props.push(prop2); //put in the props
  45714. }
  45715. }
  45716. }
  45717. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45718. };
  45719. unwatchPropsInObject(obj);
  45720. }
  45721. };
  45722. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45723. for (var prop2 in props) {
  45724. //watch each attribute of "props" if is an object
  45725. if (props.hasOwnProperty(prop2)) {
  45726. unwatchOne(obj, props[prop2], watcher);
  45727. }
  45728. }
  45729. };
  45730. var timeouts = [],
  45731. timerID = null;
  45732. function clearTimerID() {
  45733. timerID = null;
  45734. for (var i = 0; i < timeouts.length; i++) {
  45735. timeouts[i]();
  45736. }
  45737. timeouts.length = 0;
  45738. }
  45739. var getTimerID = function getTimerID() {
  45740. if (!timerID) {
  45741. timerID = setTimeout(clearTimerID);
  45742. }
  45743. return timerID;
  45744. };
  45745. var registerTimeout = function registerTimeout(fn) {
  45746. // register function to be called on timeout
  45747. if (timerID == null) getTimerID();
  45748. timeouts[timeouts.length] = fn;
  45749. };
  45750. // Track changes made to an array, object or an object's property
  45751. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  45752. // Syntax:
  45753. // trackChange(obj, callback, recursive, addNRemove)
  45754. // trackChange(obj, prop, callback, recursive, addNRemove)
  45755. var trackChange = function trackChange() {
  45756. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  45757. fn.apply(this, arguments);
  45758. };
  45759. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  45760. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  45761. var change = null,
  45762. lastTimerID = -1;
  45763. var isArr = isArray(obj);
  45764. var level,
  45765. fn = function fn(prop, action, newValue, oldValue) {
  45766. var timerID = getTimerID();
  45767. if (lastTimerID !== timerID) {
  45768. // check if timer has changed since last update
  45769. lastTimerID = timerID;
  45770. change = {
  45771. type: 'update'
  45772. };
  45773. change['value'] = obj;
  45774. change['splices'] = null;
  45775. registerTimeout(function () {
  45776. callback.call(this, change);
  45777. change = null;
  45778. });
  45779. }
  45780. // create splices for array changes
  45781. if (isArr && obj === this && change !== null) {
  45782. if (action === 'pop' || action === 'shift') {
  45783. newValue = [];
  45784. oldValue = [oldValue];
  45785. } else if (action === 'push' || action === 'unshift') {
  45786. newValue = [newValue];
  45787. oldValue = [];
  45788. } else if (action !== 'splice') {
  45789. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  45790. }
  45791. if (!change.splices) change.splices = [];
  45792. change.splices[change.splices.length] = {
  45793. index: prop,
  45794. deleteCount: oldValue ? oldValue.length : 0,
  45795. addedCount: newValue ? newValue.length : 0,
  45796. added: newValue,
  45797. deleted: oldValue
  45798. };
  45799. }
  45800. };
  45801. level = recursive == true ? undefined : 0;
  45802. watchAll(obj, fn, level, addNRemove);
  45803. };
  45804. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  45805. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  45806. if (obj && prop) {
  45807. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  45808. var change = {
  45809. type: 'update'
  45810. };
  45811. change['value'] = newvalue;
  45812. change['oldvalue'] = oldvalue;
  45813. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  45814. trackObject(newvalue, callback, recursive, addNRemove);
  45815. }
  45816. callback.call(this, change);
  45817. }, 0);
  45818. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  45819. trackObject(obj[prop], callback, recursive, addNRemove);
  45820. }
  45821. }
  45822. };
  45823. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  45824. var newWatcher = false;
  45825. var isArr = isArray(obj);
  45826. if (!obj.watchers) {
  45827. defineProp(obj, "watchers", {});
  45828. if (isArr) {
  45829. // watch array functions
  45830. watchFunctions(obj, function (index, action, newValue, oldValue) {
  45831. addPendingChange(obj, index, action, newValue, oldValue);
  45832. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  45833. var i,
  45834. n,
  45835. ln,
  45836. wAll,
  45837. watchList = obj.watchers[prop];
  45838. if (wAll = obj.watchers['__watchall__']) {
  45839. watchList = watchList ? watchList.concat(wAll) : wAll;
  45840. }
  45841. ln = watchList ? watchList.length : 0;
  45842. for (i = 0; i < ln; i++) {
  45843. if (action !== 'splice') {
  45844. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  45845. } else {
  45846. // watch spliced values
  45847. for (n = 0; n < newValue.length; n++) {
  45848. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  45849. }
  45850. }
  45851. }
  45852. }
  45853. });
  45854. }
  45855. }
  45856. if (!obj.watchers[prop]) {
  45857. obj.watchers[prop] = [];
  45858. if (!isArr) newWatcher = true;
  45859. }
  45860. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45861. if (obj.watchers[prop][i] === watcher) {
  45862. return;
  45863. }
  45864. }
  45865. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  45866. if (newWatcher) {
  45867. var val = obj[prop];
  45868. var getter = function getter() {
  45869. return val;
  45870. };
  45871. var setter = function setter(newval, delayWatcher) {
  45872. var oldval = val;
  45873. val = newval;
  45874. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  45875. // watch sub properties
  45876. var i,
  45877. ln = obj.watchers[prop].length;
  45878. for (i = 0; i < ln; i++) {
  45879. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  45880. }
  45881. }
  45882. //watchFunctions(obj, prop);
  45883. if (isSuspended(obj, prop)) {
  45884. resume(obj, prop);
  45885. return;
  45886. }
  45887. if (!WatchJS.noMore) {
  45888. // this does not work with Object.observe
  45889. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  45890. if (oldval !== newval) {
  45891. if (!delayWatcher) {
  45892. callWatchers(obj, prop, "set", newval, oldval);
  45893. } else {
  45894. addPendingChange(obj, prop, "set", newval, oldval);
  45895. }
  45896. WatchJS.noMore = false;
  45897. }
  45898. }
  45899. };
  45900. if (WatchJS.useDirtyCheck) {
  45901. observeDirtyChanges(obj, prop, setter);
  45902. } else {
  45903. defineGetAndSet(obj, prop, getter, setter);
  45904. }
  45905. }
  45906. };
  45907. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  45908. if (prop !== undefined) {
  45909. var ln,
  45910. wl,
  45911. watchList = obj.watchers[prop];
  45912. if (wl = obj.watchers['__watchall__']) {
  45913. watchList = watchList ? watchList.concat(wl) : wl;
  45914. }
  45915. ln = watchList ? watchList.length : 0;
  45916. for (var wr = 0; wr < ln; wr++) {
  45917. watchList[wr].call(obj, prop, action, newval, oldval);
  45918. }
  45919. } else {
  45920. for (var prop in obj) {
  45921. //call all
  45922. if (obj.hasOwnProperty(prop)) {
  45923. callWatchers(obj, prop, action, newval, oldval);
  45924. }
  45925. }
  45926. }
  45927. };
  45928. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  45929. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  45930. defineProp(obj, methodName, function () {
  45931. var index = 0;
  45932. var i, newValue, oldValue, response;
  45933. // get values before splicing array
  45934. if (methodName === 'splice') {
  45935. var start = arguments[0];
  45936. var end = start + arguments[1];
  45937. oldValue = obj.slice(start, end);
  45938. newValue = [];
  45939. for (i = 2; i < arguments.length; i++) {
  45940. newValue[i - 2] = arguments[i];
  45941. }
  45942. index = start;
  45943. } else {
  45944. newValue = arguments.length > 0 ? arguments[0] : undefined;
  45945. }
  45946. response = original.apply(obj, arguments);
  45947. if (methodName !== 'slice') {
  45948. if (methodName === 'pop') {
  45949. oldValue = response;
  45950. index = obj.length;
  45951. } else if (methodName === 'push') {
  45952. index = obj.length - 1;
  45953. } else if (methodName === 'shift') {
  45954. oldValue = response;
  45955. } else if (methodName !== 'unshift' && newValue === undefined) {
  45956. newValue = response;
  45957. }
  45958. callback.call(obj, index, methodName, newValue, oldValue);
  45959. }
  45960. return response;
  45961. });
  45962. };
  45963. var watchFunctions = function watchFunctions(obj, callback) {
  45964. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  45965. return;
  45966. }
  45967. for (var i = methodNames.length, methodName; i--;) {
  45968. methodName = methodNames[i];
  45969. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  45970. }
  45971. };
  45972. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  45973. if (prop) {
  45974. if (obj.watchers && obj.watchers[prop]) {
  45975. if (watcher === undefined) {
  45976. delete obj.watchers[prop]; // remove all property watchers
  45977. } else {
  45978. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45979. var w = obj.watchers[prop][i];
  45980. if (w == watcher) {
  45981. obj.watchers[prop].splice(i, 1);
  45982. }
  45983. }
  45984. }
  45985. }
  45986. } else {
  45987. delete obj.watchers;
  45988. }
  45989. removeFromLengthSubjects(obj, prop, watcher);
  45990. removeFromDirtyChecklist(obj, prop);
  45991. };
  45992. // suspend watchers until next update cycle
  45993. var suspend = function suspend(obj, prop) {
  45994. if (obj.watchers) {
  45995. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  45996. obj.watchers[name] = true;
  45997. }
  45998. };
  45999. var isSuspended = function isSuspended(obj, prop) {
  46000. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  46001. };
  46002. // resumes preivously suspended watchers
  46003. var resume = function resume(obj, prop) {
  46004. registerTimeout(function () {
  46005. delete obj.watchers['__wjs_suspend__'];
  46006. delete obj.watchers['__wjs_suspend__' + prop];
  46007. });
  46008. };
  46009. var pendingTimerID = null;
  46010. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  46011. pendingChanges[pendingChanges.length] = {
  46012. obj: obj,
  46013. prop: prop,
  46014. mode: mode,
  46015. newval: newval,
  46016. oldval: oldval
  46017. };
  46018. if (pendingTimerID === null) {
  46019. pendingTimerID = setTimeout(applyPendingChanges);
  46020. }
  46021. };
  46022. var applyPendingChanges = function applyPendingChanges() {
  46023. // apply pending changes
  46024. var change = null;
  46025. pendingTimerID = null;
  46026. for (var i = 0; i < pendingChanges.length; i++) {
  46027. change = pendingChanges[i];
  46028. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  46029. }
  46030. if (change) {
  46031. pendingChanges = [];
  46032. change = null;
  46033. }
  46034. };
  46035. var loop = function loop() {
  46036. // check for new or deleted props
  46037. for (var i = 0; i < lengthsubjects.length; i++) {
  46038. var subj = lengthsubjects[i];
  46039. if (subj.prop === "$$watchlengthsubjectroot") {
  46040. var difference = getObjDiff(subj.obj, subj.actual);
  46041. if (difference.added.length || difference.removed.length) {
  46042. if (difference.added.length) {
  46043. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  46044. }
  46045. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  46046. }
  46047. subj.actual = clone(subj.obj);
  46048. } else {
  46049. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  46050. if (difference.added.length || difference.removed.length) {
  46051. if (difference.added.length) {
  46052. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  46053. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  46054. }
  46055. }
  46056. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  46057. }
  46058. subj.actual = clone(subj.obj[subj.prop]);
  46059. }
  46060. }
  46061. // start dirty check
  46062. var n, value;
  46063. if (dirtyChecklist.length > 0) {
  46064. for (var i = 0; i < dirtyChecklist.length; i++) {
  46065. n = dirtyChecklist[i];
  46066. value = n.object[n.prop];
  46067. if (!compareValues(n.orig, value)) {
  46068. n.orig = clone(value);
  46069. n.callback(value);
  46070. }
  46071. }
  46072. }
  46073. };
  46074. var compareValues = function compareValues(a, b) {
  46075. var i,
  46076. state = true;
  46077. if (a !== b) {
  46078. if (isObject(a)) {
  46079. for (i in a) {
  46080. if (!supportDefineProperty && i === 'watchers') continue;
  46081. if (a[i] !== b[i]) {
  46082. state = false;
  46083. break;
  46084. };
  46085. }
  46086. } else {
  46087. state = false;
  46088. }
  46089. }
  46090. return state;
  46091. };
  46092. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  46093. var actual;
  46094. if (prop === "$$watchlengthsubjectroot") {
  46095. actual = clone(obj);
  46096. } else {
  46097. actual = clone(obj[prop]);
  46098. }
  46099. lengthsubjects.push({
  46100. obj: obj,
  46101. prop: prop,
  46102. actual: actual,
  46103. watcher: watcher,
  46104. level: level
  46105. });
  46106. };
  46107. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  46108. for (var i = 0; i < lengthsubjects.length; i++) {
  46109. var subj = lengthsubjects[i];
  46110. if (subj.obj == obj) {
  46111. if (!prop || subj.prop == prop) {
  46112. if (!watcher || subj.watcher == watcher) {
  46113. // if we splice off one item at position i
  46114. // we need to decrement i as the array is one item shorter
  46115. // so when we increment i in the loop statement we
  46116. // will land at the correct index.
  46117. // if it's not decremented, you won't delete all length subjects
  46118. lengthsubjects.splice(i--, 1);
  46119. }
  46120. }
  46121. }
  46122. }
  46123. };
  46124. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  46125. var notInUse;
  46126. for (var i = 0; i < dirtyChecklist.length; i++) {
  46127. var n = dirtyChecklist[i];
  46128. var watchers = n.object.watchers;
  46129. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  46130. if (notInUse) {
  46131. // we use the same syntax as in removeFromLengthSubjects
  46132. dirtyChecklist.splice(i--, 1);
  46133. }
  46134. }
  46135. };
  46136. setInterval(loop, 50);
  46137. WatchJS.watch = watch;
  46138. WatchJS.unwatch = unwatch;
  46139. WatchJS.callWatchers = callWatchers;
  46140. WatchJS.suspend = suspend; // suspend watchers
  46141. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  46142. return WatchJS;
  46143. });
  46144. /***/ }),
  46145. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  46146. /*!******************************************************!*\
  46147. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  46148. \******************************************************/
  46149. /*! no static exports found */
  46150. /***/ (function(module, exports, __webpack_require__) {
  46151. "use strict";
  46152. /***/ }),
  46153. /***/ "./node_modules/webpack/buildin/module.js":
  46154. /*!***********************************!*\
  46155. !*** (webpack)/buildin/module.js ***!
  46156. \***********************************/
  46157. /*! no static exports found */
  46158. /***/ (function(module, exports, __webpack_require__) {
  46159. "use strict";
  46160. module.exports = function (module) {
  46161. if (!module.webpackPolyfill) {
  46162. module.deprecate = function () {};
  46163. module.paths = [];
  46164. // module.parent = undefined by default
  46165. if (!module.children) module.children = [];
  46166. Object.defineProperty(module, "loaded", {
  46167. enumerable: true,
  46168. get: function get() {
  46169. return module.l;
  46170. }
  46171. });
  46172. Object.defineProperty(module, "id", {
  46173. enumerable: true,
  46174. get: function get() {
  46175. return module.i;
  46176. }
  46177. });
  46178. module.webpackPolyfill = 1;
  46179. }
  46180. return module;
  46181. };
  46182. /***/ })
  46183. /******/ });
  46184. });
  46185. //# sourceMappingURL=ivprog.bundle.js.map