index.html 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Main</title>
  6. <style>body { padding: 0; margin: 0; }</style>
  7. </head>
  8. <body>
  9. <pre id="elm"></pre>
  10. <script>
  11. try {
  12. (function(scope){
  13. 'use strict';
  14. function F(arity, fun, wrapper) {
  15. wrapper.a = arity;
  16. wrapper.f = fun;
  17. return wrapper;
  18. }
  19. function F2(fun) {
  20. return F(2, fun, function(a) { return function(b) { return fun(a,b); }; })
  21. }
  22. function F3(fun) {
  23. return F(3, fun, function(a) {
  24. return function(b) { return function(c) { return fun(a, b, c); }; };
  25. });
  26. }
  27. function F4(fun) {
  28. return F(4, fun, function(a) { return function(b) { return function(c) {
  29. return function(d) { return fun(a, b, c, d); }; }; };
  30. });
  31. }
  32. function F5(fun) {
  33. return F(5, fun, function(a) { return function(b) { return function(c) {
  34. return function(d) { return function(e) { return fun(a, b, c, d, e); }; }; }; };
  35. });
  36. }
  37. function F6(fun) {
  38. return F(6, fun, function(a) { return function(b) { return function(c) {
  39. return function(d) { return function(e) { return function(f) {
  40. return fun(a, b, c, d, e, f); }; }; }; }; };
  41. });
  42. }
  43. function F7(fun) {
  44. return F(7, fun, function(a) { return function(b) { return function(c) {
  45. return function(d) { return function(e) { return function(f) {
  46. return function(g) { return fun(a, b, c, d, e, f, g); }; }; }; }; }; };
  47. });
  48. }
  49. function F8(fun) {
  50. return F(8, fun, function(a) { return function(b) { return function(c) {
  51. return function(d) { return function(e) { return function(f) {
  52. return function(g) { return function(h) {
  53. return fun(a, b, c, d, e, f, g, h); }; }; }; }; }; }; };
  54. });
  55. }
  56. function F9(fun) {
  57. return F(9, fun, function(a) { return function(b) { return function(c) {
  58. return function(d) { return function(e) { return function(f) {
  59. return function(g) { return function(h) { return function(i) {
  60. return fun(a, b, c, d, e, f, g, h, i); }; }; }; }; }; }; }; };
  61. });
  62. }
  63. function A2(fun, a, b) {
  64. return fun.a === 2 ? fun.f(a, b) : fun(a)(b);
  65. }
  66. function A3(fun, a, b, c) {
  67. return fun.a === 3 ? fun.f(a, b, c) : fun(a)(b)(c);
  68. }
  69. function A4(fun, a, b, c, d) {
  70. return fun.a === 4 ? fun.f(a, b, c, d) : fun(a)(b)(c)(d);
  71. }
  72. function A5(fun, a, b, c, d, e) {
  73. return fun.a === 5 ? fun.f(a, b, c, d, e) : fun(a)(b)(c)(d)(e);
  74. }
  75. function A6(fun, a, b, c, d, e, f) {
  76. return fun.a === 6 ? fun.f(a, b, c, d, e, f) : fun(a)(b)(c)(d)(e)(f);
  77. }
  78. function A7(fun, a, b, c, d, e, f, g) {
  79. return fun.a === 7 ? fun.f(a, b, c, d, e, f, g) : fun(a)(b)(c)(d)(e)(f)(g);
  80. }
  81. function A8(fun, a, b, c, d, e, f, g, h) {
  82. return fun.a === 8 ? fun.f(a, b, c, d, e, f, g, h) : fun(a)(b)(c)(d)(e)(f)(g)(h);
  83. }
  84. function A9(fun, a, b, c, d, e, f, g, h, i) {
  85. return fun.a === 9 ? fun.f(a, b, c, d, e, f, g, h, i) : fun(a)(b)(c)(d)(e)(f)(g)(h)(i);
  86. }
  87. console.warn('Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.');
  88. // EQUALITY
  89. function _Utils_eq(x, y)
  90. {
  91. for (
  92. var pair, stack = [], isEqual = _Utils_eqHelp(x, y, 0, stack);
  93. isEqual && (pair = stack.pop());
  94. isEqual = _Utils_eqHelp(pair.a, pair.b, 0, stack)
  95. )
  96. {}
  97. return isEqual;
  98. }
  99. function _Utils_eqHelp(x, y, depth, stack)
  100. {
  101. if (x === y)
  102. {
  103. return true;
  104. }
  105. if (typeof x !== 'object' || x === null || y === null)
  106. {
  107. typeof x === 'function' && _Debug_crash(5);
  108. return false;
  109. }
  110. if (depth > 100)
  111. {
  112. stack.push(_Utils_Tuple2(x,y));
  113. return true;
  114. }
  115. /**/
  116. if (x.$ === 'Set_elm_builtin')
  117. {
  118. x = $elm$core$Set$toList(x);
  119. y = $elm$core$Set$toList(y);
  120. }
  121. if (x.$ === 'RBNode_elm_builtin' || x.$ === 'RBEmpty_elm_builtin')
  122. {
  123. x = $elm$core$Dict$toList(x);
  124. y = $elm$core$Dict$toList(y);
  125. }
  126. //*/
  127. /**_UNUSED/
  128. if (x.$ < 0)
  129. {
  130. x = $elm$core$Dict$toList(x);
  131. y = $elm$core$Dict$toList(y);
  132. }
  133. //*/
  134. for (var key in x)
  135. {
  136. if (!_Utils_eqHelp(x[key], y[key], depth + 1, stack))
  137. {
  138. return false;
  139. }
  140. }
  141. return true;
  142. }
  143. var _Utils_equal = F2(_Utils_eq);
  144. var _Utils_notEqual = F2(function(a, b) { return !_Utils_eq(a,b); });
  145. // COMPARISONS
  146. // Code in Generate/JavaScript.hs, Basics.js, and List.js depends on
  147. // the particular integer values assigned to LT, EQ, and GT.
  148. function _Utils_cmp(x, y, ord)
  149. {
  150. if (typeof x !== 'object')
  151. {
  152. return x === y ? /*EQ*/ 0 : x < y ? /*LT*/ -1 : /*GT*/ 1;
  153. }
  154. /**/
  155. if (x instanceof String)
  156. {
  157. var a = x.valueOf();
  158. var b = y.valueOf();
  159. return a === b ? 0 : a < b ? -1 : 1;
  160. }
  161. //*/
  162. /**_UNUSED/
  163. if (typeof x.$ === 'undefined')
  164. //*/
  165. /**/
  166. if (x.$[0] === '#')
  167. //*/
  168. {
  169. return (ord = _Utils_cmp(x.a, y.a))
  170. ? ord
  171. : (ord = _Utils_cmp(x.b, y.b))
  172. ? ord
  173. : _Utils_cmp(x.c, y.c);
  174. }
  175. // traverse conses until end of a list or a mismatch
  176. for (; x.b && y.b && !(ord = _Utils_cmp(x.a, y.a)); x = x.b, y = y.b) {} // WHILE_CONSES
  177. return ord || (x.b ? /*GT*/ 1 : y.b ? /*LT*/ -1 : /*EQ*/ 0);
  178. }
  179. var _Utils_lt = F2(function(a, b) { return _Utils_cmp(a, b) < 0; });
  180. var _Utils_le = F2(function(a, b) { return _Utils_cmp(a, b) < 1; });
  181. var _Utils_gt = F2(function(a, b) { return _Utils_cmp(a, b) > 0; });
  182. var _Utils_ge = F2(function(a, b) { return _Utils_cmp(a, b) >= 0; });
  183. var _Utils_compare = F2(function(x, y)
  184. {
  185. var n = _Utils_cmp(x, y);
  186. return n < 0 ? $elm$core$Basics$LT : n ? $elm$core$Basics$GT : $elm$core$Basics$EQ;
  187. });
  188. // COMMON VALUES
  189. var _Utils_Tuple0_UNUSED = 0;
  190. var _Utils_Tuple0 = { $: '#0' };
  191. function _Utils_Tuple2_UNUSED(a, b) { return { a: a, b: b }; }
  192. function _Utils_Tuple2(a, b) { return { $: '#2', a: a, b: b }; }
  193. function _Utils_Tuple3_UNUSED(a, b, c) { return { a: a, b: b, c: c }; }
  194. function _Utils_Tuple3(a, b, c) { return { $: '#3', a: a, b: b, c: c }; }
  195. function _Utils_chr_UNUSED(c) { return c; }
  196. function _Utils_chr(c) { return new String(c); }
  197. // RECORDS
  198. function _Utils_update(oldRecord, updatedFields)
  199. {
  200. var newRecord = {};
  201. for (var key in oldRecord)
  202. {
  203. newRecord[key] = oldRecord[key];
  204. }
  205. for (var key in updatedFields)
  206. {
  207. newRecord[key] = updatedFields[key];
  208. }
  209. return newRecord;
  210. }
  211. // APPEND
  212. var _Utils_append = F2(_Utils_ap);
  213. function _Utils_ap(xs, ys)
  214. {
  215. // append Strings
  216. if (typeof xs === 'string')
  217. {
  218. return xs + ys;
  219. }
  220. // append Lists
  221. if (!xs.b)
  222. {
  223. return ys;
  224. }
  225. var root = _List_Cons(xs.a, ys);
  226. xs = xs.b
  227. for (var curr = root; xs.b; xs = xs.b) // WHILE_CONS
  228. {
  229. curr = curr.b = _List_Cons(xs.a, ys);
  230. }
  231. return root;
  232. }
  233. var _List_Nil_UNUSED = { $: 0 };
  234. var _List_Nil = { $: '[]' };
  235. function _List_Cons_UNUSED(hd, tl) { return { $: 1, a: hd, b: tl }; }
  236. function _List_Cons(hd, tl) { return { $: '::', a: hd, b: tl }; }
  237. var _List_cons = F2(_List_Cons);
  238. function _List_fromArray(arr)
  239. {
  240. var out = _List_Nil;
  241. for (var i = arr.length; i--; )
  242. {
  243. out = _List_Cons(arr[i], out);
  244. }
  245. return out;
  246. }
  247. function _List_toArray(xs)
  248. {
  249. for (var out = []; xs.b; xs = xs.b) // WHILE_CONS
  250. {
  251. out.push(xs.a);
  252. }
  253. return out;
  254. }
  255. var _List_map2 = F3(function(f, xs, ys)
  256. {
  257. for (var arr = []; xs.b && ys.b; xs = xs.b, ys = ys.b) // WHILE_CONSES
  258. {
  259. arr.push(A2(f, xs.a, ys.a));
  260. }
  261. return _List_fromArray(arr);
  262. });
  263. var _List_map3 = F4(function(f, xs, ys, zs)
  264. {
  265. for (var arr = []; xs.b && ys.b && zs.b; xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES
  266. {
  267. arr.push(A3(f, xs.a, ys.a, zs.a));
  268. }
  269. return _List_fromArray(arr);
  270. });
  271. var _List_map4 = F5(function(f, ws, xs, ys, zs)
  272. {
  273. for (var arr = []; ws.b && xs.b && ys.b && zs.b; ws = ws.b, xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES
  274. {
  275. arr.push(A4(f, ws.a, xs.a, ys.a, zs.a));
  276. }
  277. return _List_fromArray(arr);
  278. });
  279. var _List_map5 = F6(function(f, vs, ws, xs, ys, zs)
  280. {
  281. for (var arr = []; vs.b && ws.b && xs.b && ys.b && zs.b; vs = vs.b, ws = ws.b, xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES
  282. {
  283. arr.push(A5(f, vs.a, ws.a, xs.a, ys.a, zs.a));
  284. }
  285. return _List_fromArray(arr);
  286. });
  287. var _List_sortBy = F2(function(f, xs)
  288. {
  289. return _List_fromArray(_List_toArray(xs).sort(function(a, b) {
  290. return _Utils_cmp(f(a), f(b));
  291. }));
  292. });
  293. var _List_sortWith = F2(function(f, xs)
  294. {
  295. return _List_fromArray(_List_toArray(xs).sort(function(a, b) {
  296. var ord = A2(f, a, b);
  297. return ord === $elm$core$Basics$EQ ? 0 : ord === $elm$core$Basics$LT ? -1 : 1;
  298. }));
  299. });
  300. var _JsArray_empty = [];
  301. function _JsArray_singleton(value)
  302. {
  303. return [value];
  304. }
  305. function _JsArray_length(array)
  306. {
  307. return array.length;
  308. }
  309. var _JsArray_initialize = F3(function(size, offset, func)
  310. {
  311. var result = new Array(size);
  312. for (var i = 0; i < size; i++)
  313. {
  314. result[i] = func(offset + i);
  315. }
  316. return result;
  317. });
  318. var _JsArray_initializeFromList = F2(function (max, ls)
  319. {
  320. var result = new Array(max);
  321. for (var i = 0; i < max && ls.b; i++)
  322. {
  323. result[i] = ls.a;
  324. ls = ls.b;
  325. }
  326. result.length = i;
  327. return _Utils_Tuple2(result, ls);
  328. });
  329. var _JsArray_unsafeGet = F2(function(index, array)
  330. {
  331. return array[index];
  332. });
  333. var _JsArray_unsafeSet = F3(function(index, value, array)
  334. {
  335. var length = array.length;
  336. var result = new Array(length);
  337. for (var i = 0; i < length; i++)
  338. {
  339. result[i] = array[i];
  340. }
  341. result[index] = value;
  342. return result;
  343. });
  344. var _JsArray_push = F2(function(value, array)
  345. {
  346. var length = array.length;
  347. var result = new Array(length + 1);
  348. for (var i = 0; i < length; i++)
  349. {
  350. result[i] = array[i];
  351. }
  352. result[length] = value;
  353. return result;
  354. });
  355. var _JsArray_foldl = F3(function(func, acc, array)
  356. {
  357. var length = array.length;
  358. for (var i = 0; i < length; i++)
  359. {
  360. acc = A2(func, array[i], acc);
  361. }
  362. return acc;
  363. });
  364. var _JsArray_foldr = F3(function(func, acc, array)
  365. {
  366. for (var i = array.length - 1; i >= 0; i--)
  367. {
  368. acc = A2(func, array[i], acc);
  369. }
  370. return acc;
  371. });
  372. var _JsArray_map = F2(function(func, array)
  373. {
  374. var length = array.length;
  375. var result = new Array(length);
  376. for (var i = 0; i < length; i++)
  377. {
  378. result[i] = func(array[i]);
  379. }
  380. return result;
  381. });
  382. var _JsArray_indexedMap = F3(function(func, offset, array)
  383. {
  384. var length = array.length;
  385. var result = new Array(length);
  386. for (var i = 0; i < length; i++)
  387. {
  388. result[i] = A2(func, offset + i, array[i]);
  389. }
  390. return result;
  391. });
  392. var _JsArray_slice = F3(function(from, to, array)
  393. {
  394. return array.slice(from, to);
  395. });
  396. var _JsArray_appendN = F3(function(n, dest, source)
  397. {
  398. var destLen = dest.length;
  399. var itemsToCopy = n - destLen;
  400. if (itemsToCopy > source.length)
  401. {
  402. itemsToCopy = source.length;
  403. }
  404. var size = destLen + itemsToCopy;
  405. var result = new Array(size);
  406. for (var i = 0; i < destLen; i++)
  407. {
  408. result[i] = dest[i];
  409. }
  410. for (var i = 0; i < itemsToCopy; i++)
  411. {
  412. result[i + destLen] = source[i];
  413. }
  414. return result;
  415. });
  416. // LOG
  417. var _Debug_log_UNUSED = F2(function(tag, value)
  418. {
  419. return value;
  420. });
  421. var _Debug_log = F2(function(tag, value)
  422. {
  423. console.log(tag + ': ' + _Debug_toString(value));
  424. return value;
  425. });
  426. // TODOS
  427. function _Debug_todo(moduleName, region)
  428. {
  429. return function(message) {
  430. _Debug_crash(8, moduleName, region, message);
  431. };
  432. }
  433. function _Debug_todoCase(moduleName, region, value)
  434. {
  435. return function(message) {
  436. _Debug_crash(9, moduleName, region, value, message);
  437. };
  438. }
  439. // TO STRING
  440. function _Debug_toString_UNUSED(value)
  441. {
  442. return '<internals>';
  443. }
  444. function _Debug_toString(value)
  445. {
  446. return _Debug_toAnsiString(false, value);
  447. }
  448. function _Debug_toAnsiString(ansi, value)
  449. {
  450. if (typeof value === 'function')
  451. {
  452. return _Debug_internalColor(ansi, '<function>');
  453. }
  454. if (typeof value === 'boolean')
  455. {
  456. return _Debug_ctorColor(ansi, value ? 'True' : 'False');
  457. }
  458. if (typeof value === 'number')
  459. {
  460. return _Debug_numberColor(ansi, value + '');
  461. }
  462. if (value instanceof String)
  463. {
  464. return _Debug_charColor(ansi, "'" + _Debug_addSlashes(value, true) + "'");
  465. }
  466. if (typeof value === 'string')
  467. {
  468. return _Debug_stringColor(ansi, '"' + _Debug_addSlashes(value, false) + '"');
  469. }
  470. if (typeof value === 'object' && '$' in value)
  471. {
  472. var tag = value.$;
  473. if (typeof tag === 'number')
  474. {
  475. return _Debug_internalColor(ansi, '<internals>');
  476. }
  477. if (tag[0] === '#')
  478. {
  479. var output = [];
  480. for (var k in value)
  481. {
  482. if (k === '$') continue;
  483. output.push(_Debug_toAnsiString(ansi, value[k]));
  484. }
  485. return '(' + output.join(',') + ')';
  486. }
  487. if (tag === 'Set_elm_builtin')
  488. {
  489. return _Debug_ctorColor(ansi, 'Set')
  490. + _Debug_fadeColor(ansi, '.fromList') + ' '
  491. + _Debug_toAnsiString(ansi, $elm$core$Set$toList(value));
  492. }
  493. if (tag === 'RBNode_elm_builtin' || tag === 'RBEmpty_elm_builtin')
  494. {
  495. return _Debug_ctorColor(ansi, 'Dict')
  496. + _Debug_fadeColor(ansi, '.fromList') + ' '
  497. + _Debug_toAnsiString(ansi, $elm$core$Dict$toList(value));
  498. }
  499. if (tag === 'Array_elm_builtin')
  500. {
  501. return _Debug_ctorColor(ansi, 'Array')
  502. + _Debug_fadeColor(ansi, '.fromList') + ' '
  503. + _Debug_toAnsiString(ansi, $elm$core$Array$toList(value));
  504. }
  505. if (tag === '::' || tag === '[]')
  506. {
  507. var output = '[';
  508. value.b && (output += _Debug_toAnsiString(ansi, value.a), value = value.b)
  509. for (; value.b; value = value.b) // WHILE_CONS
  510. {
  511. output += ',' + _Debug_toAnsiString(ansi, value.a);
  512. }
  513. return output + ']';
  514. }
  515. var output = '';
  516. for (var i in value)
  517. {
  518. if (i === '$') continue;
  519. var str = _Debug_toAnsiString(ansi, value[i]);
  520. var c0 = str[0];
  521. var parenless = c0 === '{' || c0 === '(' || c0 === '[' || c0 === '<' || c0 === '"' || str.indexOf(' ') < 0;
  522. output += ' ' + (parenless ? str : '(' + str + ')');
  523. }
  524. return _Debug_ctorColor(ansi, tag) + output;
  525. }
  526. if (typeof DataView === 'function' && value instanceof DataView)
  527. {
  528. return _Debug_stringColor(ansi, '<' + value.byteLength + ' bytes>');
  529. }
  530. if (typeof File !== 'undefined' && value instanceof File)
  531. {
  532. return _Debug_internalColor(ansi, '<' + value.name + '>');
  533. }
  534. if (typeof value === 'object')
  535. {
  536. var output = [];
  537. for (var key in value)
  538. {
  539. var field = key[0] === '_' ? key.slice(1) : key;
  540. output.push(_Debug_fadeColor(ansi, field) + ' = ' + _Debug_toAnsiString(ansi, value[key]));
  541. }
  542. if (output.length === 0)
  543. {
  544. return '{}';
  545. }
  546. return '{ ' + output.join(', ') + ' }';
  547. }
  548. return _Debug_internalColor(ansi, '<internals>');
  549. }
  550. function _Debug_addSlashes(str, isChar)
  551. {
  552. var s = str
  553. .replace(/\\/g, '\\\\')
  554. .replace(/\n/g, '\\n')
  555. .replace(/\t/g, '\\t')
  556. .replace(/\r/g, '\\r')
  557. .replace(/\v/g, '\\v')
  558. .replace(/\0/g, '\\0');
  559. if (isChar)
  560. {
  561. return s.replace(/\'/g, '\\\'');
  562. }
  563. else
  564. {
  565. return s.replace(/\"/g, '\\"');
  566. }
  567. }
  568. function _Debug_ctorColor(ansi, string)
  569. {
  570. return ansi ? '\x1b[96m' + string + '\x1b[0m' : string;
  571. }
  572. function _Debug_numberColor(ansi, string)
  573. {
  574. return ansi ? '\x1b[95m' + string + '\x1b[0m' : string;
  575. }
  576. function _Debug_stringColor(ansi, string)
  577. {
  578. return ansi ? '\x1b[93m' + string + '\x1b[0m' : string;
  579. }
  580. function _Debug_charColor(ansi, string)
  581. {
  582. return ansi ? '\x1b[92m' + string + '\x1b[0m' : string;
  583. }
  584. function _Debug_fadeColor(ansi, string)
  585. {
  586. return ansi ? '\x1b[37m' + string + '\x1b[0m' : string;
  587. }
  588. function _Debug_internalColor(ansi, string)
  589. {
  590. return ansi ? '\x1b[36m' + string + '\x1b[0m' : string;
  591. }
  592. function _Debug_toHexDigit(n)
  593. {
  594. return String.fromCharCode(n < 10 ? 48 + n : 55 + n);
  595. }
  596. // CRASH
  597. function _Debug_crash_UNUSED(identifier)
  598. {
  599. throw new Error('https://github.com/elm/core/blob/1.0.0/hints/' + identifier + '.md');
  600. }
  601. function _Debug_crash(identifier, fact1, fact2, fact3, fact4)
  602. {
  603. switch(identifier)
  604. {
  605. case 0:
  606. throw new Error('What node should I take over? In JavaScript I need something like:\n\n Elm.Main.init({\n node: document.getElementById("elm-node")\n })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');
  607. case 1:
  608. throw new Error('Browser.application programs cannot handle URLs like this:\n\n ' + document.location.href + '\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.');
  609. case 2:
  610. var jsonErrorString = fact1;
  611. throw new Error('Problem with the flags given to your Elm program on initialization.\n\n' + jsonErrorString);
  612. case 3:
  613. var portName = fact1;
  614. throw new Error('There can only be one port named `' + portName + '`, but your program has multiple.');
  615. case 4:
  616. var portName = fact1;
  617. var problem = fact2;
  618. throw new Error('Trying to send an unexpected type of value through port `' + portName + '`:\n' + problem);
  619. case 5:
  620. throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');
  621. case 6:
  622. var moduleName = fact1;
  623. throw new Error('Your page is loading multiple Elm scripts with a module named ' + moduleName + '. Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!');
  624. case 8:
  625. var moduleName = fact1;
  626. var region = fact2;
  627. var message = fact3;
  628. throw new Error('TODO in module `' + moduleName + '` ' + _Debug_regionToString(region) + '\n\n' + message);
  629. case 9:
  630. var moduleName = fact1;
  631. var region = fact2;
  632. var value = fact3;
  633. var message = fact4;
  634. throw new Error(
  635. 'TODO in module `' + moduleName + '` from the `case` expression '
  636. + _Debug_regionToString(region) + '\n\nIt received the following value:\n\n '
  637. + _Debug_toString(value).replace('\n', '\n ')
  638. + '\n\nBut the branch that handles it says:\n\n ' + message.replace('\n', '\n ')
  639. );
  640. case 10:
  641. throw new Error('Bug in https://github.com/elm/virtual-dom/issues');
  642. case 11:
  643. throw new Error('Cannot perform mod 0. Division by zero error.');
  644. }
  645. }
  646. function _Debug_regionToString(region)
  647. {
  648. if (region.start.line === region.end.line)
  649. {
  650. return 'on line ' + region.start.line;
  651. }
  652. return 'on lines ' + region.start.line + ' through ' + region.end.line;
  653. }
  654. // MATH
  655. var _Basics_add = F2(function(a, b) { return a + b; });
  656. var _Basics_sub = F2(function(a, b) { return a - b; });
  657. var _Basics_mul = F2(function(a, b) { return a * b; });
  658. var _Basics_fdiv = F2(function(a, b) { return a / b; });
  659. var _Basics_idiv = F2(function(a, b) { return (a / b) | 0; });
  660. var _Basics_pow = F2(Math.pow);
  661. var _Basics_remainderBy = F2(function(b, a) { return a % b; });
  662. // https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf
  663. var _Basics_modBy = F2(function(modulus, x)
  664. {
  665. var answer = x % modulus;
  666. return modulus === 0
  667. ? _Debug_crash(11)
  668. :
  669. ((answer > 0 && modulus < 0) || (answer < 0 && modulus > 0))
  670. ? answer + modulus
  671. : answer;
  672. });
  673. // TRIGONOMETRY
  674. var _Basics_pi = Math.PI;
  675. var _Basics_e = Math.E;
  676. var _Basics_cos = Math.cos;
  677. var _Basics_sin = Math.sin;
  678. var _Basics_tan = Math.tan;
  679. var _Basics_acos = Math.acos;
  680. var _Basics_asin = Math.asin;
  681. var _Basics_atan = Math.atan;
  682. var _Basics_atan2 = F2(Math.atan2);
  683. // MORE MATH
  684. function _Basics_toFloat(x) { return x; }
  685. function _Basics_truncate(n) { return n | 0; }
  686. function _Basics_isInfinite(n) { return n === Infinity || n === -Infinity; }
  687. var _Basics_ceiling = Math.ceil;
  688. var _Basics_floor = Math.floor;
  689. var _Basics_round = Math.round;
  690. var _Basics_sqrt = Math.sqrt;
  691. var _Basics_log = Math.log;
  692. var _Basics_isNaN = isNaN;
  693. // BOOLEANS
  694. function _Basics_not(bool) { return !bool; }
  695. var _Basics_and = F2(function(a, b) { return a && b; });
  696. var _Basics_or = F2(function(a, b) { return a || b; });
  697. var _Basics_xor = F2(function(a, b) { return a !== b; });
  698. var _String_cons = F2(function(chr, str)
  699. {
  700. return chr + str;
  701. });
  702. function _String_uncons(string)
  703. {
  704. var word = string.charCodeAt(0);
  705. return !isNaN(word)
  706. ? $elm$core$Maybe$Just(
  707. 0xD800 <= word && word <= 0xDBFF
  708. ? _Utils_Tuple2(_Utils_chr(string[0] + string[1]), string.slice(2))
  709. : _Utils_Tuple2(_Utils_chr(string[0]), string.slice(1))
  710. )
  711. : $elm$core$Maybe$Nothing;
  712. }
  713. var _String_append = F2(function(a, b)
  714. {
  715. return a + b;
  716. });
  717. function _String_length(str)
  718. {
  719. return str.length;
  720. }
  721. var _String_map = F2(function(func, string)
  722. {
  723. var len = string.length;
  724. var array = new Array(len);
  725. var i = 0;
  726. while (i < len)
  727. {
  728. var word = string.charCodeAt(i);
  729. if (0xD800 <= word && word <= 0xDBFF)
  730. {
  731. array[i] = func(_Utils_chr(string[i] + string[i+1]));
  732. i += 2;
  733. continue;
  734. }
  735. array[i] = func(_Utils_chr(string[i]));
  736. i++;
  737. }
  738. return array.join('');
  739. });
  740. var _String_filter = F2(function(isGood, str)
  741. {
  742. var arr = [];
  743. var len = str.length;
  744. var i = 0;
  745. while (i < len)
  746. {
  747. var char = str[i];
  748. var word = str.charCodeAt(i);
  749. i++;
  750. if (0xD800 <= word && word <= 0xDBFF)
  751. {
  752. char += str[i];
  753. i++;
  754. }
  755. if (isGood(_Utils_chr(char)))
  756. {
  757. arr.push(char);
  758. }
  759. }
  760. return arr.join('');
  761. });
  762. function _String_reverse(str)
  763. {
  764. var len = str.length;
  765. var arr = new Array(len);
  766. var i = 0;
  767. while (i < len)
  768. {
  769. var word = str.charCodeAt(i);
  770. if (0xD800 <= word && word <= 0xDBFF)
  771. {
  772. arr[len - i] = str[i + 1];
  773. i++;
  774. arr[len - i] = str[i - 1];
  775. i++;
  776. }
  777. else
  778. {
  779. arr[len - i] = str[i];
  780. i++;
  781. }
  782. }
  783. return arr.join('');
  784. }
  785. var _String_foldl = F3(function(func, state, string)
  786. {
  787. var len = string.length;
  788. var i = 0;
  789. while (i < len)
  790. {
  791. var char = string[i];
  792. var word = string.charCodeAt(i);
  793. i++;
  794. if (0xD800 <= word && word <= 0xDBFF)
  795. {
  796. char += string[i];
  797. i++;
  798. }
  799. state = A2(func, _Utils_chr(char), state);
  800. }
  801. return state;
  802. });
  803. var _String_foldr = F3(function(func, state, string)
  804. {
  805. var i = string.length;
  806. while (i--)
  807. {
  808. var char = string[i];
  809. var word = string.charCodeAt(i);
  810. if (0xDC00 <= word && word <= 0xDFFF)
  811. {
  812. i--;
  813. char = string[i] + char;
  814. }
  815. state = A2(func, _Utils_chr(char), state);
  816. }
  817. return state;
  818. });
  819. var _String_split = F2(function(sep, str)
  820. {
  821. return str.split(sep);
  822. });
  823. var _String_join = F2(function(sep, strs)
  824. {
  825. return strs.join(sep);
  826. });
  827. var _String_slice = F3(function(start, end, str) {
  828. return str.slice(start, end);
  829. });
  830. function _String_trim(str)
  831. {
  832. return str.trim();
  833. }
  834. function _String_trimLeft(str)
  835. {
  836. return str.replace(/^\s+/, '');
  837. }
  838. function _String_trimRight(str)
  839. {
  840. return str.replace(/\s+$/, '');
  841. }
  842. function _String_words(str)
  843. {
  844. return _List_fromArray(str.trim().split(/\s+/g));
  845. }
  846. function _String_lines(str)
  847. {
  848. return _List_fromArray(str.split(/\r\n|\r|\n/g));
  849. }
  850. function _String_toUpper(str)
  851. {
  852. return str.toUpperCase();
  853. }
  854. function _String_toLower(str)
  855. {
  856. return str.toLowerCase();
  857. }
  858. var _String_any = F2(function(isGood, string)
  859. {
  860. var i = string.length;
  861. while (i--)
  862. {
  863. var char = string[i];
  864. var word = string.charCodeAt(i);
  865. if (0xDC00 <= word && word <= 0xDFFF)
  866. {
  867. i--;
  868. char = string[i] + char;
  869. }
  870. if (isGood(_Utils_chr(char)))
  871. {
  872. return true;
  873. }
  874. }
  875. return false;
  876. });
  877. var _String_all = F2(function(isGood, string)
  878. {
  879. var i = string.length;
  880. while (i--)
  881. {
  882. var char = string[i];
  883. var word = string.charCodeAt(i);
  884. if (0xDC00 <= word && word <= 0xDFFF)
  885. {
  886. i--;
  887. char = string[i] + char;
  888. }
  889. if (!isGood(_Utils_chr(char)))
  890. {
  891. return false;
  892. }
  893. }
  894. return true;
  895. });
  896. var _String_contains = F2(function(sub, str)
  897. {
  898. return str.indexOf(sub) > -1;
  899. });
  900. var _String_startsWith = F2(function(sub, str)
  901. {
  902. return str.indexOf(sub) === 0;
  903. });
  904. var _String_endsWith = F2(function(sub, str)
  905. {
  906. return str.length >= sub.length &&
  907. str.lastIndexOf(sub) === str.length - sub.length;
  908. });
  909. var _String_indexes = F2(function(sub, str)
  910. {
  911. var subLen = sub.length;
  912. if (subLen < 1)
  913. {
  914. return _List_Nil;
  915. }
  916. var i = 0;
  917. var is = [];
  918. while ((i = str.indexOf(sub, i)) > -1)
  919. {
  920. is.push(i);
  921. i = i + subLen;
  922. }
  923. return _List_fromArray(is);
  924. });
  925. // TO STRING
  926. function _String_fromNumber(number)
  927. {
  928. return number + '';
  929. }
  930. // INT CONVERSIONS
  931. function _String_toInt(str)
  932. {
  933. var total = 0;
  934. var code0 = str.charCodeAt(0);
  935. var start = code0 == 0x2B /* + */ || code0 == 0x2D /* - */ ? 1 : 0;
  936. for (var i = start; i < str.length; ++i)
  937. {
  938. var code = str.charCodeAt(i);
  939. if (code < 0x30 || 0x39 < code)
  940. {
  941. return $elm$core$Maybe$Nothing;
  942. }
  943. total = 10 * total + code - 0x30;
  944. }
  945. return i == start
  946. ? $elm$core$Maybe$Nothing
  947. : $elm$core$Maybe$Just(code0 == 0x2D ? -total : total);
  948. }
  949. // FLOAT CONVERSIONS
  950. function _String_toFloat(s)
  951. {
  952. // check if it is a hex, octal, or binary number
  953. if (s.length === 0 || /[\sxbo]/.test(s))
  954. {
  955. return $elm$core$Maybe$Nothing;
  956. }
  957. var n = +s;
  958. // faster isNaN check
  959. return n === n ? $elm$core$Maybe$Just(n) : $elm$core$Maybe$Nothing;
  960. }
  961. function _String_fromList(chars)
  962. {
  963. return _List_toArray(chars).join('');
  964. }
  965. function _Char_toCode(char)
  966. {
  967. var code = char.charCodeAt(0);
  968. if (0xD800 <= code && code <= 0xDBFF)
  969. {
  970. return (code - 0xD800) * 0x400 + char.charCodeAt(1) - 0xDC00 + 0x10000
  971. }
  972. return code;
  973. }
  974. function _Char_fromCode(code)
  975. {
  976. return _Utils_chr(
  977. (code < 0 || 0x10FFFF < code)
  978. ? '\uFFFD'
  979. :
  980. (code <= 0xFFFF)
  981. ? String.fromCharCode(code)
  982. :
  983. (code -= 0x10000,
  984. String.fromCharCode(Math.floor(code / 0x400) + 0xD800, code % 0x400 + 0xDC00)
  985. )
  986. );
  987. }
  988. function _Char_toUpper(char)
  989. {
  990. return _Utils_chr(char.toUpperCase());
  991. }
  992. function _Char_toLower(char)
  993. {
  994. return _Utils_chr(char.toLowerCase());
  995. }
  996. function _Char_toLocaleUpper(char)
  997. {
  998. return _Utils_chr(char.toLocaleUpperCase());
  999. }
  1000. function _Char_toLocaleLower(char)
  1001. {
  1002. return _Utils_chr(char.toLocaleLowerCase());
  1003. }
  1004. /**/
  1005. function _Json_errorToString(error)
  1006. {
  1007. return $elm$json$Json$Decode$errorToString(error);
  1008. }
  1009. //*/
  1010. // CORE DECODERS
  1011. function _Json_succeed(msg)
  1012. {
  1013. return {
  1014. $: 0,
  1015. a: msg
  1016. };
  1017. }
  1018. function _Json_fail(msg)
  1019. {
  1020. return {
  1021. $: 1,
  1022. a: msg
  1023. };
  1024. }
  1025. function _Json_decodePrim(decoder)
  1026. {
  1027. return { $: 2, b: decoder };
  1028. }
  1029. var _Json_decodeInt = _Json_decodePrim(function(value) {
  1030. return (typeof value !== 'number')
  1031. ? _Json_expecting('an INT', value)
  1032. :
  1033. (-2147483647 < value && value < 2147483647 && (value | 0) === value)
  1034. ? $elm$core$Result$Ok(value)
  1035. :
  1036. (isFinite(value) && !(value % 1))
  1037. ? $elm$core$Result$Ok(value)
  1038. : _Json_expecting('an INT', value);
  1039. });
  1040. var _Json_decodeBool = _Json_decodePrim(function(value) {
  1041. return (typeof value === 'boolean')
  1042. ? $elm$core$Result$Ok(value)
  1043. : _Json_expecting('a BOOL', value);
  1044. });
  1045. var _Json_decodeFloat = _Json_decodePrim(function(value) {
  1046. return (typeof value === 'number')
  1047. ? $elm$core$Result$Ok(value)
  1048. : _Json_expecting('a FLOAT', value);
  1049. });
  1050. var _Json_decodeValue = _Json_decodePrim(function(value) {
  1051. return $elm$core$Result$Ok(_Json_wrap(value));
  1052. });
  1053. var _Json_decodeString = _Json_decodePrim(function(value) {
  1054. return (typeof value === 'string')
  1055. ? $elm$core$Result$Ok(value)
  1056. : (value instanceof String)
  1057. ? $elm$core$Result$Ok(value + '')
  1058. : _Json_expecting('a STRING', value);
  1059. });
  1060. function _Json_decodeList(decoder) { return { $: 3, b: decoder }; }
  1061. function _Json_decodeArray(decoder) { return { $: 4, b: decoder }; }
  1062. function _Json_decodeNull(value) { return { $: 5, c: value }; }
  1063. var _Json_decodeField = F2(function(field, decoder)
  1064. {
  1065. return {
  1066. $: 6,
  1067. d: field,
  1068. b: decoder
  1069. };
  1070. });
  1071. var _Json_decodeIndex = F2(function(index, decoder)
  1072. {
  1073. return {
  1074. $: 7,
  1075. e: index,
  1076. b: decoder
  1077. };
  1078. });
  1079. function _Json_decodeKeyValuePairs(decoder)
  1080. {
  1081. return {
  1082. $: 8,
  1083. b: decoder
  1084. };
  1085. }
  1086. function _Json_mapMany(f, decoders)
  1087. {
  1088. return {
  1089. $: 9,
  1090. f: f,
  1091. g: decoders
  1092. };
  1093. }
  1094. var _Json_andThen = F2(function(callback, decoder)
  1095. {
  1096. return {
  1097. $: 10,
  1098. b: decoder,
  1099. h: callback
  1100. };
  1101. });
  1102. function _Json_oneOf(decoders)
  1103. {
  1104. return {
  1105. $: 11,
  1106. g: decoders
  1107. };
  1108. }
  1109. // DECODING OBJECTS
  1110. var _Json_map1 = F2(function(f, d1)
  1111. {
  1112. return _Json_mapMany(f, [d1]);
  1113. });
  1114. var _Json_map2 = F3(function(f, d1, d2)
  1115. {
  1116. return _Json_mapMany(f, [d1, d2]);
  1117. });
  1118. var _Json_map3 = F4(function(f, d1, d2, d3)
  1119. {
  1120. return _Json_mapMany(f, [d1, d2, d3]);
  1121. });
  1122. var _Json_map4 = F5(function(f, d1, d2, d3, d4)
  1123. {
  1124. return _Json_mapMany(f, [d1, d2, d3, d4]);
  1125. });
  1126. var _Json_map5 = F6(function(f, d1, d2, d3, d4, d5)
  1127. {
  1128. return _Json_mapMany(f, [d1, d2, d3, d4, d5]);
  1129. });
  1130. var _Json_map6 = F7(function(f, d1, d2, d3, d4, d5, d6)
  1131. {
  1132. return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6]);
  1133. });
  1134. var _Json_map7 = F8(function(f, d1, d2, d3, d4, d5, d6, d7)
  1135. {
  1136. return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6, d7]);
  1137. });
  1138. var _Json_map8 = F9(function(f, d1, d2, d3, d4, d5, d6, d7, d8)
  1139. {
  1140. return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6, d7, d8]);
  1141. });
  1142. // DECODE
  1143. var _Json_runOnString = F2(function(decoder, string)
  1144. {
  1145. try
  1146. {
  1147. var value = JSON.parse(string);
  1148. return _Json_runHelp(decoder, value);
  1149. }
  1150. catch (e)
  1151. {
  1152. return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, 'This is not valid JSON! ' + e.message, _Json_wrap(string)));
  1153. }
  1154. });
  1155. var _Json_run = F2(function(decoder, value)
  1156. {
  1157. return _Json_runHelp(decoder, _Json_unwrap(value));
  1158. });
  1159. function _Json_runHelp(decoder, value)
  1160. {
  1161. switch (decoder.$)
  1162. {
  1163. case 2:
  1164. return decoder.b(value);
  1165. case 5:
  1166. return (value === null)
  1167. ? $elm$core$Result$Ok(decoder.c)
  1168. : _Json_expecting('null', value);
  1169. case 3:
  1170. if (!_Json_isArray(value))
  1171. {
  1172. return _Json_expecting('a LIST', value);
  1173. }
  1174. return _Json_runArrayDecoder(decoder.b, value, _List_fromArray);
  1175. case 4:
  1176. if (!_Json_isArray(value))
  1177. {
  1178. return _Json_expecting('an ARRAY', value);
  1179. }
  1180. return _Json_runArrayDecoder(decoder.b, value, _Json_toElmArray);
  1181. case 6:
  1182. var field = decoder.d;
  1183. if (typeof value !== 'object' || value === null || !(field in value))
  1184. {
  1185. return _Json_expecting('an OBJECT with a field named `' + field + '`', value);
  1186. }
  1187. var result = _Json_runHelp(decoder.b, value[field]);
  1188. return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, field, result.a));
  1189. case 7:
  1190. var index = decoder.e;
  1191. if (!_Json_isArray(value))
  1192. {
  1193. return _Json_expecting('an ARRAY', value);
  1194. }
  1195. if (index >= value.length)
  1196. {
  1197. return _Json_expecting('a LONGER array. Need index ' + index + ' but only see ' + value.length + ' entries', value);
  1198. }
  1199. var result = _Json_runHelp(decoder.b, value[index]);
  1200. return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, index, result.a));
  1201. case 8:
  1202. if (typeof value !== 'object' || value === null || _Json_isArray(value))
  1203. {
  1204. return _Json_expecting('an OBJECT', value);
  1205. }
  1206. var keyValuePairs = _List_Nil;
  1207. // TODO test perf of Object.keys and switch when support is good enough
  1208. for (var key in value)
  1209. {
  1210. if (value.hasOwnProperty(key))
  1211. {
  1212. var result = _Json_runHelp(decoder.b, value[key]);
  1213. if (!$elm$core$Result$isOk(result))
  1214. {
  1215. return $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, key, result.a));
  1216. }
  1217. keyValuePairs = _List_Cons(_Utils_Tuple2(key, result.a), keyValuePairs);
  1218. }
  1219. }
  1220. return $elm$core$Result$Ok($elm$core$List$reverse(keyValuePairs));
  1221. case 9:
  1222. var answer = decoder.f;
  1223. var decoders = decoder.g;
  1224. for (var i = 0; i < decoders.length; i++)
  1225. {
  1226. var result = _Json_runHelp(decoders[i], value);
  1227. if (!$elm$core$Result$isOk(result))
  1228. {
  1229. return result;
  1230. }
  1231. answer = answer(result.a);
  1232. }
  1233. return $elm$core$Result$Ok(answer);
  1234. case 10:
  1235. var result = _Json_runHelp(decoder.b, value);
  1236. return (!$elm$core$Result$isOk(result))
  1237. ? result
  1238. : _Json_runHelp(decoder.h(result.a), value);
  1239. case 11:
  1240. var errors = _List_Nil;
  1241. for (var temp = decoder.g; temp.b; temp = temp.b) // WHILE_CONS
  1242. {
  1243. var result = _Json_runHelp(temp.a, value);
  1244. if ($elm$core$Result$isOk(result))
  1245. {
  1246. return result;
  1247. }
  1248. errors = _List_Cons(result.a, errors);
  1249. }
  1250. return $elm$core$Result$Err($elm$json$Json$Decode$OneOf($elm$core$List$reverse(errors)));
  1251. case 1:
  1252. return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, decoder.a, _Json_wrap(value)));
  1253. case 0:
  1254. return $elm$core$Result$Ok(decoder.a);
  1255. }
  1256. }
  1257. function _Json_runArrayDecoder(decoder, value, toElmValue)
  1258. {
  1259. var len = value.length;
  1260. var array = new Array(len);
  1261. for (var i = 0; i < len; i++)
  1262. {
  1263. var result = _Json_runHelp(decoder, value[i]);
  1264. if (!$elm$core$Result$isOk(result))
  1265. {
  1266. return $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, i, result.a));
  1267. }
  1268. array[i] = result.a;
  1269. }
  1270. return $elm$core$Result$Ok(toElmValue(array));
  1271. }
  1272. function _Json_isArray(value)
  1273. {
  1274. return Array.isArray(value) || (typeof FileList !== 'undefined' && value instanceof FileList);
  1275. }
  1276. function _Json_toElmArray(array)
  1277. {
  1278. return A2($elm$core$Array$initialize, array.length, function(i) { return array[i]; });
  1279. }
  1280. function _Json_expecting(type, value)
  1281. {
  1282. return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, 'Expecting ' + type, _Json_wrap(value)));
  1283. }
  1284. // EQUALITY
  1285. function _Json_equality(x, y)
  1286. {
  1287. if (x === y)
  1288. {
  1289. return true;
  1290. }
  1291. if (x.$ !== y.$)
  1292. {
  1293. return false;
  1294. }
  1295. switch (x.$)
  1296. {
  1297. case 0:
  1298. case 1:
  1299. return x.a === y.a;
  1300. case 2:
  1301. return x.b === y.b;
  1302. case 5:
  1303. return x.c === y.c;
  1304. case 3:
  1305. case 4:
  1306. case 8:
  1307. return _Json_equality(x.b, y.b);
  1308. case 6:
  1309. return x.d === y.d && _Json_equality(x.b, y.b);
  1310. case 7:
  1311. return x.e === y.e && _Json_equality(x.b, y.b);
  1312. case 9:
  1313. return x.f === y.f && _Json_listEquality(x.g, y.g);
  1314. case 10:
  1315. return x.h === y.h && _Json_equality(x.b, y.b);
  1316. case 11:
  1317. return _Json_listEquality(x.g, y.g);
  1318. }
  1319. }
  1320. function _Json_listEquality(aDecoders, bDecoders)
  1321. {
  1322. var len = aDecoders.length;
  1323. if (len !== bDecoders.length)
  1324. {
  1325. return false;
  1326. }
  1327. for (var i = 0; i < len; i++)
  1328. {
  1329. if (!_Json_equality(aDecoders[i], bDecoders[i]))
  1330. {
  1331. return false;
  1332. }
  1333. }
  1334. return true;
  1335. }
  1336. // ENCODE
  1337. var _Json_encode = F2(function(indentLevel, value)
  1338. {
  1339. return JSON.stringify(_Json_unwrap(value), null, indentLevel) + '';
  1340. });
  1341. function _Json_wrap(value) { return { $: 0, a: value }; }
  1342. function _Json_unwrap(value) { return value.a; }
  1343. function _Json_wrap_UNUSED(value) { return value; }
  1344. function _Json_unwrap_UNUSED(value) { return value; }
  1345. function _Json_emptyArray() { return []; }
  1346. function _Json_emptyObject() { return {}; }
  1347. var _Json_addField = F3(function(key, value, object)
  1348. {
  1349. object[key] = _Json_unwrap(value);
  1350. return object;
  1351. });
  1352. function _Json_addEntry(func)
  1353. {
  1354. return F2(function(entry, array)
  1355. {
  1356. array.push(_Json_unwrap(func(entry)));
  1357. return array;
  1358. });
  1359. }
  1360. var _Json_encodeNull = _Json_wrap(null);
  1361. // TASKS
  1362. function _Scheduler_succeed(value)
  1363. {
  1364. return {
  1365. $: 0,
  1366. a: value
  1367. };
  1368. }
  1369. function _Scheduler_fail(error)
  1370. {
  1371. return {
  1372. $: 1,
  1373. a: error
  1374. };
  1375. }
  1376. function _Scheduler_binding(callback)
  1377. {
  1378. return {
  1379. $: 2,
  1380. b: callback,
  1381. c: null
  1382. };
  1383. }
  1384. var _Scheduler_andThen = F2(function(callback, task)
  1385. {
  1386. return {
  1387. $: 3,
  1388. b: callback,
  1389. d: task
  1390. };
  1391. });
  1392. var _Scheduler_onError = F2(function(callback, task)
  1393. {
  1394. return {
  1395. $: 4,
  1396. b: callback,
  1397. d: task
  1398. };
  1399. });
  1400. function _Scheduler_receive(callback)
  1401. {
  1402. return {
  1403. $: 5,
  1404. b: callback
  1405. };
  1406. }
  1407. // PROCESSES
  1408. var _Scheduler_guid = 0;
  1409. function _Scheduler_rawSpawn(task)
  1410. {
  1411. var proc = {
  1412. $: 0,
  1413. e: _Scheduler_guid++,
  1414. f: task,
  1415. g: null,
  1416. h: []
  1417. };
  1418. _Scheduler_enqueue(proc);
  1419. return proc;
  1420. }
  1421. function _Scheduler_spawn(task)
  1422. {
  1423. return _Scheduler_binding(function(callback) {
  1424. callback(_Scheduler_succeed(_Scheduler_rawSpawn(task)));
  1425. });
  1426. }
  1427. function _Scheduler_rawSend(proc, msg)
  1428. {
  1429. proc.h.push(msg);
  1430. _Scheduler_enqueue(proc);
  1431. }
  1432. var _Scheduler_send = F2(function(proc, msg)
  1433. {
  1434. return _Scheduler_binding(function(callback) {
  1435. _Scheduler_rawSend(proc, msg);
  1436. callback(_Scheduler_succeed(_Utils_Tuple0));
  1437. });
  1438. });
  1439. function _Scheduler_kill(proc)
  1440. {
  1441. return _Scheduler_binding(function(callback) {
  1442. var task = proc.f;
  1443. if (task.$ === 2 && task.c)
  1444. {
  1445. task.c();
  1446. }
  1447. proc.f = null;
  1448. callback(_Scheduler_succeed(_Utils_Tuple0));
  1449. });
  1450. }
  1451. /* STEP PROCESSES
  1452. type alias Process =
  1453. { $ : tag
  1454. , id : unique_id
  1455. , root : Task
  1456. , stack : null | { $: SUCCEED | FAIL, a: callback, b: stack }
  1457. , mailbox : [msg]
  1458. }
  1459. */
  1460. var _Scheduler_working = false;
  1461. var _Scheduler_queue = [];
  1462. function _Scheduler_enqueue(proc)
  1463. {
  1464. _Scheduler_queue.push(proc);
  1465. if (_Scheduler_working)
  1466. {
  1467. return;
  1468. }
  1469. _Scheduler_working = true;
  1470. while (proc = _Scheduler_queue.shift())
  1471. {
  1472. _Scheduler_step(proc);
  1473. }
  1474. _Scheduler_working = false;
  1475. }
  1476. function _Scheduler_step(proc)
  1477. {
  1478. while (proc.f)
  1479. {
  1480. var rootTag = proc.f.$;
  1481. if (rootTag === 0 || rootTag === 1)
  1482. {
  1483. while (proc.g && proc.g.$ !== rootTag)
  1484. {
  1485. proc.g = proc.g.i;
  1486. }
  1487. if (!proc.g)
  1488. {
  1489. return;
  1490. }
  1491. proc.f = proc.g.b(proc.f.a);
  1492. proc.g = proc.g.i;
  1493. }
  1494. else if (rootTag === 2)
  1495. {
  1496. proc.f.c = proc.f.b(function(newRoot) {
  1497. proc.f = newRoot;
  1498. _Scheduler_enqueue(proc);
  1499. });
  1500. return;
  1501. }
  1502. else if (rootTag === 5)
  1503. {
  1504. if (proc.h.length === 0)
  1505. {
  1506. return;
  1507. }
  1508. proc.f = proc.f.b(proc.h.shift());
  1509. }
  1510. else // if (rootTag === 3 || rootTag === 4)
  1511. {
  1512. proc.g = {
  1513. $: rootTag === 3 ? 0 : 1,
  1514. b: proc.f.b,
  1515. i: proc.g
  1516. };
  1517. proc.f = proc.f.d;
  1518. }
  1519. }
  1520. }
  1521. function _Process_sleep(time)
  1522. {
  1523. return _Scheduler_binding(function(callback) {
  1524. var id = setTimeout(function() {
  1525. callback(_Scheduler_succeed(_Utils_Tuple0));
  1526. }, time);
  1527. return function() { clearTimeout(id); };
  1528. });
  1529. }
  1530. // PROGRAMS
  1531. var _Platform_worker = F4(function(impl, flagDecoder, debugMetadata, args)
  1532. {
  1533. return _Platform_initialize(
  1534. flagDecoder,
  1535. args,
  1536. impl.init,
  1537. impl.update,
  1538. impl.subscriptions,
  1539. function() { return function() {} }
  1540. );
  1541. });
  1542. // INITIALIZE A PROGRAM
  1543. function _Platform_initialize(flagDecoder, args, init, update, subscriptions, stepperBuilder)
  1544. {
  1545. var result = A2(_Json_run, flagDecoder, _Json_wrap(args ? args['flags'] : undefined));
  1546. $elm$core$Result$isOk(result) || _Debug_crash(2 /**/, _Json_errorToString(result.a) /**/);
  1547. var managers = {};
  1548. result = init(result.a);
  1549. var model = result.a;
  1550. var stepper = stepperBuilder(sendToApp, model);
  1551. var ports = _Platform_setupEffects(managers, sendToApp);
  1552. function sendToApp(msg, viewMetadata)
  1553. {
  1554. result = A2(update, msg, model);
  1555. stepper(model = result.a, viewMetadata);
  1556. _Platform_enqueueEffects(managers, result.b, subscriptions(model));
  1557. }
  1558. _Platform_enqueueEffects(managers, result.b, subscriptions(model));
  1559. return ports ? { ports: ports } : {};
  1560. }
  1561. // TRACK PRELOADS
  1562. //
  1563. // This is used by code in elm/browser and elm/http
  1564. // to register any HTTP requests that are triggered by init.
  1565. //
  1566. var _Platform_preload;
  1567. function _Platform_registerPreload(url)
  1568. {
  1569. _Platform_preload.add(url);
  1570. }
  1571. // EFFECT MANAGERS
  1572. var _Platform_effectManagers = {};
  1573. function _Platform_setupEffects(managers, sendToApp)
  1574. {
  1575. var ports;
  1576. // setup all necessary effect managers
  1577. for (var key in _Platform_effectManagers)
  1578. {
  1579. var manager = _Platform_effectManagers[key];
  1580. if (manager.a)
  1581. {
  1582. ports = ports || {};
  1583. ports[key] = manager.a(key, sendToApp);
  1584. }
  1585. managers[key] = _Platform_instantiateManager(manager, sendToApp);
  1586. }
  1587. return ports;
  1588. }
  1589. function _Platform_createManager(init, onEffects, onSelfMsg, cmdMap, subMap)
  1590. {
  1591. return {
  1592. b: init,
  1593. c: onEffects,
  1594. d: onSelfMsg,
  1595. e: cmdMap,
  1596. f: subMap
  1597. };
  1598. }
  1599. function _Platform_instantiateManager(info, sendToApp)
  1600. {
  1601. var router = {
  1602. g: sendToApp,
  1603. h: undefined
  1604. };
  1605. var onEffects = info.c;
  1606. var onSelfMsg = info.d;
  1607. var cmdMap = info.e;
  1608. var subMap = info.f;
  1609. function loop(state)
  1610. {
  1611. return A2(_Scheduler_andThen, loop, _Scheduler_receive(function(msg)
  1612. {
  1613. var value = msg.a;
  1614. if (msg.$ === 0)
  1615. {
  1616. return A3(onSelfMsg, router, value, state);
  1617. }
  1618. return cmdMap && subMap
  1619. ? A4(onEffects, router, value.i, value.j, state)
  1620. : A3(onEffects, router, cmdMap ? value.i : value.j, state);
  1621. }));
  1622. }
  1623. return router.h = _Scheduler_rawSpawn(A2(_Scheduler_andThen, loop, info.b));
  1624. }
  1625. // ROUTING
  1626. var _Platform_sendToApp = F2(function(router, msg)
  1627. {
  1628. return _Scheduler_binding(function(callback)
  1629. {
  1630. router.g(msg);
  1631. callback(_Scheduler_succeed(_Utils_Tuple0));
  1632. });
  1633. });
  1634. var _Platform_sendToSelf = F2(function(router, msg)
  1635. {
  1636. return A2(_Scheduler_send, router.h, {
  1637. $: 0,
  1638. a: msg
  1639. });
  1640. });
  1641. // BAGS
  1642. function _Platform_leaf(home)
  1643. {
  1644. return function(value)
  1645. {
  1646. return {
  1647. $: 1,
  1648. k: home,
  1649. l: value
  1650. };
  1651. };
  1652. }
  1653. function _Platform_batch(list)
  1654. {
  1655. return {
  1656. $: 2,
  1657. m: list
  1658. };
  1659. }
  1660. var _Platform_map = F2(function(tagger, bag)
  1661. {
  1662. return {
  1663. $: 3,
  1664. n: tagger,
  1665. o: bag
  1666. }
  1667. });
  1668. // PIPE BAGS INTO EFFECT MANAGERS
  1669. //
  1670. // Effects must be queued!
  1671. //
  1672. // Say your init contains a synchronous command, like Time.now or Time.here
  1673. //
  1674. // - This will produce a batch of effects (FX_1)
  1675. // - The synchronous task triggers the subsequent `update` call
  1676. // - This will produce a batch of effects (FX_2)
  1677. //
  1678. // If we just start dispatching FX_2, subscriptions from FX_2 can be processed
  1679. // before subscriptions from FX_1. No good! Earlier versions of this code had
  1680. // this problem, leading to these reports:
  1681. //
  1682. // https://github.com/elm/core/issues/980
  1683. // https://github.com/elm/core/pull/981
  1684. // https://github.com/elm/compiler/issues/1776
  1685. //
  1686. // The queue is necessary to avoid ordering issues for synchronous commands.
  1687. // Why use true/false here? Why not just check the length of the queue?
  1688. // The goal is to detect "are we currently dispatching effects?" If we
  1689. // are, we need to bail and let the ongoing while loop handle things.
  1690. //
  1691. // Now say the queue has 1 element. When we dequeue the final element,
  1692. // the queue will be empty, but we are still actively dispatching effects.
  1693. // So you could get queue jumping in a really tricky category of cases.
  1694. //
  1695. var _Platform_effectsQueue = [];
  1696. var _Platform_effectsActive = false;
  1697. function _Platform_enqueueEffects(managers, cmdBag, subBag)
  1698. {
  1699. _Platform_effectsQueue.push({ p: managers, q: cmdBag, r: subBag });
  1700. if (_Platform_effectsActive) return;
  1701. _Platform_effectsActive = true;
  1702. for (var fx; fx = _Platform_effectsQueue.shift(); )
  1703. {
  1704. _Platform_dispatchEffects(fx.p, fx.q, fx.r);
  1705. }
  1706. _Platform_effectsActive = false;
  1707. }
  1708. function _Platform_dispatchEffects(managers, cmdBag, subBag)
  1709. {
  1710. var effectsDict = {};
  1711. _Platform_gatherEffects(true, cmdBag, effectsDict, null);
  1712. _Platform_gatherEffects(false, subBag, effectsDict, null);
  1713. for (var home in managers)
  1714. {
  1715. _Scheduler_rawSend(managers[home], {
  1716. $: 'fx',
  1717. a: effectsDict[home] || { i: _List_Nil, j: _List_Nil }
  1718. });
  1719. }
  1720. }
  1721. function _Platform_gatherEffects(isCmd, bag, effectsDict, taggers)
  1722. {
  1723. switch (bag.$)
  1724. {
  1725. case 1:
  1726. var home = bag.k;
  1727. var effect = _Platform_toEffect(isCmd, home, taggers, bag.l);
  1728. effectsDict[home] = _Platform_insert(isCmd, effect, effectsDict[home]);
  1729. return;
  1730. case 2:
  1731. for (var list = bag.m; list.b; list = list.b) // WHILE_CONS
  1732. {
  1733. _Platform_gatherEffects(isCmd, list.a, effectsDict, taggers);
  1734. }
  1735. return;
  1736. case 3:
  1737. _Platform_gatherEffects(isCmd, bag.o, effectsDict, {
  1738. s: bag.n,
  1739. t: taggers
  1740. });
  1741. return;
  1742. }
  1743. }
  1744. function _Platform_toEffect(isCmd, home, taggers, value)
  1745. {
  1746. function applyTaggers(x)
  1747. {
  1748. for (var temp = taggers; temp; temp = temp.t)
  1749. {
  1750. x = temp.s(x);
  1751. }
  1752. return x;
  1753. }
  1754. var map = isCmd
  1755. ? _Platform_effectManagers[home].e
  1756. : _Platform_effectManagers[home].f;
  1757. return A2(map, applyTaggers, value)
  1758. }
  1759. function _Platform_insert(isCmd, newEffect, effects)
  1760. {
  1761. effects = effects || { i: _List_Nil, j: _List_Nil };
  1762. isCmd
  1763. ? (effects.i = _List_Cons(newEffect, effects.i))
  1764. : (effects.j = _List_Cons(newEffect, effects.j));
  1765. return effects;
  1766. }
  1767. // PORTS
  1768. function _Platform_checkPortName(name)
  1769. {
  1770. if (_Platform_effectManagers[name])
  1771. {
  1772. _Debug_crash(3, name)
  1773. }
  1774. }
  1775. // OUTGOING PORTS
  1776. function _Platform_outgoingPort(name, converter)
  1777. {
  1778. _Platform_checkPortName(name);
  1779. _Platform_effectManagers[name] = {
  1780. e: _Platform_outgoingPortMap,
  1781. u: converter,
  1782. a: _Platform_setupOutgoingPort
  1783. };
  1784. return _Platform_leaf(name);
  1785. }
  1786. var _Platform_outgoingPortMap = F2(function(tagger, value) { return value; });
  1787. function _Platform_setupOutgoingPort(name)
  1788. {
  1789. var subs = [];
  1790. var converter = _Platform_effectManagers[name].u;
  1791. // CREATE MANAGER
  1792. var init = _Process_sleep(0);
  1793. _Platform_effectManagers[name].b = init;
  1794. _Platform_effectManagers[name].c = F3(function(router, cmdList, state)
  1795. {
  1796. for ( ; cmdList.b; cmdList = cmdList.b) // WHILE_CONS
  1797. {
  1798. // grab a separate reference to subs in case unsubscribe is called
  1799. var currentSubs = subs;
  1800. var value = _Json_unwrap(converter(cmdList.a));
  1801. for (var i = 0; i < currentSubs.length; i++)
  1802. {
  1803. currentSubs[i](value);
  1804. }
  1805. }
  1806. return init;
  1807. });
  1808. // PUBLIC API
  1809. function subscribe(callback)
  1810. {
  1811. subs.push(callback);
  1812. }
  1813. function unsubscribe(callback)
  1814. {
  1815. // copy subs into a new array in case unsubscribe is called within a
  1816. // subscribed callback
  1817. subs = subs.slice();
  1818. var index = subs.indexOf(callback);
  1819. if (index >= 0)
  1820. {
  1821. subs.splice(index, 1);
  1822. }
  1823. }
  1824. return {
  1825. subscribe: subscribe,
  1826. unsubscribe: unsubscribe
  1827. };
  1828. }
  1829. // INCOMING PORTS
  1830. function _Platform_incomingPort(name, converter)
  1831. {
  1832. _Platform_checkPortName(name);
  1833. _Platform_effectManagers[name] = {
  1834. f: _Platform_incomingPortMap,
  1835. u: converter,
  1836. a: _Platform_setupIncomingPort
  1837. };
  1838. return _Platform_leaf(name);
  1839. }
  1840. var _Platform_incomingPortMap = F2(function(tagger, finalTagger)
  1841. {
  1842. return function(value)
  1843. {
  1844. return tagger(finalTagger(value));
  1845. };
  1846. });
  1847. function _Platform_setupIncomingPort(name, sendToApp)
  1848. {
  1849. var subs = _List_Nil;
  1850. var converter = _Platform_effectManagers[name].u;
  1851. // CREATE MANAGER
  1852. var init = _Scheduler_succeed(null);
  1853. _Platform_effectManagers[name].b = init;
  1854. _Platform_effectManagers[name].c = F3(function(router, subList, state)
  1855. {
  1856. subs = subList;
  1857. return init;
  1858. });
  1859. // PUBLIC API
  1860. function send(incomingValue)
  1861. {
  1862. var result = A2(_Json_run, converter, _Json_wrap(incomingValue));
  1863. $elm$core$Result$isOk(result) || _Debug_crash(4, name, result.a);
  1864. var value = result.a;
  1865. for (var temp = subs; temp.b; temp = temp.b) // WHILE_CONS
  1866. {
  1867. sendToApp(temp.a(value));
  1868. }
  1869. }
  1870. return { send: send };
  1871. }
  1872. // EXPORT ELM MODULES
  1873. //
  1874. // Have DEBUG and PROD versions so that we can (1) give nicer errors in
  1875. // debug mode and (2) not pay for the bits needed for that in prod mode.
  1876. //
  1877. function _Platform_export_UNUSED(exports)
  1878. {
  1879. scope['Elm']
  1880. ? _Platform_mergeExportsProd(scope['Elm'], exports)
  1881. : scope['Elm'] = exports;
  1882. }
  1883. function _Platform_mergeExportsProd(obj, exports)
  1884. {
  1885. for (var name in exports)
  1886. {
  1887. (name in obj)
  1888. ? (name == 'init')
  1889. ? _Debug_crash(6)
  1890. : _Platform_mergeExportsProd(obj[name], exports[name])
  1891. : (obj[name] = exports[name]);
  1892. }
  1893. }
  1894. function _Platform_export(exports)
  1895. {
  1896. scope['Elm']
  1897. ? _Platform_mergeExportsDebug('Elm', scope['Elm'], exports)
  1898. : scope['Elm'] = exports;
  1899. }
  1900. function _Platform_mergeExportsDebug(moduleName, obj, exports)
  1901. {
  1902. for (var name in exports)
  1903. {
  1904. (name in obj)
  1905. ? (name == 'init')
  1906. ? _Debug_crash(6, moduleName)
  1907. : _Platform_mergeExportsDebug(moduleName + '.' + name, obj[name], exports[name])
  1908. : (obj[name] = exports[name]);
  1909. }
  1910. }
  1911. // HELPERS
  1912. var _VirtualDom_divertHrefToApp;
  1913. var _VirtualDom_doc = typeof document !== 'undefined' ? document : {};
  1914. function _VirtualDom_appendChild(parent, child)
  1915. {
  1916. parent.appendChild(child);
  1917. }
  1918. var _VirtualDom_init = F4(function(virtualNode, flagDecoder, debugMetadata, args)
  1919. {
  1920. // NOTE: this function needs _Platform_export available to work
  1921. /**_UNUSED/
  1922. var node = args['node'];
  1923. //*/
  1924. /**/
  1925. var node = args && args['node'] ? args['node'] : _Debug_crash(0);
  1926. //*/
  1927. node.parentNode.replaceChild(
  1928. _VirtualDom_render(virtualNode, function() {}),
  1929. node
  1930. );
  1931. return {};
  1932. });
  1933. // TEXT
  1934. function _VirtualDom_text(string)
  1935. {
  1936. return {
  1937. $: 0,
  1938. a: string
  1939. };
  1940. }
  1941. // NODE
  1942. var _VirtualDom_nodeNS = F2(function(namespace, tag)
  1943. {
  1944. return F2(function(factList, kidList)
  1945. {
  1946. for (var kids = [], descendantsCount = 0; kidList.b; kidList = kidList.b) // WHILE_CONS
  1947. {
  1948. var kid = kidList.a;
  1949. descendantsCount += (kid.b || 0);
  1950. kids.push(kid);
  1951. }
  1952. descendantsCount += kids.length;
  1953. return {
  1954. $: 1,
  1955. c: tag,
  1956. d: _VirtualDom_organizeFacts(factList),
  1957. e: kids,
  1958. f: namespace,
  1959. b: descendantsCount
  1960. };
  1961. });
  1962. });
  1963. var _VirtualDom_node = _VirtualDom_nodeNS(undefined);
  1964. // KEYED NODE
  1965. var _VirtualDom_keyedNodeNS = F2(function(namespace, tag)
  1966. {
  1967. return F2(function(factList, kidList)
  1968. {
  1969. for (var kids = [], descendantsCount = 0; kidList.b; kidList = kidList.b) // WHILE_CONS
  1970. {
  1971. var kid = kidList.a;
  1972. descendantsCount += (kid.b.b || 0);
  1973. kids.push(kid);
  1974. }
  1975. descendantsCount += kids.length;
  1976. return {
  1977. $: 2,
  1978. c: tag,
  1979. d: _VirtualDom_organizeFacts(factList),
  1980. e: kids,
  1981. f: namespace,
  1982. b: descendantsCount
  1983. };
  1984. });
  1985. });
  1986. var _VirtualDom_keyedNode = _VirtualDom_keyedNodeNS(undefined);
  1987. // CUSTOM
  1988. function _VirtualDom_custom(factList, model, render, diff)
  1989. {
  1990. return {
  1991. $: 3,
  1992. d: _VirtualDom_organizeFacts(factList),
  1993. g: model,
  1994. h: render,
  1995. i: diff
  1996. };
  1997. }
  1998. // MAP
  1999. var _VirtualDom_map = F2(function(tagger, node)
  2000. {
  2001. return {
  2002. $: 4,
  2003. j: tagger,
  2004. k: node,
  2005. b: 1 + (node.b || 0)
  2006. };
  2007. });
  2008. // LAZY
  2009. function _VirtualDom_thunk(refs, thunk)
  2010. {
  2011. return {
  2012. $: 5,
  2013. l: refs,
  2014. m: thunk,
  2015. k: undefined
  2016. };
  2017. }
  2018. var _VirtualDom_lazy = F2(function(func, a)
  2019. {
  2020. return _VirtualDom_thunk([func, a], function() {
  2021. return func(a);
  2022. });
  2023. });
  2024. var _VirtualDom_lazy2 = F3(function(func, a, b)
  2025. {
  2026. return _VirtualDom_thunk([func, a, b], function() {
  2027. return A2(func, a, b);
  2028. });
  2029. });
  2030. var _VirtualDom_lazy3 = F4(function(func, a, b, c)
  2031. {
  2032. return _VirtualDom_thunk([func, a, b, c], function() {
  2033. return A3(func, a, b, c);
  2034. });
  2035. });
  2036. var _VirtualDom_lazy4 = F5(function(func, a, b, c, d)
  2037. {
  2038. return _VirtualDom_thunk([func, a, b, c, d], function() {
  2039. return A4(func, a, b, c, d);
  2040. });
  2041. });
  2042. var _VirtualDom_lazy5 = F6(function(func, a, b, c, d, e)
  2043. {
  2044. return _VirtualDom_thunk([func, a, b, c, d, e], function() {
  2045. return A5(func, a, b, c, d, e);
  2046. });
  2047. });
  2048. var _VirtualDom_lazy6 = F7(function(func, a, b, c, d, e, f)
  2049. {
  2050. return _VirtualDom_thunk([func, a, b, c, d, e, f], function() {
  2051. return A6(func, a, b, c, d, e, f);
  2052. });
  2053. });
  2054. var _VirtualDom_lazy7 = F8(function(func, a, b, c, d, e, f, g)
  2055. {
  2056. return _VirtualDom_thunk([func, a, b, c, d, e, f, g], function() {
  2057. return A7(func, a, b, c, d, e, f, g);
  2058. });
  2059. });
  2060. var _VirtualDom_lazy8 = F9(function(func, a, b, c, d, e, f, g, h)
  2061. {
  2062. return _VirtualDom_thunk([func, a, b, c, d, e, f, g, h], function() {
  2063. return A8(func, a, b, c, d, e, f, g, h);
  2064. });
  2065. });
  2066. // FACTS
  2067. var _VirtualDom_on = F2(function(key, handler)
  2068. {
  2069. return {
  2070. $: 'a0',
  2071. n: key,
  2072. o: handler
  2073. };
  2074. });
  2075. var _VirtualDom_style = F2(function(key, value)
  2076. {
  2077. return {
  2078. $: 'a1',
  2079. n: key,
  2080. o: value
  2081. };
  2082. });
  2083. var _VirtualDom_property = F2(function(key, value)
  2084. {
  2085. return {
  2086. $: 'a2',
  2087. n: key,
  2088. o: value
  2089. };
  2090. });
  2091. var _VirtualDom_attribute = F2(function(key, value)
  2092. {
  2093. return {
  2094. $: 'a3',
  2095. n: key,
  2096. o: value
  2097. };
  2098. });
  2099. var _VirtualDom_attributeNS = F3(function(namespace, key, value)
  2100. {
  2101. return {
  2102. $: 'a4',
  2103. n: key,
  2104. o: { f: namespace, o: value }
  2105. };
  2106. });
  2107. // XSS ATTACK VECTOR CHECKS
  2108. function _VirtualDom_noScript(tag)
  2109. {
  2110. return tag == 'script' ? 'p' : tag;
  2111. }
  2112. function _VirtualDom_noOnOrFormAction(key)
  2113. {
  2114. return /^(on|formAction$)/i.test(key) ? 'data-' + key : key;
  2115. }
  2116. function _VirtualDom_noInnerHtmlOrFormAction(key)
  2117. {
  2118. return key == 'innerHTML' || key == 'formAction' ? 'data-' + key : key;
  2119. }
  2120. function _VirtualDom_noJavaScriptUri_UNUSED(value)
  2121. {
  2122. return /^javascript:/i.test(value.replace(/\s/g,'')) ? '' : value;
  2123. }
  2124. function _VirtualDom_noJavaScriptUri(value)
  2125. {
  2126. return /^javascript:/i.test(value.replace(/\s/g,''))
  2127. ? 'javascript:alert("This is an XSS vector. Please use ports or web components instead.")'
  2128. : value;
  2129. }
  2130. function _VirtualDom_noJavaScriptOrHtmlUri_UNUSED(value)
  2131. {
  2132. return /^\s*(javascript:|data:text\/html)/i.test(value) ? '' : value;
  2133. }
  2134. function _VirtualDom_noJavaScriptOrHtmlUri(value)
  2135. {
  2136. return /^\s*(javascript:|data:text\/html)/i.test(value)
  2137. ? 'javascript:alert("This is an XSS vector. Please use ports or web components instead.")'
  2138. : value;
  2139. }
  2140. // MAP FACTS
  2141. var _VirtualDom_mapAttribute = F2(function(func, attr)
  2142. {
  2143. return (attr.$ === 'a0')
  2144. ? A2(_VirtualDom_on, attr.n, _VirtualDom_mapHandler(func, attr.o))
  2145. : attr;
  2146. });
  2147. function _VirtualDom_mapHandler(func, handler)
  2148. {
  2149. var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler);
  2150. // 0 = Normal
  2151. // 1 = MayStopPropagation
  2152. // 2 = MayPreventDefault
  2153. // 3 = Custom
  2154. return {
  2155. $: handler.$,
  2156. a:
  2157. !tag
  2158. ? A2($elm$json$Json$Decode$map, func, handler.a)
  2159. :
  2160. A3($elm$json$Json$Decode$map2,
  2161. tag < 3
  2162. ? _VirtualDom_mapEventTuple
  2163. : _VirtualDom_mapEventRecord,
  2164. $elm$json$Json$Decode$succeed(func),
  2165. handler.a
  2166. )
  2167. };
  2168. }
  2169. var _VirtualDom_mapEventTuple = F2(function(func, tuple)
  2170. {
  2171. return _Utils_Tuple2(func(tuple.a), tuple.b);
  2172. });
  2173. var _VirtualDom_mapEventRecord = F2(function(func, record)
  2174. {
  2175. return {
  2176. message: func(record.message),
  2177. stopPropagation: record.stopPropagation,
  2178. preventDefault: record.preventDefault
  2179. }
  2180. });
  2181. // ORGANIZE FACTS
  2182. function _VirtualDom_organizeFacts(factList)
  2183. {
  2184. for (var facts = {}; factList.b; factList = factList.b) // WHILE_CONS
  2185. {
  2186. var entry = factList.a;
  2187. var tag = entry.$;
  2188. var key = entry.n;
  2189. var value = entry.o;
  2190. if (tag === 'a2')
  2191. {
  2192. (key === 'className')
  2193. ? _VirtualDom_addClass(facts, key, _Json_unwrap(value))
  2194. : facts[key] = _Json_unwrap(value);
  2195. continue;
  2196. }
  2197. var subFacts = facts[tag] || (facts[tag] = {});
  2198. (tag === 'a3' && key === 'class')
  2199. ? _VirtualDom_addClass(subFacts, key, value)
  2200. : subFacts[key] = value;
  2201. }
  2202. return facts;
  2203. }
  2204. function _VirtualDom_addClass(object, key, newClass)
  2205. {
  2206. var classes = object[key];
  2207. object[key] = classes ? classes + ' ' + newClass : newClass;
  2208. }
  2209. // RENDER
  2210. function _VirtualDom_render(vNode, eventNode)
  2211. {
  2212. var tag = vNode.$;
  2213. if (tag === 5)
  2214. {
  2215. return _VirtualDom_render(vNode.k || (vNode.k = vNode.m()), eventNode);
  2216. }
  2217. if (tag === 0)
  2218. {
  2219. return _VirtualDom_doc.createTextNode(vNode.a);
  2220. }
  2221. if (tag === 4)
  2222. {
  2223. var subNode = vNode.k;
  2224. var tagger = vNode.j;
  2225. while (subNode.$ === 4)
  2226. {
  2227. typeof tagger !== 'object'
  2228. ? tagger = [tagger, subNode.j]
  2229. : tagger.push(subNode.j);
  2230. subNode = subNode.k;
  2231. }
  2232. var subEventRoot = { j: tagger, p: eventNode };
  2233. var domNode = _VirtualDom_render(subNode, subEventRoot);
  2234. domNode.elm_event_node_ref = subEventRoot;
  2235. return domNode;
  2236. }
  2237. if (tag === 3)
  2238. {
  2239. var domNode = vNode.h(vNode.g);
  2240. _VirtualDom_applyFacts(domNode, eventNode, vNode.d);
  2241. return domNode;
  2242. }
  2243. // at this point `tag` must be 1 or 2
  2244. var domNode = vNode.f
  2245. ? _VirtualDom_doc.createElementNS(vNode.f, vNode.c)
  2246. : _VirtualDom_doc.createElement(vNode.c);
  2247. if (_VirtualDom_divertHrefToApp && vNode.c == 'a')
  2248. {
  2249. domNode.addEventListener('click', _VirtualDom_divertHrefToApp(domNode));
  2250. }
  2251. _VirtualDom_applyFacts(domNode, eventNode, vNode.d);
  2252. for (var kids = vNode.e, i = 0; i < kids.length; i++)
  2253. {
  2254. _VirtualDom_appendChild(domNode, _VirtualDom_render(tag === 1 ? kids[i] : kids[i].b, eventNode));
  2255. }
  2256. return domNode;
  2257. }
  2258. // APPLY FACTS
  2259. function _VirtualDom_applyFacts(domNode, eventNode, facts)
  2260. {
  2261. for (var key in facts)
  2262. {
  2263. var value = facts[key];
  2264. key === 'a1'
  2265. ? _VirtualDom_applyStyles(domNode, value)
  2266. :
  2267. key === 'a0'
  2268. ? _VirtualDom_applyEvents(domNode, eventNode, value)
  2269. :
  2270. key === 'a3'
  2271. ? _VirtualDom_applyAttrs(domNode, value)
  2272. :
  2273. key === 'a4'
  2274. ? _VirtualDom_applyAttrsNS(domNode, value)
  2275. :
  2276. ((key !== 'value' && key !== 'checked') || domNode[key] !== value) && (domNode[key] = value);
  2277. }
  2278. }
  2279. // APPLY STYLES
  2280. function _VirtualDom_applyStyles(domNode, styles)
  2281. {
  2282. var domNodeStyle = domNode.style;
  2283. for (var key in styles)
  2284. {
  2285. domNodeStyle[key] = styles[key];
  2286. }
  2287. }
  2288. // APPLY ATTRS
  2289. function _VirtualDom_applyAttrs(domNode, attrs)
  2290. {
  2291. for (var key in attrs)
  2292. {
  2293. var value = attrs[key];
  2294. typeof value !== 'undefined'
  2295. ? domNode.setAttribute(key, value)
  2296. : domNode.removeAttribute(key);
  2297. }
  2298. }
  2299. // APPLY NAMESPACED ATTRS
  2300. function _VirtualDom_applyAttrsNS(domNode, nsAttrs)
  2301. {
  2302. for (var key in nsAttrs)
  2303. {
  2304. var pair = nsAttrs[key];
  2305. var namespace = pair.f;
  2306. var value = pair.o;
  2307. typeof value !== 'undefined'
  2308. ? domNode.setAttributeNS(namespace, key, value)
  2309. : domNode.removeAttributeNS(namespace, key);
  2310. }
  2311. }
  2312. // APPLY EVENTS
  2313. function _VirtualDom_applyEvents(domNode, eventNode, events)
  2314. {
  2315. var allCallbacks = domNode.elmFs || (domNode.elmFs = {});
  2316. for (var key in events)
  2317. {
  2318. var newHandler = events[key];
  2319. var oldCallback = allCallbacks[key];
  2320. if (!newHandler)
  2321. {
  2322. domNode.removeEventListener(key, oldCallback);
  2323. allCallbacks[key] = undefined;
  2324. continue;
  2325. }
  2326. if (oldCallback)
  2327. {
  2328. var oldHandler = oldCallback.q;
  2329. if (oldHandler.$ === newHandler.$)
  2330. {
  2331. oldCallback.q = newHandler;
  2332. continue;
  2333. }
  2334. domNode.removeEventListener(key, oldCallback);
  2335. }
  2336. oldCallback = _VirtualDom_makeCallback(eventNode, newHandler);
  2337. domNode.addEventListener(key, oldCallback,
  2338. _VirtualDom_passiveSupported
  2339. && { passive: $elm$virtual_dom$VirtualDom$toHandlerInt(newHandler) < 2 }
  2340. );
  2341. allCallbacks[key] = oldCallback;
  2342. }
  2343. }
  2344. // PASSIVE EVENTS
  2345. var _VirtualDom_passiveSupported;
  2346. try
  2347. {
  2348. window.addEventListener('t', null, Object.defineProperty({}, 'passive', {
  2349. get: function() { _VirtualDom_passiveSupported = true; }
  2350. }));
  2351. }
  2352. catch(e) {}
  2353. // EVENT HANDLERS
  2354. function _VirtualDom_makeCallback(eventNode, initialHandler)
  2355. {
  2356. function callback(event)
  2357. {
  2358. var handler = callback.q;
  2359. var result = _Json_runHelp(handler.a, event);
  2360. if (!$elm$core$Result$isOk(result))
  2361. {
  2362. return;
  2363. }
  2364. var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler);
  2365. // 0 = Normal
  2366. // 1 = MayStopPropagation
  2367. // 2 = MayPreventDefault
  2368. // 3 = Custom
  2369. var value = result.a;
  2370. var message = !tag ? value : tag < 3 ? value.a : value.message;
  2371. var stopPropagation = tag == 1 ? value.b : tag == 3 && value.stopPropagation;
  2372. var currentEventNode = (
  2373. stopPropagation && event.stopPropagation(),
  2374. (tag == 2 ? value.b : tag == 3 && value.preventDefault) && event.preventDefault(),
  2375. eventNode
  2376. );
  2377. var tagger;
  2378. var i;
  2379. while (tagger = currentEventNode.j)
  2380. {
  2381. if (typeof tagger == 'function')
  2382. {
  2383. message = tagger(message);
  2384. }
  2385. else
  2386. {
  2387. for (var i = tagger.length; i--; )
  2388. {
  2389. message = tagger[i](message);
  2390. }
  2391. }
  2392. currentEventNode = currentEventNode.p;
  2393. }
  2394. currentEventNode(message, stopPropagation); // stopPropagation implies isSync
  2395. }
  2396. callback.q = initialHandler;
  2397. return callback;
  2398. }
  2399. function _VirtualDom_equalEvents(x, y)
  2400. {
  2401. return x.$ == y.$ && _Json_equality(x.a, y.a);
  2402. }
  2403. // DIFF
  2404. // TODO: Should we do patches like in iOS?
  2405. //
  2406. // type Patch
  2407. // = At Int Patch
  2408. // | Batch (List Patch)
  2409. // | Change ...
  2410. //
  2411. // How could it not be better?
  2412. //
  2413. function _VirtualDom_diff(x, y)
  2414. {
  2415. var patches = [];
  2416. _VirtualDom_diffHelp(x, y, patches, 0);
  2417. return patches;
  2418. }
  2419. function _VirtualDom_pushPatch(patches, type, index, data)
  2420. {
  2421. var patch = {
  2422. $: type,
  2423. r: index,
  2424. s: data,
  2425. t: undefined,
  2426. u: undefined
  2427. };
  2428. patches.push(patch);
  2429. return patch;
  2430. }
  2431. function _VirtualDom_diffHelp(x, y, patches, index)
  2432. {
  2433. if (x === y)
  2434. {
  2435. return;
  2436. }
  2437. var xType = x.$;
  2438. var yType = y.$;
  2439. // Bail if you run into different types of nodes. Implies that the
  2440. // structure has changed significantly and it's not worth a diff.
  2441. if (xType !== yType)
  2442. {
  2443. if (xType === 1 && yType === 2)
  2444. {
  2445. y = _VirtualDom_dekey(y);
  2446. yType = 1;
  2447. }
  2448. else
  2449. {
  2450. _VirtualDom_pushPatch(patches, 0, index, y);
  2451. return;
  2452. }
  2453. }
  2454. // Now we know that both nodes are the same $.
  2455. switch (yType)
  2456. {
  2457. case 5:
  2458. var xRefs = x.l;
  2459. var yRefs = y.l;
  2460. var i = xRefs.length;
  2461. var same = i === yRefs.length;
  2462. while (same && i--)
  2463. {
  2464. same = xRefs[i] === yRefs[i];
  2465. }
  2466. if (same)
  2467. {
  2468. y.k = x.k;
  2469. return;
  2470. }
  2471. y.k = y.m();
  2472. var subPatches = [];
  2473. _VirtualDom_diffHelp(x.k, y.k, subPatches, 0);
  2474. subPatches.length > 0 && _VirtualDom_pushPatch(patches, 1, index, subPatches);
  2475. return;
  2476. case 4:
  2477. // gather nested taggers
  2478. var xTaggers = x.j;
  2479. var yTaggers = y.j;
  2480. var nesting = false;
  2481. var xSubNode = x.k;
  2482. while (xSubNode.$ === 4)
  2483. {
  2484. nesting = true;
  2485. typeof xTaggers !== 'object'
  2486. ? xTaggers = [xTaggers, xSubNode.j]
  2487. : xTaggers.push(xSubNode.j);
  2488. xSubNode = xSubNode.k;
  2489. }
  2490. var ySubNode = y.k;
  2491. while (ySubNode.$ === 4)
  2492. {
  2493. nesting = true;
  2494. typeof yTaggers !== 'object'
  2495. ? yTaggers = [yTaggers, ySubNode.j]
  2496. : yTaggers.push(ySubNode.j);
  2497. ySubNode = ySubNode.k;
  2498. }
  2499. // Just bail if different numbers of taggers. This implies the
  2500. // structure of the virtual DOM has changed.
  2501. if (nesting && xTaggers.length !== yTaggers.length)
  2502. {
  2503. _VirtualDom_pushPatch(patches, 0, index, y);
  2504. return;
  2505. }
  2506. // check if taggers are "the same"
  2507. if (nesting ? !_VirtualDom_pairwiseRefEqual(xTaggers, yTaggers) : xTaggers !== yTaggers)
  2508. {
  2509. _VirtualDom_pushPatch(patches, 2, index, yTaggers);
  2510. }
  2511. // diff everything below the taggers
  2512. _VirtualDom_diffHelp(xSubNode, ySubNode, patches, index + 1);
  2513. return;
  2514. case 0:
  2515. if (x.a !== y.a)
  2516. {
  2517. _VirtualDom_pushPatch(patches, 3, index, y.a);
  2518. }
  2519. return;
  2520. case 1:
  2521. _VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKids);
  2522. return;
  2523. case 2:
  2524. _VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKeyedKids);
  2525. return;
  2526. case 3:
  2527. if (x.h !== y.h)
  2528. {
  2529. _VirtualDom_pushPatch(patches, 0, index, y);
  2530. return;
  2531. }
  2532. var factsDiff = _VirtualDom_diffFacts(x.d, y.d);
  2533. factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff);
  2534. var patch = y.i(x.g, y.g);
  2535. patch && _VirtualDom_pushPatch(patches, 5, index, patch);
  2536. return;
  2537. }
  2538. }
  2539. // assumes the incoming arrays are the same length
  2540. function _VirtualDom_pairwiseRefEqual(as, bs)
  2541. {
  2542. for (var i = 0; i < as.length; i++)
  2543. {
  2544. if (as[i] !== bs[i])
  2545. {
  2546. return false;
  2547. }
  2548. }
  2549. return true;
  2550. }
  2551. function _VirtualDom_diffNodes(x, y, patches, index, diffKids)
  2552. {
  2553. // Bail if obvious indicators have changed. Implies more serious
  2554. // structural changes such that it's not worth it to diff.
  2555. if (x.c !== y.c || x.f !== y.f)
  2556. {
  2557. _VirtualDom_pushPatch(patches, 0, index, y);
  2558. return;
  2559. }
  2560. var factsDiff = _VirtualDom_diffFacts(x.d, y.d);
  2561. factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff);
  2562. diffKids(x, y, patches, index);
  2563. }
  2564. // DIFF FACTS
  2565. // TODO Instead of creating a new diff object, it's possible to just test if
  2566. // there *is* a diff. During the actual patch, do the diff again and make the
  2567. // modifications directly. This way, there's no new allocations. Worth it?
  2568. function _VirtualDom_diffFacts(x, y, category)
  2569. {
  2570. var diff;
  2571. // look for changes and removals
  2572. for (var xKey in x)
  2573. {
  2574. if (xKey === 'a1' || xKey === 'a0' || xKey === 'a3' || xKey === 'a4')
  2575. {
  2576. var subDiff = _VirtualDom_diffFacts(x[xKey], y[xKey] || {}, xKey);
  2577. if (subDiff)
  2578. {
  2579. diff = diff || {};
  2580. diff[xKey] = subDiff;
  2581. }
  2582. continue;
  2583. }
  2584. // remove if not in the new facts
  2585. if (!(xKey in y))
  2586. {
  2587. diff = diff || {};
  2588. diff[xKey] =
  2589. !category
  2590. ? (typeof x[xKey] === 'string' ? '' : null)
  2591. :
  2592. (category === 'a1')
  2593. ? ''
  2594. :
  2595. (category === 'a0' || category === 'a3')
  2596. ? undefined
  2597. :
  2598. { f: x[xKey].f, o: undefined };
  2599. continue;
  2600. }
  2601. var xValue = x[xKey];
  2602. var yValue = y[xKey];
  2603. // reference equal, so don't worry about it
  2604. if (xValue === yValue && xKey !== 'value' && xKey !== 'checked'
  2605. || category === 'a0' && _VirtualDom_equalEvents(xValue, yValue))
  2606. {
  2607. continue;
  2608. }
  2609. diff = diff || {};
  2610. diff[xKey] = yValue;
  2611. }
  2612. // add new stuff
  2613. for (var yKey in y)
  2614. {
  2615. if (!(yKey in x))
  2616. {
  2617. diff = diff || {};
  2618. diff[yKey] = y[yKey];
  2619. }
  2620. }
  2621. return diff;
  2622. }
  2623. // DIFF KIDS
  2624. function _VirtualDom_diffKids(xParent, yParent, patches, index)
  2625. {
  2626. var xKids = xParent.e;
  2627. var yKids = yParent.e;
  2628. var xLen = xKids.length;
  2629. var yLen = yKids.length;
  2630. // FIGURE OUT IF THERE ARE INSERTS OR REMOVALS
  2631. if (xLen > yLen)
  2632. {
  2633. _VirtualDom_pushPatch(patches, 6, index, {
  2634. v: yLen,
  2635. i: xLen - yLen
  2636. });
  2637. }
  2638. else if (xLen < yLen)
  2639. {
  2640. _VirtualDom_pushPatch(patches, 7, index, {
  2641. v: xLen,
  2642. e: yKids
  2643. });
  2644. }
  2645. // PAIRWISE DIFF EVERYTHING ELSE
  2646. for (var minLen = xLen < yLen ? xLen : yLen, i = 0; i < minLen; i++)
  2647. {
  2648. var xKid = xKids[i];
  2649. _VirtualDom_diffHelp(xKid, yKids[i], patches, ++index);
  2650. index += xKid.b || 0;
  2651. }
  2652. }
  2653. // KEYED DIFF
  2654. function _VirtualDom_diffKeyedKids(xParent, yParent, patches, rootIndex)
  2655. {
  2656. var localPatches = [];
  2657. var changes = {}; // Dict String Entry
  2658. var inserts = []; // Array { index : Int, entry : Entry }
  2659. // type Entry = { tag : String, vnode : VNode, index : Int, data : _ }
  2660. var xKids = xParent.e;
  2661. var yKids = yParent.e;
  2662. var xLen = xKids.length;
  2663. var yLen = yKids.length;
  2664. var xIndex = 0;
  2665. var yIndex = 0;
  2666. var index = rootIndex;
  2667. while (xIndex < xLen && yIndex < yLen)
  2668. {
  2669. var x = xKids[xIndex];
  2670. var y = yKids[yIndex];
  2671. var xKey = x.a;
  2672. var yKey = y.a;
  2673. var xNode = x.b;
  2674. var yNode = y.b;
  2675. var newMatch = undefined;
  2676. var oldMatch = undefined;
  2677. // check if keys match
  2678. if (xKey === yKey)
  2679. {
  2680. index++;
  2681. _VirtualDom_diffHelp(xNode, yNode, localPatches, index);
  2682. index += xNode.b || 0;
  2683. xIndex++;
  2684. yIndex++;
  2685. continue;
  2686. }
  2687. // look ahead 1 to detect insertions and removals.
  2688. var xNext = xKids[xIndex + 1];
  2689. var yNext = yKids[yIndex + 1];
  2690. if (xNext)
  2691. {
  2692. var xNextKey = xNext.a;
  2693. var xNextNode = xNext.b;
  2694. oldMatch = yKey === xNextKey;
  2695. }
  2696. if (yNext)
  2697. {
  2698. var yNextKey = yNext.a;
  2699. var yNextNode = yNext.b;
  2700. newMatch = xKey === yNextKey;
  2701. }
  2702. // swap x and y
  2703. if (newMatch && oldMatch)
  2704. {
  2705. index++;
  2706. _VirtualDom_diffHelp(xNode, yNextNode, localPatches, index);
  2707. _VirtualDom_insertNode(changes, localPatches, xKey, yNode, yIndex, inserts);
  2708. index += xNode.b || 0;
  2709. index++;
  2710. _VirtualDom_removeNode(changes, localPatches, xKey, xNextNode, index);
  2711. index += xNextNode.b || 0;
  2712. xIndex += 2;
  2713. yIndex += 2;
  2714. continue;
  2715. }
  2716. // insert y
  2717. if (newMatch)
  2718. {
  2719. index++;
  2720. _VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts);
  2721. _VirtualDom_diffHelp(xNode, yNextNode, localPatches, index);
  2722. index += xNode.b || 0;
  2723. xIndex += 1;
  2724. yIndex += 2;
  2725. continue;
  2726. }
  2727. // remove x
  2728. if (oldMatch)
  2729. {
  2730. index++;
  2731. _VirtualDom_removeNode(changes, localPatches, xKey, xNode, index);
  2732. index += xNode.b || 0;
  2733. index++;
  2734. _VirtualDom_diffHelp(xNextNode, yNode, localPatches, index);
  2735. index += xNextNode.b || 0;
  2736. xIndex += 2;
  2737. yIndex += 1;
  2738. continue;
  2739. }
  2740. // remove x, insert y
  2741. if (xNext && xNextKey === yNextKey)
  2742. {
  2743. index++;
  2744. _VirtualDom_removeNode(changes, localPatches, xKey, xNode, index);
  2745. _VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts);
  2746. index += xNode.b || 0;
  2747. index++;
  2748. _VirtualDom_diffHelp(xNextNode, yNextNode, localPatches, index);
  2749. index += xNextNode.b || 0;
  2750. xIndex += 2;
  2751. yIndex += 2;
  2752. continue;
  2753. }
  2754. break;
  2755. }
  2756. // eat up any remaining nodes with removeNode and insertNode
  2757. while (xIndex < xLen)
  2758. {
  2759. index++;
  2760. var x = xKids[xIndex];
  2761. var xNode = x.b;
  2762. _VirtualDom_removeNode(changes, localPatches, x.a, xNode, index);
  2763. index += xNode.b || 0;
  2764. xIndex++;
  2765. }
  2766. while (yIndex < yLen)
  2767. {
  2768. var endInserts = endInserts || [];
  2769. var y = yKids[yIndex];
  2770. _VirtualDom_insertNode(changes, localPatches, y.a, y.b, undefined, endInserts);
  2771. yIndex++;
  2772. }
  2773. if (localPatches.length > 0 || inserts.length > 0 || endInserts)
  2774. {
  2775. _VirtualDom_pushPatch(patches, 8, rootIndex, {
  2776. w: localPatches,
  2777. x: inserts,
  2778. y: endInserts
  2779. });
  2780. }
  2781. }
  2782. // CHANGES FROM KEYED DIFF
  2783. var _VirtualDom_POSTFIX = '_elmW6BL';
  2784. function _VirtualDom_insertNode(changes, localPatches, key, vnode, yIndex, inserts)
  2785. {
  2786. var entry = changes[key];
  2787. // never seen this key before
  2788. if (!entry)
  2789. {
  2790. entry = {
  2791. c: 0,
  2792. z: vnode,
  2793. r: yIndex,
  2794. s: undefined
  2795. };
  2796. inserts.push({ r: yIndex, A: entry });
  2797. changes[key] = entry;
  2798. return;
  2799. }
  2800. // this key was removed earlier, a match!
  2801. if (entry.c === 1)
  2802. {
  2803. inserts.push({ r: yIndex, A: entry });
  2804. entry.c = 2;
  2805. var subPatches = [];
  2806. _VirtualDom_diffHelp(entry.z, vnode, subPatches, entry.r);
  2807. entry.r = yIndex;
  2808. entry.s.s = {
  2809. w: subPatches,
  2810. A: entry
  2811. };
  2812. return;
  2813. }
  2814. // this key has already been inserted or moved, a duplicate!
  2815. _VirtualDom_insertNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, yIndex, inserts);
  2816. }
  2817. function _VirtualDom_removeNode(changes, localPatches, key, vnode, index)
  2818. {
  2819. var entry = changes[key];
  2820. // never seen this key before
  2821. if (!entry)
  2822. {
  2823. var patch = _VirtualDom_pushPatch(localPatches, 9, index, undefined);
  2824. changes[key] = {
  2825. c: 1,
  2826. z: vnode,
  2827. r: index,
  2828. s: patch
  2829. };
  2830. return;
  2831. }
  2832. // this key was inserted earlier, a match!
  2833. if (entry.c === 0)
  2834. {
  2835. entry.c = 2;
  2836. var subPatches = [];
  2837. _VirtualDom_diffHelp(vnode, entry.z, subPatches, index);
  2838. _VirtualDom_pushPatch(localPatches, 9, index, {
  2839. w: subPatches,
  2840. A: entry
  2841. });
  2842. return;
  2843. }
  2844. // this key has already been removed or moved, a duplicate!
  2845. _VirtualDom_removeNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, index);
  2846. }
  2847. // ADD DOM NODES
  2848. //
  2849. // Each DOM node has an "index" assigned in order of traversal. It is important
  2850. // to minimize our crawl over the actual DOM, so these indexes (along with the
  2851. // descendantsCount of virtual nodes) let us skip touching entire subtrees of
  2852. // the DOM if we know there are no patches there.
  2853. function _VirtualDom_addDomNodes(domNode, vNode, patches, eventNode)
  2854. {
  2855. _VirtualDom_addDomNodesHelp(domNode, vNode, patches, 0, 0, vNode.b, eventNode);
  2856. }
  2857. // assumes `patches` is non-empty and indexes increase monotonically.
  2858. function _VirtualDom_addDomNodesHelp(domNode, vNode, patches, i, low, high, eventNode)
  2859. {
  2860. var patch = patches[i];
  2861. var index = patch.r;
  2862. while (index === low)
  2863. {
  2864. var patchType = patch.$;
  2865. if (patchType === 1)
  2866. {
  2867. _VirtualDom_addDomNodes(domNode, vNode.k, patch.s, eventNode);
  2868. }
  2869. else if (patchType === 8)
  2870. {
  2871. patch.t = domNode;
  2872. patch.u = eventNode;
  2873. var subPatches = patch.s.w;
  2874. if (subPatches.length > 0)
  2875. {
  2876. _VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
  2877. }
  2878. }
  2879. else if (patchType === 9)
  2880. {
  2881. patch.t = domNode;
  2882. patch.u = eventNode;
  2883. var data = patch.s;
  2884. if (data)
  2885. {
  2886. data.A.s = domNode;
  2887. var subPatches = data.w;
  2888. if (subPatches.length > 0)
  2889. {
  2890. _VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
  2891. }
  2892. }
  2893. }
  2894. else
  2895. {
  2896. patch.t = domNode;
  2897. patch.u = eventNode;
  2898. }
  2899. i++;
  2900. if (!(patch = patches[i]) || (index = patch.r) > high)
  2901. {
  2902. return i;
  2903. }
  2904. }
  2905. var tag = vNode.$;
  2906. if (tag === 4)
  2907. {
  2908. var subNode = vNode.k;
  2909. while (subNode.$ === 4)
  2910. {
  2911. subNode = subNode.k;
  2912. }
  2913. return _VirtualDom_addDomNodesHelp(domNode, subNode, patches, i, low + 1, high, domNode.elm_event_node_ref);
  2914. }
  2915. // tag must be 1 or 2 at this point
  2916. var vKids = vNode.e;
  2917. var childNodes = domNode.childNodes;
  2918. for (var j = 0; j < vKids.length; j++)
  2919. {
  2920. low++;
  2921. var vKid = tag === 1 ? vKids[j] : vKids[j].b;
  2922. var nextLow = low + (vKid.b || 0);
  2923. if (low <= index && index <= nextLow)
  2924. {
  2925. i = _VirtualDom_addDomNodesHelp(childNodes[j], vKid, patches, i, low, nextLow, eventNode);
  2926. if (!(patch = patches[i]) || (index = patch.r) > high)
  2927. {
  2928. return i;
  2929. }
  2930. }
  2931. low = nextLow;
  2932. }
  2933. return i;
  2934. }
  2935. // APPLY PATCHES
  2936. function _VirtualDom_applyPatches(rootDomNode, oldVirtualNode, patches, eventNode)
  2937. {
  2938. if (patches.length === 0)
  2939. {
  2940. return rootDomNode;
  2941. }
  2942. _VirtualDom_addDomNodes(rootDomNode, oldVirtualNode, patches, eventNode);
  2943. return _VirtualDom_applyPatchesHelp(rootDomNode, patches);
  2944. }
  2945. function _VirtualDom_applyPatchesHelp(rootDomNode, patches)
  2946. {
  2947. for (var i = 0; i < patches.length; i++)
  2948. {
  2949. var patch = patches[i];
  2950. var localDomNode = patch.t
  2951. var newNode = _VirtualDom_applyPatch(localDomNode, patch);
  2952. if (localDomNode === rootDomNode)
  2953. {
  2954. rootDomNode = newNode;
  2955. }
  2956. }
  2957. return rootDomNode;
  2958. }
  2959. function _VirtualDom_applyPatch(domNode, patch)
  2960. {
  2961. switch (patch.$)
  2962. {
  2963. case 0:
  2964. return _VirtualDom_applyPatchRedraw(domNode, patch.s, patch.u);
  2965. case 4:
  2966. _VirtualDom_applyFacts(domNode, patch.u, patch.s);
  2967. return domNode;
  2968. case 3:
  2969. domNode.replaceData(0, domNode.length, patch.s);
  2970. return domNode;
  2971. case 1:
  2972. return _VirtualDom_applyPatchesHelp(domNode, patch.s);
  2973. case 2:
  2974. if (domNode.elm_event_node_ref)
  2975. {
  2976. domNode.elm_event_node_ref.j = patch.s;
  2977. }
  2978. else
  2979. {
  2980. domNode.elm_event_node_ref = { j: patch.s, p: patch.u };
  2981. }
  2982. return domNode;
  2983. case 6:
  2984. var data = patch.s;
  2985. for (var i = 0; i < data.i; i++)
  2986. {
  2987. domNode.removeChild(domNode.childNodes[data.v]);
  2988. }
  2989. return domNode;
  2990. case 7:
  2991. var data = patch.s;
  2992. var kids = data.e;
  2993. var i = data.v;
  2994. var theEnd = domNode.childNodes[i];
  2995. for (; i < kids.length; i++)
  2996. {
  2997. domNode.insertBefore(_VirtualDom_render(kids[i], patch.u), theEnd);
  2998. }
  2999. return domNode;
  3000. case 9:
  3001. var data = patch.s;
  3002. if (!data)
  3003. {
  3004. domNode.parentNode.removeChild(domNode);
  3005. return domNode;
  3006. }
  3007. var entry = data.A;
  3008. if (typeof entry.r !== 'undefined')
  3009. {
  3010. domNode.parentNode.removeChild(domNode);
  3011. }
  3012. entry.s = _VirtualDom_applyPatchesHelp(domNode, data.w);
  3013. return domNode;
  3014. case 8:
  3015. return _VirtualDom_applyPatchReorder(domNode, patch);
  3016. case 5:
  3017. return patch.s(domNode);
  3018. default:
  3019. _Debug_crash(10); // 'Ran into an unknown patch!'
  3020. }
  3021. }
  3022. function _VirtualDom_applyPatchRedraw(domNode, vNode, eventNode)
  3023. {
  3024. var parentNode = domNode.parentNode;
  3025. var newNode = _VirtualDom_render(vNode, eventNode);
  3026. if (!newNode.elm_event_node_ref)
  3027. {
  3028. newNode.elm_event_node_ref = domNode.elm_event_node_ref;
  3029. }
  3030. if (parentNode && newNode !== domNode)
  3031. {
  3032. parentNode.replaceChild(newNode, domNode);
  3033. }
  3034. return newNode;
  3035. }
  3036. function _VirtualDom_applyPatchReorder(domNode, patch)
  3037. {
  3038. var data = patch.s;
  3039. // remove end inserts
  3040. var frag = _VirtualDom_applyPatchReorderEndInsertsHelp(data.y, patch);
  3041. // removals
  3042. domNode = _VirtualDom_applyPatchesHelp(domNode, data.w);
  3043. // inserts
  3044. var inserts = data.x;
  3045. for (var i = 0; i < inserts.length; i++)
  3046. {
  3047. var insert = inserts[i];
  3048. var entry = insert.A;
  3049. var node = entry.c === 2
  3050. ? entry.s
  3051. : _VirtualDom_render(entry.z, patch.u);
  3052. domNode.insertBefore(node, domNode.childNodes[insert.r]);
  3053. }
  3054. // add end inserts
  3055. if (frag)
  3056. {
  3057. _VirtualDom_appendChild(domNode, frag);
  3058. }
  3059. return domNode;
  3060. }
  3061. function _VirtualDom_applyPatchReorderEndInsertsHelp(endInserts, patch)
  3062. {
  3063. if (!endInserts)
  3064. {
  3065. return;
  3066. }
  3067. var frag = _VirtualDom_doc.createDocumentFragment();
  3068. for (var i = 0; i < endInserts.length; i++)
  3069. {
  3070. var insert = endInserts[i];
  3071. var entry = insert.A;
  3072. _VirtualDom_appendChild(frag, entry.c === 2
  3073. ? entry.s
  3074. : _VirtualDom_render(entry.z, patch.u)
  3075. );
  3076. }
  3077. return frag;
  3078. }
  3079. function _VirtualDom_virtualize(node)
  3080. {
  3081. // TEXT NODES
  3082. if (node.nodeType === 3)
  3083. {
  3084. return _VirtualDom_text(node.textContent);
  3085. }
  3086. // WEIRD NODES
  3087. if (node.nodeType !== 1)
  3088. {
  3089. return _VirtualDom_text('');
  3090. }
  3091. // ELEMENT NODES
  3092. var attrList = _List_Nil;
  3093. var attrs = node.attributes;
  3094. for (var i = attrs.length; i--; )
  3095. {
  3096. var attr = attrs[i];
  3097. var name = attr.name;
  3098. var value = attr.value;
  3099. attrList = _List_Cons( A2(_VirtualDom_attribute, name, value), attrList );
  3100. }
  3101. var tag = node.tagName.toLowerCase();
  3102. var kidList = _List_Nil;
  3103. var kids = node.childNodes;
  3104. for (var i = kids.length; i--; )
  3105. {
  3106. kidList = _List_Cons(_VirtualDom_virtualize(kids[i]), kidList);
  3107. }
  3108. return A3(_VirtualDom_node, tag, attrList, kidList);
  3109. }
  3110. function _VirtualDom_dekey(keyedNode)
  3111. {
  3112. var keyedKids = keyedNode.e;
  3113. var len = keyedKids.length;
  3114. var kids = new Array(len);
  3115. for (var i = 0; i < len; i++)
  3116. {
  3117. kids[i] = keyedKids[i].b;
  3118. }
  3119. return {
  3120. $: 1,
  3121. c: keyedNode.c,
  3122. d: keyedNode.d,
  3123. e: kids,
  3124. f: keyedNode.f,
  3125. b: keyedNode.b
  3126. };
  3127. }
  3128. // ELEMENT
  3129. var _Debugger_element;
  3130. var _Browser_element = _Debugger_element || F4(function(impl, flagDecoder, debugMetadata, args)
  3131. {
  3132. return _Platform_initialize(
  3133. flagDecoder,
  3134. args,
  3135. impl.init,
  3136. impl.update,
  3137. impl.subscriptions,
  3138. function(sendToApp, initialModel) {
  3139. var view = impl.view;
  3140. /**_UNUSED/
  3141. var domNode = args['node'];
  3142. //*/
  3143. /**/
  3144. var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
  3145. //*/
  3146. var currNode = _VirtualDom_virtualize(domNode);
  3147. return _Browser_makeAnimator(initialModel, function(model)
  3148. {
  3149. var nextNode = view(model);
  3150. var patches = _VirtualDom_diff(currNode, nextNode);
  3151. domNode = _VirtualDom_applyPatches(domNode, currNode, patches, sendToApp);
  3152. currNode = nextNode;
  3153. });
  3154. }
  3155. );
  3156. });
  3157. // DOCUMENT
  3158. var _Debugger_document;
  3159. var _Browser_document = _Debugger_document || F4(function(impl, flagDecoder, debugMetadata, args)
  3160. {
  3161. return _Platform_initialize(
  3162. flagDecoder,
  3163. args,
  3164. impl.init,
  3165. impl.update,
  3166. impl.subscriptions,
  3167. function(sendToApp, initialModel) {
  3168. var divertHrefToApp = impl.setup && impl.setup(sendToApp)
  3169. var view = impl.view;
  3170. var title = _VirtualDom_doc.title;
  3171. var bodyNode = _VirtualDom_doc.body;
  3172. var currNode = _VirtualDom_virtualize(bodyNode);
  3173. return _Browser_makeAnimator(initialModel, function(model)
  3174. {
  3175. _VirtualDom_divertHrefToApp = divertHrefToApp;
  3176. var doc = view(model);
  3177. var nextNode = _VirtualDom_node('body')(_List_Nil)(doc.body);
  3178. var patches = _VirtualDom_diff(currNode, nextNode);
  3179. bodyNode = _VirtualDom_applyPatches(bodyNode, currNode, patches, sendToApp);
  3180. currNode = nextNode;
  3181. _VirtualDom_divertHrefToApp = 0;
  3182. (title !== doc.title) && (_VirtualDom_doc.title = title = doc.title);
  3183. });
  3184. }
  3185. );
  3186. });
  3187. // ANIMATION
  3188. var _Browser_cancelAnimationFrame =
  3189. typeof cancelAnimationFrame !== 'undefined'
  3190. ? cancelAnimationFrame
  3191. : function(id) { clearTimeout(id); };
  3192. var _Browser_requestAnimationFrame =
  3193. typeof requestAnimationFrame !== 'undefined'
  3194. ? requestAnimationFrame
  3195. : function(callback) { return setTimeout(callback, 1000 / 60); };
  3196. function _Browser_makeAnimator(model, draw)
  3197. {
  3198. draw(model);
  3199. var state = 0;
  3200. function updateIfNeeded()
  3201. {
  3202. state = state === 1
  3203. ? 0
  3204. : ( _Browser_requestAnimationFrame(updateIfNeeded), draw(model), 1 );
  3205. }
  3206. return function(nextModel, isSync)
  3207. {
  3208. model = nextModel;
  3209. isSync
  3210. ? ( draw(model),
  3211. state === 2 && (state = 1)
  3212. )
  3213. : ( state === 0 && _Browser_requestAnimationFrame(updateIfNeeded),
  3214. state = 2
  3215. );
  3216. };
  3217. }
  3218. // APPLICATION
  3219. function _Browser_application(impl)
  3220. {
  3221. var onUrlChange = impl.onUrlChange;
  3222. var onUrlRequest = impl.onUrlRequest;
  3223. var key = function() { key.a(onUrlChange(_Browser_getUrl())); };
  3224. return _Browser_document({
  3225. setup: function(sendToApp)
  3226. {
  3227. key.a = sendToApp;
  3228. _Browser_window.addEventListener('popstate', key);
  3229. _Browser_window.navigator.userAgent.indexOf('Trident') < 0 || _Browser_window.addEventListener('hashchange', key);
  3230. return F2(function(domNode, event)
  3231. {
  3232. if (!event.ctrlKey && !event.metaKey && !event.shiftKey && event.button < 1 && !domNode.target && !domNode.hasAttribute('download'))
  3233. {
  3234. event.preventDefault();
  3235. var href = domNode.href;
  3236. var curr = _Browser_getUrl();
  3237. var next = $elm$url$Url$fromString(href).a;
  3238. sendToApp(onUrlRequest(
  3239. (next
  3240. && curr.protocol === next.protocol
  3241. && curr.host === next.host
  3242. && curr.port_.a === next.port_.a
  3243. )
  3244. ? $elm$browser$Browser$Internal(next)
  3245. : $elm$browser$Browser$External(href)
  3246. ));
  3247. }
  3248. });
  3249. },
  3250. init: function(flags)
  3251. {
  3252. return A3(impl.init, flags, _Browser_getUrl(), key);
  3253. },
  3254. view: impl.view,
  3255. update: impl.update,
  3256. subscriptions: impl.subscriptions
  3257. });
  3258. }
  3259. function _Browser_getUrl()
  3260. {
  3261. return $elm$url$Url$fromString(_VirtualDom_doc.location.href).a || _Debug_crash(1);
  3262. }
  3263. var _Browser_go = F2(function(key, n)
  3264. {
  3265. return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() {
  3266. n && history.go(n);
  3267. key();
  3268. }));
  3269. });
  3270. var _Browser_pushUrl = F2(function(key, url)
  3271. {
  3272. return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() {
  3273. history.pushState({}, '', url);
  3274. key();
  3275. }));
  3276. });
  3277. var _Browser_replaceUrl = F2(function(key, url)
  3278. {
  3279. return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() {
  3280. history.replaceState({}, '', url);
  3281. key();
  3282. }));
  3283. });
  3284. // GLOBAL EVENTS
  3285. var _Browser_fakeNode = { addEventListener: function() {}, removeEventListener: function() {} };
  3286. var _Browser_doc = typeof document !== 'undefined' ? document : _Browser_fakeNode;
  3287. var _Browser_window = typeof window !== 'undefined' ? window : _Browser_fakeNode;
  3288. var _Browser_on = F3(function(node, eventName, sendToSelf)
  3289. {
  3290. return _Scheduler_spawn(_Scheduler_binding(function(callback)
  3291. {
  3292. function handler(event) { _Scheduler_rawSpawn(sendToSelf(event)); }
  3293. node.addEventListener(eventName, handler, _VirtualDom_passiveSupported && { passive: true });
  3294. return function() { node.removeEventListener(eventName, handler); };
  3295. }));
  3296. });
  3297. var _Browser_decodeEvent = F2(function(decoder, event)
  3298. {
  3299. var result = _Json_runHelp(decoder, event);
  3300. return $elm$core$Result$isOk(result) ? $elm$core$Maybe$Just(result.a) : $elm$core$Maybe$Nothing;
  3301. });
  3302. // PAGE VISIBILITY
  3303. function _Browser_visibilityInfo()
  3304. {
  3305. return (typeof _VirtualDom_doc.hidden !== 'undefined')
  3306. ? { hidden: 'hidden', change: 'visibilitychange' }
  3307. :
  3308. (typeof _VirtualDom_doc.mozHidden !== 'undefined')
  3309. ? { hidden: 'mozHidden', change: 'mozvisibilitychange' }
  3310. :
  3311. (typeof _VirtualDom_doc.msHidden !== 'undefined')
  3312. ? { hidden: 'msHidden', change: 'msvisibilitychange' }
  3313. :
  3314. (typeof _VirtualDom_doc.webkitHidden !== 'undefined')
  3315. ? { hidden: 'webkitHidden', change: 'webkitvisibilitychange' }
  3316. : { hidden: 'hidden', change: 'visibilitychange' };
  3317. }
  3318. // ANIMATION FRAMES
  3319. function _Browser_rAF()
  3320. {
  3321. return _Scheduler_binding(function(callback)
  3322. {
  3323. var id = _Browser_requestAnimationFrame(function() {
  3324. callback(_Scheduler_succeed(Date.now()));
  3325. });
  3326. return function() {
  3327. _Browser_cancelAnimationFrame(id);
  3328. };
  3329. });
  3330. }
  3331. function _Browser_now()
  3332. {
  3333. return _Scheduler_binding(function(callback)
  3334. {
  3335. callback(_Scheduler_succeed(Date.now()));
  3336. });
  3337. }
  3338. // DOM STUFF
  3339. function _Browser_withNode(id, doStuff)
  3340. {
  3341. return _Scheduler_binding(function(callback)
  3342. {
  3343. _Browser_requestAnimationFrame(function() {
  3344. var node = document.getElementById(id);
  3345. callback(node
  3346. ? _Scheduler_succeed(doStuff(node))
  3347. : _Scheduler_fail($elm$browser$Browser$Dom$NotFound(id))
  3348. );
  3349. });
  3350. });
  3351. }
  3352. function _Browser_withWindow(doStuff)
  3353. {
  3354. return _Scheduler_binding(function(callback)
  3355. {
  3356. _Browser_requestAnimationFrame(function() {
  3357. callback(_Scheduler_succeed(doStuff()));
  3358. });
  3359. });
  3360. }
  3361. // FOCUS and BLUR
  3362. var _Browser_call = F2(function(functionName, id)
  3363. {
  3364. return _Browser_withNode(id, function(node) {
  3365. node[functionName]();
  3366. return _Utils_Tuple0;
  3367. });
  3368. });
  3369. // WINDOW VIEWPORT
  3370. function _Browser_getViewport()
  3371. {
  3372. return {
  3373. scene: _Browser_getScene(),
  3374. viewport: {
  3375. x: _Browser_window.pageXOffset,
  3376. y: _Browser_window.pageYOffset,
  3377. width: _Browser_doc.documentElement.clientWidth,
  3378. height: _Browser_doc.documentElement.clientHeight
  3379. }
  3380. };
  3381. }
  3382. function _Browser_getScene()
  3383. {
  3384. var body = _Browser_doc.body;
  3385. var elem = _Browser_doc.documentElement;
  3386. return {
  3387. width: Math.max(body.scrollWidth, body.offsetWidth, elem.scrollWidth, elem.offsetWidth, elem.clientWidth),
  3388. height: Math.max(body.scrollHeight, body.offsetHeight, elem.scrollHeight, elem.offsetHeight, elem.clientHeight)
  3389. };
  3390. }
  3391. var _Browser_setViewport = F2(function(x, y)
  3392. {
  3393. return _Browser_withWindow(function()
  3394. {
  3395. _Browser_window.scroll(x, y);
  3396. return _Utils_Tuple0;
  3397. });
  3398. });
  3399. // ELEMENT VIEWPORT
  3400. function _Browser_getViewportOf(id)
  3401. {
  3402. return _Browser_withNode(id, function(node)
  3403. {
  3404. return {
  3405. scene: {
  3406. width: node.scrollWidth,
  3407. height: node.scrollHeight
  3408. },
  3409. viewport: {
  3410. x: node.scrollLeft,
  3411. y: node.scrollTop,
  3412. width: node.clientWidth,
  3413. height: node.clientHeight
  3414. }
  3415. };
  3416. });
  3417. }
  3418. var _Browser_setViewportOf = F3(function(id, x, y)
  3419. {
  3420. return _Browser_withNode(id, function(node)
  3421. {
  3422. node.scrollLeft = x;
  3423. node.scrollTop = y;
  3424. return _Utils_Tuple0;
  3425. });
  3426. });
  3427. // ELEMENT
  3428. function _Browser_getElement(id)
  3429. {
  3430. return _Browser_withNode(id, function(node)
  3431. {
  3432. var rect = node.getBoundingClientRect();
  3433. var x = _Browser_window.pageXOffset;
  3434. var y = _Browser_window.pageYOffset;
  3435. return {
  3436. scene: _Browser_getScene(),
  3437. viewport: {
  3438. x: x,
  3439. y: y,
  3440. width: _Browser_doc.documentElement.clientWidth,
  3441. height: _Browser_doc.documentElement.clientHeight
  3442. },
  3443. element: {
  3444. x: x + rect.left,
  3445. y: y + rect.top,
  3446. width: rect.width,
  3447. height: rect.height
  3448. }
  3449. };
  3450. });
  3451. }
  3452. // LOAD and RELOAD
  3453. function _Browser_reload(skipCache)
  3454. {
  3455. return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback)
  3456. {
  3457. _VirtualDom_doc.location.reload(skipCache);
  3458. }));
  3459. }
  3460. function _Browser_load(url)
  3461. {
  3462. return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback)
  3463. {
  3464. try
  3465. {
  3466. _Browser_window.location = url;
  3467. }
  3468. catch(err)
  3469. {
  3470. // Only Firefox can throw a NS_ERROR_MALFORMED_URI exception here.
  3471. // Other browsers reload the page, so let's be consistent about that.
  3472. _VirtualDom_doc.location.reload(false);
  3473. }
  3474. }));
  3475. }
  3476. var $author$project$Main$init = {
  3477. character: {
  3478. abilities: {cha: 10, con: 10, dex: 10, _int: 10, str: 10, wis: 10},
  3479. name: 'Skadi the Brave'
  3480. },
  3481. name: 'STR',
  3482. val: 10
  3483. };
  3484. var $elm$core$Basics$EQ = {$: 'EQ'};
  3485. var $elm$core$Basics$GT = {$: 'GT'};
  3486. var $elm$core$Basics$LT = {$: 'LT'};
  3487. var $elm$core$List$cons = _List_cons;
  3488. var $elm$core$Dict$foldr = F3(
  3489. function (func, acc, t) {
  3490. foldr:
  3491. while (true) {
  3492. if (t.$ === 'RBEmpty_elm_builtin') {
  3493. return acc;
  3494. } else {
  3495. var key = t.b;
  3496. var value = t.c;
  3497. var left = t.d;
  3498. var right = t.e;
  3499. var $temp$func = func,
  3500. $temp$acc = A3(
  3501. func,
  3502. key,
  3503. value,
  3504. A3($elm$core$Dict$foldr, func, acc, right)),
  3505. $temp$t = left;
  3506. func = $temp$func;
  3507. acc = $temp$acc;
  3508. t = $temp$t;
  3509. continue foldr;
  3510. }
  3511. }
  3512. });
  3513. var $elm$core$Dict$toList = function (dict) {
  3514. return A3(
  3515. $elm$core$Dict$foldr,
  3516. F3(
  3517. function (key, value, list) {
  3518. return A2(
  3519. $elm$core$List$cons,
  3520. _Utils_Tuple2(key, value),
  3521. list);
  3522. }),
  3523. _List_Nil,
  3524. dict);
  3525. };
  3526. var $elm$core$Dict$keys = function (dict) {
  3527. return A3(
  3528. $elm$core$Dict$foldr,
  3529. F3(
  3530. function (key, value, keyList) {
  3531. return A2($elm$core$List$cons, key, keyList);
  3532. }),
  3533. _List_Nil,
  3534. dict);
  3535. };
  3536. var $elm$core$Set$toList = function (_v0) {
  3537. var dict = _v0.a;
  3538. return $elm$core$Dict$keys(dict);
  3539. };
  3540. var $elm$core$Elm$JsArray$foldr = _JsArray_foldr;
  3541. var $elm$core$Array$foldr = F3(
  3542. function (func, baseCase, _v0) {
  3543. var tree = _v0.c;
  3544. var tail = _v0.d;
  3545. var helper = F2(
  3546. function (node, acc) {
  3547. if (node.$ === 'SubTree') {
  3548. var subTree = node.a;
  3549. return A3($elm$core$Elm$JsArray$foldr, helper, acc, subTree);
  3550. } else {
  3551. var values = node.a;
  3552. return A3($elm$core$Elm$JsArray$foldr, func, acc, values);
  3553. }
  3554. });
  3555. return A3(
  3556. $elm$core$Elm$JsArray$foldr,
  3557. helper,
  3558. A3($elm$core$Elm$JsArray$foldr, func, baseCase, tail),
  3559. tree);
  3560. });
  3561. var $elm$core$Array$toList = function (array) {
  3562. return A3($elm$core$Array$foldr, $elm$core$List$cons, _List_Nil, array);
  3563. };
  3564. var $elm$core$Result$Err = function (a) {
  3565. return {$: 'Err', a: a};
  3566. };
  3567. var $elm$json$Json$Decode$Failure = F2(
  3568. function (a, b) {
  3569. return {$: 'Failure', a: a, b: b};
  3570. });
  3571. var $elm$json$Json$Decode$Field = F2(
  3572. function (a, b) {
  3573. return {$: 'Field', a: a, b: b};
  3574. });
  3575. var $elm$json$Json$Decode$Index = F2(
  3576. function (a, b) {
  3577. return {$: 'Index', a: a, b: b};
  3578. });
  3579. var $elm$core$Result$Ok = function (a) {
  3580. return {$: 'Ok', a: a};
  3581. };
  3582. var $elm$json$Json$Decode$OneOf = function (a) {
  3583. return {$: 'OneOf', a: a};
  3584. };
  3585. var $elm$core$Basics$False = {$: 'False'};
  3586. var $elm$core$Basics$add = _Basics_add;
  3587. var $elm$core$Maybe$Just = function (a) {
  3588. return {$: 'Just', a: a};
  3589. };
  3590. var $elm$core$Maybe$Nothing = {$: 'Nothing'};
  3591. var $elm$core$String$all = _String_all;
  3592. var $elm$core$Basics$and = _Basics_and;
  3593. var $elm$core$Basics$append = _Utils_append;
  3594. var $elm$json$Json$Encode$encode = _Json_encode;
  3595. var $elm$core$String$fromInt = _String_fromNumber;
  3596. var $elm$core$String$join = F2(
  3597. function (sep, chunks) {
  3598. return A2(
  3599. _String_join,
  3600. sep,
  3601. _List_toArray(chunks));
  3602. });
  3603. var $elm$core$String$split = F2(
  3604. function (sep, string) {
  3605. return _List_fromArray(
  3606. A2(_String_split, sep, string));
  3607. });
  3608. var $elm$json$Json$Decode$indent = function (str) {
  3609. return A2(
  3610. $elm$core$String$join,
  3611. '\n ',
  3612. A2($elm$core$String$split, '\n', str));
  3613. };
  3614. var $elm$core$List$foldl = F3(
  3615. function (func, acc, list) {
  3616. foldl:
  3617. while (true) {
  3618. if (!list.b) {
  3619. return acc;
  3620. } else {
  3621. var x = list.a;
  3622. var xs = list.b;
  3623. var $temp$func = func,
  3624. $temp$acc = A2(func, x, acc),
  3625. $temp$list = xs;
  3626. func = $temp$func;
  3627. acc = $temp$acc;
  3628. list = $temp$list;
  3629. continue foldl;
  3630. }
  3631. }
  3632. });
  3633. var $elm$core$List$length = function (xs) {
  3634. return A3(
  3635. $elm$core$List$foldl,
  3636. F2(
  3637. function (_v0, i) {
  3638. return i + 1;
  3639. }),
  3640. 0,
  3641. xs);
  3642. };
  3643. var $elm$core$List$map2 = _List_map2;
  3644. var $elm$core$Basics$le = _Utils_le;
  3645. var $elm$core$Basics$sub = _Basics_sub;
  3646. var $elm$core$List$rangeHelp = F3(
  3647. function (lo, hi, list) {
  3648. rangeHelp:
  3649. while (true) {
  3650. if (_Utils_cmp(lo, hi) < 1) {
  3651. var $temp$lo = lo,
  3652. $temp$hi = hi - 1,
  3653. $temp$list = A2($elm$core$List$cons, hi, list);
  3654. lo = $temp$lo;
  3655. hi = $temp$hi;
  3656. list = $temp$list;
  3657. continue rangeHelp;
  3658. } else {
  3659. return list;
  3660. }
  3661. }
  3662. });
  3663. var $elm$core$List$range = F2(
  3664. function (lo, hi) {
  3665. return A3($elm$core$List$rangeHelp, lo, hi, _List_Nil);
  3666. });
  3667. var $elm$core$List$indexedMap = F2(
  3668. function (f, xs) {
  3669. return A3(
  3670. $elm$core$List$map2,
  3671. f,
  3672. A2(
  3673. $elm$core$List$range,
  3674. 0,
  3675. $elm$core$List$length(xs) - 1),
  3676. xs);
  3677. });
  3678. var $elm$core$Char$toCode = _Char_toCode;
  3679. var $elm$core$Char$isLower = function (_char) {
  3680. var code = $elm$core$Char$toCode(_char);
  3681. return (97 <= code) && (code <= 122);
  3682. };
  3683. var $elm$core$Char$isUpper = function (_char) {
  3684. var code = $elm$core$Char$toCode(_char);
  3685. return (code <= 90) && (65 <= code);
  3686. };
  3687. var $elm$core$Basics$or = _Basics_or;
  3688. var $elm$core$Char$isAlpha = function (_char) {
  3689. return $elm$core$Char$isLower(_char) || $elm$core$Char$isUpper(_char);
  3690. };
  3691. var $elm$core$Char$isDigit = function (_char) {
  3692. var code = $elm$core$Char$toCode(_char);
  3693. return (code <= 57) && (48 <= code);
  3694. };
  3695. var $elm$core$Char$isAlphaNum = function (_char) {
  3696. return $elm$core$Char$isLower(_char) || ($elm$core$Char$isUpper(_char) || $elm$core$Char$isDigit(_char));
  3697. };
  3698. var $elm$core$List$reverse = function (list) {
  3699. return A3($elm$core$List$foldl, $elm$core$List$cons, _List_Nil, list);
  3700. };
  3701. var $elm$core$String$uncons = _String_uncons;
  3702. var $elm$json$Json$Decode$errorOneOf = F2(
  3703. function (i, error) {
  3704. return '\n\n(' + ($elm$core$String$fromInt(i + 1) + (') ' + $elm$json$Json$Decode$indent(
  3705. $elm$json$Json$Decode$errorToString(error))));
  3706. });
  3707. var $elm$json$Json$Decode$errorToString = function (error) {
  3708. return A2($elm$json$Json$Decode$errorToStringHelp, error, _List_Nil);
  3709. };
  3710. var $elm$json$Json$Decode$errorToStringHelp = F2(
  3711. function (error, context) {
  3712. errorToStringHelp:
  3713. while (true) {
  3714. switch (error.$) {
  3715. case 'Field':
  3716. var f = error.a;
  3717. var err = error.b;
  3718. var isSimple = function () {
  3719. var _v1 = $elm$core$String$uncons(f);
  3720. if (_v1.$ === 'Nothing') {
  3721. return false;
  3722. } else {
  3723. var _v2 = _v1.a;
  3724. var _char = _v2.a;
  3725. var rest = _v2.b;
  3726. return $elm$core$Char$isAlpha(_char) && A2($elm$core$String$all, $elm$core$Char$isAlphaNum, rest);
  3727. }
  3728. }();
  3729. var fieldName = isSimple ? ('.' + f) : ('[\'' + (f + '\']'));
  3730. var $temp$error = err,
  3731. $temp$context = A2($elm$core$List$cons, fieldName, context);
  3732. error = $temp$error;
  3733. context = $temp$context;
  3734. continue errorToStringHelp;
  3735. case 'Index':
  3736. var i = error.a;
  3737. var err = error.b;
  3738. var indexName = '[' + ($elm$core$String$fromInt(i) + ']');
  3739. var $temp$error = err,
  3740. $temp$context = A2($elm$core$List$cons, indexName, context);
  3741. error = $temp$error;
  3742. context = $temp$context;
  3743. continue errorToStringHelp;
  3744. case 'OneOf':
  3745. var errors = error.a;
  3746. if (!errors.b) {
  3747. return 'Ran into a Json.Decode.oneOf with no possibilities' + function () {
  3748. if (!context.b) {
  3749. return '!';
  3750. } else {
  3751. return ' at json' + A2(
  3752. $elm$core$String$join,
  3753. '',
  3754. $elm$core$List$reverse(context));
  3755. }
  3756. }();
  3757. } else {
  3758. if (!errors.b.b) {
  3759. var err = errors.a;
  3760. var $temp$error = err,
  3761. $temp$context = context;
  3762. error = $temp$error;
  3763. context = $temp$context;
  3764. continue errorToStringHelp;
  3765. } else {
  3766. var starter = function () {
  3767. if (!context.b) {
  3768. return 'Json.Decode.oneOf';
  3769. } else {
  3770. return 'The Json.Decode.oneOf at json' + A2(
  3771. $elm$core$String$join,
  3772. '',
  3773. $elm$core$List$reverse(context));
  3774. }
  3775. }();
  3776. var introduction = starter + (' failed in the following ' + ($elm$core$String$fromInt(
  3777. $elm$core$List$length(errors)) + ' ways:'));
  3778. return A2(
  3779. $elm$core$String$join,
  3780. '\n\n',
  3781. A2(
  3782. $elm$core$List$cons,
  3783. introduction,
  3784. A2($elm$core$List$indexedMap, $elm$json$Json$Decode$errorOneOf, errors)));
  3785. }
  3786. }
  3787. default:
  3788. var msg = error.a;
  3789. var json = error.b;
  3790. var introduction = function () {
  3791. if (!context.b) {
  3792. return 'Problem with the given value:\n\n';
  3793. } else {
  3794. return 'Problem with the value at json' + (A2(
  3795. $elm$core$String$join,
  3796. '',
  3797. $elm$core$List$reverse(context)) + ':\n\n ');
  3798. }
  3799. }();
  3800. return introduction + ($elm$json$Json$Decode$indent(
  3801. A2($elm$json$Json$Encode$encode, 4, json)) + ('\n\n' + msg));
  3802. }
  3803. }
  3804. });
  3805. var $elm$core$Array$branchFactor = 32;
  3806. var $elm$core$Array$Array_elm_builtin = F4(
  3807. function (a, b, c, d) {
  3808. return {$: 'Array_elm_builtin', a: a, b: b, c: c, d: d};
  3809. });
  3810. var $elm$core$Elm$JsArray$empty = _JsArray_empty;
  3811. var $elm$core$Basics$ceiling = _Basics_ceiling;
  3812. var $elm$core$Basics$fdiv = _Basics_fdiv;
  3813. var $elm$core$Basics$logBase = F2(
  3814. function (base, number) {
  3815. return _Basics_log(number) / _Basics_log(base);
  3816. });
  3817. var $elm$core$Basics$toFloat = _Basics_toFloat;
  3818. var $elm$core$Array$shiftStep = $elm$core$Basics$ceiling(
  3819. A2($elm$core$Basics$logBase, 2, $elm$core$Array$branchFactor));
  3820. var $elm$core$Array$empty = A4($elm$core$Array$Array_elm_builtin, 0, $elm$core$Array$shiftStep, $elm$core$Elm$JsArray$empty, $elm$core$Elm$JsArray$empty);
  3821. var $elm$core$Elm$JsArray$initialize = _JsArray_initialize;
  3822. var $elm$core$Array$Leaf = function (a) {
  3823. return {$: 'Leaf', a: a};
  3824. };
  3825. var $elm$core$Basics$apL = F2(
  3826. function (f, x) {
  3827. return f(x);
  3828. });
  3829. var $elm$core$Basics$apR = F2(
  3830. function (x, f) {
  3831. return f(x);
  3832. });
  3833. var $elm$core$Basics$eq = _Utils_equal;
  3834. var $elm$core$Basics$floor = _Basics_floor;
  3835. var $elm$core$Elm$JsArray$length = _JsArray_length;
  3836. var $elm$core$Basics$gt = _Utils_gt;
  3837. var $elm$core$Basics$max = F2(
  3838. function (x, y) {
  3839. return (_Utils_cmp(x, y) > 0) ? x : y;
  3840. });
  3841. var $elm$core$Basics$mul = _Basics_mul;
  3842. var $elm$core$Array$SubTree = function (a) {
  3843. return {$: 'SubTree', a: a};
  3844. };
  3845. var $elm$core$Elm$JsArray$initializeFromList = _JsArray_initializeFromList;
  3846. var $elm$core$Array$compressNodes = F2(
  3847. function (nodes, acc) {
  3848. compressNodes:
  3849. while (true) {
  3850. var _v0 = A2($elm$core$Elm$JsArray$initializeFromList, $elm$core$Array$branchFactor, nodes);
  3851. var node = _v0.a;
  3852. var remainingNodes = _v0.b;
  3853. var newAcc = A2(
  3854. $elm$core$List$cons,
  3855. $elm$core$Array$SubTree(node),
  3856. acc);
  3857. if (!remainingNodes.b) {
  3858. return $elm$core$List$reverse(newAcc);
  3859. } else {
  3860. var $temp$nodes = remainingNodes,
  3861. $temp$acc = newAcc;
  3862. nodes = $temp$nodes;
  3863. acc = $temp$acc;
  3864. continue compressNodes;
  3865. }
  3866. }
  3867. });
  3868. var $elm$core$Tuple$first = function (_v0) {
  3869. var x = _v0.a;
  3870. return x;
  3871. };
  3872. var $elm$core$Array$treeFromBuilder = F2(
  3873. function (nodeList, nodeListSize) {
  3874. treeFromBuilder:
  3875. while (true) {
  3876. var newNodeSize = $elm$core$Basics$ceiling(nodeListSize / $elm$core$Array$branchFactor);
  3877. if (newNodeSize === 1) {
  3878. return A2($elm$core$Elm$JsArray$initializeFromList, $elm$core$Array$branchFactor, nodeList).a;
  3879. } else {
  3880. var $temp$nodeList = A2($elm$core$Array$compressNodes, nodeList, _List_Nil),
  3881. $temp$nodeListSize = newNodeSize;
  3882. nodeList = $temp$nodeList;
  3883. nodeListSize = $temp$nodeListSize;
  3884. continue treeFromBuilder;
  3885. }
  3886. }
  3887. });
  3888. var $elm$core$Array$builderToArray = F2(
  3889. function (reverseNodeList, builder) {
  3890. if (!builder.nodeListSize) {
  3891. return A4(
  3892. $elm$core$Array$Array_elm_builtin,
  3893. $elm$core$Elm$JsArray$length(builder.tail),
  3894. $elm$core$Array$shiftStep,
  3895. $elm$core$Elm$JsArray$empty,
  3896. builder.tail);
  3897. } else {
  3898. var treeLen = builder.nodeListSize * $elm$core$Array$branchFactor;
  3899. var depth = $elm$core$Basics$floor(
  3900. A2($elm$core$Basics$logBase, $elm$core$Array$branchFactor, treeLen - 1));
  3901. var correctNodeList = reverseNodeList ? $elm$core$List$reverse(builder.nodeList) : builder.nodeList;
  3902. var tree = A2($elm$core$Array$treeFromBuilder, correctNodeList, builder.nodeListSize);
  3903. return A4(
  3904. $elm$core$Array$Array_elm_builtin,
  3905. $elm$core$Elm$JsArray$length(builder.tail) + treeLen,
  3906. A2($elm$core$Basics$max, 5, depth * $elm$core$Array$shiftStep),
  3907. tree,
  3908. builder.tail);
  3909. }
  3910. });
  3911. var $elm$core$Basics$idiv = _Basics_idiv;
  3912. var $elm$core$Basics$lt = _Utils_lt;
  3913. var $elm$core$Array$initializeHelp = F5(
  3914. function (fn, fromIndex, len, nodeList, tail) {
  3915. initializeHelp:
  3916. while (true) {
  3917. if (fromIndex < 0) {
  3918. return A2(
  3919. $elm$core$Array$builderToArray,
  3920. false,
  3921. {nodeList: nodeList, nodeListSize: (len / $elm$core$Array$branchFactor) | 0, tail: tail});
  3922. } else {
  3923. var leaf = $elm$core$Array$Leaf(
  3924. A3($elm$core$Elm$JsArray$initialize, $elm$core$Array$branchFactor, fromIndex, fn));
  3925. var $temp$fn = fn,
  3926. $temp$fromIndex = fromIndex - $elm$core$Array$branchFactor,
  3927. $temp$len = len,
  3928. $temp$nodeList = A2($elm$core$List$cons, leaf, nodeList),
  3929. $temp$tail = tail;
  3930. fn = $temp$fn;
  3931. fromIndex = $temp$fromIndex;
  3932. len = $temp$len;
  3933. nodeList = $temp$nodeList;
  3934. tail = $temp$tail;
  3935. continue initializeHelp;
  3936. }
  3937. }
  3938. });
  3939. var $elm$core$Basics$remainderBy = _Basics_remainderBy;
  3940. var $elm$core$Array$initialize = F2(
  3941. function (len, fn) {
  3942. if (len <= 0) {
  3943. return $elm$core$Array$empty;
  3944. } else {
  3945. var tailLen = len % $elm$core$Array$branchFactor;
  3946. var tail = A3($elm$core$Elm$JsArray$initialize, tailLen, len - tailLen, fn);
  3947. var initialFromIndex = (len - tailLen) - $elm$core$Array$branchFactor;
  3948. return A5($elm$core$Array$initializeHelp, fn, initialFromIndex, len, _List_Nil, tail);
  3949. }
  3950. });
  3951. var $elm$core$Basics$True = {$: 'True'};
  3952. var $elm$core$Result$isOk = function (result) {
  3953. if (result.$ === 'Ok') {
  3954. return true;
  3955. } else {
  3956. return false;
  3957. }
  3958. };
  3959. var $elm$json$Json$Decode$map = _Json_map1;
  3960. var $elm$json$Json$Decode$map2 = _Json_map2;
  3961. var $elm$json$Json$Decode$succeed = _Json_succeed;
  3962. var $elm$virtual_dom$VirtualDom$toHandlerInt = function (handler) {
  3963. switch (handler.$) {
  3964. case 'Normal':
  3965. return 0;
  3966. case 'MayStopPropagation':
  3967. return 1;
  3968. case 'MayPreventDefault':
  3969. return 2;
  3970. default:
  3971. return 3;
  3972. }
  3973. };
  3974. var $elm$browser$Browser$External = function (a) {
  3975. return {$: 'External', a: a};
  3976. };
  3977. var $elm$browser$Browser$Internal = function (a) {
  3978. return {$: 'Internal', a: a};
  3979. };
  3980. var $elm$core$Basics$identity = function (x) {
  3981. return x;
  3982. };
  3983. var $elm$browser$Browser$Dom$NotFound = function (a) {
  3984. return {$: 'NotFound', a: a};
  3985. };
  3986. var $elm$url$Url$Http = {$: 'Http'};
  3987. var $elm$url$Url$Https = {$: 'Https'};
  3988. var $elm$url$Url$Url = F6(
  3989. function (protocol, host, port_, path, query, fragment) {
  3990. return {fragment: fragment, host: host, path: path, port_: port_, protocol: protocol, query: query};
  3991. });
  3992. var $elm$core$String$contains = _String_contains;
  3993. var $elm$core$String$length = _String_length;
  3994. var $elm$core$String$slice = _String_slice;
  3995. var $elm$core$String$dropLeft = F2(
  3996. function (n, string) {
  3997. return (n < 1) ? string : A3(
  3998. $elm$core$String$slice,
  3999. n,
  4000. $elm$core$String$length(string),
  4001. string);
  4002. });
  4003. var $elm$core$String$indexes = _String_indexes;
  4004. var $elm$core$String$isEmpty = function (string) {
  4005. return string === '';
  4006. };
  4007. var $elm$core$String$left = F2(
  4008. function (n, string) {
  4009. return (n < 1) ? '' : A3($elm$core$String$slice, 0, n, string);
  4010. });
  4011. var $elm$core$String$toInt = _String_toInt;
  4012. var $elm$url$Url$chompBeforePath = F5(
  4013. function (protocol, path, params, frag, str) {
  4014. if ($elm$core$String$isEmpty(str) || A2($elm$core$String$contains, '@', str)) {
  4015. return $elm$core$Maybe$Nothing;
  4016. } else {
  4017. var _v0 = A2($elm$core$String$indexes, ':', str);
  4018. if (!_v0.b) {
  4019. return $elm$core$Maybe$Just(
  4020. A6($elm$url$Url$Url, protocol, str, $elm$core$Maybe$Nothing, path, params, frag));
  4021. } else {
  4022. if (!_v0.b.b) {
  4023. var i = _v0.a;
  4024. var _v1 = $elm$core$String$toInt(
  4025. A2($elm$core$String$dropLeft, i + 1, str));
  4026. if (_v1.$ === 'Nothing') {
  4027. return $elm$core$Maybe$Nothing;
  4028. } else {
  4029. var port_ = _v1;
  4030. return $elm$core$Maybe$Just(
  4031. A6(
  4032. $elm$url$Url$Url,
  4033. protocol,
  4034. A2($elm$core$String$left, i, str),
  4035. port_,
  4036. path,
  4037. params,
  4038. frag));
  4039. }
  4040. } else {
  4041. return $elm$core$Maybe$Nothing;
  4042. }
  4043. }
  4044. }
  4045. });
  4046. var $elm$url$Url$chompBeforeQuery = F4(
  4047. function (protocol, params, frag, str) {
  4048. if ($elm$core$String$isEmpty(str)) {
  4049. return $elm$core$Maybe$Nothing;
  4050. } else {
  4051. var _v0 = A2($elm$core$String$indexes, '/', str);
  4052. if (!_v0.b) {
  4053. return A5($elm$url$Url$chompBeforePath, protocol, '/', params, frag, str);
  4054. } else {
  4055. var i = _v0.a;
  4056. return A5(
  4057. $elm$url$Url$chompBeforePath,
  4058. protocol,
  4059. A2($elm$core$String$dropLeft, i, str),
  4060. params,
  4061. frag,
  4062. A2($elm$core$String$left, i, str));
  4063. }
  4064. }
  4065. });
  4066. var $elm$url$Url$chompBeforeFragment = F3(
  4067. function (protocol, frag, str) {
  4068. if ($elm$core$String$isEmpty(str)) {
  4069. return $elm$core$Maybe$Nothing;
  4070. } else {
  4071. var _v0 = A2($elm$core$String$indexes, '?', str);
  4072. if (!_v0.b) {
  4073. return A4($elm$url$Url$chompBeforeQuery, protocol, $elm$core$Maybe$Nothing, frag, str);
  4074. } else {
  4075. var i = _v0.a;
  4076. return A4(
  4077. $elm$url$Url$chompBeforeQuery,
  4078. protocol,
  4079. $elm$core$Maybe$Just(
  4080. A2($elm$core$String$dropLeft, i + 1, str)),
  4081. frag,
  4082. A2($elm$core$String$left, i, str));
  4083. }
  4084. }
  4085. });
  4086. var $elm$url$Url$chompAfterProtocol = F2(
  4087. function (protocol, str) {
  4088. if ($elm$core$String$isEmpty(str)) {
  4089. return $elm$core$Maybe$Nothing;
  4090. } else {
  4091. var _v0 = A2($elm$core$String$indexes, '#', str);
  4092. if (!_v0.b) {
  4093. return A3($elm$url$Url$chompBeforeFragment, protocol, $elm$core$Maybe$Nothing, str);
  4094. } else {
  4095. var i = _v0.a;
  4096. return A3(
  4097. $elm$url$Url$chompBeforeFragment,
  4098. protocol,
  4099. $elm$core$Maybe$Just(
  4100. A2($elm$core$String$dropLeft, i + 1, str)),
  4101. A2($elm$core$String$left, i, str));
  4102. }
  4103. }
  4104. });
  4105. var $elm$core$String$startsWith = _String_startsWith;
  4106. var $elm$url$Url$fromString = function (str) {
  4107. return A2($elm$core$String$startsWith, 'http://', str) ? A2(
  4108. $elm$url$Url$chompAfterProtocol,
  4109. $elm$url$Url$Http,
  4110. A2($elm$core$String$dropLeft, 7, str)) : (A2($elm$core$String$startsWith, 'https://', str) ? A2(
  4111. $elm$url$Url$chompAfterProtocol,
  4112. $elm$url$Url$Https,
  4113. A2($elm$core$String$dropLeft, 8, str)) : $elm$core$Maybe$Nothing);
  4114. };
  4115. var $elm$core$Basics$never = function (_v0) {
  4116. never:
  4117. while (true) {
  4118. var nvr = _v0.a;
  4119. var $temp$_v0 = nvr;
  4120. _v0 = $temp$_v0;
  4121. continue never;
  4122. }
  4123. };
  4124. var $elm$core$Task$Perform = function (a) {
  4125. return {$: 'Perform', a: a};
  4126. };
  4127. var $elm$core$Task$succeed = _Scheduler_succeed;
  4128. var $elm$core$Task$init = $elm$core$Task$succeed(_Utils_Tuple0);
  4129. var $elm$core$List$foldrHelper = F4(
  4130. function (fn, acc, ctr, ls) {
  4131. if (!ls.b) {
  4132. return acc;
  4133. } else {
  4134. var a = ls.a;
  4135. var r1 = ls.b;
  4136. if (!r1.b) {
  4137. return A2(fn, a, acc);
  4138. } else {
  4139. var b = r1.a;
  4140. var r2 = r1.b;
  4141. if (!r2.b) {
  4142. return A2(
  4143. fn,
  4144. a,
  4145. A2(fn, b, acc));
  4146. } else {
  4147. var c = r2.a;
  4148. var r3 = r2.b;
  4149. if (!r3.b) {
  4150. return A2(
  4151. fn,
  4152. a,
  4153. A2(
  4154. fn,
  4155. b,
  4156. A2(fn, c, acc)));
  4157. } else {
  4158. var d = r3.a;
  4159. var r4 = r3.b;
  4160. var res = (ctr > 500) ? A3(
  4161. $elm$core$List$foldl,
  4162. fn,
  4163. acc,
  4164. $elm$core$List$reverse(r4)) : A4($elm$core$List$foldrHelper, fn, acc, ctr + 1, r4);
  4165. return A2(
  4166. fn,
  4167. a,
  4168. A2(
  4169. fn,
  4170. b,
  4171. A2(
  4172. fn,
  4173. c,
  4174. A2(fn, d, res))));
  4175. }
  4176. }
  4177. }
  4178. }
  4179. });
  4180. var $elm$core$List$foldr = F3(
  4181. function (fn, acc, ls) {
  4182. return A4($elm$core$List$foldrHelper, fn, acc, 0, ls);
  4183. });
  4184. var $elm$core$List$map = F2(
  4185. function (f, xs) {
  4186. return A3(
  4187. $elm$core$List$foldr,
  4188. F2(
  4189. function (x, acc) {
  4190. return A2(
  4191. $elm$core$List$cons,
  4192. f(x),
  4193. acc);
  4194. }),
  4195. _List_Nil,
  4196. xs);
  4197. });
  4198. var $elm$core$Task$andThen = _Scheduler_andThen;
  4199. var $elm$core$Task$map = F2(
  4200. function (func, taskA) {
  4201. return A2(
  4202. $elm$core$Task$andThen,
  4203. function (a) {
  4204. return $elm$core$Task$succeed(
  4205. func(a));
  4206. },
  4207. taskA);
  4208. });
  4209. var $elm$core$Task$map2 = F3(
  4210. function (func, taskA, taskB) {
  4211. return A2(
  4212. $elm$core$Task$andThen,
  4213. function (a) {
  4214. return A2(
  4215. $elm$core$Task$andThen,
  4216. function (b) {
  4217. return $elm$core$Task$succeed(
  4218. A2(func, a, b));
  4219. },
  4220. taskB);
  4221. },
  4222. taskA);
  4223. });
  4224. var $elm$core$Task$sequence = function (tasks) {
  4225. return A3(
  4226. $elm$core$List$foldr,
  4227. $elm$core$Task$map2($elm$core$List$cons),
  4228. $elm$core$Task$succeed(_List_Nil),
  4229. tasks);
  4230. };
  4231. var $elm$core$Platform$sendToApp = _Platform_sendToApp;
  4232. var $elm$core$Task$spawnCmd = F2(
  4233. function (router, _v0) {
  4234. var task = _v0.a;
  4235. return _Scheduler_spawn(
  4236. A2(
  4237. $elm$core$Task$andThen,
  4238. $elm$core$Platform$sendToApp(router),
  4239. task));
  4240. });
  4241. var $elm$core$Task$onEffects = F3(
  4242. function (router, commands, state) {
  4243. return A2(
  4244. $elm$core$Task$map,
  4245. function (_v0) {
  4246. return _Utils_Tuple0;
  4247. },
  4248. $elm$core$Task$sequence(
  4249. A2(
  4250. $elm$core$List$map,
  4251. $elm$core$Task$spawnCmd(router),
  4252. commands)));
  4253. });
  4254. var $elm$core$Task$onSelfMsg = F3(
  4255. function (_v0, _v1, _v2) {
  4256. return $elm$core$Task$succeed(_Utils_Tuple0);
  4257. });
  4258. var $elm$core$Task$cmdMap = F2(
  4259. function (tagger, _v0) {
  4260. var task = _v0.a;
  4261. return $elm$core$Task$Perform(
  4262. A2($elm$core$Task$map, tagger, task));
  4263. });
  4264. _Platform_effectManagers['Task'] = _Platform_createManager($elm$core$Task$init, $elm$core$Task$onEffects, $elm$core$Task$onSelfMsg, $elm$core$Task$cmdMap);
  4265. var $elm$core$Task$command = _Platform_leaf('Task');
  4266. var $elm$core$Task$perform = F2(
  4267. function (toMessage, task) {
  4268. return $elm$core$Task$command(
  4269. $elm$core$Task$Perform(
  4270. A2($elm$core$Task$map, toMessage, task)));
  4271. });
  4272. var $elm$core$Platform$Cmd$batch = _Platform_batch;
  4273. var $elm$core$Platform$Cmd$none = $elm$core$Platform$Cmd$batch(_List_Nil);
  4274. var $elm$core$Platform$Sub$batch = _Platform_batch;
  4275. var $elm$core$Platform$Sub$none = $elm$core$Platform$Sub$batch(_List_Nil);
  4276. var $elm$browser$Browser$sandbox = function (impl) {
  4277. return _Browser_element(
  4278. {
  4279. init: function (_v0) {
  4280. return _Utils_Tuple2(impl.init, $elm$core$Platform$Cmd$none);
  4281. },
  4282. subscriptions: function (_v1) {
  4283. return $elm$core$Platform$Sub$none;
  4284. },
  4285. update: F2(
  4286. function (msg, model) {
  4287. return _Utils_Tuple2(
  4288. A2(impl.update, msg, model),
  4289. $elm$core$Platform$Cmd$none);
  4290. }),
  4291. view: impl.view
  4292. });
  4293. };
  4294. var $author$project$Main$Strength = {$: 'Strength'};
  4295. var $author$project$Main$changeAbi = F3(
  4296. function (abilities, abi, x) {
  4297. if (abi.$ === 'Strength') {
  4298. return {cha: 10, con: 10, dex: 10, _int: 10, str: abilities.str + x, wis: 10};
  4299. } else {
  4300. return abilities;
  4301. }
  4302. });
  4303. var $author$project$Main$changeAbilities = F2(
  4304. function (model, abilities) {
  4305. return {
  4306. character: {abilities: abilities, name: model.character.name},
  4307. name: model.name,
  4308. val: model.val
  4309. };
  4310. });
  4311. var $author$project$Main$changeVal = F2(
  4312. function (model, x) {
  4313. return {character: model.character, name: model.name, val: model.val + x};
  4314. });
  4315. var $elm$core$Basics$negate = function (n) {
  4316. return -n;
  4317. };
  4318. var $author$project$Main$update = F2(
  4319. function (msg, model) {
  4320. switch (msg.$) {
  4321. case 'Increment':
  4322. return A2($author$project$Main$changeVal, model, 1);
  4323. case 'Decrement':
  4324. return A2($author$project$Main$changeVal, model, -1);
  4325. case 'IncrementStr':
  4326. return A2(
  4327. $author$project$Main$changeAbilities,
  4328. model,
  4329. A3($author$project$Main$changeAbi, model.character.abilities, $author$project$Main$Strength, 1));
  4330. default:
  4331. return A2(
  4332. $author$project$Main$changeAbilities,
  4333. model,
  4334. A3($author$project$Main$changeAbi, model.character.abilities, $author$project$Main$Strength, -1));
  4335. }
  4336. });
  4337. var $author$project$Main$Decrement = {$: 'Decrement'};
  4338. var $author$project$Main$DecrementStr = {$: 'DecrementStr'};
  4339. var $author$project$Main$Increment = {$: 'Increment'};
  4340. var $author$project$Main$IncrementStr = {$: 'IncrementStr'};
  4341. var $elm$html$Html$button = _VirtualDom_node('button');
  4342. var $elm$html$Html$div = _VirtualDom_node('div');
  4343. var $elm$html$Html$hr = _VirtualDom_node('hr');
  4344. var $elm$virtual_dom$VirtualDom$Normal = function (a) {
  4345. return {$: 'Normal', a: a};
  4346. };
  4347. var $elm$virtual_dom$VirtualDom$on = _VirtualDom_on;
  4348. var $elm$html$Html$Events$on = F2(
  4349. function (event, decoder) {
  4350. return A2(
  4351. $elm$virtual_dom$VirtualDom$on,
  4352. event,
  4353. $elm$virtual_dom$VirtualDom$Normal(decoder));
  4354. });
  4355. var $elm$html$Html$Events$onClick = function (msg) {
  4356. return A2(
  4357. $elm$html$Html$Events$on,
  4358. 'click',
  4359. $elm$json$Json$Decode$succeed(msg));
  4360. };
  4361. var $elm$virtual_dom$VirtualDom$text = _VirtualDom_text;
  4362. var $elm$html$Html$text = $elm$virtual_dom$VirtualDom$text;
  4363. var $author$project$Main$view = function (model) {
  4364. return A2(
  4365. $elm$html$Html$div,
  4366. _List_Nil,
  4367. _List_fromArray(
  4368. [
  4369. A2(
  4370. $elm$html$Html$button,
  4371. _List_fromArray(
  4372. [
  4373. $elm$html$Html$Events$onClick($author$project$Main$Increment)
  4374. ]),
  4375. _List_fromArray(
  4376. [
  4377. $elm$html$Html$text('+')
  4378. ])),
  4379. A2(
  4380. $elm$html$Html$div,
  4381. _List_Nil,
  4382. _List_fromArray(
  4383. [
  4384. $elm$html$Html$text(
  4385. model.name + (':' + $elm$core$String$fromInt(model.val)))
  4386. ])),
  4387. A2(
  4388. $elm$html$Html$button,
  4389. _List_fromArray(
  4390. [
  4391. $elm$html$Html$Events$onClick($author$project$Main$Decrement)
  4392. ]),
  4393. _List_fromArray(
  4394. [
  4395. $elm$html$Html$text('-')
  4396. ])),
  4397. A2($elm$html$Html$hr, _List_Nil, _List_Nil),
  4398. A2(
  4399. $elm$html$Html$div,
  4400. _List_Nil,
  4401. _List_fromArray(
  4402. [
  4403. A2(
  4404. $elm$html$Html$div,
  4405. _List_Nil,
  4406. _List_fromArray(
  4407. [
  4408. $elm$html$Html$text(model.character.name)
  4409. ])),
  4410. A2(
  4411. $elm$html$Html$div,
  4412. _List_Nil,
  4413. _List_fromArray(
  4414. [
  4415. A2(
  4416. $elm$html$Html$button,
  4417. _List_fromArray(
  4418. [
  4419. $elm$html$Html$Events$onClick($author$project$Main$IncrementStr)
  4420. ]),
  4421. _List_fromArray(
  4422. [
  4423. $elm$html$Html$text('+')
  4424. ])),
  4425. A2(
  4426. $elm$html$Html$div,
  4427. _List_Nil,
  4428. _List_fromArray(
  4429. [
  4430. $elm$html$Html$text(
  4431. 'STR:' + $elm$core$String$fromInt(model.character.abilities.str))
  4432. ])),
  4433. A2(
  4434. $elm$html$Html$button,
  4435. _List_fromArray(
  4436. [
  4437. $elm$html$Html$Events$onClick($author$project$Main$DecrementStr)
  4438. ]),
  4439. _List_fromArray(
  4440. [
  4441. $elm$html$Html$text('-')
  4442. ]))
  4443. ])),
  4444. A2(
  4445. $elm$html$Html$div,
  4446. _List_Nil,
  4447. _List_fromArray(
  4448. [
  4449. $elm$html$Html$text(
  4450. 'DEX:' + $elm$core$String$fromInt(model.character.abilities.dex))
  4451. ])),
  4452. A2(
  4453. $elm$html$Html$div,
  4454. _List_Nil,
  4455. _List_fromArray(
  4456. [
  4457. $elm$html$Html$text(
  4458. 'CON:' + $elm$core$String$fromInt(model.character.abilities.con))
  4459. ])),
  4460. A2(
  4461. $elm$html$Html$div,
  4462. _List_Nil,
  4463. _List_fromArray(
  4464. [
  4465. $elm$html$Html$text(
  4466. 'INT:' + $elm$core$String$fromInt(model.character.abilities._int))
  4467. ])),
  4468. A2(
  4469. $elm$html$Html$div,
  4470. _List_Nil,
  4471. _List_fromArray(
  4472. [
  4473. $elm$html$Html$text(
  4474. 'WIS:' + $elm$core$String$fromInt(model.character.abilities.wis))
  4475. ])),
  4476. A2(
  4477. $elm$html$Html$div,
  4478. _List_Nil,
  4479. _List_fromArray(
  4480. [
  4481. $elm$html$Html$text(
  4482. 'CHA:' + $elm$core$String$fromInt(model.character.abilities.cha))
  4483. ]))
  4484. ]))
  4485. ]));
  4486. };
  4487. var $author$project$Main$main = $elm$browser$Browser$sandbox(
  4488. {init: $author$project$Main$init, update: $author$project$Main$update, view: $author$project$Main$view});
  4489. _Platform_export({'Main':{'init':$author$project$Main$main(
  4490. $elm$json$Json$Decode$succeed(_Utils_Tuple0))(0)}});}(this));
  4491. var app = Elm.Main.init({ node: document.getElementById("elm") });
  4492. }
  4493. catch (e)
  4494. {
  4495. // display initialization errors (e.g. bad flags, infinite recursion)
  4496. var header = document.createElement("h1");
  4497. header.style.fontFamily = "monospace";
  4498. header.innerText = "Initialization Error";
  4499. var pre = document.getElementById("elm");
  4500. document.body.insertBefore(header, pre);
  4501. pre.innerText = e;
  4502. throw e;
  4503. }
  4504. </script>
  4505. </body>
  4506. </html>