blockly_compressed.js 919 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125
  1. // Do not edit this file; automatically generated by build.py.
  2. 'use strict';
  3. var $jscomp = $jscomp || {};
  4. $jscomp.scope = {};
  5. var COMPILED = !0
  6. , goog = goog || {};
  7. goog.global = this || self;
  8. goog.isDef = function (a) {
  9. return void 0 !== a
  10. }
  11. ;
  12. goog.isString = function (a) {
  13. return "string" == typeof a
  14. }
  15. ;
  16. goog.isBoolean = function (a) {
  17. return "boolean" == typeof a
  18. }
  19. ;
  20. goog.isNumber = function (a) {
  21. return "number" == typeof a
  22. }
  23. ;
  24. goog.exportPath_ = function (a, b, c) {
  25. a = a.split(".");
  26. c = c || goog.global;
  27. a[0] in c || "undefined" == typeof c.execScript || c.execScript("var " + a[0]);
  28. for (var d; a.length && (d = a.shift());)
  29. a.length || void 0 === b ? c = c[d] && c[d] !== Object.prototype[d] ? c[d] : c[d] = {} : c[d] = b
  30. }
  31. ;
  32. goog.define = function (a, b) {
  33. var c = b;
  34. if (!COMPILED) {
  35. var d = goog.global.CLOSURE_UNCOMPILED_DEFINES
  36. , e = goog.global.CLOSURE_DEFINES;
  37. d && void 0 === d.nodeType && Object.prototype.hasOwnProperty.call(d, a) ? c = d[a] : e && void 0 === e.nodeType && Object.prototype.hasOwnProperty.call(e, a) && (c = e[a])
  38. }
  39. return c
  40. }
  41. ;
  42. goog.FEATURESET_YEAR = 2012;
  43. goog.DEBUG = !1;
  44. goog.LOCALE = "en";
  45. goog.TRUSTED_SITE = !0;
  46. goog.STRICT_MODE_COMPATIBLE = !1;
  47. goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG;
  48. goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1;
  49. goog.provide = function (a) {
  50. if (goog.isInModuleLoader_())
  51. throw Error("goog.provide cannot be used within a module.");
  52. if (!COMPILED && goog.isProvided_(a))
  53. throw Error('Namespace "' + a + '" already declared.');
  54. goog.constructNamespace_(a)
  55. }
  56. ;
  57. goog.constructNamespace_ = function (a, b) {
  58. if (!COMPILED) {
  59. delete goog.implicitNamespaces_[a];
  60. for (var c = a; (c = c.substring(0, c.lastIndexOf("."))) && !goog.getObjectByName(c);)
  61. goog.implicitNamespaces_[c] = !0
  62. }
  63. goog.exportPath_(a, b)
  64. }
  65. ;
  66. goog.getScriptNonce = function (a) {
  67. if (a && a != goog.global)
  68. return goog.getScriptNonce_(a.document);
  69. null === goog.cspNonce_ && (goog.cspNonce_ = goog.getScriptNonce_(goog.global.document));
  70. return goog.cspNonce_
  71. }
  72. ;
  73. goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/;
  74. goog.cspNonce_ = null;
  75. goog.getScriptNonce_ = function (a) {
  76. return (a = a.querySelector && a.querySelector("script[nonce]")) && (a = a.nonce || a.getAttribute("nonce")) && goog.NONCE_PATTERN_.test(a) ? a : ""
  77. }
  78. ;
  79. goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
  80. goog.module = function (a) {
  81. if ("string" !== typeof a || !a || -1 == a.search(goog.VALID_MODULE_RE_))
  82. throw Error("Invalid module identifier");
  83. if (!goog.isInGoogModuleLoader_())
  84. throw Error("Module " + a + " has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");
  85. if (goog.moduleLoaderState_.moduleName)
  86. throw Error("goog.module may only be called once per module.");
  87. goog.moduleLoaderState_.moduleName = a;
  88. if (!COMPILED) {
  89. if (goog.isProvided_(a))
  90. throw Error('Namespace "' + a + '" already declared.');
  91. delete goog.implicitNamespaces_[a]
  92. }
  93. }
  94. ;
  95. goog.module.get = function (a) {
  96. return goog.module.getInternal_(a)
  97. }
  98. ;
  99. goog.module.getInternal_ = function (a) {
  100. if (!COMPILED) {
  101. if (a in goog.loadedModules_)
  102. return goog.loadedModules_[a].exports;
  103. if (!goog.implicitNamespaces_[a])
  104. return a = goog.getObjectByName(a),
  105. null != a ? a : null
  106. }
  107. return null
  108. }
  109. ;
  110. goog.ModuleType = {
  111. ES6: "es6",
  112. GOOG: "goog"
  113. };
  114. goog.moduleLoaderState_ = null;
  115. goog.isInModuleLoader_ = function () {
  116. return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_()
  117. }
  118. ;
  119. goog.isInGoogModuleLoader_ = function () {
  120. return !!goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.GOOG
  121. }
  122. ;
  123. goog.isInEs6ModuleLoader_ = function () {
  124. if (goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.ES6)
  125. return !0;
  126. var a = goog.global.$jscomp;
  127. return a ? "function" != typeof a.getCurrentModulePath ? !1 : !!a.getCurrentModulePath() : !1
  128. }
  129. ;
  130. goog.module.declareLegacyNamespace = function () {
  131. if (!COMPILED && !goog.isInGoogModuleLoader_())
  132. throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");
  133. if (!COMPILED && !goog.moduleLoaderState_.moduleName)
  134. throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");
  135. goog.moduleLoaderState_.declareLegacyNamespace = !0
  136. }
  137. ;
  138. goog.declareModuleId = function (a) {
  139. if (!COMPILED) {
  140. if (!goog.isInEs6ModuleLoader_())
  141. throw Error("goog.declareModuleId may only be called from within an ES6 module");
  142. if (goog.moduleLoaderState_ && goog.moduleLoaderState_.moduleName)
  143. throw Error("goog.declareModuleId may only be called once per module.");
  144. if (a in goog.loadedModules_)
  145. throw Error('Module with namespace "' + a + '" already exists.');
  146. }
  147. if (goog.moduleLoaderState_)
  148. goog.moduleLoaderState_.moduleName = a;
  149. else {
  150. var b = goog.global.$jscomp;
  151. if (!b || "function" != typeof b.getCurrentModulePath)
  152. throw Error('Module with namespace "' + a + '" has been loaded incorrectly.');
  153. b = b.require(b.getCurrentModulePath());
  154. goog.loadedModules_[a] = {
  155. exports: b,
  156. type: goog.ModuleType.ES6,
  157. moduleId: a
  158. }
  159. }
  160. }
  161. ;
  162. goog.setTestOnly = function (a) {
  163. if (goog.DISALLOW_TEST_ONLY_CODE)
  164. throw a = a || "",
  165. Error("Importing test-only code into non-debug environment" + (a ? ": " + a : "."));
  166. }
  167. ;
  168. goog.forwardDeclare = function (a) { }
  169. ;
  170. COMPILED || (goog.isProvided_ = function (a) {
  171. return a in goog.loadedModules_ || !goog.implicitNamespaces_[a] && null != goog.getObjectByName(a)
  172. }
  173. ,
  174. goog.implicitNamespaces_ = {
  175. "goog.module": !0
  176. });
  177. goog.getObjectByName = function (a, b) {
  178. for (var c = a.split("."), d = b || goog.global, e = 0; e < c.length; e++)
  179. if (d = d[c[e]],
  180. null == d)
  181. return null;
  182. return d
  183. }
  184. ;
  185. goog.globalize = function (a, b) {
  186. var c = b || goog.global, d;
  187. for (d in a)
  188. c[d] = a[d]
  189. }
  190. ;
  191. goog.addDependency = function (a, b, c, d) {
  192. !COMPILED && goog.DEPENDENCIES_ENABLED && goog.debugLoader_.addDependency(a, b, c, d)
  193. }
  194. ;
  195. goog.ENABLE_DEBUG_LOADER = !0;
  196. goog.logToConsole_ = function (a) {
  197. goog.global.console && goog.global.console.error(a)
  198. }
  199. ;
  200. goog.require = function (a) {
  201. if (!COMPILED) {
  202. goog.ENABLE_DEBUG_LOADER && goog.debugLoader_.requested(a);
  203. if (goog.isProvided_(a)) {
  204. if (goog.isInModuleLoader_())
  205. return goog.module.getInternal_(a)
  206. } else if (goog.ENABLE_DEBUG_LOADER) {
  207. var b = goog.moduleLoaderState_;
  208. goog.moduleLoaderState_ = null;
  209. try {
  210. goog.debugLoader_.load_(a)
  211. } finally {
  212. goog.moduleLoaderState_ = b
  213. }
  214. }
  215. return null
  216. }
  217. }
  218. ;
  219. goog.requireType = function (a) {
  220. return {}
  221. }
  222. ;
  223. goog.basePath = "";
  224. goog.nullFunction = function () { }
  225. ;
  226. goog.abstractMethod = function () {
  227. throw Error("unimplemented abstract method");
  228. }
  229. ;
  230. goog.addSingletonGetter = function (a) {
  231. a.instance_ = void 0;
  232. a.getInstance = function () {
  233. if (a.instance_)
  234. return a.instance_;
  235. goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a);
  236. return a.instance_ = new a
  237. }
  238. }
  239. ;
  240. goog.instantiatedSingletons_ = [];
  241. goog.LOAD_MODULE_USING_EVAL = !0;
  242. goog.SEAL_MODULE_EXPORTS = goog.DEBUG;
  243. goog.loadedModules_ = {};
  244. goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
  245. goog.TRANSPILE = "detect";
  246. goog.ASSUME_ES_MODULES_TRANSPILED = !1;
  247. goog.TRANSPILE_TO_LANGUAGE = "";
  248. goog.TRANSPILER = "transpile.js";
  249. goog.hasBadLetScoping = null;
  250. goog.useSafari10Workaround = function () {
  251. if (null == goog.hasBadLetScoping) {
  252. try {
  253. var a = !eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";')
  254. } catch (b) {
  255. a = !1
  256. }
  257. goog.hasBadLetScoping = a
  258. }
  259. return goog.hasBadLetScoping
  260. }
  261. ;
  262. goog.workaroundSafari10EvalBug = function (a) {
  263. return "(function(){" + a + "\n;})();\n"
  264. }
  265. ;
  266. goog.loadModule = function (a) {
  267. var b = goog.moduleLoaderState_;
  268. try {
  269. goog.moduleLoaderState_ = {
  270. moduleName: "",
  271. declareLegacyNamespace: !1,
  272. type: goog.ModuleType.GOOG
  273. };
  274. if (goog.isFunction(a))
  275. var c = a.call(void 0, {});
  276. else if ("string" === typeof a)
  277. goog.useSafari10Workaround() && (a = goog.workaroundSafari10EvalBug(a)),
  278. c = goog.loadModuleFromSource_.call(void 0, a);
  279. else
  280. throw Error("Invalid module definition");
  281. var d = goog.moduleLoaderState_.moduleName;
  282. if ("string" === typeof d && d)
  283. goog.moduleLoaderState_.declareLegacyNamespace ? goog.constructNamespace_(d, c) : goog.SEAL_MODULE_EXPORTS && Object.seal && "object" == typeof c && null != c && Object.seal(c),
  284. goog.loadedModules_[d] = {
  285. exports: c,
  286. type: goog.ModuleType.GOOG,
  287. moduleId: goog.moduleLoaderState_.moduleName
  288. };
  289. else
  290. throw Error('Invalid module name "' + d + '"');
  291. } finally {
  292. goog.moduleLoaderState_ = b
  293. }
  294. }
  295. ;
  296. goog.loadModuleFromSource_ = function (a) {
  297. eval(a);
  298. return {}
  299. }
  300. ;
  301. goog.normalizePath_ = function (a) {
  302. a = a.split("/");
  303. for (var b = 0; b < a.length;)
  304. "." == a[b] ? a.splice(b, 1) : b && ".." == a[b] && a[b - 1] && ".." != a[b - 1] ? a.splice(--b, 2) : b++;
  305. return a.join("/")
  306. }
  307. ;
  308. goog.loadFileSync_ = function (a) {
  309. if (goog.global.CLOSURE_LOAD_FILE_SYNC)
  310. return goog.global.CLOSURE_LOAD_FILE_SYNC(a);
  311. try {
  312. var b = new goog.global.XMLHttpRequest;
  313. b.open("get", a, !1);
  314. b.send();
  315. return 0 == b.status || 200 == b.status ? b.responseText : null
  316. } catch (c) {
  317. return null
  318. }
  319. }
  320. ;
  321. goog.transpile_ = function (a, b, c) {
  322. var d = goog.global.$jscomp;
  323. d || (goog.global.$jscomp = d = {});
  324. var e = d.transpile;
  325. if (!e) {
  326. var f = goog.basePath + goog.TRANSPILER
  327. , g = goog.loadFileSync_(f);
  328. if (g) {
  329. (function () {
  330. (0,
  331. eval)(g + "\n//# sourceURL=" + f)
  332. }
  333. ).call(goog.global);
  334. if (goog.global.$gwtExport && goog.global.$gwtExport.$jscomp && !goog.global.$gwtExport.$jscomp.transpile)
  335. throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: ' + JSON.stringify(goog.global.$gwtExport));
  336. goog.global.$jscomp.transpile = goog.global.$gwtExport.$jscomp.transpile;
  337. d = goog.global.$jscomp;
  338. e = d.transpile
  339. }
  340. }
  341. e || (e = d.transpile = function (a, b) {
  342. goog.logToConsole_(b + " requires transpilation but no transpiler was found.");
  343. return a
  344. }
  345. );
  346. return e(a, b, c)
  347. }
  348. ;
  349. goog.typeOf = function (a) {
  350. var b = typeof a;
  351. if ("object" == b)
  352. if (a) {
  353. if (a instanceof Array)
  354. return "array";
  355. if (a instanceof Object)
  356. return b;
  357. var c = Object.prototype.toString.call(a);
  358. if ("[object Window]" == c)
  359. return "object";
  360. if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice"))
  361. return "array";
  362. if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call"))
  363. return "function"
  364. } else
  365. return "null";
  366. else if ("function" == b && "undefined" == typeof a.call)
  367. return "object";
  368. return b
  369. }
  370. ;
  371. goog.isNull = function (a) {
  372. return null === a
  373. }
  374. ;
  375. goog.isDefAndNotNull = function (a) {
  376. return null != a
  377. }
  378. ;
  379. goog.isArray = function (a) {
  380. return "array" == goog.typeOf(a)
  381. }
  382. ;
  383. goog.isArrayLike = function (a) {
  384. var b = goog.typeOf(a);
  385. return "array" == b || "object" == b && "number" == typeof a.length
  386. }
  387. ;
  388. goog.isDateLike = function (a) {
  389. return goog.isObject(a) && "function" == typeof a.getFullYear
  390. }
  391. ;
  392. goog.isFunction = function (a) {
  393. return "function" == goog.typeOf(a)
  394. }
  395. ;
  396. goog.isObject = function (a) {
  397. var b = typeof a;
  398. return "object" == b && null != a || "function" == b
  399. }
  400. ;
  401. goog.getUid = function (a) {
  402. return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_)
  403. }
  404. ;
  405. goog.hasUid = function (a) {
  406. return !!a[goog.UID_PROPERTY_]
  407. }
  408. ;
  409. goog.removeUid = function (a) {
  410. null !== a && "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_);
  411. try {
  412. delete a[goog.UID_PROPERTY_]
  413. } catch (b) { }
  414. }
  415. ;
  416. goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0);
  417. goog.uidCounter_ = 0;
  418. goog.getHashCode = goog.getUid;
  419. goog.removeHashCode = goog.removeUid;
  420. goog.cloneObject = function (a) {
  421. var b = goog.typeOf(a);
  422. if ("object" == b || "array" == b) {
  423. if ("function" === typeof a.clone)
  424. return a.clone();
  425. b = "array" == b ? [] : {};
  426. for (var c in a)
  427. b[c] = goog.cloneObject(a[c]);
  428. return b
  429. }
  430. return a
  431. }
  432. ;
  433. goog.bindNative_ = function (a, b, c) {
  434. return a.call.apply(a.bind, arguments)
  435. }
  436. ;
  437. goog.bindJs_ = function (a, b, c) {
  438. if (!a)
  439. throw Error();
  440. if (2 < arguments.length) {
  441. var d = Array.prototype.slice.call(arguments, 2);
  442. return function () {
  443. var c = Array.prototype.slice.call(arguments);
  444. Array.prototype.unshift.apply(c, d);
  445. return a.apply(b, c)
  446. }
  447. }
  448. return function () {
  449. return a.apply(b, arguments)
  450. }
  451. }
  452. ;
  453. goog.bind = function (a, b, c) {
  454. Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_;
  455. return goog.bind.apply(null, arguments)
  456. }
  457. ;
  458. goog.partial = function (a, b) {
  459. var c = Array.prototype.slice.call(arguments, 1);
  460. return function () {
  461. var b = c.slice();
  462. b.push.apply(b, arguments);
  463. return a.apply(this, b)
  464. }
  465. }
  466. ;
  467. goog.mixin = function (a, b) {
  468. for (var c in b)
  469. a[c] = b[c]
  470. }
  471. ;
  472. goog.now = goog.TRUSTED_SITE && Date.now || function () {
  473. return +new Date
  474. }
  475. ;
  476. goog.globalEval = function (a) {
  477. if (goog.global.execScript)
  478. goog.global.execScript(a, "JavaScript");
  479. else if (goog.global.eval) {
  480. if (null == goog.evalWorksForGlobals_) {
  481. try {
  482. goog.global.eval("var _evalTest_ = 1;")
  483. } catch (d) { }
  484. if ("undefined" != typeof goog.global._evalTest_) {
  485. try {
  486. delete goog.global._evalTest_
  487. } catch (d) { }
  488. goog.evalWorksForGlobals_ = !0
  489. } else
  490. goog.evalWorksForGlobals_ = !1
  491. }
  492. if (goog.evalWorksForGlobals_)
  493. goog.global.eval(a);
  494. else {
  495. var b = goog.global.document
  496. , c = b.createElement("script");
  497. c.type = "text/javascript";
  498. c.defer = !1;
  499. c.appendChild(b.createTextNode(a));
  500. b.head.appendChild(c);
  501. b.head.removeChild(c)
  502. }
  503. } else
  504. throw Error("goog.globalEval not available");
  505. }
  506. ;
  507. goog.evalWorksForGlobals_ = null;
  508. goog.getCssName = function (a, b) {
  509. if ("." == String(a).charAt(0))
  510. throw Error('className passed in goog.getCssName must not start with ".". You passed: ' + a);
  511. var c = function (a) {
  512. return goog.cssNameMapping_[a] || a
  513. }
  514. , d = function (a) {
  515. a = a.split("-");
  516. for (var b = [], d = 0; d < a.length; d++)
  517. b.push(c(a[d]));
  518. return b.join("-")
  519. };
  520. d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function (a) {
  521. return a
  522. }
  523. ;
  524. d = b ? a + "-" + d(b) : d(a);
  525. return goog.global.CLOSURE_CSS_NAME_MAP_FN ? goog.global.CLOSURE_CSS_NAME_MAP_FN(d) : d
  526. }
  527. ;
  528. goog.setCssNameMapping = function (a, b) {
  529. goog.cssNameMapping_ = a;
  530. goog.cssNameMappingStyle_ = b
  531. }
  532. ;
  533. !COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING);
  534. goog.getMsg = function (a, b, c) {
  535. c && c.html && (a = a.replace(/</g, "&lt;"));
  536. b && (a = a.replace(/\{\$([^}]+)}/g, function (a, c) {
  537. return null != b && c in b ? b[c] : a
  538. }));
  539. return a
  540. }
  541. ;
  542. goog.getMsgWithFallback = function (a, b) {
  543. return a
  544. }
  545. ;
  546. goog.exportSymbol = function (a, b, c) {
  547. goog.exportPath_(a, b, c)
  548. }
  549. ;
  550. goog.exportProperty = function (a, b, c) {
  551. a[b] = c
  552. }
  553. ;
  554. goog.inherits = function (a, b) {
  555. function c() { }
  556. c.prototype = b.prototype;
  557. a.superClass_ = b.prototype;
  558. a.prototype = new c;
  559. a.prototype.constructor = a;
  560. a.base = function (a, c, f) {
  561. for (var d = Array(arguments.length - 2), e = 2; e < arguments.length; e++)
  562. d[e - 2] = arguments[e];
  563. return b.prototype[c].apply(a, d)
  564. }
  565. }
  566. ;
  567. goog.base = function (a, b, c) {
  568. var d = arguments.callee.caller;
  569. if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d)
  570. throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");
  571. if ("undefined" !== typeof d.superClass_) {
  572. for (var e = Array(arguments.length - 1), f = 1; f < arguments.length; f++)
  573. e[f - 1] = arguments[f];
  574. return d.superClass_.constructor.apply(a, e)
  575. }
  576. if ("string" != typeof b && "symbol" != typeof b)
  577. throw Error("method names provided to goog.base must be a string or a symbol");
  578. e = Array(arguments.length - 2);
  579. for (f = 2; f < arguments.length; f++)
  580. e[f - 2] = arguments[f];
  581. f = !1;
  582. for (var g = a.constructor.prototype; g; g = Object.getPrototypeOf(g))
  583. if (g[b] === d)
  584. f = !0;
  585. else if (f)
  586. return g[b].apply(a, e);
  587. if (a[b] === d)
  588. return a.constructor.prototype[b].apply(a, e);
  589. throw Error("goog.base called from a method of one name to a method of a different name");
  590. }
  591. ;
  592. goog.scope = function (a) {
  593. if (goog.isInModuleLoader_())
  594. throw Error("goog.scope is not supported within a module.");
  595. a.call(goog.global)
  596. }
  597. ;
  598. COMPILED || (goog.global.COMPILED = COMPILED);
  599. goog.defineClass = function (a, b) {
  600. var c = b.constructor
  601. , d = b.statics;
  602. c && c != Object.prototype.constructor || (c = function () {
  603. throw Error("cannot instantiate an interface (no constructor defined).");
  604. }
  605. );
  606. c = goog.defineClass.createSealingConstructor_(c, a);
  607. a && goog.inherits(c, a);
  608. delete b.constructor;
  609. delete b.statics;
  610. goog.defineClass.applyProperties_(c.prototype, b);
  611. null != d && (d instanceof Function ? d(c) : goog.defineClass.applyProperties_(c, d));
  612. return c
  613. }
  614. ;
  615. goog.defineClass.SEAL_CLASS_INSTANCES = goog.DEBUG;
  616. goog.defineClass.createSealingConstructor_ = function (a, b) {
  617. if (!goog.defineClass.SEAL_CLASS_INSTANCES)
  618. return a;
  619. var c = !goog.defineClass.isUnsealable_(b)
  620. , d = function () {
  621. var b = a.apply(this, arguments) || this;
  622. b[goog.UID_PROPERTY_] = b[goog.UID_PROPERTY_];
  623. this.constructor === d && c && Object.seal instanceof Function && Object.seal(b);
  624. return b
  625. };
  626. return d
  627. }
  628. ;
  629. goog.defineClass.isUnsealable_ = function (a) {
  630. return a && a.prototype && a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]
  631. }
  632. ;
  633. goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
  634. goog.defineClass.applyProperties_ = function (a, b) {
  635. for (var c in b)
  636. Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);
  637. for (var d = 0; d < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; d++)
  638. c = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d],
  639. Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c])
  640. }
  641. ;
  642. goog.tagUnsealableClass = function (a) {
  643. !COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES && (a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = !0)
  644. }
  645. ;
  646. goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = "goog_defineClass_legacy_unsealable";
  647. !COMPILED && goog.DEPENDENCIES_ENABLED && (goog.inHtmlDocument_ = function () {
  648. var a = goog.global.document;
  649. return null != a && "write" in a
  650. }
  651. ,
  652. goog.isDocumentLoading_ = function () {
  653. var a = goog.global.document;
  654. return a.attachEvent ? "complete" != a.readyState : "loading" == a.readyState
  655. }
  656. ,
  657. goog.findBasePath_ = function () {
  658. if (void 0 != goog.global.CLOSURE_BASE_PATH && "string" === typeof goog.global.CLOSURE_BASE_PATH)
  659. goog.basePath = goog.global.CLOSURE_BASE_PATH;
  660. else if (goog.inHtmlDocument_()) {
  661. var a = goog.global.document
  662. , b = a.currentScript;
  663. a = b ? [b] : a.getElementsByTagName("SCRIPT");
  664. for (b = a.length - 1; 0 <= b; --b) {
  665. var c = a[b].src
  666. , d = c.lastIndexOf("?");
  667. d = -1 == d ? c.length : d;
  668. if ("base.js" == c.substr(d - 7, 7)) {
  669. goog.basePath = c.substr(0, d - 7);
  670. break
  671. }
  672. }
  673. }
  674. }
  675. ,
  676. goog.findBasePath_(),
  677. goog.Transpiler = function () {
  678. this.requiresTranspilation_ = null;
  679. this.transpilationTarget_ = goog.TRANSPILE_TO_LANGUAGE
  680. }
  681. ,
  682. goog.Transpiler.prototype.createRequiresTranspilation_ = function () {
  683. function a(a, b) {
  684. e ? d[a] = !0 : b() ? (c = a,
  685. d[a] = !1) : e = d[a] = !0
  686. }
  687. function b(a) {
  688. try {
  689. return !!eval(a)
  690. } catch (h) {
  691. return !1
  692. }
  693. }
  694. var c = "es3"
  695. , d = {
  696. es3: !1
  697. }
  698. , e = !1
  699. , f = goog.global.navigator && goog.global.navigator.userAgent ? goog.global.navigator.userAgent : "";
  700. a("es5", function () {
  701. return b("[1,].length==1")
  702. });
  703. a("es6", function () {
  704. return f.match(/Edge\/(\d+)(\.\d)*/i) ? !1 : b('(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')
  705. });
  706. a("es7", function () {
  707. return b("2 ** 2 == 4")
  708. });
  709. a("es8", function () {
  710. return b("async () => 1, true")
  711. });
  712. a("es9", function () {
  713. return b("({...rest} = {}), true")
  714. });
  715. a("es_next", function () {
  716. return !1
  717. });
  718. return {
  719. target: c,
  720. map: d
  721. }
  722. }
  723. ,
  724. goog.Transpiler.prototype.needsTranspile = function (a, b) {
  725. if ("always" == goog.TRANSPILE)
  726. return !0;
  727. if ("never" == goog.TRANSPILE)
  728. return !1;
  729. if (!this.requiresTranspilation_) {
  730. var c = this.createRequiresTranspilation_();
  731. this.requiresTranspilation_ = c.map;
  732. this.transpilationTarget_ = this.transpilationTarget_ || c.target
  733. }
  734. if (a in this.requiresTranspilation_)
  735. return this.requiresTranspilation_[a] ? !0 : !goog.inHtmlDocument_() || "es6" != b || "noModule" in goog.global.document.createElement("script") ? !1 : !0;
  736. throw Error("Unknown language mode: " + a);
  737. }
  738. ,
  739. goog.Transpiler.prototype.transpile = function (a, b) {
  740. return goog.transpile_(a, b, this.transpilationTarget_)
  741. }
  742. ,
  743. goog.transpiler_ = new goog.Transpiler,
  744. goog.protectScriptTag_ = function (a) {
  745. return a.replace(/<\/(SCRIPT)/ig, "\\x3c/$1")
  746. }
  747. ,
  748. goog.DebugLoader_ = function () {
  749. this.dependencies_ = {};
  750. this.idToPath_ = {};
  751. this.written_ = {};
  752. this.loadingDeps_ = [];
  753. this.depsToLoad_ = [];
  754. this.paused_ = !1;
  755. this.factory_ = new goog.DependencyFactory(goog.transpiler_);
  756. this.deferredCallbacks_ = {};
  757. this.deferredQueue_ = []
  758. }
  759. ,
  760. goog.DebugLoader_.prototype.bootstrap = function (a, b) {
  761. function c() {
  762. d && (goog.global.setTimeout(d, 0),
  763. d = null)
  764. }
  765. var d = b;
  766. if (a.length) {
  767. for (var e = [], f = 0; f < a.length; f++) {
  768. var g = this.getPathFromDeps_(a[f]);
  769. if (!g)
  770. throw Error("Unregonized namespace: " + a[f]);
  771. e.push(this.dependencies_[g])
  772. }
  773. g = goog.require;
  774. var h = 0;
  775. for (f = 0; f < a.length; f++)
  776. g(a[f]),
  777. e[f].onLoad(function () {
  778. ++h == a.length && c()
  779. })
  780. } else
  781. c()
  782. }
  783. ,
  784. goog.DebugLoader_.prototype.loadClosureDeps = function () {
  785. this.depsToLoad_.push(this.factory_.createDependency(goog.normalizePath_(goog.basePath + "deps.js"), "deps.js", [], [], {}, !1));
  786. this.loadDeps_()
  787. }
  788. ,
  789. goog.DebugLoader_.prototype.requested = function (a, b) {
  790. var c = this.getPathFromDeps_(a);
  791. if (c && (b || this.areDepsLoaded_(this.dependencies_[c].requires))) {
  792. var d = this.deferredCallbacks_[c];
  793. d && (delete this.deferredCallbacks_[c],
  794. d())
  795. }
  796. }
  797. ,
  798. goog.DebugLoader_.prototype.setDependencyFactory = function (a) {
  799. this.factory_ = a
  800. }
  801. ,
  802. goog.DebugLoader_.prototype.load_ = function (a) {
  803. if (this.getPathFromDeps_(a)) {
  804. var b = this
  805. , c = []
  806. , d = function (a) {
  807. var e = b.getPathFromDeps_(a);
  808. if (!e)
  809. throw Error("Bad dependency path or symbol: " + a);
  810. if (!b.written_[e]) {
  811. b.written_[e] = !0;
  812. a = b.dependencies_[e];
  813. for (e = 0; e < a.requires.length; e++)
  814. goog.isProvided_(a.requires[e]) || d(a.requires[e]);
  815. c.push(a)
  816. }
  817. };
  818. d(a);
  819. a = !!this.depsToLoad_.length;
  820. this.depsToLoad_ = this.depsToLoad_.concat(c);
  821. this.paused_ || a || this.loadDeps_()
  822. } else
  823. throw a = "goog.require could not find: " + a,
  824. goog.logToConsole_(a),
  825. Error(a);
  826. }
  827. ,
  828. goog.DebugLoader_.prototype.loadDeps_ = function () {
  829. for (var a = this, b = this.paused_; this.depsToLoad_.length && !b;)
  830. (function () {
  831. var c = !1
  832. , d = a.depsToLoad_.shift()
  833. , e = !1;
  834. a.loading_(d);
  835. var f = {
  836. pause: function () {
  837. if (c)
  838. throw Error("Cannot call pause after the call to load.");
  839. b = !0
  840. },
  841. resume: function () {
  842. c ? a.resume_() : b = !1
  843. },
  844. loaded: function () {
  845. if (e)
  846. throw Error("Double call to loaded.");
  847. e = !0;
  848. a.loaded_(d)
  849. },
  850. pending: function () {
  851. for (var b = [], c = 0; c < a.loadingDeps_.length; c++)
  852. b.push(a.loadingDeps_[c]);
  853. return b
  854. },
  855. setModuleState: function (a) {
  856. goog.moduleLoaderState_ = {
  857. type: a,
  858. moduleName: "",
  859. declareLegacyNamespace: !1
  860. }
  861. },
  862. registerEs6ModuleExports: function (a, b, c) {
  863. c && (goog.loadedModules_[c] = {
  864. exports: b,
  865. type: goog.ModuleType.ES6,
  866. moduleId: c || ""
  867. })
  868. },
  869. registerGoogModuleExports: function (a, b) {
  870. goog.loadedModules_[a] = {
  871. exports: b,
  872. type: goog.ModuleType.GOOG,
  873. moduleId: a
  874. }
  875. },
  876. clearModuleState: function () {
  877. goog.moduleLoaderState_ = null
  878. },
  879. defer: function (b) {
  880. if (c)
  881. throw Error("Cannot register with defer after the call to load.");
  882. a.defer_(d, b)
  883. },
  884. areDepsLoaded: function () {
  885. return a.areDepsLoaded_(d.requires)
  886. }
  887. };
  888. try {
  889. d.load(f)
  890. } finally {
  891. c = !0
  892. }
  893. }
  894. )();
  895. b && this.pause_()
  896. }
  897. ,
  898. goog.DebugLoader_.prototype.pause_ = function () {
  899. this.paused_ = !0
  900. }
  901. ,
  902. goog.DebugLoader_.prototype.resume_ = function () {
  903. this.paused_ && (this.paused_ = !1,
  904. this.loadDeps_())
  905. }
  906. ,
  907. goog.DebugLoader_.prototype.loading_ = function (a) {
  908. this.loadingDeps_.push(a)
  909. }
  910. ,
  911. goog.DebugLoader_.prototype.loaded_ = function (a) {
  912. for (var b = 0; b < this.loadingDeps_.length; b++)
  913. if (this.loadingDeps_[b] == a) {
  914. this.loadingDeps_.splice(b, 1);
  915. break
  916. }
  917. for (b = 0; b < this.deferredQueue_.length; b++)
  918. if (this.deferredQueue_[b] == a.path) {
  919. this.deferredQueue_.splice(b, 1);
  920. break
  921. }
  922. if (this.loadingDeps_.length == this.deferredQueue_.length && !this.depsToLoad_.length)
  923. for (; this.deferredQueue_.length;)
  924. this.requested(this.deferredQueue_.shift(), !0);
  925. a.loaded()
  926. }
  927. ,
  928. goog.DebugLoader_.prototype.areDepsLoaded_ = function (a) {
  929. for (var b = 0; b < a.length; b++) {
  930. var c = this.getPathFromDeps_(a[b]);
  931. if (!c || !(c in this.deferredCallbacks_ || goog.isProvided_(a[b])))
  932. return !1
  933. }
  934. return !0
  935. }
  936. ,
  937. goog.DebugLoader_.prototype.getPathFromDeps_ = function (a) {
  938. return a in this.idToPath_ ? this.idToPath_[a] : a in this.dependencies_ ? a : null
  939. }
  940. ,
  941. goog.DebugLoader_.prototype.defer_ = function (a, b) {
  942. this.deferredCallbacks_[a.path] = b;
  943. this.deferredQueue_.push(a.path)
  944. }
  945. ,
  946. goog.LoadController = function () { }
  947. ,
  948. goog.LoadController.prototype.pause = function () { }
  949. ,
  950. goog.LoadController.prototype.resume = function () { }
  951. ,
  952. goog.LoadController.prototype.loaded = function () { }
  953. ,
  954. goog.LoadController.prototype.pending = function () { }
  955. ,
  956. goog.LoadController.prototype.registerEs6ModuleExports = function (a, b, c) { }
  957. ,
  958. goog.LoadController.prototype.setModuleState = function (a) { }
  959. ,
  960. goog.LoadController.prototype.clearModuleState = function () { }
  961. ,
  962. goog.LoadController.prototype.defer = function (a) { }
  963. ,
  964. goog.LoadController.prototype.areDepsLoaded = function () { }
  965. ,
  966. goog.Dependency = function (a, b, c, d, e) {
  967. this.path = a;
  968. this.relativePath = b;
  969. this.provides = c;
  970. this.requires = d;
  971. this.loadFlags = e;
  972. this.loaded_ = !1;
  973. this.loadCallbacks_ = []
  974. }
  975. ,
  976. goog.Dependency.prototype.getPathName = function () {
  977. var a = this.path
  978. , b = a.indexOf("://");
  979. 0 <= b && (a = a.substring(b + 3),
  980. b = a.indexOf("/"),
  981. 0 <= b && (a = a.substring(b + 1)));
  982. return a
  983. }
  984. ,
  985. goog.Dependency.prototype.onLoad = function (a) {
  986. this.loaded_ ? a() : this.loadCallbacks_.push(a)
  987. }
  988. ,
  989. goog.Dependency.prototype.loaded = function () {
  990. this.loaded_ = !0;
  991. var a = this.loadCallbacks_;
  992. this.loadCallbacks_ = [];
  993. for (var b = 0; b < a.length; b++)
  994. a[b]()
  995. }
  996. ,
  997. goog.Dependency.defer_ = !1,
  998. goog.Dependency.callbackMap_ = {},
  999. goog.Dependency.registerCallback_ = function (a) {
  1000. var b = Math.random().toString(32);
  1001. goog.Dependency.callbackMap_[b] = a;
  1002. return b
  1003. }
  1004. ,
  1005. goog.Dependency.unregisterCallback_ = function (a) {
  1006. delete goog.Dependency.callbackMap_[a]
  1007. }
  1008. ,
  1009. goog.Dependency.callback_ = function (a, b) {
  1010. if (a in goog.Dependency.callbackMap_) {
  1011. for (var c = goog.Dependency.callbackMap_[a], d = [], e = 1; e < arguments.length; e++)
  1012. d.push(arguments[e]);
  1013. c.apply(void 0, d)
  1014. } else
  1015. throw Error("Callback key " + a + " does not exist (was base.js loaded more than once?).");
  1016. }
  1017. ,
  1018. goog.Dependency.prototype.load = function (a) {
  1019. if (goog.global.CLOSURE_IMPORT_SCRIPT)
  1020. goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();
  1021. else if (goog.inHtmlDocument_()) {
  1022. var b = goog.global.document;
  1023. if ("complete" == b.readyState && !goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) {
  1024. if (/\bdeps.js$/.test(this.path)) {
  1025. a.loaded();
  1026. return
  1027. }
  1028. throw Error('Cannot write "' + this.path + '" after document load');
  1029. }
  1030. if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && goog.isDocumentLoading_()) {
  1031. var c = goog.Dependency.registerCallback_(function (b) {
  1032. goog.DebugLoader_.IS_OLD_IE_ && "complete" != b.readyState || (goog.Dependency.unregisterCallback_(c),
  1033. a.loaded())
  1034. })
  1035. , d = !goog.DebugLoader_.IS_OLD_IE_ && goog.getScriptNonce() ? ' nonce="' + goog.getScriptNonce() + '"' : "";
  1036. d = '<script src="' + this.path + '" ' + (goog.DebugLoader_.IS_OLD_IE_ ? "onreadystatechange" : "onload") + "=\"goog.Dependency.callback_('" + c + '\', this)" type="text/javascript" ' + (goog.Dependency.defer_ ? "defer" : "") + d + ">\x3c/script>";
  1037. b.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(d) : d)
  1038. } else {
  1039. var e = b.createElement("script");
  1040. e.defer = goog.Dependency.defer_;
  1041. e.async = !1;
  1042. e.type = "text/javascript";
  1043. (d = goog.getScriptNonce()) && e.setAttribute("nonce", d);
  1044. goog.DebugLoader_.IS_OLD_IE_ ? (a.pause(),
  1045. e.onreadystatechange = function () {
  1046. if ("loaded" == e.readyState || "complete" == e.readyState)
  1047. a.loaded(),
  1048. a.resume()
  1049. }
  1050. ) : e.onload = function () {
  1051. e.onload = null;
  1052. a.loaded()
  1053. }
  1054. ;
  1055. e.src = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path) : this.path;
  1056. b.head.appendChild(e)
  1057. }
  1058. } else
  1059. goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),
  1060. "deps.js" == this.relativePath ? (goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."),
  1061. a.loaded()) : a.pause()
  1062. }
  1063. ,
  1064. goog.Es6ModuleDependency = function (a, b, c, d, e) {
  1065. goog.Dependency.call(this, a, b, c, d, e)
  1066. }
  1067. ,
  1068. goog.inherits(goog.Es6ModuleDependency, goog.Dependency),
  1069. goog.Es6ModuleDependency.prototype.load = function (a) {
  1070. function b(a, b) {
  1071. var c = b ? '<script type="module" crossorigin>' + b + "\x3c/script>" : '<script type="module" crossorigin src="' + a + '">\x3c/script>';
  1072. d.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(c) : c)
  1073. }
  1074. function c(a, b) {
  1075. var c = d.createElement("script");
  1076. c.defer = !0;
  1077. c.async = !1;
  1078. c.type = "module";
  1079. c.setAttribute("crossorigin", !0);
  1080. var e = goog.getScriptNonce();
  1081. e && c.setAttribute("nonce", e);
  1082. b ? c.textContent = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScript(b) : b : c.src = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScriptURL(a) : a;
  1083. d.head.appendChild(c)
  1084. }
  1085. if (goog.global.CLOSURE_IMPORT_SCRIPT)
  1086. goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();
  1087. else if (goog.inHtmlDocument_()) {
  1088. var d = goog.global.document
  1089. , e = this;
  1090. if (goog.isDocumentLoading_()) {
  1091. var f = b;
  1092. goog.Dependency.defer_ = !0
  1093. } else
  1094. f = c;
  1095. var g = goog.Dependency.registerCallback_(function () {
  1096. goog.Dependency.unregisterCallback_(g);
  1097. a.setModuleState(goog.ModuleType.ES6)
  1098. });
  1099. f(void 0, 'goog.Dependency.callback_("' + g + '")');
  1100. f(this.path, void 0);
  1101. var h = goog.Dependency.registerCallback_(function (b) {
  1102. goog.Dependency.unregisterCallback_(h);
  1103. a.registerEs6ModuleExports(e.path, b, goog.moduleLoaderState_.moduleName)
  1104. });
  1105. f(void 0, 'import * as m from "' + this.path + '"; goog.Dependency.callback_("' + h + '", m)');
  1106. var k = goog.Dependency.registerCallback_(function () {
  1107. goog.Dependency.unregisterCallback_(k);
  1108. a.clearModuleState();
  1109. a.loaded()
  1110. });
  1111. f(void 0, 'goog.Dependency.callback_("' + k + '")')
  1112. } else
  1113. goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),
  1114. a.pause()
  1115. }
  1116. ,
  1117. goog.TransformedDependency = function (a, b, c, d, e) {
  1118. goog.Dependency.call(this, a, b, c, d, e);
  1119. this.contents_ = null;
  1120. this.lazyFetch_ = !goog.inHtmlDocument_() || !("noModule" in goog.global.document.createElement("script"))
  1121. }
  1122. ,
  1123. goog.inherits(goog.TransformedDependency, goog.Dependency),
  1124. goog.TransformedDependency.prototype.load = function (a) {
  1125. function b() {
  1126. e.contents_ = goog.loadFileSync_(e.path);
  1127. e.contents_ && (e.contents_ = e.transform(e.contents_),
  1128. e.contents_ && (e.contents_ += "\n//# sourceURL=" + e.path))
  1129. }
  1130. function c() {
  1131. e.lazyFetch_ && b();
  1132. if (e.contents_) {
  1133. f && a.setModuleState(goog.ModuleType.ES6);
  1134. try {
  1135. var c = e.contents_;
  1136. e.contents_ = null;
  1137. goog.globalEval(c);
  1138. if (f)
  1139. var d = goog.moduleLoaderState_.moduleName
  1140. } finally {
  1141. f && a.clearModuleState()
  1142. }
  1143. f && goog.global.$jscomp.require.ensure([e.getPathName()], function () {
  1144. a.registerEs6ModuleExports(e.path, goog.global.$jscomp.require(e.getPathName()), d)
  1145. });
  1146. a.loaded()
  1147. }
  1148. }
  1149. function d() {
  1150. var a = goog.global.document
  1151. , b = goog.Dependency.registerCallback_(function () {
  1152. goog.Dependency.unregisterCallback_(b);
  1153. c()
  1154. })
  1155. , d = '<script type="text/javascript">' + goog.protectScriptTag_('goog.Dependency.callback_("' + b + '");') + "\x3c/script>";
  1156. a.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(d) : d)
  1157. }
  1158. var e = this;
  1159. if (goog.global.CLOSURE_IMPORT_SCRIPT)
  1160. b(),
  1161. this.contents_ && goog.global.CLOSURE_IMPORT_SCRIPT("", this.contents_) ? (this.contents_ = null,
  1162. a.loaded()) : a.pause();
  1163. else {
  1164. var f = this.loadFlags.module == goog.ModuleType.ES6;
  1165. this.lazyFetch_ || b();
  1166. var g = 1 < a.pending().length
  1167. , h = g && goog.DebugLoader_.IS_OLD_IE_;
  1168. g = goog.Dependency.defer_ && (g || goog.isDocumentLoading_());
  1169. if (h || g)
  1170. a.defer(function () {
  1171. c()
  1172. });
  1173. else {
  1174. var k = goog.global.document;
  1175. h = goog.inHtmlDocument_() && "ActiveXObject" in goog.global;
  1176. if (f && goog.inHtmlDocument_() && goog.isDocumentLoading_() && !h) {
  1177. goog.Dependency.defer_ = !0;
  1178. a.pause();
  1179. var m = k.onreadystatechange;
  1180. k.onreadystatechange = function () {
  1181. "interactive" == k.readyState && (k.onreadystatechange = m,
  1182. c(),
  1183. a.resume());
  1184. goog.isFunction(m) && m.apply(void 0, arguments)
  1185. }
  1186. } else
  1187. !goog.DebugLoader_.IS_OLD_IE_ && goog.inHtmlDocument_() && goog.isDocumentLoading_() ? d() : c()
  1188. }
  1189. }
  1190. }
  1191. ,
  1192. goog.TransformedDependency.prototype.transform = function (a) { }
  1193. ,
  1194. goog.TranspiledDependency = function (a, b, c, d, e, f) {
  1195. goog.TransformedDependency.call(this, a, b, c, d, e);
  1196. this.transpiler = f
  1197. }
  1198. ,
  1199. goog.inherits(goog.TranspiledDependency, goog.TransformedDependency),
  1200. goog.TranspiledDependency.prototype.transform = function (a) {
  1201. return this.transpiler.transpile(a, this.getPathName())
  1202. }
  1203. ,
  1204. goog.PreTranspiledEs6ModuleDependency = function (a, b, c, d, e) {
  1205. goog.TransformedDependency.call(this, a, b, c, d, e)
  1206. }
  1207. ,
  1208. goog.inherits(goog.PreTranspiledEs6ModuleDependency, goog.TransformedDependency),
  1209. goog.PreTranspiledEs6ModuleDependency.prototype.transform = function (a) {
  1210. return a
  1211. }
  1212. ,
  1213. goog.GoogModuleDependency = function (a, b, c, d, e, f, g) {
  1214. goog.TransformedDependency.call(this, a, b, c, d, e);
  1215. this.needsTranspile_ = f;
  1216. this.transpiler_ = g
  1217. }
  1218. ,
  1219. goog.inherits(goog.GoogModuleDependency, goog.TransformedDependency),
  1220. goog.GoogModuleDependency.prototype.transform = function (a) {
  1221. this.needsTranspile_ && (a = this.transpiler_.transpile(a, this.getPathName()));
  1222. return goog.LOAD_MODULE_USING_EVAL && void 0 !== goog.global.JSON ? "goog.loadModule(" + goog.global.JSON.stringify(a + "\n//# sourceURL=" + this.path + "\n") + ");" : 'goog.loadModule(function(exports) {"use strict";' + a + "\n;return exports});\n//# sourceURL=" + this.path + "\n"
  1223. }
  1224. ,
  1225. goog.DebugLoader_.IS_OLD_IE_ = !(goog.global.atob || !goog.global.document || !goog.global.document.all),
  1226. goog.DebugLoader_.prototype.addDependency = function (a, b, c, d) {
  1227. b = b || [];
  1228. a = a.replace(/\\/g, "/");
  1229. var e = goog.normalizePath_(goog.basePath + a);
  1230. d && "boolean" !== typeof d || (d = d ? {
  1231. module: goog.ModuleType.GOOG
  1232. } : {});
  1233. c = this.factory_.createDependency(e, a, b, c, d, goog.transpiler_.needsTranspile(d.lang || "es3", d.module));
  1234. this.dependencies_[e] = c;
  1235. for (c = 0; c < b.length; c++)
  1236. this.idToPath_[b[c]] = e;
  1237. this.idToPath_[a] = e
  1238. }
  1239. ,
  1240. goog.DependencyFactory = function (a) {
  1241. this.transpiler = a
  1242. }
  1243. ,
  1244. goog.DependencyFactory.prototype.createDependency = function (a, b, c, d, e, f) {
  1245. return e.module == goog.ModuleType.GOOG ? new goog.GoogModuleDependency(a, b, c, d, e, f, this.transpiler) : f ? new goog.TranspiledDependency(a, b, c, d, e, this.transpiler) : e.module == goog.ModuleType.ES6 ? "never" == goog.TRANSPILE && goog.ASSUME_ES_MODULES_TRANSPILED ? new goog.PreTranspiledEs6ModuleDependency(a, b, c, d, e) : new goog.Es6ModuleDependency(a, b, c, d, e) : new goog.Dependency(a, b, c, d, e)
  1246. }
  1247. ,
  1248. goog.debugLoader_ = new goog.DebugLoader_,
  1249. goog.loadClosureDeps = function () {
  1250. goog.debugLoader_.loadClosureDeps()
  1251. }
  1252. ,
  1253. goog.setDependencyFactory = function (a) {
  1254. goog.debugLoader_.setDependencyFactory(a)
  1255. }
  1256. ,
  1257. goog.global.CLOSURE_NO_DEPS || goog.debugLoader_.loadClosureDeps(),
  1258. goog.bootstrap = function (a, b) {
  1259. goog.debugLoader_.bootstrap(a, b)
  1260. }
  1261. );
  1262. goog.TRUSTED_TYPES_POLICY_NAME = "";
  1263. goog.identity_ = function (a) {
  1264. return a
  1265. }
  1266. ;
  1267. goog.createTrustedTypesPolicy = function (a) {
  1268. var b = null
  1269. , c = goog.global.trustedTypes || goog.global.TrustedTypes;
  1270. if (!c || !c.createPolicy)
  1271. return b;
  1272. try {
  1273. b = c.createPolicy(a, {
  1274. createHTML: goog.identity_,
  1275. createScript: goog.identity_,
  1276. createScriptURL: goog.identity_,
  1277. createURL: goog.identity_
  1278. })
  1279. } catch (d) {
  1280. goog.logToConsole_(d.message)
  1281. }
  1282. return b
  1283. }
  1284. ;
  1285. goog.TRUSTED_TYPES_POLICY_ = goog.TRUSTED_TYPES_POLICY_NAME ? goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + "#base") : null;
  1286. goog.debug = {};
  1287. goog.debug.Error = function (a) {
  1288. if (Error.captureStackTrace)
  1289. Error.captureStackTrace(this, goog.debug.Error);
  1290. else {
  1291. var b = Error().stack;
  1292. b && (this.stack = b)
  1293. }
  1294. a && (this.message = String(a));
  1295. this.reportErrorToServer = !0
  1296. }
  1297. ;
  1298. goog.inherits(goog.debug.Error, Error);
  1299. goog.debug.Error.prototype.name = "CustomError";
  1300. goog.dom = {};
  1301. goog.dom.NodeType = {
  1302. ELEMENT: 1,
  1303. ATTRIBUTE: 2,
  1304. TEXT: 3,
  1305. CDATA_SECTION: 4,
  1306. ENTITY_REFERENCE: 5,
  1307. ENTITY: 6,
  1308. PROCESSING_INSTRUCTION: 7,
  1309. COMMENT: 8,
  1310. DOCUMENT: 9,
  1311. DOCUMENT_TYPE: 10,
  1312. DOCUMENT_FRAGMENT: 11,
  1313. NOTATION: 12
  1314. };
  1315. goog.asserts = {};
  1316. goog.asserts.ENABLE_ASSERTS = goog.DEBUG;
  1317. goog.asserts.AssertionError = function (a, b) {
  1318. goog.debug.Error.call(this, goog.asserts.subs_(a, b));
  1319. this.messagePattern = a
  1320. }
  1321. ;
  1322. goog.inherits(goog.asserts.AssertionError, goog.debug.Error);
  1323. goog.asserts.AssertionError.prototype.name = "AssertionError";
  1324. goog.asserts.DEFAULT_ERROR_HANDLER = function (a) {
  1325. throw a;
  1326. }
  1327. ;
  1328. goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;
  1329. goog.asserts.subs_ = function (a, b) {
  1330. for (var c = a.split("%s"), d = "", e = c.length - 1, f = 0; f < e; f++)
  1331. d += c[f] + (f < b.length ? b[f] : "%s");
  1332. return d + c[e]
  1333. }
  1334. ;
  1335. goog.asserts.doAssertFailure_ = function (a, b, c, d) {
  1336. var e = "Assertion failed";
  1337. if (c) {
  1338. e += ": " + c;
  1339. var f = d
  1340. } else
  1341. a && (e += ": " + a,
  1342. f = b);
  1343. a = new goog.asserts.AssertionError("" + e, f || []);
  1344. goog.asserts.errorHandler_(a)
  1345. }
  1346. ;
  1347. goog.asserts.setErrorHandler = function (a) {
  1348. goog.asserts.ENABLE_ASSERTS && (goog.asserts.errorHandler_ = a)
  1349. }
  1350. ;
  1351. goog.asserts.assert = function (a, b, c) {
  1352. goog.asserts.ENABLE_ASSERTS && !a && goog.asserts.doAssertFailure_("", null, b, Array.prototype.slice.call(arguments, 2));
  1353. return a
  1354. }
  1355. ;
  1356. goog.asserts.assertExists = function (a, b, c) {
  1357. goog.asserts.ENABLE_ASSERTS && null == a && goog.asserts.doAssertFailure_("Expected to exist: %s.", [a], b, Array.prototype.slice.call(arguments, 2));
  1358. return a
  1359. }
  1360. ;
  1361. goog.asserts.fail = function (a, b) {
  1362. goog.asserts.ENABLE_ASSERTS && goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure" + (a ? ": " + a : ""), Array.prototype.slice.call(arguments, 1)))
  1363. }
  1364. ;
  1365. goog.asserts.assertNumber = function (a, b, c) {
  1366. goog.asserts.ENABLE_ASSERTS && "number" !== typeof a && goog.asserts.doAssertFailure_("Expected number but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1367. return a
  1368. }
  1369. ;
  1370. goog.asserts.assertString = function (a, b, c) {
  1371. goog.asserts.ENABLE_ASSERTS && "string" !== typeof a && goog.asserts.doAssertFailure_("Expected string but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1372. return a
  1373. }
  1374. ;
  1375. goog.asserts.assertFunction = function (a, b, c) {
  1376. goog.asserts.ENABLE_ASSERTS && !goog.isFunction(a) && goog.asserts.doAssertFailure_("Expected function but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1377. return a
  1378. }
  1379. ;
  1380. goog.asserts.assertObject = function (a, b, c) {
  1381. goog.asserts.ENABLE_ASSERTS && !goog.isObject(a) && goog.asserts.doAssertFailure_("Expected object but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1382. return a
  1383. }
  1384. ;
  1385. goog.asserts.assertArray = function (a, b, c) {
  1386. goog.asserts.ENABLE_ASSERTS && !goog.isArray(a) && goog.asserts.doAssertFailure_("Expected array but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1387. return a
  1388. }
  1389. ;
  1390. goog.asserts.assertBoolean = function (a, b, c) {
  1391. goog.asserts.ENABLE_ASSERTS && "boolean" !== typeof a && goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1392. return a
  1393. }
  1394. ;
  1395. goog.asserts.assertElement = function (a, b, c) {
  1396. !goog.asserts.ENABLE_ASSERTS || goog.isObject(a) && a.nodeType == goog.dom.NodeType.ELEMENT || goog.asserts.doAssertFailure_("Expected Element but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));
  1397. return a
  1398. }
  1399. ;
  1400. goog.asserts.assertInstanceof = function (a, b, c, d) {
  1401. !goog.asserts.ENABLE_ASSERTS || a instanceof b || goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.", [goog.asserts.getType_(b), goog.asserts.getType_(a)], c, Array.prototype.slice.call(arguments, 3));
  1402. return a
  1403. }
  1404. ;
  1405. goog.asserts.assertFinite = function (a, b, c) {
  1406. !goog.asserts.ENABLE_ASSERTS || "number" == typeof a && isFinite(a) || goog.asserts.doAssertFailure_("Expected %s to be a finite number but it is not.", [a], b, Array.prototype.slice.call(arguments, 2));
  1407. return a
  1408. }
  1409. ;
  1410. goog.asserts.assertObjectPrototypeIsIntact = function () {
  1411. for (var a in Object.prototype)
  1412. goog.asserts.fail(a + " should not be enumerable in Object.prototype.")
  1413. }
  1414. ;
  1415. goog.asserts.getType_ = function (a) {
  1416. return a instanceof Function ? a.displayName || a.name || "unknown type name" : a instanceof Object ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : null === a ? "null" : typeof a
  1417. }
  1418. ;
  1419. goog.array = {};
  1420. goog.NATIVE_ARRAY_PROTOTYPES = goog.TRUSTED_SITE;
  1421. goog.array.ASSUME_NATIVE_FUNCTIONS = 2012 < goog.FEATURESET_YEAR;
  1422. goog.array.peek = function (a) {
  1423. return a[a.length - 1]
  1424. }
  1425. ;
  1426. goog.array.last = goog.array.peek;
  1427. goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ? function (a, b, c) {
  1428. goog.asserts.assert(null != a.length);
  1429. return Array.prototype.indexOf.call(a, b, c)
  1430. }
  1431. : function (a, b, c) {
  1432. c = null == c ? 0 : 0 > c ? Math.max(0, a.length + c) : c;
  1433. if ("string" === typeof a)
  1434. return "string" !== typeof b || 1 != b.length ? -1 : a.indexOf(b, c);
  1435. for (; c < a.length; c++)
  1436. if (c in a && a[c] === b)
  1437. return c;
  1438. return -1
  1439. }
  1440. ;
  1441. goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ? function (a, b, c) {
  1442. goog.asserts.assert(null != a.length);
  1443. return Array.prototype.lastIndexOf.call(a, b, null == c ? a.length - 1 : c)
  1444. }
  1445. : function (a, b, c) {
  1446. c = null == c ? a.length - 1 : c;
  1447. 0 > c && (c = Math.max(0, a.length + c));
  1448. if ("string" === typeof a)
  1449. return "string" !== typeof b || 1 != b.length ? -1 : a.lastIndexOf(b, c);
  1450. for (; 0 <= c; c--)
  1451. if (c in a && a[c] === b)
  1452. return c;
  1453. return -1
  1454. }
  1455. ;
  1456. goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ? function (a, b, c) {
  1457. goog.asserts.assert(null != a.length);
  1458. Array.prototype.forEach.call(a, b, c)
  1459. }
  1460. : function (a, b, c) {
  1461. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1462. f in e && b.call(c, e[f], f, a)
  1463. }
  1464. ;
  1465. goog.array.forEachRight = function (a, b, c) {
  1466. var d = a.length
  1467. , e = "string" === typeof a ? a.split("") : a;
  1468. for (--d; 0 <= d; --d)
  1469. d in e && b.call(c, e[d], d, a)
  1470. }
  1471. ;
  1472. goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ? function (a, b, c) {
  1473. goog.asserts.assert(null != a.length);
  1474. return Array.prototype.filter.call(a, b, c)
  1475. }
  1476. : function (a, b, c) {
  1477. for (var d = a.length, e = [], f = 0, g = "string" === typeof a ? a.split("") : a, h = 0; h < d; h++)
  1478. if (h in g) {
  1479. var k = g[h];
  1480. b.call(c, k, h, a) && (e[f++] = k)
  1481. }
  1482. return e
  1483. }
  1484. ;
  1485. goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ? function (a, b, c) {
  1486. goog.asserts.assert(null != a.length);
  1487. return Array.prototype.map.call(a, b, c)
  1488. }
  1489. : function (a, b, c) {
  1490. for (var d = a.length, e = Array(d), f = "string" === typeof a ? a.split("") : a, g = 0; g < d; g++)
  1491. g in f && (e[g] = b.call(c, f[g], g, a));
  1492. return e
  1493. }
  1494. ;
  1495. goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ? function (a, b, c, d) {
  1496. goog.asserts.assert(null != a.length);
  1497. d && (b = goog.bind(b, d));
  1498. return Array.prototype.reduce.call(a, b, c)
  1499. }
  1500. : function (a, b, c, d) {
  1501. var e = c;
  1502. goog.array.forEach(a, function (c, g) {
  1503. e = b.call(d, e, c, g, a)
  1504. });
  1505. return e
  1506. }
  1507. ;
  1508. goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ? function (a, b, c, d) {
  1509. goog.asserts.assert(null != a.length);
  1510. goog.asserts.assert(null != b);
  1511. d && (b = goog.bind(b, d));
  1512. return Array.prototype.reduceRight.call(a, b, c)
  1513. }
  1514. : function (a, b, c, d) {
  1515. var e = c;
  1516. goog.array.forEachRight(a, function (c, g) {
  1517. e = b.call(d, e, c, g, a)
  1518. });
  1519. return e
  1520. }
  1521. ;
  1522. goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ? function (a, b, c) {
  1523. goog.asserts.assert(null != a.length);
  1524. return Array.prototype.some.call(a, b, c)
  1525. }
  1526. : function (a, b, c) {
  1527. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1528. if (f in e && b.call(c, e[f], f, a))
  1529. return !0;
  1530. return !1
  1531. }
  1532. ;
  1533. goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ? function (a, b, c) {
  1534. goog.asserts.assert(null != a.length);
  1535. return Array.prototype.every.call(a, b, c)
  1536. }
  1537. : function (a, b, c) {
  1538. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1539. if (f in e && !b.call(c, e[f], f, a))
  1540. return !1;
  1541. return !0
  1542. }
  1543. ;
  1544. goog.array.count = function (a, b, c) {
  1545. var d = 0;
  1546. goog.array.forEach(a, function (a, f, g) {
  1547. b.call(c, a, f, g) && ++d
  1548. }, c);
  1549. return d
  1550. }
  1551. ;
  1552. goog.array.find = function (a, b, c) {
  1553. b = goog.array.findIndex(a, b, c);
  1554. return 0 > b ? null : "string" === typeof a ? a.charAt(b) : a[b]
  1555. }
  1556. ;
  1557. goog.array.findIndex = function (a, b, c) {
  1558. for (var d = a.length, e = "string" === typeof a ? a.split("") : a, f = 0; f < d; f++)
  1559. if (f in e && b.call(c, e[f], f, a))
  1560. return f;
  1561. return -1
  1562. }
  1563. ;
  1564. goog.array.findRight = function (a, b, c) {
  1565. b = goog.array.findIndexRight(a, b, c);
  1566. return 0 > b ? null : "string" === typeof a ? a.charAt(b) : a[b]
  1567. }
  1568. ;
  1569. goog.array.findIndexRight = function (a, b, c) {
  1570. var d = a.length
  1571. , e = "string" === typeof a ? a.split("") : a;
  1572. for (--d; 0 <= d; d--)
  1573. if (d in e && b.call(c, e[d], d, a))
  1574. return d;
  1575. return -1
  1576. }
  1577. ;
  1578. goog.array.contains = function (a, b) {
  1579. return 0 <= goog.array.indexOf(a, b)
  1580. }
  1581. ;
  1582. goog.array.isEmpty = function (a) {
  1583. return 0 == a.length
  1584. }
  1585. ;
  1586. goog.array.clear = function (a) {
  1587. if (!goog.isArray(a))
  1588. for (var b = a.length - 1; 0 <= b; b--)
  1589. delete a[b];
  1590. a.length = 0
  1591. }
  1592. ;
  1593. goog.array.insert = function (a, b) {
  1594. goog.array.contains(a, b) || a.push(b)
  1595. }
  1596. ;
  1597. goog.array.insertAt = function (a, b, c) {
  1598. goog.array.splice(a, c, 0, b)
  1599. }
  1600. ;
  1601. goog.array.insertArrayAt = function (a, b, c) {
  1602. goog.partial(goog.array.splice, a, c, 0).apply(null, b)
  1603. }
  1604. ;
  1605. goog.array.insertBefore = function (a, b, c) {
  1606. var d;
  1607. 2 == arguments.length || 0 > (d = goog.array.indexOf(a, c)) ? a.push(b) : goog.array.insertAt(a, b, d)
  1608. }
  1609. ;
  1610. goog.array.remove = function (a, b) {
  1611. var c = goog.array.indexOf(a, b), d;
  1612. (d = 0 <= c) && goog.array.removeAt(a, c);
  1613. return d
  1614. }
  1615. ;
  1616. goog.array.removeLast = function (a, b) {
  1617. var c = goog.array.lastIndexOf(a, b);
  1618. return 0 <= c ? (goog.array.removeAt(a, c),
  1619. !0) : !1
  1620. }
  1621. ;
  1622. goog.array.removeAt = function (a, b) {
  1623. goog.asserts.assert(null != a.length);
  1624. return 1 == Array.prototype.splice.call(a, b, 1).length
  1625. }
  1626. ;
  1627. goog.array.removeIf = function (a, b, c) {
  1628. b = goog.array.findIndex(a, b, c);
  1629. return 0 <= b ? (goog.array.removeAt(a, b),
  1630. !0) : !1
  1631. }
  1632. ;
  1633. goog.array.removeAllIf = function (a, b, c) {
  1634. var d = 0;
  1635. goog.array.forEachRight(a, function (e, f) {
  1636. b.call(c, e, f, a) && goog.array.removeAt(a, f) && d++
  1637. });
  1638. return d
  1639. }
  1640. ;
  1641. goog.array.concat = function (a) {
  1642. return Array.prototype.concat.apply([], arguments)
  1643. }
  1644. ;
  1645. goog.array.join = function (a) {
  1646. return Array.prototype.concat.apply([], arguments)
  1647. }
  1648. ;
  1649. goog.array.toArray = function (a) {
  1650. var b = a.length;
  1651. if (0 < b) {
  1652. for (var c = Array(b), d = 0; d < b; d++)
  1653. c[d] = a[d];
  1654. return c
  1655. }
  1656. return []
  1657. }
  1658. ;
  1659. goog.array.clone = goog.array.toArray;
  1660. goog.array.extend = function (a, b) {
  1661. for (var c = 1; c < arguments.length; c++) {
  1662. var d = arguments[c];
  1663. if (goog.isArrayLike(d)) {
  1664. var e = a.length || 0
  1665. , f = d.length || 0;
  1666. a.length = e + f;
  1667. for (var g = 0; g < f; g++)
  1668. a[e + g] = d[g]
  1669. } else
  1670. a.push(d)
  1671. }
  1672. }
  1673. ;
  1674. goog.array.splice = function (a, b, c, d) {
  1675. goog.asserts.assert(null != a.length);
  1676. return Array.prototype.splice.apply(a, goog.array.slice(arguments, 1))
  1677. }
  1678. ;
  1679. goog.array.slice = function (a, b, c) {
  1680. goog.asserts.assert(null != a.length);
  1681. return 2 >= arguments.length ? Array.prototype.slice.call(a, b) : Array.prototype.slice.call(a, b, c)
  1682. }
  1683. ;
  1684. goog.array.removeDuplicates = function (a, b, c) {
  1685. b = b || a;
  1686. var d = function (a) {
  1687. return goog.isObject(a) ? "o" + goog.getUid(a) : (typeof a).charAt(0) + a
  1688. };
  1689. c = c || d;
  1690. d = {};
  1691. for (var e = 0, f = 0; f < a.length;) {
  1692. var g = a[f++]
  1693. , h = c(g);
  1694. Object.prototype.hasOwnProperty.call(d, h) || (d[h] = !0,
  1695. b[e++] = g)
  1696. }
  1697. b.length = e
  1698. }
  1699. ;
  1700. goog.array.binarySearch = function (a, b, c) {
  1701. return goog.array.binarySearch_(a, c || goog.array.defaultCompare, !1, b)
  1702. }
  1703. ;
  1704. goog.array.binarySelect = function (a, b, c) {
  1705. return goog.array.binarySearch_(a, b, !0, void 0, c)
  1706. }
  1707. ;
  1708. goog.array.binarySearch_ = function (a, b, c, d, e) {
  1709. for (var f = 0, g = a.length, h; f < g;) {
  1710. var k = f + (g - f >>> 1);
  1711. var m = c ? b.call(e, a[k], k, a) : b(d, a[k]);
  1712. 0 < m ? f = k + 1 : (g = k,
  1713. h = !m)
  1714. }
  1715. return h ? f : -f - 1
  1716. }
  1717. ;
  1718. goog.array.sort = function (a, b) {
  1719. a.sort(b || goog.array.defaultCompare)
  1720. }
  1721. ;
  1722. goog.array.stableSort = function (a, b) {
  1723. for (var c = Array(a.length), d = 0; d < a.length; d++)
  1724. c[d] = {
  1725. index: d,
  1726. value: a[d]
  1727. };
  1728. var e = b || goog.array.defaultCompare;
  1729. goog.array.sort(c, function (a, b) {
  1730. return e(a.value, b.value) || a.index - b.index
  1731. });
  1732. for (d = 0; d < a.length; d++)
  1733. a[d] = c[d].value
  1734. }
  1735. ;
  1736. goog.array.sortByKey = function (a, b, c) {
  1737. var d = c || goog.array.defaultCompare;
  1738. goog.array.sort(a, function (a, c) {
  1739. return d(b(a), b(c))
  1740. })
  1741. }
  1742. ;
  1743. goog.array.sortObjectsByKey = function (a, b, c) {
  1744. goog.array.sortByKey(a, function (a) {
  1745. return a[b]
  1746. }, c)
  1747. }
  1748. ;
  1749. goog.array.isSorted = function (a, b, c) {
  1750. b = b || goog.array.defaultCompare;
  1751. for (var d = 1; d < a.length; d++) {
  1752. var e = b(a[d - 1], a[d]);
  1753. if (0 < e || 0 == e && c)
  1754. return !1
  1755. }
  1756. return !0
  1757. }
  1758. ;
  1759. goog.array.equals = function (a, b, c) {
  1760. if (!goog.isArrayLike(a) || !goog.isArrayLike(b) || a.length != b.length)
  1761. return !1;
  1762. var d = a.length;
  1763. c = c || goog.array.defaultCompareEquality;
  1764. for (var e = 0; e < d; e++)
  1765. if (!c(a[e], b[e]))
  1766. return !1;
  1767. return !0
  1768. }
  1769. ;
  1770. goog.array.compare3 = function (a, b, c) {
  1771. c = c || goog.array.defaultCompare;
  1772. for (var d = Math.min(a.length, b.length), e = 0; e < d; e++) {
  1773. var f = c(a[e], b[e]);
  1774. if (0 != f)
  1775. return f
  1776. }
  1777. return goog.array.defaultCompare(a.length, b.length)
  1778. }
  1779. ;
  1780. goog.array.defaultCompare = function (a, b) {
  1781. return a > b ? 1 : a < b ? -1 : 0
  1782. }
  1783. ;
  1784. goog.array.inverseDefaultCompare = function (a, b) {
  1785. return -goog.array.defaultCompare(a, b)
  1786. }
  1787. ;
  1788. goog.array.defaultCompareEquality = function (a, b) {
  1789. return a === b
  1790. }
  1791. ;
  1792. goog.array.binaryInsert = function (a, b, c) {
  1793. c = goog.array.binarySearch(a, b, c);
  1794. return 0 > c ? (goog.array.insertAt(a, b, -(c + 1)),
  1795. !0) : !1
  1796. }
  1797. ;
  1798. goog.array.binaryRemove = function (a, b, c) {
  1799. b = goog.array.binarySearch(a, b, c);
  1800. return 0 <= b ? goog.array.removeAt(a, b) : !1
  1801. }
  1802. ;
  1803. goog.array.bucket = function (a, b, c) {
  1804. for (var d = {}, e = 0; e < a.length; e++) {
  1805. var f = a[e]
  1806. , g = b.call(c, f, e, a);
  1807. void 0 !== g && (d[g] || (d[g] = [])).push(f)
  1808. }
  1809. return d
  1810. }
  1811. ;
  1812. goog.array.toObject = function (a, b, c) {
  1813. var d = {};
  1814. goog.array.forEach(a, function (e, f) {
  1815. d[b.call(c, e, f, a)] = e
  1816. });
  1817. return d
  1818. }
  1819. ;
  1820. goog.array.range = function (a, b, c) {
  1821. var d = []
  1822. , e = 0
  1823. , f = a;
  1824. c = c || 1;
  1825. void 0 !== b && (e = a,
  1826. f = b);
  1827. if (0 > c * (f - e))
  1828. return [];
  1829. if (0 < c)
  1830. for (a = e; a < f; a += c)
  1831. d.push(a);
  1832. else
  1833. for (a = e; a > f; a += c)
  1834. d.push(a);
  1835. return d
  1836. }
  1837. ;
  1838. goog.array.repeat = function (a, b) {
  1839. for (var c = [], d = 0; d < b; d++)
  1840. c[d] = a;
  1841. return c
  1842. }
  1843. ;
  1844. goog.array.flatten = function (a) {
  1845. for (var b = [], c = 0; c < arguments.length; c++) {
  1846. var d = arguments[c];
  1847. if (goog.isArray(d))
  1848. for (var e = 0; e < d.length; e += 8192) {
  1849. var f = goog.array.slice(d, e, e + 8192);
  1850. f = goog.array.flatten.apply(null, f);
  1851. for (var g = 0; g < f.length; g++)
  1852. b.push(f[g])
  1853. }
  1854. else
  1855. b.push(d)
  1856. }
  1857. return b
  1858. }
  1859. ;
  1860. goog.array.rotate = function (a, b) {
  1861. goog.asserts.assert(null != a.length);
  1862. a.length && (b %= a.length,
  1863. 0 < b ? Array.prototype.unshift.apply(a, a.splice(-b, b)) : 0 > b && Array.prototype.push.apply(a, a.splice(0, -b)));
  1864. return a
  1865. }
  1866. ;
  1867. goog.array.moveItem = function (a, b, c) {
  1868. goog.asserts.assert(0 <= b && b < a.length);
  1869. goog.asserts.assert(0 <= c && c < a.length);
  1870. b = Array.prototype.splice.call(a, b, 1);
  1871. Array.prototype.splice.call(a, c, 0, b[0])
  1872. }
  1873. ;
  1874. goog.array.zip = function (a) {
  1875. if (!arguments.length)
  1876. return [];
  1877. for (var b = [], c = arguments[0].length, d = 1; d < arguments.length; d++)
  1878. arguments[d].length < c && (c = arguments[d].length);
  1879. for (d = 0; d < c; d++) {
  1880. for (var e = [], f = 0; f < arguments.length; f++)
  1881. e.push(arguments[f][d]);
  1882. b.push(e)
  1883. }
  1884. return b
  1885. }
  1886. ;
  1887. goog.array.shuffle = function (a, b) {
  1888. for (var c = b || Math.random, d = a.length - 1; 0 < d; d--) {
  1889. var e = Math.floor(c() * (d + 1))
  1890. , f = a[d];
  1891. a[d] = a[e];
  1892. a[e] = f
  1893. }
  1894. }
  1895. ;
  1896. goog.array.copyByIndex = function (a, b) {
  1897. var c = [];
  1898. goog.array.forEach(b, function (b) {
  1899. c.push(a[b])
  1900. });
  1901. return c
  1902. }
  1903. ;
  1904. goog.array.concatMap = function (a, b, c) {
  1905. return goog.array.concat.apply([], goog.array.map(a, b, c))
  1906. }
  1907. ;
  1908. goog.math = {};
  1909. goog.math.randomInt = function (a) {
  1910. return Math.floor(Math.random() * a)
  1911. }
  1912. ;
  1913. goog.math.uniformRandom = function (a, b) {
  1914. return a + Math.random() * (b - a)
  1915. }
  1916. ;
  1917. goog.math.clamp = function (a, b, c) {
  1918. return Math.min(Math.max(a, b), c)
  1919. }
  1920. ;
  1921. goog.math.modulo = function (a, b) {
  1922. var c = a % b;
  1923. return 0 > c * b ? c + b : c
  1924. }
  1925. ;
  1926. goog.math.lerp = function (a, b, c) {
  1927. return a + c * (b - a)
  1928. }
  1929. ;
  1930. goog.math.nearlyEquals = function (a, b, c) {
  1931. return Math.abs(a - b) <= (c || 1E-6)
  1932. }
  1933. ;
  1934. goog.math.standardAngle = function (a) {
  1935. return goog.math.modulo(a, 360)
  1936. }
  1937. ;
  1938. goog.math.standardAngleInRadians = function (a) {
  1939. return goog.math.modulo(a, 2 * Math.PI)
  1940. }
  1941. ;
  1942. goog.math.toRadians = function (a) {
  1943. return a * Math.PI / 180
  1944. }
  1945. ;
  1946. goog.math.toDegrees = function (a) {
  1947. return 180 * a / Math.PI
  1948. }
  1949. ;
  1950. goog.math.angleDx = function (a, b) {
  1951. return b * Math.cos(goog.math.toRadians(a))
  1952. }
  1953. ;
  1954. goog.math.angleDy = function (a, b) {
  1955. return b * Math.sin(goog.math.toRadians(a))
  1956. }
  1957. ;
  1958. goog.math.angle = function (a, b, c, d) {
  1959. return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(d - b, c - a)))
  1960. }
  1961. ;
  1962. goog.math.angleDifference = function (a, b) {
  1963. var c = goog.math.standardAngle(b) - goog.math.standardAngle(a);
  1964. 180 < c ? c -= 360 : -180 >= c && (c = 360 + c);
  1965. return c
  1966. }
  1967. ;
  1968. goog.math.sign = function (a) {
  1969. return 0 < a ? 1 : 0 > a ? -1 : a
  1970. }
  1971. ;
  1972. goog.math.longestCommonSubsequence = function (a, b, c, d) {
  1973. c = c || function (a, b) {
  1974. return a == b
  1975. }
  1976. ;
  1977. d = d || function (b, c) {
  1978. return a[b]
  1979. }
  1980. ;
  1981. for (var e = a.length, f = b.length, g = [], h = 0; h < e + 1; h++)
  1982. g[h] = [],
  1983. g[h][0] = 0;
  1984. for (var k = 0; k < f + 1; k++)
  1985. g[0][k] = 0;
  1986. for (h = 1; h <= e; h++)
  1987. for (k = 1; k <= f; k++)
  1988. c(a[h - 1], b[k - 1]) ? g[h][k] = g[h - 1][k - 1] + 1 : g[h][k] = Math.max(g[h - 1][k], g[h][k - 1]);
  1989. var m = [];
  1990. h = e;
  1991. for (k = f; 0 < h && 0 < k;)
  1992. c(a[h - 1], b[k - 1]) ? (m.unshift(d(h - 1, k - 1)),
  1993. h-- ,
  1994. k--) : g[h - 1][k] > g[h][k - 1] ? h-- : k--;
  1995. return m
  1996. }
  1997. ;
  1998. goog.math.sum = function (a) {
  1999. return goog.array.reduce(arguments, function (a, c) {
  2000. return a + c
  2001. }, 0)
  2002. }
  2003. ;
  2004. goog.math.average = function (a) {
  2005. return goog.math.sum.apply(null, arguments) / arguments.length
  2006. }
  2007. ;
  2008. goog.math.sampleVariance = function (a) {
  2009. var b = arguments.length;
  2010. if (2 > b)
  2011. return 0;
  2012. var c = goog.math.average.apply(null, arguments);
  2013. return goog.math.sum.apply(null, goog.array.map(arguments, function (a) {
  2014. return Math.pow(a - c, 2)
  2015. })) / (b - 1)
  2016. }
  2017. ;
  2018. goog.math.standardDeviation = function (a) {
  2019. return Math.sqrt(goog.math.sampleVariance.apply(null, arguments))
  2020. }
  2021. ;
  2022. goog.math.isInt = function (a) {
  2023. return isFinite(a) && 0 == a % 1
  2024. }
  2025. ;
  2026. goog.math.isFiniteNumber = function (a) {
  2027. return isFinite(a)
  2028. }
  2029. ;
  2030. goog.math.isNegativeZero = function (a) {
  2031. return 0 == a && 0 > 1 / a
  2032. }
  2033. ;
  2034. goog.math.log10Floor = function (a) {
  2035. if (0 < a) {
  2036. var b = Math.round(Math.log(a) * Math.LOG10E);
  2037. return b - (parseFloat("1e" + b) > a ? 1 : 0)
  2038. }
  2039. return 0 == a ? -Infinity : NaN
  2040. }
  2041. ;
  2042. goog.math.safeFloor = function (a, b) {
  2043. goog.asserts.assert(void 0 === b || 0 < b);
  2044. return Math.floor(a + (b || 2E-15))
  2045. }
  2046. ;
  2047. goog.math.safeCeil = function (a, b) {
  2048. goog.asserts.assert(void 0 === b || 0 < b);
  2049. return Math.ceil(a - (b || 2E-15))
  2050. }
  2051. ;
  2052. goog.math.Coordinate = function (a, b) {
  2053. this.x = void 0 !== a ? a : 0;
  2054. this.y = void 0 !== b ? b : 0
  2055. }
  2056. ;
  2057. goog.math.Coordinate.prototype.clone = function () {
  2058. return new goog.math.Coordinate(this.x, this.y)
  2059. }
  2060. ;
  2061. goog.DEBUG && (goog.math.Coordinate.prototype.toString = function () {
  2062. return "(" + this.x + ", " + this.y + ")"
  2063. }
  2064. );
  2065. goog.math.Coordinate.prototype.equals = function (a) {
  2066. return a instanceof goog.math.Coordinate && goog.math.Coordinate.equals(this, a)
  2067. }
  2068. ;
  2069. goog.math.Coordinate.equals = function (a, b) {
  2070. return a == b ? !0 : a && b ? a.x == b.x && a.y == b.y : !1
  2071. }
  2072. ;
  2073. goog.math.Coordinate.distance = function (a, b) {
  2074. var c = a.x - b.x
  2075. , d = a.y - b.y;
  2076. return Math.sqrt(c * c + d * d)
  2077. }
  2078. ;
  2079. goog.math.Coordinate.magnitude = function (a) {
  2080. return Math.sqrt(a.x * a.x + a.y * a.y)
  2081. }
  2082. ;
  2083. goog.math.Coordinate.azimuth = function (a) {
  2084. return goog.math.angle(0, 0, a.x, a.y)
  2085. }
  2086. ;
  2087. goog.math.Coordinate.squaredDistance = function (a, b) {
  2088. var c = a.x - b.x
  2089. , d = a.y - b.y;
  2090. return c * c + d * d
  2091. }
  2092. ;
  2093. goog.math.Coordinate.difference = function (a, b) {
  2094. return new goog.math.Coordinate(a.x - b.x, a.y - b.y)
  2095. }
  2096. ;
  2097. goog.math.Coordinate.sum = function (a, b) {
  2098. return new goog.math.Coordinate(a.x + b.x, a.y + b.y)
  2099. }
  2100. ;
  2101. goog.math.Coordinate.prototype.ceil = function () {
  2102. this.x = Math.ceil(this.x);
  2103. this.y = Math.ceil(this.y);
  2104. return this
  2105. }
  2106. ;
  2107. goog.math.Coordinate.prototype.floor = function () {
  2108. this.x = Math.floor(this.x);
  2109. this.y = Math.floor(this.y);
  2110. return this
  2111. }
  2112. ;
  2113. goog.math.Coordinate.prototype.round = function () {
  2114. this.x = Math.round(this.x);
  2115. this.y = Math.round(this.y);
  2116. return this
  2117. }
  2118. ;
  2119. goog.math.Coordinate.prototype.translate = function (a, b) {
  2120. a instanceof goog.math.Coordinate ? (this.x += a.x,
  2121. this.y += a.y) : (this.x += Number(a),
  2122. "number" === typeof b && (this.y += b));
  2123. return this
  2124. }
  2125. ;
  2126. goog.math.Coordinate.prototype.scale = function (a, b) {
  2127. this.x *= a;
  2128. this.y *= "number" === typeof b ? b : a;
  2129. return this
  2130. }
  2131. ;
  2132. goog.math.Coordinate.prototype.rotateRadians = function (a, b) {
  2133. var c = b || new goog.math.Coordinate(0, 0)
  2134. , d = this.x
  2135. , e = this.y
  2136. , f = Math.cos(a)
  2137. , g = Math.sin(a);
  2138. this.x = (d - c.x) * f - (e - c.y) * g + c.x;
  2139. this.y = (d - c.x) * g + (e - c.y) * f + c.y
  2140. }
  2141. ;
  2142. goog.math.Coordinate.prototype.rotateDegrees = function (a, b) {
  2143. this.rotateRadians(goog.math.toRadians(a), b)
  2144. }
  2145. ;
  2146. goog.dom.asserts = {};
  2147. goog.dom.asserts.assertIsLocation = function (a) {
  2148. if (goog.asserts.ENABLE_ASSERTS) {
  2149. var b = goog.dom.asserts.getWindow_(a);
  2150. b && (!a || !(a instanceof b.Location) && a instanceof b.Element) && goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s", goog.dom.asserts.debugStringForType_(a))
  2151. }
  2152. return a
  2153. }
  2154. ;
  2155. goog.dom.asserts.assertIsElementType_ = function (a, b) {
  2156. if (goog.asserts.ENABLE_ASSERTS) {
  2157. var c = goog.dom.asserts.getWindow_(a);
  2158. c && "undefined" != typeof c[b] && (a && (a instanceof c[b] || !(a instanceof c.Location || a instanceof c.Element)) || goog.asserts.fail("Argument is not a %s (or a non-Element, non-Location mock); got: %s", b, goog.dom.asserts.debugStringForType_(a)))
  2159. }
  2160. return a
  2161. }
  2162. ;
  2163. goog.dom.asserts.assertIsHTMLAnchorElement = function (a) {
  2164. return goog.dom.asserts.assertIsElementType_(a, "HTMLAnchorElement")
  2165. }
  2166. ;
  2167. goog.dom.asserts.assertIsHTMLButtonElement = function (a) {
  2168. return goog.dom.asserts.assertIsElementType_(a, "HTMLButtonElement")
  2169. }
  2170. ;
  2171. goog.dom.asserts.assertIsHTMLLinkElement = function (a) {
  2172. return goog.dom.asserts.assertIsElementType_(a, "HTMLLinkElement")
  2173. }
  2174. ;
  2175. goog.dom.asserts.assertIsHTMLImageElement = function (a) {
  2176. return goog.dom.asserts.assertIsElementType_(a, "HTMLImageElement")
  2177. }
  2178. ;
  2179. goog.dom.asserts.assertIsHTMLAudioElement = function (a) {
  2180. return goog.dom.asserts.assertIsElementType_(a, "HTMLAudioElement")
  2181. }
  2182. ;
  2183. goog.dom.asserts.assertIsHTMLVideoElement = function (a) {
  2184. return goog.dom.asserts.assertIsElementType_(a, "HTMLVideoElement")
  2185. }
  2186. ;
  2187. goog.dom.asserts.assertIsHTMLInputElement = function (a) {
  2188. return goog.dom.asserts.assertIsElementType_(a, "HTMLInputElement")
  2189. }
  2190. ;
  2191. goog.dom.asserts.assertIsHTMLTextAreaElement = function (a) {
  2192. return goog.dom.asserts.assertIsElementType_(a, "HTMLTextAreaElement")
  2193. }
  2194. ;
  2195. goog.dom.asserts.assertIsHTMLCanvasElement = function (a) {
  2196. return goog.dom.asserts.assertIsElementType_(a, "HTMLCanvasElement")
  2197. }
  2198. ;
  2199. goog.dom.asserts.assertIsHTMLEmbedElement = function (a) {
  2200. return goog.dom.asserts.assertIsElementType_(a, "HTMLEmbedElement")
  2201. }
  2202. ;
  2203. goog.dom.asserts.assertIsHTMLFormElement = function (a) {
  2204. return goog.dom.asserts.assertIsElementType_(a, "HTMLFormElement")
  2205. }
  2206. ;
  2207. goog.dom.asserts.assertIsHTMLFrameElement = function (a) {
  2208. return goog.dom.asserts.assertIsElementType_(a, "HTMLFrameElement")
  2209. }
  2210. ;
  2211. goog.dom.asserts.assertIsHTMLIFrameElement = function (a) {
  2212. return goog.dom.asserts.assertIsElementType_(a, "HTMLIFrameElement")
  2213. }
  2214. ;
  2215. goog.dom.asserts.assertIsHTMLObjectElement = function (a) {
  2216. return goog.dom.asserts.assertIsElementType_(a, "HTMLObjectElement")
  2217. }
  2218. ;
  2219. goog.dom.asserts.assertIsHTMLScriptElement = function (a) {
  2220. return goog.dom.asserts.assertIsElementType_(a, "HTMLScriptElement")
  2221. }
  2222. ;
  2223. goog.dom.asserts.debugStringForType_ = function (a) {
  2224. if (goog.isObject(a))
  2225. try {
  2226. return a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a)
  2227. } catch (b) {
  2228. return "<object could not be stringified>"
  2229. }
  2230. else
  2231. return void 0 === a ? "undefined" : null === a ? "null" : typeof a
  2232. }
  2233. ;
  2234. goog.dom.asserts.getWindow_ = function (a) {
  2235. try {
  2236. var b = a && a.ownerDocument
  2237. , c = b && (b.defaultView || b.parentWindow);
  2238. c = c || goog.global;
  2239. if (c.Element && c.Location)
  2240. return c
  2241. } catch (d) { }
  2242. return null
  2243. }
  2244. ;
  2245. goog.functions = {};
  2246. goog.functions.constant = function (a) {
  2247. return function () {
  2248. return a
  2249. }
  2250. }
  2251. ;
  2252. goog.functions.FALSE = function () {
  2253. return !1
  2254. }
  2255. ;
  2256. goog.functions.TRUE = function () {
  2257. return !0
  2258. }
  2259. ;
  2260. goog.functions.NULL = function () {
  2261. return null
  2262. }
  2263. ;
  2264. goog.functions.identity = function (a, b) {
  2265. return a
  2266. }
  2267. ;
  2268. goog.functions.error = function (a) {
  2269. return function () {
  2270. throw Error(a);
  2271. }
  2272. }
  2273. ;
  2274. goog.functions.fail = function (a) {
  2275. return function () {
  2276. throw a;
  2277. }
  2278. }
  2279. ;
  2280. goog.functions.lock = function (a, b) {
  2281. b = b || 0;
  2282. return function () {
  2283. return a.apply(this, Array.prototype.slice.call(arguments, 0, b))
  2284. }
  2285. }
  2286. ;
  2287. goog.functions.nth = function (a) {
  2288. return function () {
  2289. return arguments[a]
  2290. }
  2291. }
  2292. ;
  2293. goog.functions.partialRight = function (a, b) {
  2294. var c = Array.prototype.slice.call(arguments, 1);
  2295. return function () {
  2296. var b = Array.prototype.slice.call(arguments);
  2297. b.push.apply(b, c);
  2298. return a.apply(this, b)
  2299. }
  2300. }
  2301. ;
  2302. goog.functions.withReturnValue = function (a, b) {
  2303. return goog.functions.sequence(a, goog.functions.constant(b))
  2304. }
  2305. ;
  2306. goog.functions.equalTo = function (a, b) {
  2307. return function (c) {
  2308. return b ? a == c : a === c
  2309. }
  2310. }
  2311. ;
  2312. goog.functions.compose = function (a, b) {
  2313. var c = arguments
  2314. , d = c.length;
  2315. return function () {
  2316. var a;
  2317. d && (a = c[d - 1].apply(this, arguments));
  2318. for (var b = d - 2; 0 <= b; b--)
  2319. a = c[b].call(this, a);
  2320. return a
  2321. }
  2322. }
  2323. ;
  2324. goog.functions.sequence = function (a) {
  2325. var b = arguments
  2326. , c = b.length;
  2327. return function () {
  2328. for (var a, e = 0; e < c; e++)
  2329. a = b[e].apply(this, arguments);
  2330. return a
  2331. }
  2332. }
  2333. ;
  2334. goog.functions.and = function (a) {
  2335. var b = arguments
  2336. , c = b.length;
  2337. return function () {
  2338. for (var a = 0; a < c; a++)
  2339. if (!b[a].apply(this, arguments))
  2340. return !1;
  2341. return !0
  2342. }
  2343. }
  2344. ;
  2345. goog.functions.or = function (a) {
  2346. var b = arguments
  2347. , c = b.length;
  2348. return function () {
  2349. for (var a = 0; a < c; a++)
  2350. if (b[a].apply(this, arguments))
  2351. return !0;
  2352. return !1
  2353. }
  2354. }
  2355. ;
  2356. goog.functions.not = function (a) {
  2357. return function () {
  2358. return !a.apply(this, arguments)
  2359. }
  2360. }
  2361. ;
  2362. goog.functions.create = function (a, b) {
  2363. var c = function () { };
  2364. c.prototype = a.prototype;
  2365. c = new c;
  2366. a.apply(c, Array.prototype.slice.call(arguments, 1));
  2367. return c
  2368. }
  2369. ;
  2370. goog.functions.CACHE_RETURN_VALUE = !0;
  2371. goog.functions.cacheReturnValue = function (a) {
  2372. var b = !1, c;
  2373. return function () {
  2374. if (!goog.functions.CACHE_RETURN_VALUE)
  2375. return a();
  2376. b || (c = a(),
  2377. b = !0);
  2378. return c
  2379. }
  2380. }
  2381. ;
  2382. goog.functions.once = function (a) {
  2383. var b = a;
  2384. return function () {
  2385. if (b) {
  2386. var a = b;
  2387. b = null;
  2388. a()
  2389. }
  2390. }
  2391. }
  2392. ;
  2393. goog.functions.debounce = function (a, b, c) {
  2394. var d = 0;
  2395. return function (e) {
  2396. goog.global.clearTimeout(d);
  2397. var f = arguments;
  2398. d = goog.global.setTimeout(function () {
  2399. a.apply(c, f)
  2400. }, b)
  2401. }
  2402. }
  2403. ;
  2404. goog.functions.throttle = function (a, b, c) {
  2405. var d = 0
  2406. , e = !1
  2407. , f = []
  2408. , g = function () {
  2409. d = 0;
  2410. e && (e = !1,
  2411. h())
  2412. }
  2413. , h = function () {
  2414. d = goog.global.setTimeout(g, b);
  2415. a.apply(c, f)
  2416. };
  2417. return function (a) {
  2418. f = arguments;
  2419. d ? e = !0 : h()
  2420. }
  2421. }
  2422. ;
  2423. goog.functions.rateLimit = function (a, b, c) {
  2424. var d = 0
  2425. , e = function () {
  2426. d = 0
  2427. };
  2428. return function (f) {
  2429. d || (d = goog.global.setTimeout(e, b),
  2430. a.apply(c, arguments))
  2431. }
  2432. }
  2433. ;
  2434. goog.dom.HtmlElement = function () { }
  2435. ;
  2436. goog.dom.TagName = function (a) {
  2437. this.tagName_ = a
  2438. }
  2439. ;
  2440. goog.dom.TagName.prototype.toString = function () {
  2441. return this.tagName_
  2442. }
  2443. ;
  2444. goog.dom.TagName.A = new goog.dom.TagName("A");
  2445. goog.dom.TagName.ABBR = new goog.dom.TagName("ABBR");
  2446. goog.dom.TagName.ACRONYM = new goog.dom.TagName("ACRONYM");
  2447. goog.dom.TagName.ADDRESS = new goog.dom.TagName("ADDRESS");
  2448. goog.dom.TagName.APPLET = new goog.dom.TagName("APPLET");
  2449. goog.dom.TagName.AREA = new goog.dom.TagName("AREA");
  2450. goog.dom.TagName.ARTICLE = new goog.dom.TagName("ARTICLE");
  2451. goog.dom.TagName.ASIDE = new goog.dom.TagName("ASIDE");
  2452. goog.dom.TagName.AUDIO = new goog.dom.TagName("AUDIO");
  2453. goog.dom.TagName.B = new goog.dom.TagName("B");
  2454. goog.dom.TagName.BASE = new goog.dom.TagName("BASE");
  2455. goog.dom.TagName.BASEFONT = new goog.dom.TagName("BASEFONT");
  2456. goog.dom.TagName.BDI = new goog.dom.TagName("BDI");
  2457. goog.dom.TagName.BDO = new goog.dom.TagName("BDO");
  2458. goog.dom.TagName.BIG = new goog.dom.TagName("BIG");
  2459. goog.dom.TagName.BLOCKQUOTE = new goog.dom.TagName("BLOCKQUOTE");
  2460. goog.dom.TagName.BODY = new goog.dom.TagName("BODY");
  2461. goog.dom.TagName.BR = new goog.dom.TagName("BR");
  2462. goog.dom.TagName.BUTTON = new goog.dom.TagName("BUTTON");
  2463. goog.dom.TagName.CANVAS = new goog.dom.TagName("CANVAS");
  2464. goog.dom.TagName.CAPTION = new goog.dom.TagName("CAPTION");
  2465. goog.dom.TagName.CENTER = new goog.dom.TagName("CENTER");
  2466. goog.dom.TagName.CITE = new goog.dom.TagName("CITE");
  2467. goog.dom.TagName.CODE = new goog.dom.TagName("CODE");
  2468. goog.dom.TagName.COL = new goog.dom.TagName("COL");
  2469. goog.dom.TagName.COLGROUP = new goog.dom.TagName("COLGROUP");
  2470. goog.dom.TagName.COMMAND = new goog.dom.TagName("COMMAND");
  2471. goog.dom.TagName.DATA = new goog.dom.TagName("DATA");
  2472. goog.dom.TagName.DATALIST = new goog.dom.TagName("DATALIST");
  2473. goog.dom.TagName.DD = new goog.dom.TagName("DD");
  2474. goog.dom.TagName.DEL = new goog.dom.TagName("DEL");
  2475. goog.dom.TagName.DETAILS = new goog.dom.TagName("DETAILS");
  2476. goog.dom.TagName.DFN = new goog.dom.TagName("DFN");
  2477. goog.dom.TagName.DIALOG = new goog.dom.TagName("DIALOG");
  2478. goog.dom.TagName.DIR = new goog.dom.TagName("DIR");
  2479. goog.dom.TagName.DIV = new goog.dom.TagName("DIV");
  2480. goog.dom.TagName.DL = new goog.dom.TagName("DL");
  2481. goog.dom.TagName.DT = new goog.dom.TagName("DT");
  2482. goog.dom.TagName.EM = new goog.dom.TagName("EM");
  2483. goog.dom.TagName.EMBED = new goog.dom.TagName("EMBED");
  2484. goog.dom.TagName.FIELDSET = new goog.dom.TagName("FIELDSET");
  2485. goog.dom.TagName.FIGCAPTION = new goog.dom.TagName("FIGCAPTION");
  2486. goog.dom.TagName.FIGURE = new goog.dom.TagName("FIGURE");
  2487. goog.dom.TagName.FONT = new goog.dom.TagName("FONT");
  2488. goog.dom.TagName.FOOTER = new goog.dom.TagName("FOOTER");
  2489. goog.dom.TagName.FORM = new goog.dom.TagName("FORM");
  2490. goog.dom.TagName.FRAME = new goog.dom.TagName("FRAME");
  2491. goog.dom.TagName.FRAMESET = new goog.dom.TagName("FRAMESET");
  2492. goog.dom.TagName.H1 = new goog.dom.TagName("H1");
  2493. goog.dom.TagName.H2 = new goog.dom.TagName("H2");
  2494. goog.dom.TagName.H3 = new goog.dom.TagName("H3");
  2495. goog.dom.TagName.H4 = new goog.dom.TagName("H4");
  2496. goog.dom.TagName.H5 = new goog.dom.TagName("H5");
  2497. goog.dom.TagName.H6 = new goog.dom.TagName("H6");
  2498. goog.dom.TagName.HEAD = new goog.dom.TagName("HEAD");
  2499. goog.dom.TagName.HEADER = new goog.dom.TagName("HEADER");
  2500. goog.dom.TagName.HGROUP = new goog.dom.TagName("HGROUP");
  2501. goog.dom.TagName.HR = new goog.dom.TagName("HR");
  2502. goog.dom.TagName.HTML = new goog.dom.TagName("HTML");
  2503. goog.dom.TagName.I = new goog.dom.TagName("I");
  2504. goog.dom.TagName.IFRAME = new goog.dom.TagName("IFRAME");
  2505. goog.dom.TagName.IMG = new goog.dom.TagName("IMG");
  2506. goog.dom.TagName.INPUT = new goog.dom.TagName("INPUT");
  2507. goog.dom.TagName.INS = new goog.dom.TagName("INS");
  2508. goog.dom.TagName.ISINDEX = new goog.dom.TagName("ISINDEX");
  2509. goog.dom.TagName.KBD = new goog.dom.TagName("KBD");
  2510. goog.dom.TagName.KEYGEN = new goog.dom.TagName("KEYGEN");
  2511. goog.dom.TagName.LABEL = new goog.dom.TagName("LABEL");
  2512. goog.dom.TagName.LEGEND = new goog.dom.TagName("LEGEND");
  2513. goog.dom.TagName.LI = new goog.dom.TagName("LI");
  2514. goog.dom.TagName.LINK = new goog.dom.TagName("LINK");
  2515. goog.dom.TagName.MAIN = new goog.dom.TagName("MAIN");
  2516. goog.dom.TagName.MAP = new goog.dom.TagName("MAP");
  2517. goog.dom.TagName.MARK = new goog.dom.TagName("MARK");
  2518. goog.dom.TagName.MATH = new goog.dom.TagName("MATH");
  2519. goog.dom.TagName.MENU = new goog.dom.TagName("MENU");
  2520. goog.dom.TagName.MENUITEM = new goog.dom.TagName("MENUITEM");
  2521. goog.dom.TagName.META = new goog.dom.TagName("META");
  2522. goog.dom.TagName.METER = new goog.dom.TagName("METER");
  2523. goog.dom.TagName.NAV = new goog.dom.TagName("NAV");
  2524. goog.dom.TagName.NOFRAMES = new goog.dom.TagName("NOFRAMES");
  2525. goog.dom.TagName.NOSCRIPT = new goog.dom.TagName("NOSCRIPT");
  2526. goog.dom.TagName.OBJECT = new goog.dom.TagName("OBJECT");
  2527. goog.dom.TagName.OL = new goog.dom.TagName("OL");
  2528. goog.dom.TagName.OPTGROUP = new goog.dom.TagName("OPTGROUP");
  2529. goog.dom.TagName.OPTION = new goog.dom.TagName("OPTION");
  2530. goog.dom.TagName.OUTPUT = new goog.dom.TagName("OUTPUT");
  2531. goog.dom.TagName.P = new goog.dom.TagName("P");
  2532. goog.dom.TagName.PARAM = new goog.dom.TagName("PARAM");
  2533. goog.dom.TagName.PICTURE = new goog.dom.TagName("PICTURE");
  2534. goog.dom.TagName.PRE = new goog.dom.TagName("PRE");
  2535. goog.dom.TagName.PROGRESS = new goog.dom.TagName("PROGRESS");
  2536. goog.dom.TagName.Q = new goog.dom.TagName("Q");
  2537. goog.dom.TagName.RP = new goog.dom.TagName("RP");
  2538. goog.dom.TagName.RT = new goog.dom.TagName("RT");
  2539. goog.dom.TagName.RTC = new goog.dom.TagName("RTC");
  2540. goog.dom.TagName.RUBY = new goog.dom.TagName("RUBY");
  2541. goog.dom.TagName.S = new goog.dom.TagName("S");
  2542. goog.dom.TagName.SAMP = new goog.dom.TagName("SAMP");
  2543. goog.dom.TagName.SCRIPT = new goog.dom.TagName("SCRIPT");
  2544. goog.dom.TagName.SECTION = new goog.dom.TagName("SECTION");
  2545. goog.dom.TagName.SELECT = new goog.dom.TagName("SELECT");
  2546. goog.dom.TagName.SMALL = new goog.dom.TagName("SMALL");
  2547. goog.dom.TagName.SOURCE = new goog.dom.TagName("SOURCE");
  2548. goog.dom.TagName.SPAN = new goog.dom.TagName("SPAN");
  2549. goog.dom.TagName.STRIKE = new goog.dom.TagName("STRIKE");
  2550. goog.dom.TagName.STRONG = new goog.dom.TagName("STRONG");
  2551. goog.dom.TagName.STYLE = new goog.dom.TagName("STYLE");
  2552. goog.dom.TagName.SUB = new goog.dom.TagName("SUB");
  2553. goog.dom.TagName.SUMMARY = new goog.dom.TagName("SUMMARY");
  2554. goog.dom.TagName.SUP = new goog.dom.TagName("SUP");
  2555. goog.dom.TagName.SVG = new goog.dom.TagName("SVG");
  2556. goog.dom.TagName.TABLE = new goog.dom.TagName("TABLE");
  2557. goog.dom.TagName.TBODY = new goog.dom.TagName("TBODY");
  2558. goog.dom.TagName.TD = new goog.dom.TagName("TD");
  2559. goog.dom.TagName.TEMPLATE = new goog.dom.TagName("TEMPLATE");
  2560. goog.dom.TagName.TEXTAREA = new goog.dom.TagName("TEXTAREA");
  2561. goog.dom.TagName.TFOOT = new goog.dom.TagName("TFOOT");
  2562. goog.dom.TagName.TH = new goog.dom.TagName("TH");
  2563. goog.dom.TagName.THEAD = new goog.dom.TagName("THEAD");
  2564. goog.dom.TagName.TIME = new goog.dom.TagName("TIME");
  2565. goog.dom.TagName.TITLE = new goog.dom.TagName("TITLE");
  2566. goog.dom.TagName.TR = new goog.dom.TagName("TR");
  2567. goog.dom.TagName.TRACK = new goog.dom.TagName("TRACK");
  2568. goog.dom.TagName.TT = new goog.dom.TagName("TT");
  2569. goog.dom.TagName.U = new goog.dom.TagName("U");
  2570. goog.dom.TagName.UL = new goog.dom.TagName("UL");
  2571. goog.dom.TagName.VAR = new goog.dom.TagName("VAR");
  2572. goog.dom.TagName.VIDEO = new goog.dom.TagName("VIDEO");
  2573. goog.dom.TagName.WBR = new goog.dom.TagName("WBR");
  2574. goog.object = {};
  2575. goog.object.is = function (a, b) {
  2576. return a === b ? 0 !== a || 1 / a === 1 / b : a !== a && b !== b
  2577. }
  2578. ;
  2579. goog.object.forEach = function (a, b, c) {
  2580. for (var d in a)
  2581. b.call(c, a[d], d, a)
  2582. }
  2583. ;
  2584. goog.object.filter = function (a, b, c) {
  2585. var d = {}, e;
  2586. for (e in a)
  2587. b.call(c, a[e], e, a) && (d[e] = a[e]);
  2588. return d
  2589. }
  2590. ;
  2591. goog.object.map = function (a, b, c) {
  2592. var d = {}, e;
  2593. for (e in a)
  2594. d[e] = b.call(c, a[e], e, a);
  2595. return d
  2596. }
  2597. ;
  2598. goog.object.some = function (a, b, c) {
  2599. for (var d in a)
  2600. if (b.call(c, a[d], d, a))
  2601. return !0;
  2602. return !1
  2603. }
  2604. ;
  2605. goog.object.every = function (a, b, c) {
  2606. for (var d in a)
  2607. if (!b.call(c, a[d], d, a))
  2608. return !1;
  2609. return !0
  2610. }
  2611. ;
  2612. goog.object.getCount = function (a) {
  2613. var b = 0, c;
  2614. for (c in a)
  2615. b++;
  2616. return b
  2617. }
  2618. ;
  2619. goog.object.getAnyKey = function (a) {
  2620. for (var b in a)
  2621. return b
  2622. }
  2623. ;
  2624. goog.object.getAnyValue = function (a) {
  2625. for (var b in a)
  2626. return a[b]
  2627. }
  2628. ;
  2629. goog.object.contains = function (a, b) {
  2630. return goog.object.containsValue(a, b)
  2631. }
  2632. ;
  2633. goog.object.getValues = function (a) {
  2634. var b = [], c = 0, d;
  2635. for (d in a)
  2636. b[c++] = a[d];
  2637. return b
  2638. }
  2639. ;
  2640. goog.object.getKeys = function (a) {
  2641. var b = [], c = 0, d;
  2642. for (d in a)
  2643. b[c++] = d;
  2644. return b
  2645. }
  2646. ;
  2647. goog.object.getValueByKeys = function (a, b) {
  2648. var c = goog.isArrayLike(b)
  2649. , d = c ? b : arguments;
  2650. for (c = c ? 0 : 1; c < d.length; c++) {
  2651. if (null == a)
  2652. return;
  2653. a = a[d[c]]
  2654. }
  2655. return a
  2656. }
  2657. ;
  2658. goog.object.containsKey = function (a, b) {
  2659. return null !== a && b in a
  2660. }
  2661. ;
  2662. goog.object.containsValue = function (a, b) {
  2663. for (var c in a)
  2664. if (a[c] == b)
  2665. return !0;
  2666. return !1
  2667. }
  2668. ;
  2669. goog.object.findKey = function (a, b, c) {
  2670. for (var d in a)
  2671. if (b.call(c, a[d], d, a))
  2672. return d
  2673. }
  2674. ;
  2675. goog.object.findValue = function (a, b, c) {
  2676. return (b = goog.object.findKey(a, b, c)) && a[b]
  2677. }
  2678. ;
  2679. goog.object.isEmpty = function (a) {
  2680. for (var b in a)
  2681. return !1;
  2682. return !0
  2683. }
  2684. ;
  2685. goog.object.clear = function (a) {
  2686. for (var b in a)
  2687. delete a[b]
  2688. }
  2689. ;
  2690. goog.object.remove = function (a, b) {
  2691. var c;
  2692. (c = b in a) && delete a[b];
  2693. return c
  2694. }
  2695. ;
  2696. goog.object.add = function (a, b, c) {
  2697. if (null !== a && b in a)
  2698. throw Error('The object already contains the key "' + b + '"');
  2699. goog.object.set(a, b, c)
  2700. }
  2701. ;
  2702. goog.object.get = function (a, b, c) {
  2703. return null !== a && b in a ? a[b] : c
  2704. }
  2705. ;
  2706. goog.object.set = function (a, b, c) {
  2707. a[b] = c
  2708. }
  2709. ;
  2710. goog.object.setIfUndefined = function (a, b, c) {
  2711. return b in a ? a[b] : a[b] = c
  2712. }
  2713. ;
  2714. goog.object.setWithReturnValueIfNotSet = function (a, b, c) {
  2715. if (b in a)
  2716. return a[b];
  2717. c = c();
  2718. return a[b] = c
  2719. }
  2720. ;
  2721. goog.object.equals = function (a, b) {
  2722. for (var c in a)
  2723. if (!(c in b) || a[c] !== b[c])
  2724. return !1;
  2725. for (var d in b)
  2726. if (!(d in a))
  2727. return !1;
  2728. return !0
  2729. }
  2730. ;
  2731. goog.object.clone = function (a) {
  2732. var b = {}, c;
  2733. for (c in a)
  2734. b[c] = a[c];
  2735. return b
  2736. }
  2737. ;
  2738. goog.object.unsafeClone = function (a) {
  2739. var b = goog.typeOf(a);
  2740. if ("object" == b || "array" == b) {
  2741. if (goog.isFunction(a.clone))
  2742. return a.clone();
  2743. b = "array" == b ? [] : {};
  2744. for (var c in a)
  2745. b[c] = goog.object.unsafeClone(a[c]);
  2746. return b
  2747. }
  2748. return a
  2749. }
  2750. ;
  2751. goog.object.transpose = function (a) {
  2752. var b = {}, c;
  2753. for (c in a)
  2754. b[a[c]] = c;
  2755. return b
  2756. }
  2757. ;
  2758. goog.object.PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
  2759. goog.object.extend = function (a, b) {
  2760. for (var c, d, e = 1; e < arguments.length; e++) {
  2761. d = arguments[e];
  2762. for (c in d)
  2763. a[c] = d[c];
  2764. for (var f = 0; f < goog.object.PROTOTYPE_FIELDS_.length; f++)
  2765. c = goog.object.PROTOTYPE_FIELDS_[f],
  2766. Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c])
  2767. }
  2768. }
  2769. ;
  2770. goog.object.create = function (a) {
  2771. var b = arguments.length;
  2772. if (1 == b && goog.isArray(arguments[0]))
  2773. return goog.object.create.apply(null, arguments[0]);
  2774. if (b % 2)
  2775. throw Error("Uneven number of arguments");
  2776. for (var c = {}, d = 0; d < b; d += 2)
  2777. c[arguments[d]] = arguments[d + 1];
  2778. return c
  2779. }
  2780. ;
  2781. goog.object.createSet = function (a) {
  2782. var b = arguments.length;
  2783. if (1 == b && goog.isArray(arguments[0]))
  2784. return goog.object.createSet.apply(null, arguments[0]);
  2785. for (var c = {}, d = 0; d < b; d++)
  2786. c[arguments[d]] = !0;
  2787. return c
  2788. }
  2789. ;
  2790. goog.object.createImmutableView = function (a) {
  2791. var b = a;
  2792. Object.isFrozen && !Object.isFrozen(a) && (b = Object.create(a),
  2793. Object.freeze(b));
  2794. return b
  2795. }
  2796. ;
  2797. goog.object.isImmutableView = function (a) {
  2798. return !!Object.isFrozen && Object.isFrozen(a)
  2799. }
  2800. ;
  2801. goog.object.getAllPropertyNames = function (a, b, c) {
  2802. if (!a)
  2803. return [];
  2804. if (!Object.getOwnPropertyNames || !Object.getPrototypeOf)
  2805. return goog.object.getKeys(a);
  2806. for (var d = {}; a && (a !== Object.prototype || b) && (a !== Function.prototype || c);) {
  2807. for (var e = Object.getOwnPropertyNames(a), f = 0; f < e.length; f++)
  2808. d[e[f]] = !0;
  2809. a = Object.getPrototypeOf(a)
  2810. }
  2811. return goog.object.getKeys(d)
  2812. }
  2813. ;
  2814. goog.object.getSuperClass = function (a) {
  2815. return (a = Object.getPrototypeOf(a.prototype)) && a.constructor
  2816. }
  2817. ;
  2818. goog.dom.tags = {};
  2819. goog.dom.tags.VOID_TAGS_ = {
  2820. area: !0,
  2821. base: !0,
  2822. br: !0,
  2823. col: !0,
  2824. command: !0,
  2825. embed: !0,
  2826. hr: !0,
  2827. img: !0,
  2828. input: !0,
  2829. keygen: !0,
  2830. link: !0,
  2831. meta: !0,
  2832. param: !0,
  2833. source: !0,
  2834. track: !0,
  2835. wbr: !0
  2836. };
  2837. goog.dom.tags.isVoidTag = function (a) {
  2838. return !0 === goog.dom.tags.VOID_TAGS_[a]
  2839. }
  2840. ;
  2841. goog.html = {};
  2842. goog.html.trustedtypes = {};
  2843. goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY = goog.TRUSTED_TYPES_POLICY_NAME ? goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + "#html") : null;
  2844. goog.string = {};
  2845. goog.string.TypedString = function () { }
  2846. ;
  2847. goog.string.Const = function (a, b) {
  2848. this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = a === goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_ && b || "";
  2849. this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ = goog.string.Const.TYPE_MARKER_
  2850. }
  2851. ;
  2852. goog.string.Const.prototype.implementsGoogStringTypedString = !0;
  2853. goog.string.Const.prototype.getTypedStringValue = function () {
  2854. return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_
  2855. }
  2856. ;
  2857. goog.DEBUG && (goog.string.Const.prototype.toString = function () {
  2858. return "Const{" + this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ + "}"
  2859. }
  2860. );
  2861. goog.string.Const.unwrap = function (a) {
  2862. if (a instanceof goog.string.Const && a.constructor === goog.string.Const && a.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ === goog.string.Const.TYPE_MARKER_)
  2863. return a.stringConstValueWithSecurityContract__googStringSecurityPrivate_;
  2864. goog.asserts.fail("expected object of type Const, got '" + a + "'");
  2865. return "type_error:Const"
  2866. }
  2867. ;
  2868. goog.string.Const.from = function (a) {
  2869. return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_, a)
  2870. }
  2871. ;
  2872. goog.string.Const.TYPE_MARKER_ = {};
  2873. goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_ = {};
  2874. goog.string.Const.EMPTY = goog.string.Const.from("");
  2875. goog.html.SafeScript = function () {
  2876. this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = "";
  2877. this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  2878. }
  2879. ;
  2880. goog.html.SafeScript.prototype.implementsGoogStringTypedString = !0;
  2881. goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  2882. goog.html.SafeScript.fromConstant = function (a) {
  2883. a = goog.string.Const.unwrap(a);
  2884. return 0 === a.length ? goog.html.SafeScript.EMPTY : goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(a)
  2885. }
  2886. ;
  2887. goog.html.SafeScript.fromConstantAndArgs = function (a, b) {
  2888. for (var c = [], d = 1; d < arguments.length; d++)
  2889. c.push(goog.html.SafeScript.stringify_(arguments[d]));
  2890. return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("(" + goog.string.Const.unwrap(a) + ")(" + c.join(", ") + ");")
  2891. }
  2892. ;
  2893. goog.html.SafeScript.fromJson = function (a) {
  2894. return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(goog.html.SafeScript.stringify_(a))
  2895. }
  2896. ;
  2897. goog.html.SafeScript.prototype.getTypedStringValue = function () {
  2898. return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString()
  2899. }
  2900. ;
  2901. goog.DEBUG && (goog.html.SafeScript.prototype.toString = function () {
  2902. return "SafeScript{" + this.privateDoNotAccessOrElseSafeScriptWrappedValue_ + "}"
  2903. }
  2904. );
  2905. goog.html.SafeScript.unwrap = function (a) {
  2906. return goog.html.SafeScript.unwrapTrustedScript(a).toString()
  2907. }
  2908. ;
  2909. goog.html.SafeScript.unwrapTrustedScript = function (a) {
  2910. if (a instanceof goog.html.SafeScript && a.constructor === goog.html.SafeScript && a.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  2911. return a.privateDoNotAccessOrElseSafeScriptWrappedValue_;
  2912. goog.asserts.fail("expected object of type SafeScript, got '" + a + "' of type " + goog.typeOf(a));
  2913. return "type_error:SafeScript"
  2914. }
  2915. ;
  2916. goog.html.SafeScript.stringify_ = function (a) {
  2917. return JSON.stringify(a).replace(/</g, "\\x3c")
  2918. }
  2919. ;
  2920. goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse = function (a) {
  2921. return (new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(a)
  2922. }
  2923. ;
  2924. goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) {
  2925. this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScript(a) : a;
  2926. return this
  2927. }
  2928. ;
  2929. goog.html.SafeScript.EMPTY = goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("");
  2930. goog.fs = {};
  2931. goog.fs.url = {};
  2932. goog.fs.url.createObjectUrl = function (a) {
  2933. return goog.fs.url.getUrlObject_().createObjectURL(a)
  2934. }
  2935. ;
  2936. goog.fs.url.revokeObjectUrl = function (a) {
  2937. goog.fs.url.getUrlObject_().revokeObjectURL(a)
  2938. }
  2939. ;
  2940. goog.fs.url.getUrlObject_ = function () {
  2941. var a = goog.fs.url.findUrlObject_();
  2942. if (null != a)
  2943. return a;
  2944. throw Error("This browser doesn't seem to support blob URLs");
  2945. }
  2946. ;
  2947. goog.fs.url.findUrlObject_ = function () {
  2948. return void 0 !== goog.global.URL && void 0 !== goog.global.URL.createObjectURL ? goog.global.URL : void 0 !== goog.global.webkitURL && void 0 !== goog.global.webkitURL.createObjectURL ? goog.global.webkitURL : void 0 !== goog.global.createObjectURL ? goog.global : null
  2949. }
  2950. ;
  2951. goog.fs.url.browserSupportsObjectUrls = function () {
  2952. return null != goog.fs.url.findUrlObject_()
  2953. }
  2954. ;
  2955. goog.i18n = {};
  2956. goog.i18n.bidi = {};
  2957. goog.i18n.bidi.FORCE_RTL = !1;
  2958. goog.i18n.bidi.IS_RTL = goog.i18n.bidi.FORCE_RTL || ("ar" == goog.LOCALE.substring(0, 2).toLowerCase() || "fa" == goog.LOCALE.substring(0, 2).toLowerCase() || "he" == goog.LOCALE.substring(0, 2).toLowerCase() || "iw" == goog.LOCALE.substring(0, 2).toLowerCase() || "ps" == goog.LOCALE.substring(0, 2).toLowerCase() || "sd" == goog.LOCALE.substring(0, 2).toLowerCase() || "ug" == goog.LOCALE.substring(0, 2).toLowerCase() || "ur" == goog.LOCALE.substring(0, 2).toLowerCase() || "yi" == goog.LOCALE.substring(0, 2).toLowerCase()) && (2 == goog.LOCALE.length || "-" == goog.LOCALE.substring(2, 3) || "_" == goog.LOCALE.substring(2, 3)) || 3 <= goog.LOCALE.length && "ckb" == goog.LOCALE.substring(0, 3).toLowerCase() && (3 == goog.LOCALE.length || "-" == goog.LOCALE.substring(3, 4) || "_" == goog.LOCALE.substring(3, 4)) || 7 <= goog.LOCALE.length && ("-" == goog.LOCALE.substring(2, 3) || "_" == goog.LOCALE.substring(2, 3)) && ("adlm" == goog.LOCALE.substring(3, 7).toLowerCase() || "arab" == goog.LOCALE.substring(3, 7).toLowerCase() || "hebr" == goog.LOCALE.substring(3, 7).toLowerCase() || "nkoo" == goog.LOCALE.substring(3, 7).toLowerCase() || "rohg" == goog.LOCALE.substring(3, 7).toLowerCase() || "thaa" == goog.LOCALE.substring(3, 7).toLowerCase()) || 8 <= goog.LOCALE.length && ("-" == goog.LOCALE.substring(3, 4) || "_" == goog.LOCALE.substring(3, 4)) && ("adlm" == goog.LOCALE.substring(4, 8).toLowerCase() || "arab" == goog.LOCALE.substring(4, 8).toLowerCase() || "hebr" == goog.LOCALE.substring(4, 8).toLowerCase() || "nkoo" == goog.LOCALE.substring(4, 8).toLowerCase() || "rohg" == goog.LOCALE.substring(4, 8).toLowerCase() || "thaa" == goog.LOCALE.substring(4, 8).toLowerCase());
  2959. goog.i18n.bidi.Format = {
  2960. LRE: "\u202a",
  2961. RLE: "\u202b",
  2962. PDF: "\u202c",
  2963. LRM: "\u200e",
  2964. RLM: "\u200f"
  2965. };
  2966. goog.i18n.bidi.Dir = {
  2967. LTR: 1,
  2968. RTL: -1,
  2969. NEUTRAL: 0
  2970. };
  2971. goog.i18n.bidi.RIGHT = "right";
  2972. goog.i18n.bidi.LEFT = "left";
  2973. goog.i18n.bidi.I18N_RIGHT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.LEFT : goog.i18n.bidi.RIGHT;
  2974. goog.i18n.bidi.I18N_LEFT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT;
  2975. goog.i18n.bidi.toDir = function (a, b) {
  2976. return "number" == typeof a ? 0 < a ? goog.i18n.bidi.Dir.LTR : 0 > a ? goog.i18n.bidi.Dir.RTL : b ? null : goog.i18n.bidi.Dir.NEUTRAL : null == a ? null : a ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR
  2977. }
  2978. ;
  2979. goog.i18n.bidi.ltrChars_ = "A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0900-\u1fff\u200e\u2c00-\ud801\ud804-\ud839\ud83c-\udbff\uf900-\ufb1c\ufe00-\ufe6f\ufefd-\uffff";
  2980. goog.i18n.bidi.rtlChars_ = "\u0591-\u06ef\u06fa-\u08ff\u200f\ud802-\ud803\ud83a-\ud83b\ufb1d-\ufdff\ufe70-\ufefc";
  2981. goog.i18n.bidi.htmlSkipReg_ = /<[^>]*>|&[^;]+;/g;
  2982. goog.i18n.bidi.stripHtmlIfNeeded_ = function (a, b) {
  2983. return b ? a.replace(goog.i18n.bidi.htmlSkipReg_, "") : a
  2984. }
  2985. ;
  2986. goog.i18n.bidi.rtlCharReg_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "]");
  2987. goog.i18n.bidi.ltrCharReg_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "]");
  2988. goog.i18n.bidi.hasAnyRtl = function (a, b) {
  2989. return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  2990. }
  2991. ;
  2992. goog.i18n.bidi.hasRtlChar = goog.i18n.bidi.hasAnyRtl;
  2993. goog.i18n.bidi.hasAnyLtr = function (a, b) {
  2994. return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  2995. }
  2996. ;
  2997. goog.i18n.bidi.ltrRe_ = new RegExp("^[" + goog.i18n.bidi.ltrChars_ + "]");
  2998. goog.i18n.bidi.rtlRe_ = new RegExp("^[" + goog.i18n.bidi.rtlChars_ + "]");
  2999. goog.i18n.bidi.isRtlChar = function (a) {
  3000. return goog.i18n.bidi.rtlRe_.test(a)
  3001. }
  3002. ;
  3003. goog.i18n.bidi.isLtrChar = function (a) {
  3004. return goog.i18n.bidi.ltrRe_.test(a)
  3005. }
  3006. ;
  3007. goog.i18n.bidi.isNeutralChar = function (a) {
  3008. return !goog.i18n.bidi.isLtrChar(a) && !goog.i18n.bidi.isRtlChar(a)
  3009. }
  3010. ;
  3011. goog.i18n.bidi.ltrDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.rtlChars_ + "]*[" + goog.i18n.bidi.ltrChars_ + "]");
  3012. goog.i18n.bidi.rtlDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.ltrChars_ + "]*[" + goog.i18n.bidi.rtlChars_ + "]");
  3013. goog.i18n.bidi.startsWithRtl = function (a, b) {
  3014. return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3015. }
  3016. ;
  3017. goog.i18n.bidi.isRtlText = goog.i18n.bidi.startsWithRtl;
  3018. goog.i18n.bidi.startsWithLtr = function (a, b) {
  3019. return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3020. }
  3021. ;
  3022. goog.i18n.bidi.isLtrText = goog.i18n.bidi.startsWithLtr;
  3023. goog.i18n.bidi.isRequiredLtrRe_ = /^http:\/\/.*/;
  3024. goog.i18n.bidi.isNeutralText = function (a, b) {
  3025. a = goog.i18n.bidi.stripHtmlIfNeeded_(a, b);
  3026. return goog.i18n.bidi.isRequiredLtrRe_.test(a) || !goog.i18n.bidi.hasAnyLtr(a) && !goog.i18n.bidi.hasAnyRtl(a)
  3027. }
  3028. ;
  3029. goog.i18n.bidi.ltrExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "][^" + goog.i18n.bidi.rtlChars_ + "]*$");
  3030. goog.i18n.bidi.rtlExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "][^" + goog.i18n.bidi.ltrChars_ + "]*$");
  3031. goog.i18n.bidi.endsWithLtr = function (a, b) {
  3032. return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3033. }
  3034. ;
  3035. goog.i18n.bidi.isLtrExitText = goog.i18n.bidi.endsWithLtr;
  3036. goog.i18n.bidi.endsWithRtl = function (a, b) {
  3037. return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b))
  3038. }
  3039. ;
  3040. goog.i18n.bidi.isRtlExitText = goog.i18n.bidi.endsWithRtl;
  3041. goog.i18n.bidi.rtlLocalesRe_ = /^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;
  3042. goog.i18n.bidi.isRtlLanguage = function (a) {
  3043. return goog.i18n.bidi.rtlLocalesRe_.test(a)
  3044. }
  3045. ;
  3046. goog.i18n.bidi.bracketGuardTextRe_ = /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g;
  3047. goog.i18n.bidi.guardBracketInText = function (a, b) {
  3048. var c = (void 0 === b ? goog.i18n.bidi.hasAnyRtl(a) : b) ? goog.i18n.bidi.Format.RLM : goog.i18n.bidi.Format.LRM;
  3049. return a.replace(goog.i18n.bidi.bracketGuardTextRe_, c + "$&" + c)
  3050. }
  3051. ;
  3052. goog.i18n.bidi.enforceRtlInHtml = function (a) {
  3053. return "<" == a.charAt(0) ? a.replace(/<\w+/, "$& dir=rtl") : "\n<span dir=rtl>" + a + "</span>"
  3054. }
  3055. ;
  3056. goog.i18n.bidi.enforceRtlInText = function (a) {
  3057. return goog.i18n.bidi.Format.RLE + a + goog.i18n.bidi.Format.PDF
  3058. }
  3059. ;
  3060. goog.i18n.bidi.enforceLtrInHtml = function (a) {
  3061. return "<" == a.charAt(0) ? a.replace(/<\w+/, "$& dir=ltr") : "\n<span dir=ltr>" + a + "</span>"
  3062. }
  3063. ;
  3064. goog.i18n.bidi.enforceLtrInText = function (a) {
  3065. return goog.i18n.bidi.Format.LRE + a + goog.i18n.bidi.Format.PDF
  3066. }
  3067. ;
  3068. goog.i18n.bidi.dimensionsRe_ = /:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g;
  3069. goog.i18n.bidi.leftRe_ = /left/gi;
  3070. goog.i18n.bidi.rightRe_ = /right/gi;
  3071. goog.i18n.bidi.tempRe_ = /%%%%/g;
  3072. goog.i18n.bidi.mirrorCSS = function (a) {
  3073. return a.replace(goog.i18n.bidi.dimensionsRe_, ":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_, "%%%%").replace(goog.i18n.bidi.rightRe_, goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_, goog.i18n.bidi.RIGHT)
  3074. }
  3075. ;
  3076. goog.i18n.bidi.doubleQuoteSubstituteRe_ = /([\u0591-\u05f2])"/g;
  3077. goog.i18n.bidi.singleQuoteSubstituteRe_ = /([\u0591-\u05f2])'/g;
  3078. goog.i18n.bidi.normalizeHebrewQuote = function (a) {
  3079. return a.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_, "$1\u05f4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_, "$1\u05f3")
  3080. }
  3081. ;
  3082. goog.i18n.bidi.wordSeparatorRe_ = /\s+/;
  3083. goog.i18n.bidi.hasNumeralsRe_ = /[\d\u06f0-\u06f9]/;
  3084. goog.i18n.bidi.rtlDetectionThreshold_ = .4;
  3085. goog.i18n.bidi.estimateDirection = function (a, b) {
  3086. for (var c = 0, d = 0, e = !1, f = goog.i18n.bidi.stripHtmlIfNeeded_(a, b).split(goog.i18n.bidi.wordSeparatorRe_), g = 0; g < f.length; g++) {
  3087. var h = f[g];
  3088. goog.i18n.bidi.startsWithRtl(h) ? (c++ ,
  3089. d++) : goog.i18n.bidi.isRequiredLtrRe_.test(h) ? e = !0 : goog.i18n.bidi.hasAnyLtr(h) ? d++ : goog.i18n.bidi.hasNumeralsRe_.test(h) && (e = !0)
  3090. }
  3091. return 0 == d ? e ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL : c / d > goog.i18n.bidi.rtlDetectionThreshold_ ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR
  3092. }
  3093. ;
  3094. goog.i18n.bidi.detectRtlDirectionality = function (a, b) {
  3095. return goog.i18n.bidi.estimateDirection(a, b) == goog.i18n.bidi.Dir.RTL
  3096. }
  3097. ;
  3098. goog.i18n.bidi.setElementDirAndAlign = function (a, b) {
  3099. a && (b = goog.i18n.bidi.toDir(b)) && (a.style.textAlign = b == goog.i18n.bidi.Dir.RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT,
  3100. a.dir = b == goog.i18n.bidi.Dir.RTL ? "rtl" : "ltr")
  3101. }
  3102. ;
  3103. goog.i18n.bidi.setElementDirByTextDirectionality = function (a, b) {
  3104. switch (goog.i18n.bidi.estimateDirection(b)) {
  3105. case goog.i18n.bidi.Dir.LTR:
  3106. a.dir = "ltr";
  3107. break;
  3108. case goog.i18n.bidi.Dir.RTL:
  3109. a.dir = "rtl";
  3110. break;
  3111. default:
  3112. a.removeAttribute("dir")
  3113. }
  3114. }
  3115. ;
  3116. goog.i18n.bidi.DirectionalString = function () { }
  3117. ;
  3118. goog.html.TrustedResourceUrl = function (a, b) {
  3119. this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = a === goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_ && b || "";
  3120. this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3121. }
  3122. ;
  3123. goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString = !0;
  3124. goog.html.TrustedResourceUrl.prototype.getTypedStringValue = function () {
  3125. return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()
  3126. }
  3127. ;
  3128. goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString = !0;
  3129. goog.html.TrustedResourceUrl.prototype.getDirection = function () {
  3130. return goog.i18n.bidi.Dir.LTR
  3131. }
  3132. ;
  3133. goog.html.TrustedResourceUrl.prototype.cloneWithParams = function (a, b) {
  3134. var c = goog.html.TrustedResourceUrl.unwrap(this);
  3135. c = goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(c);
  3136. var d = c[3] || "";
  3137. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(c[1] + goog.html.TrustedResourceUrl.stringifyParams_("?", c[2] || "", a) + goog.html.TrustedResourceUrl.stringifyParams_("#", d, b))
  3138. }
  3139. ;
  3140. goog.DEBUG && (goog.html.TrustedResourceUrl.prototype.toString = function () {
  3141. return "TrustedResourceUrl{" + this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ + "}"
  3142. }
  3143. );
  3144. goog.html.TrustedResourceUrl.unwrap = function (a) {
  3145. return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(a).toString()
  3146. }
  3147. ;
  3148. goog.html.TrustedResourceUrl.unwrapTrustedScriptURL = function (a) {
  3149. if (a instanceof goog.html.TrustedResourceUrl && a.constructor === goog.html.TrustedResourceUrl && a.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3150. return a.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;
  3151. goog.asserts.fail("expected object of type TrustedResourceUrl, got '" + a + "' of type " + goog.typeOf(a));
  3152. return "type_error:TrustedResourceUrl"
  3153. }
  3154. ;
  3155. goog.html.TrustedResourceUrl.format = function (a, b) {
  3156. var c = goog.string.Const.unwrap(a);
  3157. if (!goog.html.TrustedResourceUrl.BASE_URL_.test(c))
  3158. throw Error("Invalid TrustedResourceUrl format: " + c);
  3159. var d = c.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_, function (a, d) {
  3160. if (!Object.prototype.hasOwnProperty.call(b, d))
  3161. throw Error('Found marker, "' + d + '", in format string, "' + c + '", but no valid label mapping found in args: ' + JSON.stringify(b));
  3162. var e = b[d];
  3163. return e instanceof goog.string.Const ? goog.string.Const.unwrap(e) : encodeURIComponent(String(e))
  3164. });
  3165. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(d)
  3166. }
  3167. ;
  3168. goog.html.TrustedResourceUrl.FORMAT_MARKER_ = /%{(\w+)}/g;
  3169. goog.html.TrustedResourceUrl.BASE_URL_ = /^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i;
  3170. goog.html.TrustedResourceUrl.URL_PARAM_PARSER_ = /^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/;
  3171. goog.html.TrustedResourceUrl.formatWithParams = function (a, b, c, d) {
  3172. return goog.html.TrustedResourceUrl.format(a, b).cloneWithParams(c, d)
  3173. }
  3174. ;
  3175. goog.html.TrustedResourceUrl.fromConstant = function (a) {
  3176. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))
  3177. }
  3178. ;
  3179. goog.html.TrustedResourceUrl.fromConstants = function (a) {
  3180. for (var b = "", c = 0; c < a.length; c++)
  3181. b += goog.string.Const.unwrap(a[c]);
  3182. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)
  3183. }
  3184. ;
  3185. goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3186. goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse = function (a) {
  3187. a = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScriptURL(a) : a;
  3188. return new goog.html.TrustedResourceUrl(goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_, a)
  3189. }
  3190. ;
  3191. goog.html.TrustedResourceUrl.stringifyParams_ = function (a, b, c) {
  3192. if (null == c)
  3193. return b;
  3194. if ("string" === typeof c)
  3195. return c ? a + encodeURIComponent(c) : "";
  3196. for (var d in c) {
  3197. var e = c[d];
  3198. e = goog.isArray(e) ? e : [e];
  3199. for (var f = 0; f < e.length; f++) {
  3200. var g = e[f];
  3201. null != g && (b || (b = a),
  3202. b += (b.length > a.length ? "&" : "") + encodeURIComponent(d) + "=" + encodeURIComponent(String(g)))
  3203. }
  3204. }
  3205. return b
  3206. }
  3207. ;
  3208. goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_ = {};
  3209. goog.string.internal = {};
  3210. goog.string.internal.startsWith = function (a, b) {
  3211. return 0 == a.lastIndexOf(b, 0)
  3212. }
  3213. ;
  3214. goog.string.internal.endsWith = function (a, b) {
  3215. var c = a.length - b.length;
  3216. return 0 <= c && a.indexOf(b, c) == c
  3217. }
  3218. ;
  3219. goog.string.internal.caseInsensitiveStartsWith = function (a, b) {
  3220. return 0 == goog.string.internal.caseInsensitiveCompare(b, a.substr(0, b.length))
  3221. }
  3222. ;
  3223. goog.string.internal.caseInsensitiveEndsWith = function (a, b) {
  3224. return 0 == goog.string.internal.caseInsensitiveCompare(b, a.substr(a.length - b.length, b.length))
  3225. }
  3226. ;
  3227. goog.string.internal.caseInsensitiveEquals = function (a, b) {
  3228. return a.toLowerCase() == b.toLowerCase()
  3229. }
  3230. ;
  3231. goog.string.internal.isEmptyOrWhitespace = function (a) {
  3232. return /^[\s\xa0]*$/.test(a)
  3233. }
  3234. ;
  3235. goog.string.internal.trim = goog.TRUSTED_SITE && String.prototype.trim ? function (a) {
  3236. return a.trim()
  3237. }
  3238. : function (a) {
  3239. return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]
  3240. }
  3241. ;
  3242. goog.string.internal.caseInsensitiveCompare = function (a, b) {
  3243. var c = String(a).toLowerCase()
  3244. , d = String(b).toLowerCase();
  3245. return c < d ? -1 : c == d ? 0 : 1
  3246. }
  3247. ;
  3248. goog.string.internal.newLineToBr = function (a, b) {
  3249. return a.replace(/(\r\n|\r|\n)/g, b ? "<br />" : "<br>")
  3250. }
  3251. ;
  3252. goog.string.internal.htmlEscape = function (a, b) {
  3253. if (b)
  3254. a = a.replace(goog.string.internal.AMP_RE_, "&amp;").replace(goog.string.internal.LT_RE_, "&lt;").replace(goog.string.internal.GT_RE_, "&gt;").replace(goog.string.internal.QUOT_RE_, "&quot;").replace(goog.string.internal.SINGLE_QUOTE_RE_, "&#39;").replace(goog.string.internal.NULL_RE_, "&#0;");
  3255. else {
  3256. if (!goog.string.internal.ALL_RE_.test(a))
  3257. return a;
  3258. -1 != a.indexOf("&") && (a = a.replace(goog.string.internal.AMP_RE_, "&amp;"));
  3259. -1 != a.indexOf("<") && (a = a.replace(goog.string.internal.LT_RE_, "&lt;"));
  3260. -1 != a.indexOf(">") && (a = a.replace(goog.string.internal.GT_RE_, "&gt;"));
  3261. -1 != a.indexOf('"') && (a = a.replace(goog.string.internal.QUOT_RE_, "&quot;"));
  3262. -1 != a.indexOf("'") && (a = a.replace(goog.string.internal.SINGLE_QUOTE_RE_, "&#39;"));
  3263. -1 != a.indexOf("\x00") && (a = a.replace(goog.string.internal.NULL_RE_, "&#0;"))
  3264. }
  3265. return a
  3266. }
  3267. ;
  3268. goog.string.internal.AMP_RE_ = /&/g;
  3269. goog.string.internal.LT_RE_ = /</g;
  3270. goog.string.internal.GT_RE_ = />/g;
  3271. goog.string.internal.QUOT_RE_ = /"/g;
  3272. goog.string.internal.SINGLE_QUOTE_RE_ = /'/g;
  3273. goog.string.internal.NULL_RE_ = /\x00/g;
  3274. goog.string.internal.ALL_RE_ = /[\x00&<>"']/;
  3275. goog.string.internal.whitespaceEscape = function (a, b) {
  3276. return goog.string.internal.newLineToBr(a.replace(/ /g, " &#160;"), b)
  3277. }
  3278. ;
  3279. goog.string.internal.contains = function (a, b) {
  3280. return -1 != a.indexOf(b)
  3281. }
  3282. ;
  3283. goog.string.internal.caseInsensitiveContains = function (a, b) {
  3284. return goog.string.internal.contains(a.toLowerCase(), b.toLowerCase())
  3285. }
  3286. ;
  3287. goog.string.internal.compareVersions = function (a, b) {
  3288. for (var c = 0, d = goog.string.internal.trim(String(a)).split("."), e = goog.string.internal.trim(String(b)).split("."), f = Math.max(d.length, e.length), g = 0; 0 == c && g < f; g++) {
  3289. var h = d[g] || ""
  3290. , k = e[g] || "";
  3291. do {
  3292. h = /(\d*)(\D*)(.*)/.exec(h) || ["", "", "", ""];
  3293. k = /(\d*)(\D*)(.*)/.exec(k) || ["", "", "", ""];
  3294. if (0 == h[0].length && 0 == k[0].length)
  3295. break;
  3296. c = 0 == h[1].length ? 0 : parseInt(h[1], 10);
  3297. var m = 0 == k[1].length ? 0 : parseInt(k[1], 10);
  3298. c = goog.string.internal.compareElements_(c, m) || goog.string.internal.compareElements_(0 == h[2].length, 0 == k[2].length) || goog.string.internal.compareElements_(h[2], k[2]);
  3299. h = h[3];
  3300. k = k[3]
  3301. } while (0 == c)
  3302. }
  3303. return c
  3304. }
  3305. ;
  3306. goog.string.internal.compareElements_ = function (a, b) {
  3307. return a < b ? -1 : a > b ? 1 : 0
  3308. }
  3309. ;
  3310. goog.html.SafeUrl = function (a, b) {
  3311. this.privateDoNotAccessOrElseSafeUrlWrappedValue_ = a === goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_ && b || "";
  3312. this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3313. }
  3314. ;
  3315. goog.html.SafeUrl.INNOCUOUS_STRING = "about:invalid#zClosurez";
  3316. goog.html.SafeUrl.prototype.implementsGoogStringTypedString = !0;
  3317. goog.html.SafeUrl.prototype.getTypedStringValue = function () {
  3318. return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()
  3319. }
  3320. ;
  3321. goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString = !0;
  3322. goog.html.SafeUrl.prototype.getDirection = function () {
  3323. return goog.i18n.bidi.Dir.LTR
  3324. }
  3325. ;
  3326. goog.DEBUG && (goog.html.SafeUrl.prototype.toString = function () {
  3327. return "SafeUrl{" + this.privateDoNotAccessOrElseSafeUrlWrappedValue_ + "}"
  3328. }
  3329. );
  3330. goog.html.SafeUrl.unwrap = function (a) {
  3331. if (a instanceof goog.html.SafeUrl && a.constructor === goog.html.SafeUrl && a.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3332. return a.privateDoNotAccessOrElseSafeUrlWrappedValue_;
  3333. goog.asserts.fail("expected object of type SafeUrl, got '" + a + "' of type " + goog.typeOf(a));
  3334. return "type_error:SafeUrl"
  3335. }
  3336. ;
  3337. goog.html.SafeUrl.fromConstant = function (a) {
  3338. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))
  3339. }
  3340. ;
  3341. goog.html.SAFE_MIME_TYPE_PATTERN_ = /^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\w+=(?:\w+|"[\w;=]+"))*$/i;
  3342. goog.html.SafeUrl.isSafeMimeType = function (a) {
  3343. return goog.html.SAFE_MIME_TYPE_PATTERN_.test(a)
  3344. }
  3345. ;
  3346. goog.html.SafeUrl.fromBlob = function (a) {
  3347. a = goog.html.SAFE_MIME_TYPE_PATTERN_.test(a.type) ? goog.fs.url.createObjectUrl(a) : goog.html.SafeUrl.INNOCUOUS_STRING;
  3348. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3349. }
  3350. ;
  3351. goog.html.DATA_URL_PATTERN_ = /^data:([^,]*);base64,[a-z0-9+\/]+=*$/i;
  3352. goog.html.SafeUrl.fromDataUrl = function (a) {
  3353. a = a.replace(/(%0A|%0D)/g, "");
  3354. var b = a.match(goog.html.DATA_URL_PATTERN_);
  3355. b = b && goog.html.SAFE_MIME_TYPE_PATTERN_.test(b[1]);
  3356. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b ? a : goog.html.SafeUrl.INNOCUOUS_STRING)
  3357. }
  3358. ;
  3359. goog.html.SafeUrl.fromTelUrl = function (a) {
  3360. goog.string.internal.caseInsensitiveStartsWith(a, "tel:") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3361. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3362. }
  3363. ;
  3364. goog.html.SIP_URL_PATTERN_ = /^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i;
  3365. goog.html.SafeUrl.fromSipUrl = function (a) {
  3366. goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(a)) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3367. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3368. }
  3369. ;
  3370. goog.html.SafeUrl.fromFacebookMessengerUrl = function (a) {
  3371. goog.string.internal.caseInsensitiveStartsWith(a, "fb-messenger://share") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3372. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3373. }
  3374. ;
  3375. goog.html.SafeUrl.fromWhatsAppUrl = function (a) {
  3376. goog.string.internal.caseInsensitiveStartsWith(a, "whatsapp://send") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3377. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3378. }
  3379. ;
  3380. goog.html.SafeUrl.fromSmsUrl = function (a) {
  3381. goog.string.internal.caseInsensitiveStartsWith(a, "sms:") && goog.html.SafeUrl.isSmsUrlBodyValid_(a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3382. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3383. }
  3384. ;
  3385. goog.html.SafeUrl.isSmsUrlBodyValid_ = function (a) {
  3386. var b = a.indexOf("#");
  3387. 0 < b && (a = a.substring(0, b));
  3388. b = a.match(/[?&]body=/gi);
  3389. if (!b)
  3390. return !0;
  3391. if (1 < b.length)
  3392. return !1;
  3393. a = a.match(/[?&]body=([^&]*)/)[1];
  3394. if (!a)
  3395. return !0;
  3396. try {
  3397. decodeURIComponent(a)
  3398. } catch (c) {
  3399. return !1
  3400. }
  3401. return /^(?:[a-z0-9\-_.~]|%[0-9a-f]{2})+$/i.test(a)
  3402. }
  3403. ;
  3404. goog.html.SafeUrl.fromSshUrl = function (a) {
  3405. goog.string.internal.caseInsensitiveStartsWith(a, "ssh://") || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3406. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3407. }
  3408. ;
  3409. goog.html.SafeUrl.sanitizeChromeExtensionUrl = function (a, b) {
  3410. return goog.html.SafeUrl.sanitizeExtensionUrl_(/^chrome-extension:\/\/([^\/]+)\//, a, b)
  3411. }
  3412. ;
  3413. goog.html.SafeUrl.sanitizeFirefoxExtensionUrl = function (a, b) {
  3414. return goog.html.SafeUrl.sanitizeExtensionUrl_(/^moz-extension:\/\/([^\/]+)\//, a, b)
  3415. }
  3416. ;
  3417. goog.html.SafeUrl.sanitizeEdgeExtensionUrl = function (a, b) {
  3418. return goog.html.SafeUrl.sanitizeExtensionUrl_(/^ms-browser-extension:\/\/([^\/]+)\//, a, b)
  3419. }
  3420. ;
  3421. goog.html.SafeUrl.sanitizeExtensionUrl_ = function (a, b, c) {
  3422. (a = a.exec(b)) ? (a = a[1],
  3423. -1 == (c instanceof goog.string.Const ? [goog.string.Const.unwrap(c)] : c.map(function (a) {
  3424. return goog.string.Const.unwrap(a)
  3425. })).indexOf(a) && (b = goog.html.SafeUrl.INNOCUOUS_STRING)) : b = goog.html.SafeUrl.INNOCUOUS_STRING;
  3426. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)
  3427. }
  3428. ;
  3429. goog.html.SafeUrl.fromTrustedResourceUrl = function (a) {
  3430. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(a))
  3431. }
  3432. ;
  3433. goog.html.SAFE_URL_PATTERN_ = /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;
  3434. goog.html.SafeUrl.SAFE_URL_PATTERN = goog.html.SAFE_URL_PATTERN_;
  3435. goog.html.SafeUrl.sanitize = function (a) {
  3436. if (a instanceof goog.html.SafeUrl)
  3437. return a;
  3438. a = "object" == typeof a && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a);
  3439. goog.html.SAFE_URL_PATTERN_.test(a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3440. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3441. }
  3442. ;
  3443. goog.html.SafeUrl.sanitizeAssertUnchanged = function (a, b) {
  3444. if (a instanceof goog.html.SafeUrl)
  3445. return a;
  3446. a = "object" == typeof a && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a);
  3447. if (b && /^data:/i.test(a)) {
  3448. var c = goog.html.SafeUrl.fromDataUrl(a);
  3449. if (c.getTypedStringValue() == a)
  3450. return c
  3451. }
  3452. goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(a), "%s does not match the safe URL pattern", a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING);
  3453. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)
  3454. }
  3455. ;
  3456. goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3457. goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse = function (a) {
  3458. return new goog.html.SafeUrl(goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_, a)
  3459. }
  3460. ;
  3461. goog.html.SafeUrl.ABOUT_BLANK = goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank");
  3462. goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_ = {};
  3463. goog.html.SafeStyle = function () {
  3464. this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = "";
  3465. this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3466. }
  3467. ;
  3468. goog.html.SafeStyle.prototype.implementsGoogStringTypedString = !0;
  3469. goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3470. goog.html.SafeStyle.fromConstant = function (a) {
  3471. a = goog.string.Const.unwrap(a);
  3472. if (0 === a.length)
  3473. return goog.html.SafeStyle.EMPTY;
  3474. goog.asserts.assert(goog.string.internal.endsWith(a, ";"), "Last character of style string is not ';': " + a);
  3475. goog.asserts.assert(goog.string.internal.contains(a, ":"), "Style string must contain at least one ':', to specify a \"name: value\" pair: " + a);
  3476. return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(a)
  3477. }
  3478. ;
  3479. goog.html.SafeStyle.prototype.getTypedStringValue = function () {
  3480. return this.privateDoNotAccessOrElseSafeStyleWrappedValue_
  3481. }
  3482. ;
  3483. goog.DEBUG && (goog.html.SafeStyle.prototype.toString = function () {
  3484. return "SafeStyle{" + this.privateDoNotAccessOrElseSafeStyleWrappedValue_ + "}"
  3485. }
  3486. );
  3487. goog.html.SafeStyle.unwrap = function (a) {
  3488. if (a instanceof goog.html.SafeStyle && a.constructor === goog.html.SafeStyle && a.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3489. return a.privateDoNotAccessOrElseSafeStyleWrappedValue_;
  3490. goog.asserts.fail("expected object of type SafeStyle, got '" + a + "' of type " + goog.typeOf(a));
  3491. return "type_error:SafeStyle"
  3492. }
  3493. ;
  3494. goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = function (a) {
  3495. return (new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(a)
  3496. }
  3497. ;
  3498. goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) {
  3499. this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = a;
  3500. return this
  3501. }
  3502. ;
  3503. goog.html.SafeStyle.EMPTY = goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse("");
  3504. goog.html.SafeStyle.INNOCUOUS_STRING = "zClosurez";
  3505. goog.html.SafeStyle.create = function (a) {
  3506. var b = "", c;
  3507. for (c in a) {
  3508. if (!/^[-_a-zA-Z0-9]+$/.test(c))
  3509. throw Error("Name allows only [-_a-zA-Z0-9], got: " + c);
  3510. var d = a[c];
  3511. null != d && (d = goog.isArray(d) ? goog.array.map(d, goog.html.SafeStyle.sanitizePropertyValue_).join(" ") : goog.html.SafeStyle.sanitizePropertyValue_(d),
  3512. b += c + ":" + d + ";")
  3513. }
  3514. return b ? goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b) : goog.html.SafeStyle.EMPTY
  3515. }
  3516. ;
  3517. goog.html.SafeStyle.sanitizePropertyValue_ = function (a) {
  3518. if (a instanceof goog.html.SafeUrl)
  3519. return 'url("' + goog.html.SafeUrl.unwrap(a).replace(/</g, "%3c").replace(/[\\"]/g, "\\$&") + '")';
  3520. a = a instanceof goog.string.Const ? goog.string.Const.unwrap(a) : goog.html.SafeStyle.sanitizePropertyValueString_(String(a));
  3521. if (/[{;}]/.test(a))
  3522. throw new goog.asserts.AssertionError("Value does not allow [{;}], got: %s.", [a]);
  3523. return a
  3524. }
  3525. ;
  3526. goog.html.SafeStyle.sanitizePropertyValueString_ = function (a) {
  3527. var b = a.replace(goog.html.SafeStyle.FUNCTIONS_RE_, "$1").replace(goog.html.SafeStyle.FUNCTIONS_RE_, "$1").replace(goog.html.SafeStyle.URL_RE_, "url");
  3528. if (goog.html.SafeStyle.VALUE_RE_.test(b)) {
  3529. if (goog.html.SafeStyle.COMMENT_RE_.test(a))
  3530. return goog.asserts.fail("String value disallows comments, got: " + a),
  3531. goog.html.SafeStyle.INNOCUOUS_STRING;
  3532. if (!goog.html.SafeStyle.hasBalancedQuotes_(a))
  3533. return goog.asserts.fail("String value requires balanced quotes, got: " + a),
  3534. goog.html.SafeStyle.INNOCUOUS_STRING;
  3535. if (!goog.html.SafeStyle.hasBalancedSquareBrackets_(a))
  3536. return goog.asserts.fail("String value requires balanced square brackets and one identifier per pair of brackets, got: " + a),
  3537. goog.html.SafeStyle.INNOCUOUS_STRING
  3538. } else
  3539. return goog.asserts.fail("String value allows only " + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + " and simple functions, got: " + a),
  3540. goog.html.SafeStyle.INNOCUOUS_STRING;
  3541. return goog.html.SafeStyle.sanitizeUrl_(a)
  3542. }
  3543. ;
  3544. goog.html.SafeStyle.hasBalancedQuotes_ = function (a) {
  3545. for (var b = !0, c = !0, d = 0; d < a.length; d++) {
  3546. var e = a.charAt(d);
  3547. "'" == e && c ? b = !b : '"' == e && b && (c = !c)
  3548. }
  3549. return b && c
  3550. }
  3551. ;
  3552. goog.html.SafeStyle.hasBalancedSquareBrackets_ = function (a) {
  3553. for (var b = !0, c = /^[-_a-zA-Z0-9]$/, d = 0; d < a.length; d++) {
  3554. var e = a.charAt(d);
  3555. if ("]" == e) {
  3556. if (b)
  3557. return !1;
  3558. b = !0
  3559. } else if ("[" == e) {
  3560. if (!b)
  3561. return !1;
  3562. b = !1
  3563. } else if (!b && !c.test(e))
  3564. return !1
  3565. }
  3566. return b
  3567. }
  3568. ;
  3569. goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ = "[-,.\"'%_!# a-zA-Z0-9\\[\\]]";
  3570. goog.html.SafeStyle.VALUE_RE_ = new RegExp("^" + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + "+$");
  3571. goog.html.SafeStyle.URL_RE_ = RegExp("\\b(url\\([ \t\n]*)('[ -&(-\\[\\]-~]*'|\"[ !#-\\[\\]-~]*\"|[!#-&*-\\[\\]-~]*)([ \t\n]*\\))", "g");
  3572. goog.html.SafeStyle.ALLOWED_FUNCTIONS_ = "calc cubic-bezier fit-content hsl hsla matrix minmax repeat rgb rgba (rotate|scale|translate)(X|Y|Z|3d)?".split(" ");
  3573. goog.html.SafeStyle.FUNCTIONS_RE_ = new RegExp("\\b(" + goog.html.SafeStyle.ALLOWED_FUNCTIONS_.join("|") + ")\\([-+*/0-9a-z.%\\[\\], ]+\\)", "g");
  3574. goog.html.SafeStyle.COMMENT_RE_ = /\/\*/;
  3575. goog.html.SafeStyle.sanitizeUrl_ = function (a) {
  3576. return a.replace(goog.html.SafeStyle.URL_RE_, function (a, c, d, e) {
  3577. var b = "";
  3578. d = d.replace(/^(['"])(.*)\1$/, function (a, c, d) {
  3579. b = c;
  3580. return d
  3581. });
  3582. a = goog.html.SafeUrl.sanitize(d).getTypedStringValue();
  3583. return c + b + a + b + e
  3584. })
  3585. }
  3586. ;
  3587. goog.html.SafeStyle.concat = function (a) {
  3588. var b = ""
  3589. , c = function (a) {
  3590. goog.isArray(a) ? goog.array.forEach(a, c) : b += goog.html.SafeStyle.unwrap(a)
  3591. };
  3592. goog.array.forEach(arguments, c);
  3593. return b ? goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b) : goog.html.SafeStyle.EMPTY
  3594. }
  3595. ;
  3596. goog.html.SafeStyleSheet = function () {
  3597. this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = "";
  3598. this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_
  3599. }
  3600. ;
  3601. goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString = !0;
  3602. goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  3603. goog.html.SafeStyleSheet.createRule = function (a, b) {
  3604. if (goog.string.internal.contains(a, "<"))
  3605. throw Error("Selector does not allow '<', got: " + a);
  3606. var c = a.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g, "");
  3607. if (!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(c))
  3608. throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: " + a);
  3609. if (!goog.html.SafeStyleSheet.hasBalancedBrackets_(c))
  3610. throw Error("() and [] in selector must be balanced, got: " + a);
  3611. b instanceof goog.html.SafeStyle || (b = goog.html.SafeStyle.create(b));
  3612. c = a + "{" + goog.html.SafeStyle.unwrap(b).replace(/</g, "\\3C ") + "}";
  3613. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(c)
  3614. }
  3615. ;
  3616. goog.html.SafeStyleSheet.hasBalancedBrackets_ = function (a) {
  3617. for (var b = {
  3618. "(": ")",
  3619. "[": "]"
  3620. }, c = [], d = 0; d < a.length; d++) {
  3621. var e = a[d];
  3622. if (b[e])
  3623. c.push(b[e]);
  3624. else if (goog.object.contains(b, e) && c.pop() != e)
  3625. return !1
  3626. }
  3627. return 0 == c.length
  3628. }
  3629. ;
  3630. goog.html.SafeStyleSheet.concat = function (a) {
  3631. var b = ""
  3632. , c = function (a) {
  3633. goog.isArray(a) ? goog.array.forEach(a, c) : b += goog.html.SafeStyleSheet.unwrap(a)
  3634. };
  3635. goog.array.forEach(arguments, c);
  3636. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)
  3637. }
  3638. ;
  3639. goog.html.SafeStyleSheet.fromConstant = function (a) {
  3640. a = goog.string.Const.unwrap(a);
  3641. if (0 === a.length)
  3642. return goog.html.SafeStyleSheet.EMPTY;
  3643. goog.asserts.assert(!goog.string.internal.contains(a, "<"), "Forbidden '<' character in style sheet string: " + a);
  3644. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(a)
  3645. }
  3646. ;
  3647. goog.html.SafeStyleSheet.prototype.getTypedStringValue = function () {
  3648. return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_
  3649. }
  3650. ;
  3651. goog.DEBUG && (goog.html.SafeStyleSheet.prototype.toString = function () {
  3652. return "SafeStyleSheet{" + this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ + "}"
  3653. }
  3654. );
  3655. goog.html.SafeStyleSheet.unwrap = function (a) {
  3656. if (a instanceof goog.html.SafeStyleSheet && a.constructor === goog.html.SafeStyleSheet && a.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3657. return a.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;
  3658. goog.asserts.fail("expected object of type SafeStyleSheet, got '" + a + "' of type " + goog.typeOf(a));
  3659. return "type_error:SafeStyleSheet"
  3660. }
  3661. ;
  3662. goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse = function (a) {
  3663. return (new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(a)
  3664. }
  3665. ;
  3666. goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) {
  3667. this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = a;
  3668. return this
  3669. }
  3670. ;
  3671. goog.html.SafeStyleSheet.EMPTY = goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse("");
  3672. goog.labs = {};
  3673. goog.labs.userAgent = {};
  3674. goog.labs.userAgent.util = {};
  3675. goog.labs.userAgent.util.getNativeUserAgentString_ = function () {
  3676. var a = goog.labs.userAgent.util.getNavigator_();
  3677. return a && (a = a.userAgent) ? a : ""
  3678. }
  3679. ;
  3680. goog.labs.userAgent.util.getNavigator_ = function () {
  3681. return goog.global.navigator
  3682. }
  3683. ;
  3684. goog.labs.userAgent.util.userAgent_ = goog.labs.userAgent.util.getNativeUserAgentString_();
  3685. goog.labs.userAgent.util.setUserAgent = function (a) {
  3686. goog.labs.userAgent.util.userAgent_ = a || goog.labs.userAgent.util.getNativeUserAgentString_()
  3687. }
  3688. ;
  3689. goog.labs.userAgent.util.getUserAgent = function () {
  3690. return goog.labs.userAgent.util.userAgent_
  3691. }
  3692. ;
  3693. goog.labs.userAgent.util.matchUserAgent = function (a) {
  3694. var b = goog.labs.userAgent.util.getUserAgent();
  3695. return goog.string.internal.contains(b, a)
  3696. }
  3697. ;
  3698. goog.labs.userAgent.util.matchUserAgentIgnoreCase = function (a) {
  3699. var b = goog.labs.userAgent.util.getUserAgent();
  3700. return goog.string.internal.caseInsensitiveContains(b, a)
  3701. }
  3702. ;
  3703. goog.labs.userAgent.util.extractVersionTuples = function (a) {
  3704. for (var b = RegExp("(\\w[\\w ]+)/([^\\s]+)\\s*(?:\\((.*?)\\))?", "g"), c = [], d; d = b.exec(a);)
  3705. c.push([d[1], d[2], d[3] || void 0]);
  3706. return c
  3707. }
  3708. ;
  3709. goog.labs.userAgent.browser = {};
  3710. goog.labs.userAgent.browser.matchOpera_ = function () {
  3711. return goog.labs.userAgent.util.matchUserAgent("Opera")
  3712. }
  3713. ;
  3714. goog.labs.userAgent.browser.matchIE_ = function () {
  3715. return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE")
  3716. }
  3717. ;
  3718. goog.labs.userAgent.browser.matchEdgeHtml_ = function () {
  3719. return goog.labs.userAgent.util.matchUserAgent("Edge")
  3720. }
  3721. ;
  3722. goog.labs.userAgent.browser.matchEdgeChromium_ = function () {
  3723. return goog.labs.userAgent.util.matchUserAgent("Edg/")
  3724. }
  3725. ;
  3726. goog.labs.userAgent.browser.matchOperaChromium_ = function () {
  3727. return goog.labs.userAgent.util.matchUserAgent("OPR")
  3728. }
  3729. ;
  3730. goog.labs.userAgent.browser.matchFirefox_ = function () {
  3731. return goog.labs.userAgent.util.matchUserAgent("Firefox") || goog.labs.userAgent.util.matchUserAgent("FxiOS")
  3732. }
  3733. ;
  3734. goog.labs.userAgent.browser.matchSafari_ = function () {
  3735. return goog.labs.userAgent.util.matchUserAgent("Safari") && !(goog.labs.userAgent.browser.matchChrome_() || goog.labs.userAgent.browser.matchCoast_() || goog.labs.userAgent.browser.matchOpera_() || goog.labs.userAgent.browser.matchEdgeHtml_() || goog.labs.userAgent.browser.matchEdgeChromium_() || goog.labs.userAgent.browser.matchOperaChromium_() || goog.labs.userAgent.browser.matchFirefox_() || goog.labs.userAgent.browser.isSilk() || goog.labs.userAgent.util.matchUserAgent("Android"))
  3736. }
  3737. ;
  3738. goog.labs.userAgent.browser.matchCoast_ = function () {
  3739. return goog.labs.userAgent.util.matchUserAgent("Coast")
  3740. }
  3741. ;
  3742. goog.labs.userAgent.browser.matchIosWebview_ = function () {
  3743. return (goog.labs.userAgent.util.matchUserAgent("iPad") || goog.labs.userAgent.util.matchUserAgent("iPhone")) && !goog.labs.userAgent.browser.matchSafari_() && !goog.labs.userAgent.browser.matchChrome_() && !goog.labs.userAgent.browser.matchCoast_() && !goog.labs.userAgent.browser.matchFirefox_() && goog.labs.userAgent.util.matchUserAgent("AppleWebKit")
  3744. }
  3745. ;
  3746. goog.labs.userAgent.browser.matchChrome_ = function () {
  3747. return (goog.labs.userAgent.util.matchUserAgent("Chrome") || goog.labs.userAgent.util.matchUserAgent("CriOS")) && !goog.labs.userAgent.browser.matchEdgeHtml_()
  3748. }
  3749. ;
  3750. goog.labs.userAgent.browser.matchAndroidBrowser_ = function () {
  3751. return goog.labs.userAgent.util.matchUserAgent("Android") && !(goog.labs.userAgent.browser.isChrome() || goog.labs.userAgent.browser.isFirefox() || goog.labs.userAgent.browser.isOpera() || goog.labs.userAgent.browser.isSilk())
  3752. }
  3753. ;
  3754. goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_;
  3755. goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_;
  3756. goog.labs.userAgent.browser.isEdge = goog.labs.userAgent.browser.matchEdgeHtml_;
  3757. goog.labs.userAgent.browser.isEdgeChromium = goog.labs.userAgent.browser.matchEdgeChromium_;
  3758. goog.labs.userAgent.browser.isOperaChromium = goog.labs.userAgent.browser.matchOperaChromium_;
  3759. goog.labs.userAgent.browser.isFirefox = goog.labs.userAgent.browser.matchFirefox_;
  3760. goog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_;
  3761. goog.labs.userAgent.browser.isCoast = goog.labs.userAgent.browser.matchCoast_;
  3762. goog.labs.userAgent.browser.isIosWebview = goog.labs.userAgent.browser.matchIosWebview_;
  3763. goog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_;
  3764. goog.labs.userAgent.browser.isAndroidBrowser = goog.labs.userAgent.browser.matchAndroidBrowser_;
  3765. goog.labs.userAgent.browser.isSilk = function () {
  3766. return goog.labs.userAgent.util.matchUserAgent("Silk")
  3767. }
  3768. ;
  3769. goog.labs.userAgent.browser.getVersion = function () {
  3770. function a(a) {
  3771. a = goog.array.find(a, d);
  3772. return c[a] || ""
  3773. }
  3774. var b = goog.labs.userAgent.util.getUserAgent();
  3775. if (goog.labs.userAgent.browser.isIE())
  3776. return goog.labs.userAgent.browser.getIEVersion_(b);
  3777. b = goog.labs.userAgent.util.extractVersionTuples(b);
  3778. var c = {};
  3779. goog.array.forEach(b, function (a) {
  3780. c[a[0]] = a[1]
  3781. });
  3782. var d = goog.partial(goog.object.containsKey, c);
  3783. return goog.labs.userAgent.browser.isOpera() ? a(["Version", "Opera"]) : goog.labs.userAgent.browser.isEdge() ? a(["Edge"]) : goog.labs.userAgent.browser.isEdgeChromium() ? a(["Edg"]) : goog.labs.userAgent.browser.isChrome() ? a(["Chrome", "CriOS"]) : (b = b[2]) && b[1] || ""
  3784. }
  3785. ;
  3786. goog.labs.userAgent.browser.isVersionOrHigher = function (a) {
  3787. return 0 <= goog.string.internal.compareVersions(goog.labs.userAgent.browser.getVersion(), a)
  3788. }
  3789. ;
  3790. goog.labs.userAgent.browser.getIEVersion_ = function (a) {
  3791. var b = /rv: *([\d\.]*)/.exec(a);
  3792. if (b && b[1])
  3793. return b[1];
  3794. b = "";
  3795. var c = /MSIE +([\d\.]+)/.exec(a);
  3796. if (c && c[1])
  3797. if (a = /Trident\/(\d.\d)/.exec(a),
  3798. "7.0" == c[1])
  3799. if (a && a[1])
  3800. switch (a[1]) {
  3801. case "4.0":
  3802. b = "8.0";
  3803. break;
  3804. case "5.0":
  3805. b = "9.0";
  3806. break;
  3807. case "6.0":
  3808. b = "10.0";
  3809. break;
  3810. case "7.0":
  3811. b = "11.0"
  3812. }
  3813. else
  3814. b = "7.0";
  3815. else
  3816. b = c[1];
  3817. return b
  3818. }
  3819. ;
  3820. goog.html.SafeHtml = function () {
  3821. this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = "";
  3822. this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
  3823. this.dir_ = null
  3824. }
  3825. ;
  3826. goog.html.SafeHtml.ENABLE_ERROR_MESSAGES = goog.DEBUG;
  3827. goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE = !0;
  3828. goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString = !0;
  3829. goog.html.SafeHtml.prototype.getDirection = function () {
  3830. return this.dir_
  3831. }
  3832. ;
  3833. goog.html.SafeHtml.prototype.implementsGoogStringTypedString = !0;
  3834. goog.html.SafeHtml.prototype.getTypedStringValue = function () {
  3835. return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString()
  3836. }
  3837. ;
  3838. goog.DEBUG && (goog.html.SafeHtml.prototype.toString = function () {
  3839. return "SafeHtml{" + this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ + "}"
  3840. }
  3841. );
  3842. goog.html.SafeHtml.unwrap = function (a) {
  3843. return goog.html.SafeHtml.unwrapTrustedHTML(a).toString()
  3844. }
  3845. ;
  3846. goog.html.SafeHtml.unwrapTrustedHTML = function (a) {
  3847. if (a instanceof goog.html.SafeHtml && a.constructor === goog.html.SafeHtml && a.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)
  3848. return a.privateDoNotAccessOrElseSafeHtmlWrappedValue_;
  3849. goog.asserts.fail("expected object of type SafeHtml, got '" + a + "' of type " + goog.typeOf(a));
  3850. return "type_error:SafeHtml"
  3851. }
  3852. ;
  3853. goog.html.SafeHtml.htmlEscape = function (a) {
  3854. if (a instanceof goog.html.SafeHtml)
  3855. return a;
  3856. var b = "object" == typeof a
  3857. , c = null;
  3858. b && a.implementsGoogI18nBidiDirectionalString && (c = a.getDirection());
  3859. a = b && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a);
  3860. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.htmlEscape(a), c)
  3861. }
  3862. ;
  3863. goog.html.SafeHtml.htmlEscapePreservingNewlines = function (a) {
  3864. if (a instanceof goog.html.SafeHtml)
  3865. return a;
  3866. a = goog.html.SafeHtml.htmlEscape(a);
  3867. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(a)), a.getDirection())
  3868. }
  3869. ;
  3870. goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces = function (a) {
  3871. if (a instanceof goog.html.SafeHtml)
  3872. return a;
  3873. a = goog.html.SafeHtml.htmlEscape(a);
  3874. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(a)), a.getDirection())
  3875. }
  3876. ;
  3877. goog.html.SafeHtml.from = goog.html.SafeHtml.htmlEscape;
  3878. goog.html.SafeHtml.VALID_NAMES_IN_TAG_ = /^[a-zA-Z0-9-]+$/;
  3879. goog.html.SafeHtml.URL_ATTRIBUTES_ = {
  3880. action: !0,
  3881. cite: !0,
  3882. data: !0,
  3883. formaction: !0,
  3884. href: !0,
  3885. manifest: !0,
  3886. poster: !0,
  3887. src: !0
  3888. };
  3889. goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_ = {
  3890. APPLET: !0,
  3891. BASE: !0,
  3892. EMBED: !0,
  3893. IFRAME: !0,
  3894. LINK: !0,
  3895. MATH: !0,
  3896. META: !0,
  3897. OBJECT: !0,
  3898. SCRIPT: !0,
  3899. STYLE: !0,
  3900. SVG: !0,
  3901. TEMPLATE: !0
  3902. };
  3903. goog.html.SafeHtml.create = function (a, b, c) {
  3904. goog.html.SafeHtml.verifyTagName(String(a));
  3905. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(a), b, c)
  3906. }
  3907. ;
  3908. goog.html.SafeHtml.verifyTagName = function (a) {
  3909. if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(a))
  3910. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? "Invalid tag name <" + a + ">." : "");
  3911. if (a.toUpperCase() in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)
  3912. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? "Tag name <" + a + "> is not allowed for SafeHtml." : "");
  3913. }
  3914. ;
  3915. goog.html.SafeHtml.createIframe = function (a, b, c, d) {
  3916. a && goog.html.TrustedResourceUrl.unwrap(a);
  3917. var e = {};
  3918. e.src = a || null;
  3919. e.srcdoc = b && goog.html.SafeHtml.unwrap(b);
  3920. a = goog.html.SafeHtml.combineAttributes(e, {
  3921. sandbox: ""
  3922. }, c);
  3923. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", a, d)
  3924. }
  3925. ;
  3926. goog.html.SafeHtml.createSandboxIframe = function (a, b, c, d) {
  3927. if (!goog.html.SafeHtml.canUseSandboxIframe())
  3928. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? "The browser does not support sandboxed iframes." : "");
  3929. var e = {};
  3930. e.src = a ? goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a)) : null;
  3931. e.srcdoc = b || null;
  3932. e.sandbox = "";
  3933. a = goog.html.SafeHtml.combineAttributes(e, {}, c);
  3934. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", a, d)
  3935. }
  3936. ;
  3937. goog.html.SafeHtml.canUseSandboxIframe = function () {
  3938. return goog.global.HTMLIFrameElement && "sandbox" in goog.global.HTMLIFrameElement.prototype
  3939. }
  3940. ;
  3941. goog.html.SafeHtml.createScriptSrc = function (a, b) {
  3942. goog.html.TrustedResourceUrl.unwrap(a);
  3943. var c = goog.html.SafeHtml.combineAttributes({
  3944. src: a
  3945. }, {}, b);
  3946. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", c)
  3947. }
  3948. ;
  3949. goog.html.SafeHtml.createScript = function (a, b) {
  3950. for (var c in b) {
  3951. var d = c.toLowerCase();
  3952. if ("language" == d || "src" == d || "text" == d || "type" == d)
  3953. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Cannot set "' + d + '" attribute' : "");
  3954. }
  3955. c = "";
  3956. a = goog.array.concat(a);
  3957. for (d = 0; d < a.length; d++)
  3958. c += goog.html.SafeScript.unwrap(a[d]);
  3959. c = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(c, goog.i18n.bidi.Dir.NEUTRAL);
  3960. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", b, c)
  3961. }
  3962. ;
  3963. goog.html.SafeHtml.createStyle = function (a, b) {
  3964. var c = goog.html.SafeHtml.combineAttributes({
  3965. type: "text/css"
  3966. }, {}, b)
  3967. , d = "";
  3968. a = goog.array.concat(a);
  3969. for (var e = 0; e < a.length; e++)
  3970. d += goog.html.SafeStyleSheet.unwrap(a[e]);
  3971. d = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(d, goog.i18n.bidi.Dir.NEUTRAL);
  3972. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style", c, d)
  3973. }
  3974. ;
  3975. goog.html.SafeHtml.createMetaRefresh = function (a, b) {
  3976. var c = goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a));
  3977. (goog.labs.userAgent.browser.isIE() || goog.labs.userAgent.browser.isEdge()) && goog.string.internal.contains(c, ";") && (c = "'" + c.replace(/'/g, "%27") + "'");
  3978. return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta", {
  3979. "http-equiv": "refresh",
  3980. content: (b || 0) + "; url=" + c
  3981. })
  3982. }
  3983. ;
  3984. goog.html.SafeHtml.getAttrNameAndValue_ = function (a, b, c) {
  3985. if (c instanceof goog.string.Const)
  3986. c = goog.string.Const.unwrap(c);
  3987. else if ("style" == b.toLowerCase())
  3988. if (goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE)
  3989. c = goog.html.SafeHtml.getStyleValue_(c);
  3990. else
  3991. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Attribute "style" not supported.' : "");
  3992. else {
  3993. if (/^on/i.test(b))
  3994. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Attribute "' + b + '" requires goog.string.Const value, "' + c + '" given.' : "");
  3995. if (b.toLowerCase() in goog.html.SafeHtml.URL_ATTRIBUTES_)
  3996. if (c instanceof goog.html.TrustedResourceUrl)
  3997. c = goog.html.TrustedResourceUrl.unwrap(c);
  3998. else if (c instanceof goog.html.SafeUrl)
  3999. c = goog.html.SafeUrl.unwrap(c);
  4000. else if ("string" === typeof c)
  4001. c = goog.html.SafeUrl.sanitize(c).getTypedStringValue();
  4002. else
  4003. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Attribute "' + b + '" on tag "' + a + '" requires goog.html.SafeUrl, goog.string.Const, or string, value "' + c + '" given.' : "");
  4004. }
  4005. c.implementsGoogStringTypedString && (c = c.getTypedStringValue());
  4006. goog.asserts.assert("string" === typeof c || "number" === typeof c, "String or number value expected, got " + typeof c + " with value: " + c);
  4007. return b + '="' + goog.string.internal.htmlEscape(String(c)) + '"'
  4008. }
  4009. ;
  4010. goog.html.SafeHtml.getStyleValue_ = function (a) {
  4011. if (!goog.isObject(a))
  4012. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'The "style" attribute requires goog.html.SafeStyle or map of style properties, ' + typeof a + " given: " + a : "");
  4013. a instanceof goog.html.SafeStyle || (a = goog.html.SafeStyle.create(a));
  4014. return goog.html.SafeStyle.unwrap(a)
  4015. }
  4016. ;
  4017. goog.html.SafeHtml.createWithDir = function (a, b, c, d) {
  4018. b = goog.html.SafeHtml.create(b, c, d);
  4019. b.dir_ = a;
  4020. return b
  4021. }
  4022. ;
  4023. goog.html.SafeHtml.join = function (a, b) {
  4024. var c = goog.html.SafeHtml.htmlEscape(a)
  4025. , d = c.getDirection()
  4026. , e = []
  4027. , f = function (a) {
  4028. goog.isArray(a) ? goog.array.forEach(a, f) : (a = goog.html.SafeHtml.htmlEscape(a),
  4029. e.push(goog.html.SafeHtml.unwrap(a)),
  4030. a = a.getDirection(),
  4031. d == goog.i18n.bidi.Dir.NEUTRAL ? d = a : a != goog.i18n.bidi.Dir.NEUTRAL && d != a && (d = null))
  4032. };
  4033. goog.array.forEach(b, f);
  4034. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e.join(goog.html.SafeHtml.unwrap(c)), d)
  4035. }
  4036. ;
  4037. goog.html.SafeHtml.concat = function (a) {
  4038. return goog.html.SafeHtml.join(goog.html.SafeHtml.EMPTY, Array.prototype.slice.call(arguments))
  4039. }
  4040. ;
  4041. goog.html.SafeHtml.concatWithDir = function (a, b) {
  4042. var c = goog.html.SafeHtml.concat(goog.array.slice(arguments, 1));
  4043. c.dir_ = a;
  4044. return c
  4045. }
  4046. ;
  4047. goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
  4048. goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse = function (a, b) {
  4049. return (new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(a, b)
  4050. }
  4051. ;
  4052. goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a, b) {
  4053. this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createHTML(a) : a;
  4054. this.dir_ = b;
  4055. return this
  4056. }
  4057. ;
  4058. goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse = function (a, b, c) {
  4059. var d = null;
  4060. var e = "<" + a + goog.html.SafeHtml.stringifyAttributes(a, b);
  4061. null == c ? c = [] : goog.isArray(c) || (c = [c]);
  4062. goog.dom.tags.isVoidTag(a.toLowerCase()) ? (goog.asserts.assert(!c.length, "Void tag <" + a + "> does not allow content."),
  4063. e += ">") : (d = goog.html.SafeHtml.concat(c),
  4064. e += ">" + goog.html.SafeHtml.unwrap(d) + "</" + a + ">",
  4065. d = d.getDirection());
  4066. (a = b && b.dir) && (d = /^(ltr|rtl|auto)$/i.test(a) ? goog.i18n.bidi.Dir.NEUTRAL : null);
  4067. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e, d)
  4068. }
  4069. ;
  4070. goog.html.SafeHtml.stringifyAttributes = function (a, b) {
  4071. var c = "";
  4072. if (b)
  4073. for (var d in b) {
  4074. if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(d))
  4075. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Invalid attribute name "' + d + '".' : "");
  4076. var e = b[d];
  4077. null != e && (c += " " + goog.html.SafeHtml.getAttrNameAndValue_(a, d, e))
  4078. }
  4079. return c
  4080. }
  4081. ;
  4082. goog.html.SafeHtml.combineAttributes = function (a, b, c) {
  4083. var d = {}, e;
  4084. for (e in a)
  4085. goog.asserts.assert(e.toLowerCase() == e, "Must be lower case"),
  4086. d[e] = a[e];
  4087. for (e in b)
  4088. goog.asserts.assert(e.toLowerCase() == e, "Must be lower case"),
  4089. d[e] = b[e];
  4090. if (c)
  4091. for (e in c) {
  4092. var f = e.toLowerCase();
  4093. if (f in a)
  4094. throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES ? 'Cannot override "' + f + '" attribute, got "' + e + '" with value "' + c[e] + '"' : "");
  4095. f in b && delete d[f];
  4096. d[e] = c[e]
  4097. }
  4098. return d
  4099. }
  4100. ;
  4101. goog.html.SafeHtml.DOCTYPE_HTML = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<!DOCTYPE html>", goog.i18n.bidi.Dir.NEUTRAL);
  4102. goog.html.SafeHtml.EMPTY = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("", goog.i18n.bidi.Dir.NEUTRAL);
  4103. goog.html.SafeHtml.BR = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<br>", goog.i18n.bidi.Dir.NEUTRAL);
  4104. goog.html.uncheckedconversions = {};
  4105. goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract = function (a, b, c) {
  4106. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4107. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4108. return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(b, c || null)
  4109. }
  4110. ;
  4111. goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract = function (a, b) {
  4112. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4113. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4114. return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(b)
  4115. }
  4116. ;
  4117. goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract = function (a, b) {
  4118. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4119. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4120. return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b)
  4121. }
  4122. ;
  4123. goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract = function (a, b) {
  4124. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4125. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4126. return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)
  4127. }
  4128. ;
  4129. goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract = function (a, b) {
  4130. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4131. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4132. return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)
  4133. }
  4134. ;
  4135. goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract = function (a, b) {
  4136. goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification");
  4137. goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification");
  4138. return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)
  4139. }
  4140. ;
  4141. goog.dom.safe = {};
  4142. goog.dom.safe.InsertAdjacentHtmlPosition = {
  4143. AFTERBEGIN: "afterbegin",
  4144. AFTEREND: "afterend",
  4145. BEFOREBEGIN: "beforebegin",
  4146. BEFOREEND: "beforeend"
  4147. };
  4148. goog.dom.safe.insertAdjacentHtml = function (a, b, c) {
  4149. a.insertAdjacentHTML(b, goog.html.SafeHtml.unwrapTrustedHTML(c))
  4150. }
  4151. ;
  4152. goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_ = {
  4153. MATH: !0,
  4154. SCRIPT: !0,
  4155. STYLE: !0,
  4156. SVG: !0,
  4157. TEMPLATE: !0
  4158. };
  4159. goog.dom.safe.isInnerHtmlCleanupRecursive_ = goog.functions.cacheReturnValue(function () {
  4160. if (goog.DEBUG && "undefined" === typeof document)
  4161. return !1;
  4162. var a = document.createElement("div")
  4163. , b = document.createElement("div");
  4164. b.appendChild(document.createElement("div"));
  4165. a.appendChild(b);
  4166. if (goog.DEBUG && !a.firstChild)
  4167. return !1;
  4168. b = a.firstChild.firstChild;
  4169. a.innerHTML = goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY);
  4170. return !b.parentElement
  4171. });
  4172. goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse = function (a, b) {
  4173. if (goog.dom.safe.isInnerHtmlCleanupRecursive_())
  4174. for (; a.lastChild;)
  4175. a.removeChild(a.lastChild);
  4176. a.innerHTML = goog.html.SafeHtml.unwrapTrustedHTML(b)
  4177. }
  4178. ;
  4179. goog.dom.safe.setInnerHtml = function (a, b) {
  4180. if (goog.asserts.ENABLE_ASSERTS) {
  4181. var c = a.tagName.toUpperCase();
  4182. if (goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[c])
  4183. throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of " + a.tagName + ".");
  4184. }
  4185. goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(a, b)
  4186. }
  4187. ;
  4188. goog.dom.safe.setOuterHtml = function (a, b) {
  4189. a.outerHTML = goog.html.SafeHtml.unwrapTrustedHTML(b)
  4190. }
  4191. ;
  4192. goog.dom.safe.setFormElementAction = function (a, b) {
  4193. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4194. goog.dom.asserts.assertIsHTMLFormElement(a).action = goog.html.SafeUrl.unwrap(c)
  4195. }
  4196. ;
  4197. goog.dom.safe.setButtonFormAction = function (a, b) {
  4198. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4199. goog.dom.asserts.assertIsHTMLButtonElement(a).formAction = goog.html.SafeUrl.unwrap(c)
  4200. }
  4201. ;
  4202. goog.dom.safe.setInputFormAction = function (a, b) {
  4203. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4204. goog.dom.asserts.assertIsHTMLInputElement(a).formAction = goog.html.SafeUrl.unwrap(c)
  4205. }
  4206. ;
  4207. goog.dom.safe.setStyle = function (a, b) {
  4208. a.style.cssText = goog.html.SafeStyle.unwrap(b)
  4209. }
  4210. ;
  4211. goog.dom.safe.documentWrite = function (a, b) {
  4212. a.write(goog.html.SafeHtml.unwrapTrustedHTML(b))
  4213. }
  4214. ;
  4215. goog.dom.safe.setAnchorHref = function (a, b) {
  4216. goog.dom.asserts.assertIsHTMLAnchorElement(a);
  4217. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4218. a.href = goog.html.SafeUrl.unwrap(c)
  4219. }
  4220. ;
  4221. goog.dom.safe.setImageSrc = function (a, b) {
  4222. goog.dom.asserts.assertIsHTMLImageElement(a);
  4223. if (b instanceof goog.html.SafeUrl)
  4224. var c = b;
  4225. else
  4226. c = /^data:image\//i.test(b),
  4227. c = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c);
  4228. a.src = goog.html.SafeUrl.unwrap(c)
  4229. }
  4230. ;
  4231. goog.dom.safe.setAudioSrc = function (a, b) {
  4232. goog.dom.asserts.assertIsHTMLAudioElement(a);
  4233. if (b instanceof goog.html.SafeUrl)
  4234. var c = b;
  4235. else
  4236. c = /^data:audio\//i.test(b),
  4237. c = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c);
  4238. a.src = goog.html.SafeUrl.unwrap(c)
  4239. }
  4240. ;
  4241. goog.dom.safe.setVideoSrc = function (a, b) {
  4242. goog.dom.asserts.assertIsHTMLVideoElement(a);
  4243. if (b instanceof goog.html.SafeUrl)
  4244. var c = b;
  4245. else
  4246. c = /^data:video\//i.test(b),
  4247. c = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c);
  4248. a.src = goog.html.SafeUrl.unwrap(c)
  4249. }
  4250. ;
  4251. goog.dom.safe.setEmbedSrc = function (a, b) {
  4252. goog.dom.asserts.assertIsHTMLEmbedElement(a);
  4253. a.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)
  4254. }
  4255. ;
  4256. goog.dom.safe.setFrameSrc = function (a, b) {
  4257. goog.dom.asserts.assertIsHTMLFrameElement(a);
  4258. a.src = goog.html.TrustedResourceUrl.unwrap(b)
  4259. }
  4260. ;
  4261. goog.dom.safe.setIframeSrc = function (a, b) {
  4262. goog.dom.asserts.assertIsHTMLIFrameElement(a);
  4263. a.src = goog.html.TrustedResourceUrl.unwrap(b)
  4264. }
  4265. ;
  4266. goog.dom.safe.setIframeSrcdoc = function (a, b) {
  4267. goog.dom.asserts.assertIsHTMLIFrameElement(a);
  4268. a.srcdoc = goog.html.SafeHtml.unwrapTrustedHTML(b)
  4269. }
  4270. ;
  4271. goog.dom.safe.setLinkHrefAndRel = function (a, b, c) {
  4272. goog.dom.asserts.assertIsHTMLLinkElement(a);
  4273. a.rel = c;
  4274. goog.string.internal.caseInsensitiveContains(c, "stylesheet") ? (goog.asserts.assert(b instanceof goog.html.TrustedResourceUrl, 'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),
  4275. a.href = goog.html.TrustedResourceUrl.unwrap(b)) : a.href = b instanceof goog.html.TrustedResourceUrl ? goog.html.TrustedResourceUrl.unwrap(b) : b instanceof goog.html.SafeUrl ? goog.html.SafeUrl.unwrap(b) : goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(b))
  4276. }
  4277. ;
  4278. goog.dom.safe.setObjectData = function (a, b) {
  4279. goog.dom.asserts.assertIsHTMLObjectElement(a);
  4280. a.data = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)
  4281. }
  4282. ;
  4283. goog.dom.safe.setScriptSrc = function (a, b) {
  4284. goog.dom.asserts.assertIsHTMLScriptElement(a);
  4285. a.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b);
  4286. var c = goog.getScriptNonce();
  4287. c && a.setAttribute("nonce", c)
  4288. }
  4289. ;
  4290. goog.dom.safe.setScriptContent = function (a, b) {
  4291. goog.dom.asserts.assertIsHTMLScriptElement(a);
  4292. a.text = goog.html.SafeScript.unwrapTrustedScript(b);
  4293. var c = goog.getScriptNonce();
  4294. c && a.setAttribute("nonce", c)
  4295. }
  4296. ;
  4297. goog.dom.safe.setLocationHref = function (a, b) {
  4298. goog.dom.asserts.assertIsLocation(a);
  4299. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4300. a.href = goog.html.SafeUrl.unwrap(c)
  4301. }
  4302. ;
  4303. goog.dom.safe.assignLocation = function (a, b) {
  4304. goog.dom.asserts.assertIsLocation(a);
  4305. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4306. a.assign(goog.html.SafeUrl.unwrap(c))
  4307. }
  4308. ;
  4309. goog.dom.safe.replaceLocation = function (a, b) {
  4310. goog.dom.asserts.assertIsLocation(a);
  4311. var c = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b);
  4312. a.replace(goog.html.SafeUrl.unwrap(c))
  4313. }
  4314. ;
  4315. goog.dom.safe.openInWindow = function (a, b, c, d, e) {
  4316. a = a instanceof goog.html.SafeUrl ? a : goog.html.SafeUrl.sanitizeAssertUnchanged(a);
  4317. return (b || goog.global).open(goog.html.SafeUrl.unwrap(a), c ? goog.string.Const.unwrap(c) : "", d, e)
  4318. }
  4319. ;
  4320. goog.dom.safe.parseFromStringHtml = function (a, b) {
  4321. return goog.dom.safe.parseFromString(a, b, "text/html")
  4322. }
  4323. ;
  4324. goog.dom.safe.parseFromString = function (a, b, c) {
  4325. return a.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(b), c)
  4326. }
  4327. ;
  4328. goog.dom.safe.createImageFromBlob = function (a) {
  4329. if (!/^image\/.*/g.test(a.type))
  4330. throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");
  4331. var b = goog.global.URL.createObjectURL(a);
  4332. a = new goog.global.Image;
  4333. a.onload = function () {
  4334. goog.global.URL.revokeObjectURL(b)
  4335. }
  4336. ;
  4337. goog.dom.safe.setImageSrc(a, goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."), b));
  4338. return a
  4339. }
  4340. ;
  4341. goog.string.DETECT_DOUBLE_ESCAPING = !1;
  4342. goog.string.FORCE_NON_DOM_HTML_UNESCAPING = !1;
  4343. goog.string.Unicode = {
  4344. NBSP: "\u00a0"
  4345. };
  4346. goog.string.startsWith = goog.string.internal.startsWith;
  4347. goog.string.endsWith = goog.string.internal.endsWith;
  4348. goog.string.caseInsensitiveStartsWith = goog.string.internal.caseInsensitiveStartsWith;
  4349. goog.string.caseInsensitiveEndsWith = goog.string.internal.caseInsensitiveEndsWith;
  4350. goog.string.caseInsensitiveEquals = goog.string.internal.caseInsensitiveEquals;
  4351. goog.string.subs = function (a, b) {
  4352. for (var c = a.split("%s"), d = "", e = Array.prototype.slice.call(arguments, 1); e.length && 1 < c.length;)
  4353. d += c.shift() + e.shift();
  4354. return d + c.join("%s")
  4355. }
  4356. ;
  4357. goog.string.collapseWhitespace = function (a) {
  4358. return a.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, "")
  4359. }
  4360. ;
  4361. goog.string.isEmptyOrWhitespace = goog.string.internal.isEmptyOrWhitespace;
  4362. goog.string.isEmptyString = function (a) {
  4363. return 0 == a.length
  4364. }
  4365. ;
  4366. goog.string.isEmpty = goog.string.isEmptyOrWhitespace;
  4367. goog.string.isEmptyOrWhitespaceSafe = function (a) {
  4368. return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(a))
  4369. }
  4370. ;
  4371. goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe;
  4372. goog.string.isBreakingWhitespace = function (a) {
  4373. return !/[^\t\n\r ]/.test(a)
  4374. }
  4375. ;
  4376. goog.string.isAlpha = function (a) {
  4377. return !/[^a-zA-Z]/.test(a)
  4378. }
  4379. ;
  4380. goog.string.isNumeric = function (a) {
  4381. return !/[^0-9]/.test(a)
  4382. }
  4383. ;
  4384. goog.string.isAlphaNumeric = function (a) {
  4385. return !/[^a-zA-Z0-9]/.test(a)
  4386. }
  4387. ;
  4388. goog.string.isSpace = function (a) {
  4389. return " " == a
  4390. }
  4391. ;
  4392. goog.string.isUnicodeChar = function (a) {
  4393. return 1 == a.length && " " <= a && "~" >= a || "\u0080" <= a && "\ufffd" >= a
  4394. }
  4395. ;
  4396. goog.string.stripNewlines = function (a) {
  4397. return a.replace(/(\r\n|\r|\n)+/g, " ")
  4398. }
  4399. ;
  4400. goog.string.canonicalizeNewlines = function (a) {
  4401. return a.replace(/(\r\n|\r|\n)/g, "\n")
  4402. }
  4403. ;
  4404. goog.string.normalizeWhitespace = function (a) {
  4405. return a.replace(/\xa0|\s/g, " ")
  4406. }
  4407. ;
  4408. goog.string.normalizeSpaces = function (a) {
  4409. return a.replace(/\xa0|[ \t]+/g, " ")
  4410. }
  4411. ;
  4412. goog.string.collapseBreakingSpaces = function (a) {
  4413. return a.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, "")
  4414. }
  4415. ;
  4416. goog.string.trim = goog.string.internal.trim;
  4417. goog.string.trimLeft = function (a) {
  4418. return a.replace(/^[\s\xa0]+/, "")
  4419. }
  4420. ;
  4421. goog.string.trimRight = function (a) {
  4422. return a.replace(/[\s\xa0]+$/, "")
  4423. }
  4424. ;
  4425. goog.string.caseInsensitiveCompare = goog.string.internal.caseInsensitiveCompare;
  4426. goog.string.numberAwareCompare_ = function (a, b, c) {
  4427. if (a == b)
  4428. return 0;
  4429. if (!a)
  4430. return -1;
  4431. if (!b)
  4432. return 1;
  4433. for (var d = a.toLowerCase().match(c), e = b.toLowerCase().match(c), f = Math.min(d.length, e.length), g = 0; g < f; g++) {
  4434. c = d[g];
  4435. var h = e[g];
  4436. if (c != h)
  4437. return a = parseInt(c, 10),
  4438. !isNaN(a) && (b = parseInt(h, 10),
  4439. !isNaN(b) && a - b) ? a - b : c < h ? -1 : 1
  4440. }
  4441. return d.length != e.length ? d.length - e.length : a < b ? -1 : 1
  4442. }
  4443. ;
  4444. goog.string.intAwareCompare = function (a, b) {
  4445. return goog.string.numberAwareCompare_(a, b, /\d+|\D+/g)
  4446. }
  4447. ;
  4448. goog.string.floatAwareCompare = function (a, b) {
  4449. return goog.string.numberAwareCompare_(a, b, /\d+|\.\d+|\D+/g)
  4450. }
  4451. ;
  4452. goog.string.numerateCompare = goog.string.floatAwareCompare;
  4453. goog.string.urlEncode = function (a) {
  4454. return encodeURIComponent(String(a))
  4455. }
  4456. ;
  4457. goog.string.urlDecode = function (a) {
  4458. return decodeURIComponent(a.replace(/\+/g, " "))
  4459. }
  4460. ;
  4461. goog.string.newLineToBr = goog.string.internal.newLineToBr;
  4462. goog.string.htmlEscape = function (a, b) {
  4463. a = goog.string.internal.htmlEscape(a, b);
  4464. goog.string.DETECT_DOUBLE_ESCAPING && (a = a.replace(goog.string.E_RE_, "&#101;"));
  4465. return a
  4466. }
  4467. ;
  4468. goog.string.E_RE_ = /e/g;
  4469. goog.string.unescapeEntities = function (a) {
  4470. return goog.string.contains(a, "&") ? !goog.string.FORCE_NON_DOM_HTML_UNESCAPING && "document" in goog.global ? goog.string.unescapeEntitiesUsingDom_(a) : goog.string.unescapePureXmlEntities_(a) : a
  4471. }
  4472. ;
  4473. goog.string.unescapeEntitiesWithDocument = function (a, b) {
  4474. return goog.string.contains(a, "&") ? goog.string.unescapeEntitiesUsingDom_(a, b) : a
  4475. }
  4476. ;
  4477. goog.string.unescapeEntitiesUsingDom_ = function (a, b) {
  4478. var c = {
  4479. "&amp;": "&",
  4480. "&lt;": "<",
  4481. "&gt;": ">",
  4482. "&quot;": '"'
  4483. };
  4484. var d = b ? b.createElement("div") : goog.global.document.createElement("div");
  4485. return a.replace(goog.string.HTML_ENTITY_PATTERN_, function (a, b) {
  4486. var e = c[a];
  4487. if (e)
  4488. return e;
  4489. if ("#" == b.charAt(0)) {
  4490. var f = Number("0" + b.substr(1));
  4491. isNaN(f) || (e = String.fromCharCode(f))
  4492. }
  4493. e || (goog.dom.safe.setInnerHtml(d, goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."), a + " ")),
  4494. e = d.firstChild.nodeValue.slice(0, -1));
  4495. return c[a] = e
  4496. })
  4497. }
  4498. ;
  4499. goog.string.unescapePureXmlEntities_ = function (a) {
  4500. return a.replace(/&([^;]+);/g, function (a, c) {
  4501. switch (c) {
  4502. case "amp":
  4503. return "&";
  4504. case "lt":
  4505. return "<";
  4506. case "gt":
  4507. return ">";
  4508. case "quot":
  4509. return '"';
  4510. default:
  4511. if ("#" == c.charAt(0)) {
  4512. var b = Number("0" + c.substr(1));
  4513. if (!isNaN(b))
  4514. return String.fromCharCode(b)
  4515. }
  4516. return a
  4517. }
  4518. })
  4519. }
  4520. ;
  4521. goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g;
  4522. goog.string.whitespaceEscape = function (a, b) {
  4523. return goog.string.newLineToBr(a.replace(/ /g, " &#160;"), b)
  4524. }
  4525. ;
  4526. goog.string.preserveSpaces = function (a) {
  4527. return a.replace(/(^|[\n ]) /g, "$1" + goog.string.Unicode.NBSP)
  4528. }
  4529. ;
  4530. goog.string.stripQuotes = function (a, b) {
  4531. for (var c = b.length, d = 0; d < c; d++) {
  4532. var e = 1 == c ? b : b.charAt(d);
  4533. if (a.charAt(0) == e && a.charAt(a.length - 1) == e)
  4534. return a.substring(1, a.length - 1)
  4535. }
  4536. return a
  4537. }
  4538. ;
  4539. goog.string.truncate = function (a, b, c) {
  4540. c && (a = goog.string.unescapeEntities(a));
  4541. a.length > b && (a = a.substring(0, b - 3) + "...");
  4542. c && (a = goog.string.htmlEscape(a));
  4543. return a
  4544. }
  4545. ;
  4546. goog.string.truncateMiddle = function (a, b, c, d) {
  4547. c && (a = goog.string.unescapeEntities(a));
  4548. if (d && a.length > b) {
  4549. d > b && (d = b);
  4550. var e = a.length - d;
  4551. a = a.substring(0, b - d) + "..." + a.substring(e)
  4552. } else
  4553. a.length > b && (d = Math.floor(b / 2),
  4554. e = a.length - d,
  4555. a = a.substring(0, d + b % 2) + "..." + a.substring(e));
  4556. c && (a = goog.string.htmlEscape(a));
  4557. return a
  4558. }
  4559. ;
  4560. goog.string.specialEscapeChars_ = {
  4561. "\x00": "\\0",
  4562. "\b": "\\b",
  4563. "\f": "\\f",
  4564. "\n": "\\n",
  4565. "\r": "\\r",
  4566. "\t": "\\t",
  4567. "\x0B": "\\x0B",
  4568. '"': '\\"',
  4569. "\\": "\\\\",
  4570. "<": "\\u003C"
  4571. };
  4572. goog.string.jsEscapeCache_ = {
  4573. "'": "\\'"
  4574. };
  4575. goog.string.quote = function (a) {
  4576. a = String(a);
  4577. for (var b = ['"'], c = 0; c < a.length; c++) {
  4578. var d = a.charAt(c)
  4579. , e = d.charCodeAt(0);
  4580. b[c + 1] = goog.string.specialEscapeChars_[d] || (31 < e && 127 > e ? d : goog.string.escapeChar(d))
  4581. }
  4582. b.push('"');
  4583. return b.join("")
  4584. }
  4585. ;
  4586. goog.string.escapeString = function (a) {
  4587. for (var b = [], c = 0; c < a.length; c++)
  4588. b[c] = goog.string.escapeChar(a.charAt(c));
  4589. return b.join("")
  4590. }
  4591. ;
  4592. goog.string.escapeChar = function (a) {
  4593. if (a in goog.string.jsEscapeCache_)
  4594. return goog.string.jsEscapeCache_[a];
  4595. if (a in goog.string.specialEscapeChars_)
  4596. return goog.string.jsEscapeCache_[a] = goog.string.specialEscapeChars_[a];
  4597. var b = a.charCodeAt(0);
  4598. if (31 < b && 127 > b)
  4599. var c = a;
  4600. else {
  4601. if (256 > b) {
  4602. if (c = "\\x",
  4603. 16 > b || 256 < b)
  4604. c += "0"
  4605. } else
  4606. c = "\\u",
  4607. 4096 > b && (c += "0");
  4608. c += b.toString(16).toUpperCase()
  4609. }
  4610. return goog.string.jsEscapeCache_[a] = c
  4611. }
  4612. ;
  4613. goog.string.contains = goog.string.internal.contains;
  4614. goog.string.caseInsensitiveContains = goog.string.internal.caseInsensitiveContains;
  4615. goog.string.countOf = function (a, b) {
  4616. return a && b ? a.split(b).length - 1 : 0
  4617. }
  4618. ;
  4619. goog.string.removeAt = function (a, b, c) {
  4620. var d = a;
  4621. 0 <= b && b < a.length && 0 < c && (d = a.substr(0, b) + a.substr(b + c, a.length - b - c));
  4622. return d
  4623. }
  4624. ;
  4625. goog.string.remove = function (a, b) {
  4626. return a.replace(b, "")
  4627. }
  4628. ;
  4629. goog.string.removeAll = function (a, b) {
  4630. var c = new RegExp(goog.string.regExpEscape(b), "g");
  4631. return a.replace(c, "")
  4632. }
  4633. ;
  4634. goog.string.replaceAll = function (a, b, c) {
  4635. b = new RegExp(goog.string.regExpEscape(b), "g");
  4636. return a.replace(b, c.replace(/\$/g, "$$$$"))
  4637. }
  4638. ;
  4639. goog.string.regExpEscape = function (a) {
  4640. return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08")
  4641. }
  4642. ;
  4643. goog.string.repeat = String.prototype.repeat ? function (a, b) {
  4644. return a.repeat(b)
  4645. }
  4646. : function (a, b) {
  4647. return Array(b + 1).join(a)
  4648. }
  4649. ;
  4650. goog.string.padNumber = function (a, b, c) {
  4651. a = void 0 !== c ? a.toFixed(c) : String(a);
  4652. c = a.indexOf(".");
  4653. -1 == c && (c = a.length);
  4654. return goog.string.repeat("0", Math.max(0, b - c)) + a
  4655. }
  4656. ;
  4657. goog.string.makeSafe = function (a) {
  4658. return null == a ? "" : String(a)
  4659. }
  4660. ;
  4661. goog.string.buildString = function (a) {
  4662. return Array.prototype.join.call(arguments, "")
  4663. }
  4664. ;
  4665. goog.string.getRandomString = function () {
  4666. return Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ goog.now()).toString(36)
  4667. }
  4668. ;
  4669. goog.string.compareVersions = goog.string.internal.compareVersions;
  4670. goog.string.hashCode = function (a) {
  4671. for (var b = 0, c = 0; c < a.length; ++c)
  4672. b = 31 * b + a.charCodeAt(c) >>> 0;
  4673. return b
  4674. }
  4675. ;
  4676. goog.string.uniqueStringCounter_ = 2147483648 * Math.random() | 0;
  4677. goog.string.createUniqueString = function () {
  4678. return "goog_" + goog.string.uniqueStringCounter_++
  4679. }
  4680. ;
  4681. goog.string.toNumber = function (a) {
  4682. var b = Number(a);
  4683. return 0 == b && goog.string.isEmptyOrWhitespace(a) ? NaN : b
  4684. }
  4685. ;
  4686. goog.string.isLowerCamelCase = function (a) {
  4687. return /^[a-z]+([A-Z][a-z]*)*$/.test(a)
  4688. }
  4689. ;
  4690. goog.string.isUpperCamelCase = function (a) {
  4691. return /^([A-Z][a-z]*)+$/.test(a)
  4692. }
  4693. ;
  4694. goog.string.toCamelCase = function (a) {
  4695. return String(a).replace(/\-([a-z])/g, function (a, c) {
  4696. return c.toUpperCase()
  4697. })
  4698. }
  4699. ;
  4700. goog.string.toSelectorCase = function (a) {
  4701. return String(a).replace(/([A-Z])/g, "-$1").toLowerCase()
  4702. }
  4703. ;
  4704. goog.string.toTitleCase = function (a, b) {
  4705. var c = "string" === typeof b ? goog.string.regExpEscape(b) : "\\s";
  4706. return a.replace(new RegExp("(^" + (c ? "|[" + c + "]+" : "") + ")([a-z])", "g"), function (a, b, c) {
  4707. return b + c.toUpperCase()
  4708. })
  4709. }
  4710. ;
  4711. goog.string.capitalize = function (a) {
  4712. return String(a.charAt(0)).toUpperCase() + String(a.substr(1)).toLowerCase()
  4713. }
  4714. ;
  4715. goog.string.parseInt = function (a) {
  4716. isFinite(a) && (a = String(a));
  4717. return "string" === typeof a ? /^\s*-?0x/i.test(a) ? parseInt(a, 16) : parseInt(a, 10) : NaN
  4718. }
  4719. ;
  4720. goog.string.splitLimit = function (a, b, c) {
  4721. a = a.split(b);
  4722. for (var d = []; 0 < c && a.length;)
  4723. d.push(a.shift()),
  4724. c--;
  4725. a.length && d.push(a.join(b));
  4726. return d
  4727. }
  4728. ;
  4729. goog.string.lastComponent = function (a, b) {
  4730. if (b)
  4731. "string" == typeof b && (b = [b]);
  4732. else
  4733. return a;
  4734. for (var c = -1, d = 0; d < b.length; d++)
  4735. if ("" != b[d]) {
  4736. var e = a.lastIndexOf(b[d]);
  4737. e > c && (c = e)
  4738. }
  4739. return -1 == c ? a : a.slice(c + 1)
  4740. }
  4741. ;
  4742. goog.string.editDistance = function (a, b) {
  4743. var c = []
  4744. , d = [];
  4745. if (a == b)
  4746. return 0;
  4747. if (!a.length || !b.length)
  4748. return Math.max(a.length, b.length);
  4749. for (var e = 0; e < b.length + 1; e++)
  4750. c[e] = e;
  4751. for (e = 0; e < a.length; e++) {
  4752. d[0] = e + 1;
  4753. for (var f = 0; f < b.length; f++)
  4754. d[f + 1] = Math.min(d[f] + 1, c[f + 1] + 1, c[f] + Number(a[e] != b[f]));
  4755. for (f = 0; f < c.length; f++)
  4756. c[f] = d[f]
  4757. }
  4758. return d[b.length]
  4759. }
  4760. ;
  4761. goog.Thenable = function () { }
  4762. ;
  4763. goog.Thenable.prototype.then = function (a, b, c) { }
  4764. ;
  4765. goog.Thenable.IMPLEMENTED_BY_PROP = "$goog_Thenable";
  4766. goog.Thenable.addImplementation = function (a) {
  4767. COMPILED ? a.prototype[goog.Thenable.IMPLEMENTED_BY_PROP] = !0 : a.prototype.$goog_Thenable = !0
  4768. }
  4769. ;
  4770. goog.Thenable.isImplementedBy = function (a) {
  4771. if (!a)
  4772. return !1;
  4773. try {
  4774. return COMPILED ? !!a[goog.Thenable.IMPLEMENTED_BY_PROP] : !!a.$goog_Thenable
  4775. } catch (b) {
  4776. return !1
  4777. }
  4778. }
  4779. ;
  4780. goog.async = {};
  4781. goog.async.FreeList = function (a, b, c) {
  4782. this.limit_ = c;
  4783. this.create_ = a;
  4784. this.reset_ = b;
  4785. this.occupants_ = 0;
  4786. this.head_ = null
  4787. }
  4788. ;
  4789. goog.async.FreeList.prototype.get = function () {
  4790. if (0 < this.occupants_) {
  4791. this.occupants_--;
  4792. var a = this.head_;
  4793. this.head_ = a.next;
  4794. a.next = null
  4795. } else
  4796. a = this.create_();
  4797. return a
  4798. }
  4799. ;
  4800. goog.async.FreeList.prototype.put = function (a) {
  4801. this.reset_(a);
  4802. this.occupants_ < this.limit_ && (this.occupants_++ ,
  4803. a.next = this.head_,
  4804. this.head_ = a)
  4805. }
  4806. ;
  4807. goog.async.FreeList.prototype.occupants = function () {
  4808. return this.occupants_
  4809. }
  4810. ;
  4811. goog.async.WorkQueue = function () {
  4812. this.workTail_ = this.workHead_ = null
  4813. }
  4814. ;
  4815. goog.async.WorkQueue.DEFAULT_MAX_UNUSED = 100;
  4816. goog.async.WorkQueue.freelist_ = new goog.async.FreeList(function () {
  4817. return new goog.async.WorkItem
  4818. }
  4819. , function (a) {
  4820. a.reset()
  4821. }
  4822. , goog.async.WorkQueue.DEFAULT_MAX_UNUSED);
  4823. goog.async.WorkQueue.prototype.add = function (a, b) {
  4824. var c = this.getUnusedItem_();
  4825. c.set(a, b);
  4826. this.workTail_ ? this.workTail_.next = c : (goog.asserts.assert(!this.workHead_),
  4827. this.workHead_ = c);
  4828. this.workTail_ = c
  4829. }
  4830. ;
  4831. goog.async.WorkQueue.prototype.remove = function () {
  4832. var a = null;
  4833. this.workHead_ && (a = this.workHead_,
  4834. this.workHead_ = this.workHead_.next,
  4835. this.workHead_ || (this.workTail_ = null),
  4836. a.next = null);
  4837. return a
  4838. }
  4839. ;
  4840. goog.async.WorkQueue.prototype.returnUnused = function (a) {
  4841. goog.async.WorkQueue.freelist_.put(a)
  4842. }
  4843. ;
  4844. goog.async.WorkQueue.prototype.getUnusedItem_ = function () {
  4845. return goog.async.WorkQueue.freelist_.get()
  4846. }
  4847. ;
  4848. goog.async.WorkItem = function () {
  4849. this.next = this.scope = this.fn = null
  4850. }
  4851. ;
  4852. goog.async.WorkItem.prototype.set = function (a, b) {
  4853. this.fn = a;
  4854. this.scope = b;
  4855. this.next = null
  4856. }
  4857. ;
  4858. goog.async.WorkItem.prototype.reset = function () {
  4859. this.next = this.scope = this.fn = null
  4860. }
  4861. ;
  4862. goog.debug.entryPointRegistry = {};
  4863. goog.debug.EntryPointMonitor = function () { }
  4864. ;
  4865. goog.debug.entryPointRegistry.refList_ = [];
  4866. goog.debug.entryPointRegistry.monitors_ = [];
  4867. goog.debug.entryPointRegistry.monitorsMayExist_ = !1;
  4868. goog.debug.entryPointRegistry.register = function (a) {
  4869. goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length] = a;
  4870. if (goog.debug.entryPointRegistry.monitorsMayExist_)
  4871. for (var b = goog.debug.entryPointRegistry.monitors_, c = 0; c < b.length; c++)
  4872. a(goog.bind(b[c].wrap, b[c]))
  4873. }
  4874. ;
  4875. goog.debug.entryPointRegistry.monitorAll = function (a) {
  4876. goog.debug.entryPointRegistry.monitorsMayExist_ = !0;
  4877. for (var b = goog.bind(a.wrap, a), c = 0; c < goog.debug.entryPointRegistry.refList_.length; c++)
  4878. goog.debug.entryPointRegistry.refList_[c](b);
  4879. goog.debug.entryPointRegistry.monitors_.push(a)
  4880. }
  4881. ;
  4882. goog.debug.entryPointRegistry.unmonitorAllIfPossible = function (a) {
  4883. var b = goog.debug.entryPointRegistry.monitors_;
  4884. goog.asserts.assert(a == b[b.length - 1], "Only the most recent monitor can be unwrapped.");
  4885. a = goog.bind(a.unwrap, a);
  4886. for (var c = 0; c < goog.debug.entryPointRegistry.refList_.length; c++)
  4887. goog.debug.entryPointRegistry.refList_[c](a);
  4888. b.length--
  4889. }
  4890. ;
  4891. goog.labs.userAgent.engine = {};
  4892. goog.labs.userAgent.engine.isPresto = function () {
  4893. return goog.labs.userAgent.util.matchUserAgent("Presto")
  4894. }
  4895. ;
  4896. goog.labs.userAgent.engine.isTrident = function () {
  4897. return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE")
  4898. }
  4899. ;
  4900. goog.labs.userAgent.engine.isEdge = function () {
  4901. return goog.labs.userAgent.util.matchUserAgent("Edge")
  4902. }
  4903. ;
  4904. goog.labs.userAgent.engine.isWebKit = function () {
  4905. return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit") && !goog.labs.userAgent.engine.isEdge()
  4906. }
  4907. ;
  4908. goog.labs.userAgent.engine.isGecko = function () {
  4909. return goog.labs.userAgent.util.matchUserAgent("Gecko") && !goog.labs.userAgent.engine.isWebKit() && !goog.labs.userAgent.engine.isTrident() && !goog.labs.userAgent.engine.isEdge()
  4910. }
  4911. ;
  4912. goog.labs.userAgent.engine.getVersion = function () {
  4913. var a = goog.labs.userAgent.util.getUserAgent();
  4914. if (a) {
  4915. a = goog.labs.userAgent.util.extractVersionTuples(a);
  4916. var b = goog.labs.userAgent.engine.getEngineTuple_(a);
  4917. if (b)
  4918. return "Gecko" == b[0] ? goog.labs.userAgent.engine.getVersionForKey_(a, "Firefox") : b[1];
  4919. a = a[0];
  4920. var c;
  4921. if (a && (c = a[2]) && (c = /Trident\/([^\s;]+)/.exec(c)))
  4922. return c[1]
  4923. }
  4924. return ""
  4925. }
  4926. ;
  4927. goog.labs.userAgent.engine.getEngineTuple_ = function (a) {
  4928. if (!goog.labs.userAgent.engine.isEdge())
  4929. return a[1];
  4930. for (var b = 0; b < a.length; b++) {
  4931. var c = a[b];
  4932. if ("Edge" == c[0])
  4933. return c
  4934. }
  4935. }
  4936. ;
  4937. goog.labs.userAgent.engine.isVersionOrHigher = function (a) {
  4938. return 0 <= goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), a)
  4939. }
  4940. ;
  4941. goog.labs.userAgent.engine.getVersionForKey_ = function (a, b) {
  4942. var c = goog.array.find(a, function (a) {
  4943. return b == a[0]
  4944. });
  4945. return c && c[1] || ""
  4946. }
  4947. ;
  4948. goog.labs.userAgent.platform = {};
  4949. goog.labs.userAgent.platform.isAndroid = function () {
  4950. return goog.labs.userAgent.util.matchUserAgent("Android")
  4951. }
  4952. ;
  4953. goog.labs.userAgent.platform.isIpod = function () {
  4954. return goog.labs.userAgent.util.matchUserAgent("iPod")
  4955. }
  4956. ;
  4957. goog.labs.userAgent.platform.isIphone = function () {
  4958. return goog.labs.userAgent.util.matchUserAgent("iPhone") && !goog.labs.userAgent.util.matchUserAgent("iPod") && !goog.labs.userAgent.util.matchUserAgent("iPad")
  4959. }
  4960. ;
  4961. goog.labs.userAgent.platform.isIpad = function () {
  4962. return goog.labs.userAgent.util.matchUserAgent("iPad")
  4963. }
  4964. ;
  4965. goog.labs.userAgent.platform.isIos = function () {
  4966. return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpad() || goog.labs.userAgent.platform.isIpod()
  4967. }
  4968. ;
  4969. goog.labs.userAgent.platform.isMacintosh = function () {
  4970. return goog.labs.userAgent.util.matchUserAgent("Macintosh")
  4971. }
  4972. ;
  4973. goog.labs.userAgent.platform.isLinux = function () {
  4974. return goog.labs.userAgent.util.matchUserAgent("Linux")
  4975. }
  4976. ;
  4977. goog.labs.userAgent.platform.isWindows = function () {
  4978. return goog.labs.userAgent.util.matchUserAgent("Windows")
  4979. }
  4980. ;
  4981. goog.labs.userAgent.platform.isChromeOS = function () {
  4982. return goog.labs.userAgent.util.matchUserAgent("CrOS")
  4983. }
  4984. ;
  4985. goog.labs.userAgent.platform.isChromecast = function () {
  4986. return goog.labs.userAgent.util.matchUserAgent("CrKey")
  4987. }
  4988. ;
  4989. goog.labs.userAgent.platform.isKaiOS = function () {
  4990. return goog.labs.userAgent.util.matchUserAgentIgnoreCase("KaiOS")
  4991. }
  4992. ;
  4993. goog.labs.userAgent.platform.isGo2Phone = function () {
  4994. return goog.labs.userAgent.util.matchUserAgentIgnoreCase("GAFP")
  4995. }
  4996. ;
  4997. goog.labs.userAgent.platform.getVersion = function () {
  4998. var a = goog.labs.userAgent.util.getUserAgent()
  4999. , b = "";
  5000. goog.labs.userAgent.platform.isWindows() ? (b = /Windows (?:NT|Phone) ([0-9.]+)/,
  5001. b = (a = b.exec(a)) ? a[1] : "0.0") : goog.labs.userAgent.platform.isIos() ? (b = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/,
  5002. b = (a = b.exec(a)) && a[1].replace(/_/g, ".")) : goog.labs.userAgent.platform.isMacintosh() ? (b = /Mac OS X ([0-9_.]+)/,
  5003. b = (a = b.exec(a)) ? a[1].replace(/_/g, ".") : "10") : goog.labs.userAgent.platform.isKaiOS() ? (b = /(?:KaiOS)\/(\S+)/i,
  5004. b = (a = b.exec(a)) && a[1]) : goog.labs.userAgent.platform.isAndroid() ? (b = /Android\s+([^\);]+)(\)|;)/,
  5005. b = (a = b.exec(a)) && a[1]) : goog.labs.userAgent.platform.isChromeOS() && (b = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/,
  5006. b = (a = b.exec(a)) && a[1]);
  5007. return b || ""
  5008. }
  5009. ;
  5010. goog.labs.userAgent.platform.isVersionOrHigher = function (a) {
  5011. return 0 <= goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(), a)
  5012. }
  5013. ;
  5014. goog.reflect = {};
  5015. goog.reflect.object = function (a, b) {
  5016. return b
  5017. }
  5018. ;
  5019. goog.reflect.objectProperty = function (a, b) {
  5020. return a
  5021. }
  5022. ;
  5023. goog.reflect.sinkValue = function (a) {
  5024. goog.reflect.sinkValue[" "](a);
  5025. return a
  5026. }
  5027. ;
  5028. goog.reflect.sinkValue[" "] = goog.nullFunction;
  5029. goog.reflect.canAccessProperty = function (a, b) {
  5030. try {
  5031. return goog.reflect.sinkValue(a[b]),
  5032. !0
  5033. } catch (c) { }
  5034. return !1
  5035. }
  5036. ;
  5037. goog.reflect.cache = function (a, b, c, d) {
  5038. d = d ? d(b) : b;
  5039. return Object.prototype.hasOwnProperty.call(a, d) ? a[d] : a[d] = c(b)
  5040. }
  5041. ;
  5042. goog.userAgent = {};
  5043. goog.userAgent.ASSUME_IE = !1;
  5044. goog.userAgent.ASSUME_EDGE = !1;
  5045. goog.userAgent.ASSUME_GECKO = !1;
  5046. goog.userAgent.ASSUME_WEBKIT = !1;
  5047. goog.userAgent.ASSUME_MOBILE_WEBKIT = !1;
  5048. goog.userAgent.ASSUME_OPERA = !1;
  5049. goog.userAgent.ASSUME_ANY_VERSION = !1;
  5050. goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_OPERA;
  5051. goog.userAgent.getUserAgentString = function () {
  5052. return goog.labs.userAgent.util.getUserAgent()
  5053. }
  5054. ;
  5055. goog.userAgent.getNavigatorTyped = function () {
  5056. return goog.global.navigator || null
  5057. }
  5058. ;
  5059. goog.userAgent.getNavigator = function () {
  5060. return goog.userAgent.getNavigatorTyped()
  5061. }
  5062. ;
  5063. goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPERA : goog.labs.userAgent.browser.isOpera();
  5064. goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : goog.labs.userAgent.browser.isIE();
  5065. goog.userAgent.EDGE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_EDGE : goog.labs.userAgent.engine.isEdge();
  5066. goog.userAgent.EDGE_OR_IE = goog.userAgent.EDGE || goog.userAgent.IE;
  5067. goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GECKO : goog.labs.userAgent.engine.isGecko();
  5068. goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.labs.userAgent.engine.isWebKit();
  5069. goog.userAgent.isMobile_ = function () {
  5070. return goog.userAgent.WEBKIT && goog.labs.userAgent.util.matchUserAgent("Mobile")
  5071. }
  5072. ;
  5073. goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_();
  5074. goog.userAgent.SAFARI = goog.userAgent.WEBKIT;
  5075. goog.userAgent.determinePlatform_ = function () {
  5076. var a = goog.userAgent.getNavigatorTyped();
  5077. return a && a.platform || ""
  5078. }
  5079. ;
  5080. goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();
  5081. goog.userAgent.ASSUME_MAC = !1;
  5082. goog.userAgent.ASSUME_WINDOWS = !1;
  5083. goog.userAgent.ASSUME_LINUX = !1;
  5084. goog.userAgent.ASSUME_X11 = !1;
  5085. goog.userAgent.ASSUME_ANDROID = !1;
  5086. goog.userAgent.ASSUME_IPHONE = !1;
  5087. goog.userAgent.ASSUME_IPAD = !1;
  5088. goog.userAgent.ASSUME_IPOD = !1;
  5089. goog.userAgent.ASSUME_KAIOS = !1;
  5090. goog.userAgent.ASSUME_GO2PHONE = !1;
  5091. goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD;
  5092. goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC : goog.labs.userAgent.platform.isMacintosh();
  5093. goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_WINDOWS : goog.labs.userAgent.platform.isWindows();
  5094. goog.userAgent.isLegacyLinux_ = function () {
  5095. return goog.labs.userAgent.platform.isLinux() || goog.labs.userAgent.platform.isChromeOS()
  5096. }
  5097. ;
  5098. goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LINUX : goog.userAgent.isLegacyLinux_();
  5099. goog.userAgent.isX11_ = function () {
  5100. var a = goog.userAgent.getNavigatorTyped();
  5101. return !!a && goog.string.contains(a.appVersion || "", "X11")
  5102. }
  5103. ;
  5104. goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11 : goog.userAgent.isX11_();
  5105. goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_ANDROID : goog.labs.userAgent.platform.isAndroid();
  5106. goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE : goog.labs.userAgent.platform.isIphone();
  5107. goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();
  5108. goog.userAgent.IPOD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIpod();
  5109. goog.userAgent.IOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIos();
  5110. goog.userAgent.KAIOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_KAIOS : goog.labs.userAgent.platform.isKaiOS();
  5111. goog.userAgent.GO2PHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_GO2PHONE : goog.labs.userAgent.platform.isGo2Phone();
  5112. goog.userAgent.determineVersion_ = function () {
  5113. var a = ""
  5114. , b = goog.userAgent.getVersionRegexResult_();
  5115. b && (a = b ? b[1] : "");
  5116. return goog.userAgent.IE && (b = goog.userAgent.getDocumentMode_(),
  5117. null != b && b > parseFloat(a)) ? String(b) : a
  5118. }
  5119. ;
  5120. goog.userAgent.getVersionRegexResult_ = function () {
  5121. var a = goog.userAgent.getUserAgentString();
  5122. if (goog.userAgent.GECKO)
  5123. return /rv:([^\);]+)(\)|;)/.exec(a);
  5124. if (goog.userAgent.EDGE)
  5125. return /Edge\/([\d\.]+)/.exec(a);
  5126. if (goog.userAgent.IE)
  5127. return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);
  5128. if (goog.userAgent.WEBKIT)
  5129. return /WebKit\/(\S+)/.exec(a);
  5130. if (goog.userAgent.OPERA)
  5131. return /(?:Version)[ \/]?(\S+)/.exec(a)
  5132. }
  5133. ;
  5134. goog.userAgent.getDocumentMode_ = function () {
  5135. var a = goog.global.document;
  5136. return a ? a.documentMode : void 0
  5137. }
  5138. ;
  5139. goog.userAgent.VERSION = goog.userAgent.determineVersion_();
  5140. goog.userAgent.compare = function (a, b) {
  5141. return goog.string.compareVersions(a, b)
  5142. }
  5143. ;
  5144. goog.userAgent.isVersionOrHigherCache_ = {};
  5145. goog.userAgent.isVersionOrHigher = function (a) {
  5146. return goog.userAgent.ASSUME_ANY_VERSION || goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_, a, function () {
  5147. return 0 <= goog.string.compareVersions(goog.userAgent.VERSION, a)
  5148. })
  5149. }
  5150. ;
  5151. goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher;
  5152. goog.userAgent.isDocumentModeOrHigher = function (a) {
  5153. return Number(goog.userAgent.DOCUMENT_MODE) >= a
  5154. }
  5155. ;
  5156. goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher;
  5157. goog.userAgent.DOCUMENT_MODE = function () {
  5158. if (goog.global.document && goog.userAgent.IE)
  5159. return goog.userAgent.getDocumentMode_()
  5160. }();
  5161. goog.dom.BrowserFeature = {};
  5162. goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS = !1;
  5163. goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS = !1;
  5164. goog.dom.BrowserFeature.detectOffscreenCanvas_ = function (a) {
  5165. try {
  5166. return !!(new self.OffscreenCanvas(0, 0)).getContext(a)
  5167. } catch (b) { }
  5168. return !1
  5169. }
  5170. ;
  5171. goog.dom.BrowserFeature.OFFSCREEN_CANVAS_2D = !goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS && (goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS || goog.dom.BrowserFeature.detectOffscreenCanvas_("2d"));
  5172. goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES = !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9);
  5173. goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE = !goog.userAgent.GECKO && !goog.userAgent.IE || goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) || goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9.1");
  5174. goog.dom.BrowserFeature.CAN_USE_INNER_TEXT = goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9");
  5175. goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY = goog.userAgent.IE || goog.userAgent.OPERA || goog.userAgent.WEBKIT;
  5176. goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT = goog.userAgent.IE;
  5177. goog.dom.BrowserFeature.LEGACY_IE_RANGES = goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9);
  5178. goog.math.Size = function (a, b) {
  5179. this.width = a;
  5180. this.height = b
  5181. }
  5182. ;
  5183. goog.math.Size.equals = function (a, b) {
  5184. return a == b ? !0 : a && b ? a.width == b.width && a.height == b.height : !1
  5185. }
  5186. ;
  5187. goog.math.Size.prototype.clone = function () {
  5188. return new goog.math.Size(this.width, this.height)
  5189. }
  5190. ;
  5191. goog.DEBUG && (goog.math.Size.prototype.toString = function () {
  5192. return "(" + this.width + " x " + this.height + ")"
  5193. }
  5194. );
  5195. goog.math.Size.prototype.getLongest = function () {
  5196. return Math.max(this.width, this.height)
  5197. }
  5198. ;
  5199. goog.math.Size.prototype.getShortest = function () {
  5200. return Math.min(this.width, this.height)
  5201. }
  5202. ;
  5203. goog.math.Size.prototype.area = function () {
  5204. return this.width * this.height
  5205. }
  5206. ;
  5207. goog.math.Size.prototype.perimeter = function () {
  5208. return 2 * (this.width + this.height)
  5209. }
  5210. ;
  5211. goog.math.Size.prototype.aspectRatio = function () {
  5212. return this.width / this.height
  5213. }
  5214. ;
  5215. goog.math.Size.prototype.isEmpty = function () {
  5216. return !this.area()
  5217. }
  5218. ;
  5219. goog.math.Size.prototype.ceil = function () {
  5220. this.width = Math.ceil(this.width);
  5221. this.height = Math.ceil(this.height);
  5222. return this
  5223. }
  5224. ;
  5225. goog.math.Size.prototype.fitsInside = function (a) {
  5226. return this.width <= a.width && this.height <= a.height
  5227. }
  5228. ;
  5229. goog.math.Size.prototype.floor = function () {
  5230. this.width = Math.floor(this.width);
  5231. this.height = Math.floor(this.height);
  5232. return this
  5233. }
  5234. ;
  5235. goog.math.Size.prototype.round = function () {
  5236. this.width = Math.round(this.width);
  5237. this.height = Math.round(this.height);
  5238. return this
  5239. }
  5240. ;
  5241. goog.math.Size.prototype.scale = function (a, b) {
  5242. this.width *= a;
  5243. this.height *= "number" === typeof b ? b : a;
  5244. return this
  5245. }
  5246. ;
  5247. goog.math.Size.prototype.scaleToCover = function (a) {
  5248. a = this.aspectRatio() <= a.aspectRatio() ? a.width / this.width : a.height / this.height;
  5249. return this.scale(a)
  5250. }
  5251. ;
  5252. goog.math.Size.prototype.scaleToFit = function (a) {
  5253. a = this.aspectRatio() > a.aspectRatio() ? a.width / this.width : a.height / this.height;
  5254. return this.scale(a)
  5255. }
  5256. ;
  5257. goog.dom.ASSUME_QUIRKS_MODE = !1;
  5258. goog.dom.ASSUME_STANDARDS_MODE = !1;
  5259. goog.dom.COMPAT_MODE_KNOWN_ = goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE;
  5260. goog.dom.getDomHelper = function (a) {
  5261. return a ? new goog.dom.DomHelper(goog.dom.getOwnerDocument(a)) : goog.dom.defaultDomHelper_ || (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper)
  5262. }
  5263. ;
  5264. goog.dom.getDocument = function () {
  5265. return document
  5266. }
  5267. ;
  5268. goog.dom.getElement = function (a) {
  5269. return goog.dom.getElementHelper_(document, a)
  5270. }
  5271. ;
  5272. goog.dom.getElementHelper_ = function (a, b) {
  5273. return "string" === typeof b ? a.getElementById(b) : b
  5274. }
  5275. ;
  5276. goog.dom.getRequiredElement = function (a) {
  5277. return goog.dom.getRequiredElementHelper_(document, a)
  5278. }
  5279. ;
  5280. goog.dom.getRequiredElementHelper_ = function (a, b) {
  5281. goog.asserts.assertString(b);
  5282. var c = goog.dom.getElementHelper_(a, b);
  5283. return c = goog.asserts.assertElement(c, "No element found with id: " + b)
  5284. }
  5285. ;
  5286. goog.dom.$ = goog.dom.getElement;
  5287. goog.dom.getElementsByTagName = function (a, b) {
  5288. return (b || document).getElementsByTagName(String(a))
  5289. }
  5290. ;
  5291. goog.dom.getElementsByTagNameAndClass = function (a, b, c) {
  5292. return goog.dom.getElementsByTagNameAndClass_(document, a, b, c)
  5293. }
  5294. ;
  5295. goog.dom.getElementByTagNameAndClass = function (a, b, c) {
  5296. return goog.dom.getElementByTagNameAndClass_(document, a, b, c)
  5297. }
  5298. ;
  5299. goog.dom.getElementsByClass = function (a, b) {
  5300. var c = b || document;
  5301. return goog.dom.canUseQuerySelector_(c) ? c.querySelectorAll("." + a) : goog.dom.getElementsByTagNameAndClass_(document, "*", a, b)
  5302. }
  5303. ;
  5304. goog.dom.getElementByClass = function (a, b) {
  5305. var c = b || document;
  5306. return (c.getElementsByClassName ? c.getElementsByClassName(a)[0] : goog.dom.getElementByTagNameAndClass_(document, "*", a, b)) || null
  5307. }
  5308. ;
  5309. goog.dom.getRequiredElementByClass = function (a, b) {
  5310. var c = goog.dom.getElementByClass(a, b);
  5311. return goog.asserts.assert(c, "No element found with className: " + a)
  5312. }
  5313. ;
  5314. goog.dom.canUseQuerySelector_ = function (a) {
  5315. return !(!a.querySelectorAll || !a.querySelector)
  5316. }
  5317. ;
  5318. goog.dom.getElementsByTagNameAndClass_ = function (a, b, c, d) {
  5319. a = d || a;
  5320. b = b && "*" != b ? String(b).toUpperCase() : "";
  5321. if (goog.dom.canUseQuerySelector_(a) && (b || c))
  5322. return a.querySelectorAll(b + (c ? "." + c : ""));
  5323. if (c && a.getElementsByClassName) {
  5324. a = a.getElementsByClassName(c);
  5325. if (b) {
  5326. d = {};
  5327. for (var e = 0, f = 0, g; g = a[f]; f++)
  5328. b == g.nodeName && (d[e++] = g);
  5329. d.length = e;
  5330. return d
  5331. }
  5332. return a
  5333. }
  5334. a = a.getElementsByTagName(b || "*");
  5335. if (c) {
  5336. d = {};
  5337. for (f = e = 0; g = a[f]; f++)
  5338. b = g.className,
  5339. "function" == typeof b.split && goog.array.contains(b.split(/\s+/), c) && (d[e++] = g);
  5340. d.length = e;
  5341. return d
  5342. }
  5343. return a
  5344. }
  5345. ;
  5346. goog.dom.getElementByTagNameAndClass_ = function (a, b, c, d) {
  5347. var e = d || a
  5348. , f = b && "*" != b ? String(b).toUpperCase() : "";
  5349. return goog.dom.canUseQuerySelector_(e) && (f || c) ? e.querySelector(f + (c ? "." + c : "")) : goog.dom.getElementsByTagNameAndClass_(a, b, c, d)[0] || null
  5350. }
  5351. ;
  5352. goog.dom.$$ = goog.dom.getElementsByTagNameAndClass;
  5353. goog.dom.setProperties = function (a, b) {
  5354. goog.object.forEach(b, function (b, d) {
  5355. b && "object" == typeof b && b.implementsGoogStringTypedString && (b = b.getTypedStringValue());
  5356. "style" == d ? a.style.cssText = b : "class" == d ? a.className = b : "for" == d ? a.htmlFor = b : goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(d) ? a.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[d], b) : goog.string.startsWith(d, "aria-") || goog.string.startsWith(d, "data-") ? a.setAttribute(d, b) : a[d] = b
  5357. })
  5358. }
  5359. ;
  5360. goog.dom.DIRECT_ATTRIBUTE_MAP_ = {
  5361. cellpadding: "cellPadding",
  5362. cellspacing: "cellSpacing",
  5363. colspan: "colSpan",
  5364. frameborder: "frameBorder",
  5365. height: "height",
  5366. maxlength: "maxLength",
  5367. nonce: "nonce",
  5368. role: "role",
  5369. rowspan: "rowSpan",
  5370. type: "type",
  5371. usemap: "useMap",
  5372. valign: "vAlign",
  5373. width: "width"
  5374. };
  5375. goog.dom.getViewportSize = function (a) {
  5376. return goog.dom.getViewportSize_(a || window)
  5377. }
  5378. ;
  5379. goog.dom.getViewportSize_ = function (a) {
  5380. a = a.document;
  5381. a = goog.dom.isCss1CompatMode_(a) ? a.documentElement : a.body;
  5382. return new goog.math.Size(a.clientWidth, a.clientHeight)
  5383. }
  5384. ;
  5385. goog.dom.getDocumentHeight = function () {
  5386. return goog.dom.getDocumentHeight_(window)
  5387. }
  5388. ;
  5389. goog.dom.getDocumentHeightForWindow = function (a) {
  5390. return goog.dom.getDocumentHeight_(a)
  5391. }
  5392. ;
  5393. goog.dom.getDocumentHeight_ = function (a) {
  5394. var b = a.document
  5395. , c = 0;
  5396. if (b) {
  5397. c = b.body;
  5398. var d = b.documentElement;
  5399. if (!d || !c)
  5400. return 0;
  5401. a = goog.dom.getViewportSize_(a).height;
  5402. if (goog.dom.isCss1CompatMode_(b) && d.scrollHeight)
  5403. c = d.scrollHeight != a ? d.scrollHeight : d.offsetHeight;
  5404. else {
  5405. b = d.scrollHeight;
  5406. var e = d.offsetHeight;
  5407. d.clientHeight != e && (b = c.scrollHeight,
  5408. e = c.offsetHeight);
  5409. c = b > a ? b > e ? b : e : b < e ? b : e
  5410. }
  5411. }
  5412. return c
  5413. }
  5414. ;
  5415. goog.dom.getPageScroll = function (a) {
  5416. return goog.dom.getDomHelper((a || goog.global || window).document).getDocumentScroll()
  5417. }
  5418. ;
  5419. goog.dom.getDocumentScroll = function () {
  5420. return goog.dom.getDocumentScroll_(document)
  5421. }
  5422. ;
  5423. goog.dom.getDocumentScroll_ = function (a) {
  5424. var b = goog.dom.getDocumentScrollElement_(a);
  5425. a = goog.dom.getWindow_(a);
  5426. return goog.userAgent.IE && goog.userAgent.isVersionOrHigher("10") && a.pageYOffset != b.scrollTop ? new goog.math.Coordinate(b.scrollLeft, b.scrollTop) : new goog.math.Coordinate(a.pageXOffset || b.scrollLeft, a.pageYOffset || b.scrollTop)
  5427. }
  5428. ;
  5429. goog.dom.getDocumentScrollElement = function () {
  5430. return goog.dom.getDocumentScrollElement_(document)
  5431. }
  5432. ;
  5433. goog.dom.getDocumentScrollElement_ = function (a) {
  5434. return a.scrollingElement ? a.scrollingElement : !goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(a) ? a.documentElement : a.body || a.documentElement
  5435. }
  5436. ;
  5437. goog.dom.getWindow = function (a) {
  5438. return a ? goog.dom.getWindow_(a) : window
  5439. }
  5440. ;
  5441. goog.dom.getWindow_ = function (a) {
  5442. return a.parentWindow || a.defaultView
  5443. }
  5444. ;
  5445. goog.dom.createDom = function (a, b, c) {
  5446. return goog.dom.createDom_(document, arguments)
  5447. }
  5448. ;
  5449. goog.dom.createDom_ = function (a, b) {
  5450. var c = String(b[0])
  5451. , d = b[1];
  5452. if (!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES && d && (d.name || d.type)) {
  5453. c = ["<", c];
  5454. d.name && c.push(' name="', goog.string.htmlEscape(d.name), '"');
  5455. if (d.type) {
  5456. c.push(' type="', goog.string.htmlEscape(d.type), '"');
  5457. var e = {};
  5458. goog.object.extend(e, d);
  5459. delete e.type;
  5460. d = e
  5461. }
  5462. c.push(">");
  5463. c = c.join("")
  5464. }
  5465. c = goog.dom.createElement_(a, c);
  5466. d && ("string" === typeof d ? c.className = d : goog.isArray(d) ? c.className = d.join(" ") : goog.dom.setProperties(c, d));
  5467. 2 < b.length && goog.dom.append_(a, c, b, 2);
  5468. return c
  5469. }
  5470. ;
  5471. goog.dom.append_ = function (a, b, c, d) {
  5472. function e(c) {
  5473. c && b.appendChild("string" === typeof c ? a.createTextNode(c) : c)
  5474. }
  5475. for (; d < c.length; d++) {
  5476. var f = c[d];
  5477. goog.isArrayLike(f) && !goog.dom.isNodeLike(f) ? goog.array.forEach(goog.dom.isNodeList(f) ? goog.array.toArray(f) : f, e) : e(f)
  5478. }
  5479. }
  5480. ;
  5481. goog.dom.$dom = goog.dom.createDom;
  5482. goog.dom.createElement = function (a) {
  5483. return goog.dom.createElement_(document, a)
  5484. }
  5485. ;
  5486. goog.dom.createElement_ = function (a, b) {
  5487. b = String(b);
  5488. "application/xhtml+xml" === a.contentType && (b = b.toLowerCase());
  5489. return a.createElement(b)
  5490. }
  5491. ;
  5492. goog.dom.createTextNode = function (a) {
  5493. return document.createTextNode(String(a))
  5494. }
  5495. ;
  5496. goog.dom.createTable = function (a, b, c) {
  5497. return goog.dom.createTable_(document, a, b, !!c)
  5498. }
  5499. ;
  5500. goog.dom.createTable_ = function (a, b, c, d) {
  5501. for (var e = goog.dom.createElement_(a, "TABLE"), f = e.appendChild(goog.dom.createElement_(a, "TBODY")), g = 0; g < b; g++) {
  5502. for (var h = goog.dom.createElement_(a, "TR"), k = 0; k < c; k++) {
  5503. var m = goog.dom.createElement_(a, "TD");
  5504. d && goog.dom.setTextContent(m, goog.string.Unicode.NBSP);
  5505. h.appendChild(m)
  5506. }
  5507. f.appendChild(h)
  5508. }
  5509. return e
  5510. }
  5511. ;
  5512. goog.dom.constHtmlToNode = function (a) {
  5513. var b = goog.array.map(arguments, goog.string.Const.unwrap);
  5514. b = goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Constant HTML string, that gets turned into a Node later, so it will be automatically balanced."), b.join(""));
  5515. return goog.dom.safeHtmlToNode(b)
  5516. }
  5517. ;
  5518. goog.dom.safeHtmlToNode = function (a) {
  5519. return goog.dom.safeHtmlToNode_(document, a)
  5520. }
  5521. ;
  5522. goog.dom.safeHtmlToNode_ = function (a, b) {
  5523. var c = goog.dom.createElement_(a, "DIV");
  5524. goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT ? (goog.dom.safe.setInnerHtml(c, goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, b)),
  5525. c.removeChild(goog.asserts.assert(c.firstChild))) : goog.dom.safe.setInnerHtml(c, b);
  5526. return goog.dom.childrenToNode_(a, c)
  5527. }
  5528. ;
  5529. goog.dom.childrenToNode_ = function (a, b) {
  5530. if (1 == b.childNodes.length)
  5531. return b.removeChild(goog.asserts.assert(b.firstChild));
  5532. for (var c = a.createDocumentFragment(); b.firstChild;)
  5533. c.appendChild(b.firstChild);
  5534. return c
  5535. }
  5536. ;
  5537. goog.dom.isCss1CompatMode = function () {
  5538. return goog.dom.isCss1CompatMode_(document)
  5539. }
  5540. ;
  5541. goog.dom.isCss1CompatMode_ = function (a) {
  5542. return goog.dom.COMPAT_MODE_KNOWN_ ? goog.dom.ASSUME_STANDARDS_MODE : "CSS1Compat" == a.compatMode
  5543. }
  5544. ;
  5545. goog.dom.canHaveChildren = function (a) {
  5546. if (a.nodeType != goog.dom.NodeType.ELEMENT)
  5547. return !1;
  5548. switch (a.tagName) {
  5549. case "APPLET":
  5550. case "AREA":
  5551. case "BASE":
  5552. case "BR":
  5553. case "COL":
  5554. case "COMMAND":
  5555. case "EMBED":
  5556. case "FRAME":
  5557. case "HR":
  5558. case "IMG":
  5559. case "INPUT":
  5560. case "IFRAME":
  5561. case "ISINDEX":
  5562. case "KEYGEN":
  5563. case "LINK":
  5564. case "NOFRAMES":
  5565. case "NOSCRIPT":
  5566. case "META":
  5567. case "OBJECT":
  5568. case "PARAM":
  5569. case "SCRIPT":
  5570. case "SOURCE":
  5571. case "STYLE":
  5572. case "TRACK":
  5573. case "WBR":
  5574. return !1
  5575. }
  5576. return !0
  5577. }
  5578. ;
  5579. goog.dom.appendChild = function (a, b) {
  5580. goog.asserts.assert(null != a && null != b, "goog.dom.appendChild expects non-null arguments");
  5581. a.appendChild(b)
  5582. }
  5583. ;
  5584. goog.dom.append = function (a, b) {
  5585. goog.dom.append_(goog.dom.getOwnerDocument(a), a, arguments, 1)
  5586. }
  5587. ;
  5588. goog.dom.removeChildren = function (a) {
  5589. for (var b; b = a.firstChild;)
  5590. a.removeChild(b)
  5591. }
  5592. ;
  5593. goog.dom.insertSiblingBefore = function (a, b) {
  5594. goog.asserts.assert(null != a && null != b, "goog.dom.insertSiblingBefore expects non-null arguments");
  5595. b.parentNode && b.parentNode.insertBefore(a, b)
  5596. }
  5597. ;
  5598. goog.dom.insertSiblingAfter = function (a, b) {
  5599. goog.asserts.assert(null != a && null != b, "goog.dom.insertSiblingAfter expects non-null arguments");
  5600. b.parentNode && b.parentNode.insertBefore(a, b.nextSibling)
  5601. }
  5602. ;
  5603. goog.dom.insertChildAt = function (a, b, c) {
  5604. goog.asserts.assert(null != a, "goog.dom.insertChildAt expects a non-null parent");
  5605. a.insertBefore(b, a.childNodes[c] || null)
  5606. }
  5607. ;
  5608. goog.dom.removeNode = function (a) {
  5609. return a && a.parentNode ? a.parentNode.removeChild(a) : null
  5610. }
  5611. ;
  5612. goog.dom.replaceNode = function (a, b) {
  5613. goog.asserts.assert(null != a && null != b, "goog.dom.replaceNode expects non-null arguments");
  5614. var c = b.parentNode;
  5615. c && c.replaceChild(a, b)
  5616. }
  5617. ;
  5618. goog.dom.flattenElement = function (a) {
  5619. var b, c = a.parentNode;
  5620. if (c && c.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) {
  5621. if (a.removeNode)
  5622. return a.removeNode(!1);
  5623. for (; b = a.firstChild;)
  5624. c.insertBefore(b, a);
  5625. return goog.dom.removeNode(a)
  5626. }
  5627. }
  5628. ;
  5629. goog.dom.getChildren = function (a) {
  5630. return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE && void 0 != a.children ? a.children : goog.array.filter(a.childNodes, function (a) {
  5631. return a.nodeType == goog.dom.NodeType.ELEMENT
  5632. })
  5633. }
  5634. ;
  5635. goog.dom.getFirstElementChild = function (a) {
  5636. return void 0 !== a.firstElementChild ? a.firstElementChild : goog.dom.getNextElementNode_(a.firstChild, !0)
  5637. }
  5638. ;
  5639. goog.dom.getLastElementChild = function (a) {
  5640. return void 0 !== a.lastElementChild ? a.lastElementChild : goog.dom.getNextElementNode_(a.lastChild, !1)
  5641. }
  5642. ;
  5643. goog.dom.getNextElementSibling = function (a) {
  5644. return void 0 !== a.nextElementSibling ? a.nextElementSibling : goog.dom.getNextElementNode_(a.nextSibling, !0)
  5645. }
  5646. ;
  5647. goog.dom.getPreviousElementSibling = function (a) {
  5648. return void 0 !== a.previousElementSibling ? a.previousElementSibling : goog.dom.getNextElementNode_(a.previousSibling, !1)
  5649. }
  5650. ;
  5651. goog.dom.getNextElementNode_ = function (a, b) {
  5652. for (; a && a.nodeType != goog.dom.NodeType.ELEMENT;)
  5653. a = b ? a.nextSibling : a.previousSibling;
  5654. return a
  5655. }
  5656. ;
  5657. goog.dom.getNextNode = function (a) {
  5658. if (!a)
  5659. return null;
  5660. if (a.firstChild)
  5661. return a.firstChild;
  5662. for (; a && !a.nextSibling;)
  5663. a = a.parentNode;
  5664. return a ? a.nextSibling : null
  5665. }
  5666. ;
  5667. goog.dom.getPreviousNode = function (a) {
  5668. if (!a)
  5669. return null;
  5670. if (!a.previousSibling)
  5671. return a.parentNode;
  5672. for (a = a.previousSibling; a && a.lastChild;)
  5673. a = a.lastChild;
  5674. return a
  5675. }
  5676. ;
  5677. goog.dom.isNodeLike = function (a) {
  5678. return goog.isObject(a) && 0 < a.nodeType
  5679. }
  5680. ;
  5681. goog.dom.isElement = function (a) {
  5682. return goog.isObject(a) && a.nodeType == goog.dom.NodeType.ELEMENT
  5683. }
  5684. ;
  5685. goog.dom.isWindow = function (a) {
  5686. return goog.isObject(a) && a.window == a
  5687. }
  5688. ;
  5689. goog.dom.getParentElement = function (a) {
  5690. var b;
  5691. if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY && !(goog.userAgent.IE && goog.userAgent.isVersionOrHigher("9") && !goog.userAgent.isVersionOrHigher("10") && goog.global.SVGElement && a instanceof goog.global.SVGElement) && (b = a.parentElement))
  5692. return b;
  5693. b = a.parentNode;
  5694. return goog.dom.isElement(b) ? b : null
  5695. }
  5696. ;
  5697. goog.dom.contains = function (a, b) {
  5698. if (!a || !b)
  5699. return !1;
  5700. if (a.contains && b.nodeType == goog.dom.NodeType.ELEMENT)
  5701. return a == b || a.contains(b);
  5702. if ("undefined" != typeof a.compareDocumentPosition)
  5703. return a == b || !!(a.compareDocumentPosition(b) & 16);
  5704. for (; b && a != b;)
  5705. b = b.parentNode;
  5706. return b == a
  5707. }
  5708. ;
  5709. goog.dom.compareNodeOrder = function (a, b) {
  5710. if (a == b)
  5711. return 0;
  5712. if (a.compareDocumentPosition)
  5713. return a.compareDocumentPosition(b) & 2 ? 1 : -1;
  5714. if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
  5715. if (a.nodeType == goog.dom.NodeType.DOCUMENT)
  5716. return -1;
  5717. if (b.nodeType == goog.dom.NodeType.DOCUMENT)
  5718. return 1
  5719. }
  5720. if ("sourceIndex" in a || a.parentNode && "sourceIndex" in a.parentNode) {
  5721. var c = a.nodeType == goog.dom.NodeType.ELEMENT
  5722. , d = b.nodeType == goog.dom.NodeType.ELEMENT;
  5723. if (c && d)
  5724. return a.sourceIndex - b.sourceIndex;
  5725. var e = a.parentNode
  5726. , f = b.parentNode;
  5727. return e == f ? goog.dom.compareSiblingOrder_(a, b) : !c && goog.dom.contains(e, b) ? -1 * goog.dom.compareParentsDescendantNodeIe_(a, b) : !d && goog.dom.contains(f, a) ? goog.dom.compareParentsDescendantNodeIe_(b, a) : (c ? a.sourceIndex : e.sourceIndex) - (d ? b.sourceIndex : f.sourceIndex)
  5728. }
  5729. d = goog.dom.getOwnerDocument(a);
  5730. c = d.createRange();
  5731. c.selectNode(a);
  5732. c.collapse(!0);
  5733. d = d.createRange();
  5734. d.selectNode(b);
  5735. d.collapse(!0);
  5736. return c.compareBoundaryPoints(goog.global.Range.START_TO_END, d)
  5737. }
  5738. ;
  5739. goog.dom.compareParentsDescendantNodeIe_ = function (a, b) {
  5740. var c = a.parentNode;
  5741. if (c == b)
  5742. return -1;
  5743. for (var d = b; d.parentNode != c;)
  5744. d = d.parentNode;
  5745. return goog.dom.compareSiblingOrder_(d, a)
  5746. }
  5747. ;
  5748. goog.dom.compareSiblingOrder_ = function (a, b) {
  5749. for (var c = b; c = c.previousSibling;)
  5750. if (c == a)
  5751. return -1;
  5752. return 1
  5753. }
  5754. ;
  5755. goog.dom.findCommonAncestor = function (a) {
  5756. var b, c = arguments.length;
  5757. if (!c)
  5758. return null;
  5759. if (1 == c)
  5760. return arguments[0];
  5761. var d = []
  5762. , e = Infinity;
  5763. for (b = 0; b < c; b++) {
  5764. for (var f = [], g = arguments[b]; g;)
  5765. f.unshift(g),
  5766. g = g.parentNode;
  5767. d.push(f);
  5768. e = Math.min(e, f.length)
  5769. }
  5770. f = null;
  5771. for (b = 0; b < e; b++) {
  5772. g = d[0][b];
  5773. for (var h = 1; h < c; h++)
  5774. if (g != d[h][b])
  5775. return f;
  5776. f = g
  5777. }
  5778. return f
  5779. }
  5780. ;
  5781. goog.dom.isInDocument = function (a) {
  5782. return 16 == (a.ownerDocument.compareDocumentPosition(a) & 16)
  5783. }
  5784. ;
  5785. goog.dom.getOwnerDocument = function (a) {
  5786. goog.asserts.assert(a, "Node cannot be null or undefined.");
  5787. return a.nodeType == goog.dom.NodeType.DOCUMENT ? a : a.ownerDocument || a.document
  5788. }
  5789. ;
  5790. goog.dom.getFrameContentDocument = function (a) {
  5791. return a.contentDocument || a.contentWindow.document
  5792. }
  5793. ;
  5794. goog.dom.getFrameContentWindow = function (a) {
  5795. try {
  5796. return a.contentWindow || (a.contentDocument ? goog.dom.getWindow(a.contentDocument) : null)
  5797. } catch (b) { }
  5798. return null
  5799. }
  5800. ;
  5801. goog.dom.setTextContent = function (a, b) {
  5802. goog.asserts.assert(null != a, "goog.dom.setTextContent expects a non-null value for node");
  5803. if ("textContent" in a)
  5804. a.textContent = b;
  5805. else if (a.nodeType == goog.dom.NodeType.TEXT)
  5806. a.data = String(b);
  5807. else if (a.firstChild && a.firstChild.nodeType == goog.dom.NodeType.TEXT) {
  5808. for (; a.lastChild != a.firstChild;)
  5809. a.removeChild(goog.asserts.assert(a.lastChild));
  5810. a.firstChild.data = String(b)
  5811. } else {
  5812. goog.dom.removeChildren(a);
  5813. var c = goog.dom.getOwnerDocument(a);
  5814. a.appendChild(c.createTextNode(String(b)))
  5815. }
  5816. }
  5817. ;
  5818. goog.dom.getOuterHtml = function (a) {
  5819. goog.asserts.assert(null !== a, "goog.dom.getOuterHtml expects a non-null value for element");
  5820. if ("outerHTML" in a)
  5821. return a.outerHTML;
  5822. var b = goog.dom.getOwnerDocument(a);
  5823. b = goog.dom.createElement_(b, "DIV");
  5824. b.appendChild(a.cloneNode(!0));
  5825. return b.innerHTML
  5826. }
  5827. ;
  5828. goog.dom.findNode = function (a, b) {
  5829. var c = [];
  5830. return goog.dom.findNodes_(a, b, c, !0) ? c[0] : void 0
  5831. }
  5832. ;
  5833. goog.dom.findNodes = function (a, b) {
  5834. var c = [];
  5835. goog.dom.findNodes_(a, b, c, !1);
  5836. return c
  5837. }
  5838. ;
  5839. goog.dom.findNodes_ = function (a, b, c, d) {
  5840. if (null != a)
  5841. for (a = a.firstChild; a;) {
  5842. if (b(a) && (c.push(a),
  5843. d) || goog.dom.findNodes_(a, b, c, d))
  5844. return !0;
  5845. a = a.nextSibling
  5846. }
  5847. return !1
  5848. }
  5849. ;
  5850. goog.dom.findElement = function (a, b) {
  5851. for (var c = goog.dom.getChildrenReverse_(a); 0 < c.length;) {
  5852. var d = c.pop();
  5853. if (b(d))
  5854. return d;
  5855. for (d = d.lastElementChild; d; d = d.previousElementSibling)
  5856. c.push(d)
  5857. }
  5858. return null
  5859. }
  5860. ;
  5861. goog.dom.findElements = function (a, b) {
  5862. for (var c = [], d = goog.dom.getChildrenReverse_(a); 0 < d.length;) {
  5863. var e = d.pop();
  5864. b(e) && c.push(e);
  5865. for (e = e.lastElementChild; e; e = e.previousElementSibling)
  5866. d.push(e)
  5867. }
  5868. return c
  5869. }
  5870. ;
  5871. goog.dom.getChildrenReverse_ = function (a) {
  5872. if (a.nodeType == goog.dom.NodeType.DOCUMENT)
  5873. return [a.documentElement];
  5874. var b = [];
  5875. for (a = a.lastElementChild; a; a = a.previousElementSibling)
  5876. b.push(a);
  5877. return b
  5878. }
  5879. ;
  5880. goog.dom.TAGS_TO_IGNORE_ = {
  5881. SCRIPT: 1,
  5882. STYLE: 1,
  5883. HEAD: 1,
  5884. IFRAME: 1,
  5885. OBJECT: 1
  5886. };
  5887. goog.dom.PREDEFINED_TAG_VALUES_ = {
  5888. IMG: " ",
  5889. BR: "\n"
  5890. };
  5891. goog.dom.isFocusableTabIndex = function (a) {
  5892. return goog.dom.hasSpecifiedTabIndex_(a) && goog.dom.isTabIndexFocusable_(a)
  5893. }
  5894. ;
  5895. goog.dom.setFocusableTabIndex = function (a, b) {
  5896. b ? a.tabIndex = 0 : (a.tabIndex = -1,
  5897. a.removeAttribute("tabIndex"))
  5898. }
  5899. ;
  5900. goog.dom.isFocusable = function (a) {
  5901. var b;
  5902. return (b = goog.dom.nativelySupportsFocus_(a) ? !a.disabled && (!goog.dom.hasSpecifiedTabIndex_(a) || goog.dom.isTabIndexFocusable_(a)) : goog.dom.isFocusableTabIndex(a)) && goog.userAgent.IE ? goog.dom.hasNonZeroBoundingRect_(a) : b
  5903. }
  5904. ;
  5905. goog.dom.hasSpecifiedTabIndex_ = function (a) {
  5906. return goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9") ? (a = a.getAttributeNode("tabindex"),
  5907. null != a && a.specified) : a.hasAttribute("tabindex")
  5908. }
  5909. ;
  5910. goog.dom.isTabIndexFocusable_ = function (a) {
  5911. a = a.tabIndex;
  5912. return "number" === typeof a && 0 <= a && 32768 > a
  5913. }
  5914. ;
  5915. goog.dom.nativelySupportsFocus_ = function (a) {
  5916. return "A" == a.tagName && a.hasAttribute("href") || "INPUT" == a.tagName || "TEXTAREA" == a.tagName || "SELECT" == a.tagName || "BUTTON" == a.tagName
  5917. }
  5918. ;
  5919. goog.dom.hasNonZeroBoundingRect_ = function (a) {
  5920. a = !goog.isFunction(a.getBoundingClientRect) || goog.userAgent.IE && null == a.parentElement ? {
  5921. height: a.offsetHeight,
  5922. width: a.offsetWidth
  5923. } : a.getBoundingClientRect();
  5924. return null != a && 0 < a.height && 0 < a.width
  5925. }
  5926. ;
  5927. goog.dom.getTextContent = function (a) {
  5928. if (goog.dom.BrowserFeature.CAN_USE_INNER_TEXT && null !== a && "innerText" in a)
  5929. a = goog.string.canonicalizeNewlines(a.innerText);
  5930. else {
  5931. var b = [];
  5932. goog.dom.getTextContent_(a, b, !0);
  5933. a = b.join("")
  5934. }
  5935. a = a.replace(/ \xAD /g, " ").replace(/\xAD/g, "");
  5936. a = a.replace(/\u200B/g, "");
  5937. goog.dom.BrowserFeature.CAN_USE_INNER_TEXT || (a = a.replace(/ +/g, " "));
  5938. " " != a && (a = a.replace(/^\s*/, ""));
  5939. return a
  5940. }
  5941. ;
  5942. goog.dom.getRawTextContent = function (a) {
  5943. var b = [];
  5944. goog.dom.getTextContent_(a, b, !1);
  5945. return b.join("")
  5946. }
  5947. ;
  5948. goog.dom.getTextContent_ = function (a, b, c) {
  5949. if (!(a.nodeName in goog.dom.TAGS_TO_IGNORE_))
  5950. if (a.nodeType == goog.dom.NodeType.TEXT)
  5951. c ? b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g, "")) : b.push(a.nodeValue);
  5952. else if (a.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)
  5953. b.push(goog.dom.PREDEFINED_TAG_VALUES_[a.nodeName]);
  5954. else
  5955. for (a = a.firstChild; a;)
  5956. goog.dom.getTextContent_(a, b, c),
  5957. a = a.nextSibling
  5958. }
  5959. ;
  5960. goog.dom.getNodeTextLength = function (a) {
  5961. return goog.dom.getTextContent(a).length
  5962. }
  5963. ;
  5964. goog.dom.getNodeTextOffset = function (a, b) {
  5965. for (var c = b || goog.dom.getOwnerDocument(a).body, d = []; a && a != c;) {
  5966. for (var e = a; e = e.previousSibling;)
  5967. d.unshift(goog.dom.getTextContent(e));
  5968. a = a.parentNode
  5969. }
  5970. return goog.string.trimLeft(d.join("")).replace(/ +/g, " ").length
  5971. }
  5972. ;
  5973. goog.dom.getNodeAtOffset = function (a, b, c) {
  5974. a = [a];
  5975. for (var d = 0, e = null; 0 < a.length && d < b;)
  5976. if (e = a.pop(),
  5977. !(e.nodeName in goog.dom.TAGS_TO_IGNORE_))
  5978. if (e.nodeType == goog.dom.NodeType.TEXT) {
  5979. var f = e.nodeValue.replace(/(\r\n|\r|\n)/g, "").replace(/ +/g, " ");
  5980. d += f.length
  5981. } else if (e.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)
  5982. d += goog.dom.PREDEFINED_TAG_VALUES_[e.nodeName].length;
  5983. else
  5984. for (f = e.childNodes.length - 1; 0 <= f; f--)
  5985. a.push(e.childNodes[f]);
  5986. goog.isObject(c) && (c.remainder = e ? e.nodeValue.length + b - d - 1 : 0,
  5987. c.node = e);
  5988. return e
  5989. }
  5990. ;
  5991. goog.dom.isNodeList = function (a) {
  5992. if (a && "number" == typeof a.length) {
  5993. if (goog.isObject(a))
  5994. return "function" == typeof a.item || "string" == typeof a.item;
  5995. if (goog.isFunction(a))
  5996. return "function" == typeof a.item
  5997. }
  5998. return !1
  5999. }
  6000. ;
  6001. goog.dom.getAncestorByTagNameAndClass = function (a, b, c, d) {
  6002. if (!b && !c)
  6003. return null;
  6004. var e = b ? String(b).toUpperCase() : null;
  6005. return goog.dom.getAncestor(a, function (a) {
  6006. return (!e || a.nodeName == e) && (!c || "string" === typeof a.className && goog.array.contains(a.className.split(/\s+/), c))
  6007. }, !0, d)
  6008. }
  6009. ;
  6010. goog.dom.getAncestorByClass = function (a, b, c) {
  6011. return goog.dom.getAncestorByTagNameAndClass(a, null, b, c)
  6012. }
  6013. ;
  6014. goog.dom.getAncestor = function (a, b, c, d) {
  6015. a && !c && (a = a.parentNode);
  6016. for (c = 0; a && (null == d || c <= d);) {
  6017. goog.asserts.assert("parentNode" != a.name);
  6018. if (b(a))
  6019. return a;
  6020. a = a.parentNode;
  6021. c++
  6022. }
  6023. return null
  6024. }
  6025. ;
  6026. goog.dom.getActiveElement = function (a) {
  6027. try {
  6028. var b = a && a.activeElement;
  6029. return b && b.nodeName ? b : null
  6030. } catch (c) {
  6031. return null
  6032. }
  6033. }
  6034. ;
  6035. goog.dom.getPixelRatio = function () {
  6036. var a = goog.dom.getWindow();
  6037. return void 0 !== a.devicePixelRatio ? a.devicePixelRatio : a.matchMedia ? goog.dom.matchesPixelRatio_(3) || goog.dom.matchesPixelRatio_(2) || goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(1) || .75 : 1
  6038. }
  6039. ;
  6040. goog.dom.matchesPixelRatio_ = function (a) {
  6041. return goog.dom.getWindow().matchMedia("(min-resolution: " + a + "dppx),(min--moz-device-pixel-ratio: " + a + "),(min-resolution: " + 96 * a + "dpi)").matches ? a : 0
  6042. }
  6043. ;
  6044. goog.dom.getCanvasContext2D = function (a) {
  6045. return a.getContext("2d")
  6046. }
  6047. ;
  6048. goog.dom.DomHelper = function (a) {
  6049. this.document_ = a || goog.global.document || document
  6050. }
  6051. ;
  6052. goog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper;
  6053. goog.dom.DomHelper.prototype.setDocument = function (a) {
  6054. this.document_ = a
  6055. }
  6056. ;
  6057. goog.dom.DomHelper.prototype.getDocument = function () {
  6058. return this.document_
  6059. }
  6060. ;
  6061. goog.dom.DomHelper.prototype.getElement = function (a) {
  6062. return goog.dom.getElementHelper_(this.document_, a)
  6063. }
  6064. ;
  6065. goog.dom.DomHelper.prototype.getRequiredElement = function (a) {
  6066. return goog.dom.getRequiredElementHelper_(this.document_, a)
  6067. }
  6068. ;
  6069. goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;
  6070. goog.dom.DomHelper.prototype.getElementsByTagName = function (a, b) {
  6071. return (b || this.document_).getElementsByTagName(String(a))
  6072. }
  6073. ;
  6074. goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function (a, b, c) {
  6075. return goog.dom.getElementsByTagNameAndClass_(this.document_, a, b, c)
  6076. }
  6077. ;
  6078. goog.dom.DomHelper.prototype.getElementByTagNameAndClass = function (a, b, c) {
  6079. return goog.dom.getElementByTagNameAndClass_(this.document_, a, b, c)
  6080. }
  6081. ;
  6082. goog.dom.DomHelper.prototype.getElementsByClass = function (a, b) {
  6083. return goog.dom.getElementsByClass(a, b || this.document_)
  6084. }
  6085. ;
  6086. goog.dom.DomHelper.prototype.getElementByClass = function (a, b) {
  6087. return goog.dom.getElementByClass(a, b || this.document_)
  6088. }
  6089. ;
  6090. goog.dom.DomHelper.prototype.getRequiredElementByClass = function (a, b) {
  6091. return goog.dom.getRequiredElementByClass(a, b || this.document_)
  6092. }
  6093. ;
  6094. goog.dom.DomHelper.prototype.$$ = goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;
  6095. goog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties;
  6096. goog.dom.DomHelper.prototype.getViewportSize = function (a) {
  6097. return goog.dom.getViewportSize(a || this.getWindow())
  6098. }
  6099. ;
  6100. goog.dom.DomHelper.prototype.getDocumentHeight = function () {
  6101. return goog.dom.getDocumentHeight_(this.getWindow())
  6102. }
  6103. ;
  6104. goog.dom.DomHelper.prototype.createDom = function (a, b, c) {
  6105. return goog.dom.createDom_(this.document_, arguments)
  6106. }
  6107. ;
  6108. goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;
  6109. goog.dom.DomHelper.prototype.createElement = function (a) {
  6110. return goog.dom.createElement_(this.document_, a)
  6111. }
  6112. ;
  6113. goog.dom.DomHelper.prototype.createTextNode = function (a) {
  6114. return this.document_.createTextNode(String(a))
  6115. }
  6116. ;
  6117. goog.dom.DomHelper.prototype.createTable = function (a, b, c) {
  6118. return goog.dom.createTable_(this.document_, a, b, !!c)
  6119. }
  6120. ;
  6121. goog.dom.DomHelper.prototype.safeHtmlToNode = function (a) {
  6122. return goog.dom.safeHtmlToNode_(this.document_, a)
  6123. }
  6124. ;
  6125. goog.dom.DomHelper.prototype.isCss1CompatMode = function () {
  6126. return goog.dom.isCss1CompatMode_(this.document_)
  6127. }
  6128. ;
  6129. goog.dom.DomHelper.prototype.getWindow = function () {
  6130. return goog.dom.getWindow_(this.document_)
  6131. }
  6132. ;
  6133. goog.dom.DomHelper.prototype.getDocumentScrollElement = function () {
  6134. return goog.dom.getDocumentScrollElement_(this.document_)
  6135. }
  6136. ;
  6137. goog.dom.DomHelper.prototype.getDocumentScroll = function () {
  6138. return goog.dom.getDocumentScroll_(this.document_)
  6139. }
  6140. ;
  6141. goog.dom.DomHelper.prototype.getActiveElement = function (a) {
  6142. return goog.dom.getActiveElement(a || this.document_)
  6143. }
  6144. ;
  6145. goog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild;
  6146. goog.dom.DomHelper.prototype.append = goog.dom.append;
  6147. goog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren;
  6148. goog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren;
  6149. goog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore;
  6150. goog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter;
  6151. goog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt;
  6152. goog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode;
  6153. goog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode;
  6154. goog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement;
  6155. goog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren;
  6156. goog.dom.DomHelper.prototype.getFirstElementChild = goog.dom.getFirstElementChild;
  6157. goog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild;
  6158. goog.dom.DomHelper.prototype.getNextElementSibling = goog.dom.getNextElementSibling;
  6159. goog.dom.DomHelper.prototype.getPreviousElementSibling = goog.dom.getPreviousElementSibling;
  6160. goog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode;
  6161. goog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode;
  6162. goog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike;
  6163. goog.dom.DomHelper.prototype.isElement = goog.dom.isElement;
  6164. goog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow;
  6165. goog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement;
  6166. goog.dom.DomHelper.prototype.contains = goog.dom.contains;
  6167. goog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder;
  6168. goog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor;
  6169. goog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument;
  6170. goog.dom.DomHelper.prototype.getFrameContentDocument = goog.dom.getFrameContentDocument;
  6171. goog.dom.DomHelper.prototype.getFrameContentWindow = goog.dom.getFrameContentWindow;
  6172. goog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent;
  6173. goog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml;
  6174. goog.dom.DomHelper.prototype.findNode = goog.dom.findNode;
  6175. goog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes;
  6176. goog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex;
  6177. goog.dom.DomHelper.prototype.setFocusableTabIndex = goog.dom.setFocusableTabIndex;
  6178. goog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable;
  6179. goog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent;
  6180. goog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength;
  6181. goog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset;
  6182. goog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset;
  6183. goog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList;
  6184. goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass = goog.dom.getAncestorByTagNameAndClass;
  6185. goog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass;
  6186. goog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor;
  6187. goog.dom.DomHelper.prototype.getCanvasContext2D = goog.dom.getCanvasContext2D;
  6188. goog.async.throwException = function (a) {
  6189. goog.global.setTimeout(function () {
  6190. throw a;
  6191. }, 0)
  6192. }
  6193. ;
  6194. goog.async.nextTick = function (a, b, c) {
  6195. var d = a;
  6196. b && (d = goog.bind(a, b));
  6197. d = goog.async.nextTick.wrapCallback_(d);
  6198. goog.isFunction(goog.global.setImmediate) && (c || goog.async.nextTick.useSetImmediate_()) ? goog.global.setImmediate(d) : (goog.async.nextTick.setImmediate_ || (goog.async.nextTick.setImmediate_ = goog.async.nextTick.getSetImmediateEmulator_()),
  6199. goog.async.nextTick.setImmediate_(d))
  6200. }
  6201. ;
  6202. goog.async.nextTick.useSetImmediate_ = function () {
  6203. return goog.global.Window && goog.global.Window.prototype && !goog.labs.userAgent.browser.isEdge() && goog.global.Window.prototype.setImmediate == goog.global.setImmediate ? !1 : !0
  6204. }
  6205. ;
  6206. goog.async.nextTick.getSetImmediateEmulator_ = function () {
  6207. var a = goog.global.MessageChannel;
  6208. "undefined" === typeof a && "undefined" !== typeof window && window.postMessage && window.addEventListener && !goog.labs.userAgent.engine.isPresto() && (a = function () {
  6209. var a = goog.dom.createElement("IFRAME");
  6210. a.style.display = "none";
  6211. goog.dom.safe.setIframeSrc(a, goog.html.TrustedResourceUrl.fromConstant(goog.string.Const.EMPTY));
  6212. document.documentElement.appendChild(a);
  6213. var b = a.contentWindow;
  6214. a = b.document;
  6215. a.open();
  6216. goog.dom.safe.documentWrite(a, goog.html.SafeHtml.EMPTY);
  6217. a.close();
  6218. var c = "callImmediate" + Math.random()
  6219. , d = "file:" == b.location.protocol ? "*" : b.location.protocol + "//" + b.location.host;
  6220. a = goog.bind(function (a) {
  6221. if (("*" == d || a.origin == d) && a.data == c)
  6222. this.port1.onmessage()
  6223. }, this);
  6224. b.addEventListener("message", a, !1);
  6225. this.port1 = {};
  6226. this.port2 = {
  6227. postMessage: function () {
  6228. b.postMessage(c, d)
  6229. }
  6230. }
  6231. }
  6232. );
  6233. if ("undefined" !== typeof a && !goog.labs.userAgent.browser.isIE()) {
  6234. var b = new a
  6235. , c = {}
  6236. , d = c;
  6237. b.port1.onmessage = function () {
  6238. if (void 0 !== c.next) {
  6239. c = c.next;
  6240. var a = c.cb;
  6241. c.cb = null;
  6242. a()
  6243. }
  6244. }
  6245. ;
  6246. return function (a) {
  6247. d.next = {
  6248. cb: a
  6249. };
  6250. d = d.next;
  6251. b.port2.postMessage(0)
  6252. }
  6253. }
  6254. return "undefined" !== typeof document && "onreadystatechange" in goog.dom.createElement("SCRIPT") ? function (a) {
  6255. var b = goog.dom.createElement("SCRIPT");
  6256. b.onreadystatechange = function () {
  6257. b.onreadystatechange = null;
  6258. b.parentNode.removeChild(b);
  6259. b = null;
  6260. a();
  6261. a = null
  6262. }
  6263. ;
  6264. document.documentElement.appendChild(b)
  6265. }
  6266. : function (a) {
  6267. goog.global.setTimeout(a, 0)
  6268. }
  6269. }
  6270. ;
  6271. goog.async.nextTick.wrapCallback_ = goog.functions.identity;
  6272. goog.debug.entryPointRegistry.register(function (a) {
  6273. goog.async.nextTick.wrapCallback_ = a
  6274. });
  6275. goog.ASSUME_NATIVE_PROMISE = !1;
  6276. goog.async.run = function (a, b) {
  6277. goog.async.run.schedule_ || goog.async.run.initializeRunner_();
  6278. goog.async.run.workQueueScheduled_ || (goog.async.run.schedule_(),
  6279. goog.async.run.workQueueScheduled_ = !0);
  6280. goog.async.run.workQueue_.add(a, b)
  6281. }
  6282. ;
  6283. goog.async.run.initializeRunner_ = function () {
  6284. if (goog.ASSUME_NATIVE_PROMISE || goog.global.Promise && goog.global.Promise.resolve) {
  6285. var a = goog.global.Promise.resolve(void 0);
  6286. goog.async.run.schedule_ = function () {
  6287. a.then(goog.async.run.processWorkQueue)
  6288. }
  6289. } else
  6290. goog.async.run.schedule_ = function () {
  6291. goog.async.nextTick(goog.async.run.processWorkQueue)
  6292. }
  6293. }
  6294. ;
  6295. goog.async.run.forceNextTick = function (a) {
  6296. goog.async.run.schedule_ = function () {
  6297. goog.async.nextTick(goog.async.run.processWorkQueue);
  6298. a && a(goog.async.run.processWorkQueue)
  6299. }
  6300. }
  6301. ;
  6302. goog.async.run.workQueueScheduled_ = !1;
  6303. goog.async.run.workQueue_ = new goog.async.WorkQueue;
  6304. goog.DEBUG && (goog.async.run.resetQueue = function () {
  6305. goog.async.run.workQueueScheduled_ = !1;
  6306. goog.async.run.workQueue_ = new goog.async.WorkQueue
  6307. }
  6308. );
  6309. goog.async.run.processWorkQueue = function () {
  6310. for (var a; a = goog.async.run.workQueue_.remove();) {
  6311. try {
  6312. a.fn.call(a.scope)
  6313. } catch (b) {
  6314. goog.async.throwException(b)
  6315. }
  6316. goog.async.run.workQueue_.returnUnused(a)
  6317. }
  6318. goog.async.run.workQueueScheduled_ = !1
  6319. }
  6320. ;
  6321. goog.promise = {};
  6322. goog.promise.Resolver = function () { }
  6323. ;
  6324. goog.Promise = function (a, b) {
  6325. this.state_ = goog.Promise.State_.PENDING;
  6326. this.result_ = void 0;
  6327. this.callbackEntriesTail_ = this.callbackEntries_ = this.parent_ = null;
  6328. this.executing_ = !1;
  6329. 0 < goog.Promise.UNHANDLED_REJECTION_DELAY ? this.unhandledRejectionId_ = 0 : 0 == goog.Promise.UNHANDLED_REJECTION_DELAY && (this.hadUnhandledRejection_ = !1);
  6330. goog.Promise.LONG_STACK_TRACES && (this.stack_ = [],
  6331. this.addStackTrace_(Error("created")),
  6332. this.currentStep_ = 0);
  6333. if (a != goog.nullFunction)
  6334. try {
  6335. var c = this;
  6336. a.call(b, function (a) {
  6337. c.resolve_(goog.Promise.State_.FULFILLED, a)
  6338. }, function (a) {
  6339. if (goog.DEBUG && !(a instanceof goog.Promise.CancellationError))
  6340. try {
  6341. if (a instanceof Error)
  6342. throw a;
  6343. throw Error("Promise rejected.");
  6344. } catch (e) { }
  6345. c.resolve_(goog.Promise.State_.REJECTED, a)
  6346. })
  6347. } catch (d) {
  6348. this.resolve_(goog.Promise.State_.REJECTED, d)
  6349. }
  6350. }
  6351. ;
  6352. goog.Promise.LONG_STACK_TRACES = !1;
  6353. goog.Promise.UNHANDLED_REJECTION_DELAY = 0;
  6354. goog.Promise.State_ = {
  6355. PENDING: 0,
  6356. BLOCKED: 1,
  6357. FULFILLED: 2,
  6358. REJECTED: 3
  6359. };
  6360. goog.Promise.CallbackEntry_ = function () {
  6361. this.next = this.context = this.onRejected = this.onFulfilled = this.child = null;
  6362. this.always = !1
  6363. }
  6364. ;
  6365. goog.Promise.CallbackEntry_.prototype.reset = function () {
  6366. this.context = this.onRejected = this.onFulfilled = this.child = null;
  6367. this.always = !1
  6368. }
  6369. ;
  6370. goog.Promise.DEFAULT_MAX_UNUSED = 100;
  6371. goog.Promise.freelist_ = new goog.async.FreeList(function () {
  6372. return new goog.Promise.CallbackEntry_
  6373. }
  6374. , function (a) {
  6375. a.reset()
  6376. }
  6377. , goog.Promise.DEFAULT_MAX_UNUSED);
  6378. goog.Promise.getCallbackEntry_ = function (a, b, c) {
  6379. var d = goog.Promise.freelist_.get();
  6380. d.onFulfilled = a;
  6381. d.onRejected = b;
  6382. d.context = c;
  6383. return d
  6384. }
  6385. ;
  6386. goog.Promise.returnEntry_ = function (a) {
  6387. goog.Promise.freelist_.put(a)
  6388. }
  6389. ;
  6390. goog.Promise.resolve = function (a) {
  6391. if (a instanceof goog.Promise)
  6392. return a;
  6393. var b = new goog.Promise(goog.nullFunction);
  6394. b.resolve_(goog.Promise.State_.FULFILLED, a);
  6395. return b
  6396. }
  6397. ;
  6398. goog.Promise.reject = function (a) {
  6399. return new goog.Promise(function (b, c) {
  6400. c(a)
  6401. }
  6402. )
  6403. }
  6404. ;
  6405. goog.Promise.resolveThen_ = function (a, b, c) {
  6406. goog.Promise.maybeThen_(a, b, c, null) || goog.async.run(goog.partial(b, a))
  6407. }
  6408. ;
  6409. goog.Promise.race = function (a) {
  6410. return new goog.Promise(function (b, c) {
  6411. a.length || b(void 0);
  6412. for (var d = 0, e; d < a.length; d++)
  6413. e = a[d],
  6414. goog.Promise.resolveThen_(e, b, c)
  6415. }
  6416. )
  6417. }
  6418. ;
  6419. goog.Promise.all = function (a) {
  6420. return new goog.Promise(function (b, c) {
  6421. var d = a.length
  6422. , e = [];
  6423. if (d)
  6424. for (var f = function (a, c) {
  6425. d--;
  6426. e[a] = c;
  6427. 0 == d && b(e)
  6428. }, g = function (a) {
  6429. c(a)
  6430. }, h = 0, k; h < a.length; h++)
  6431. k = a[h],
  6432. goog.Promise.resolveThen_(k, goog.partial(f, h), g);
  6433. else
  6434. b(e)
  6435. }
  6436. )
  6437. }
  6438. ;
  6439. goog.Promise.allSettled = function (a) {
  6440. return new goog.Promise(function (b, c) {
  6441. var d = a.length
  6442. , e = [];
  6443. if (d)
  6444. for (var f = function (a, c, f) {
  6445. d--;
  6446. e[a] = c ? {
  6447. fulfilled: !0,
  6448. value: f
  6449. } : {
  6450. fulfilled: !1,
  6451. reason: f
  6452. };
  6453. 0 == d && b(e)
  6454. }, g = 0, h; g < a.length; g++)
  6455. h = a[g],
  6456. goog.Promise.resolveThen_(h, goog.partial(f, g, !0), goog.partial(f, g, !1));
  6457. else
  6458. b(e)
  6459. }
  6460. )
  6461. }
  6462. ;
  6463. goog.Promise.firstFulfilled = function (a) {
  6464. return new goog.Promise(function (b, c) {
  6465. var d = a.length
  6466. , e = [];
  6467. if (d)
  6468. for (var f = function (a) {
  6469. b(a)
  6470. }, g = function (a, b) {
  6471. d--;
  6472. e[a] = b;
  6473. 0 == d && c(e)
  6474. }, h = 0, k; h < a.length; h++)
  6475. k = a[h],
  6476. goog.Promise.resolveThen_(k, f, goog.partial(g, h));
  6477. else
  6478. b(void 0)
  6479. }
  6480. )
  6481. }
  6482. ;
  6483. goog.Promise.withResolver = function () {
  6484. var a, b, c = new goog.Promise(function (c, e) {
  6485. a = c;
  6486. b = e
  6487. }
  6488. );
  6489. return new goog.Promise.Resolver_(c, a, b)
  6490. }
  6491. ;
  6492. goog.Promise.prototype.then = function (a, b, c) {
  6493. null != a && goog.asserts.assertFunction(a, "opt_onFulfilled should be a function.");
  6494. null != b && goog.asserts.assertFunction(b, "opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");
  6495. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("then"));
  6496. return this.addChildPromise_(goog.isFunction(a) ? a : null, goog.isFunction(b) ? b : null, c)
  6497. }
  6498. ;
  6499. goog.Thenable.addImplementation(goog.Promise);
  6500. goog.Promise.prototype.thenVoid = function (a, b, c) {
  6501. null != a && goog.asserts.assertFunction(a, "opt_onFulfilled should be a function.");
  6502. null != b && goog.asserts.assertFunction(b, "opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");
  6503. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("then"));
  6504. this.addCallbackEntry_(goog.Promise.getCallbackEntry_(a || goog.nullFunction, b || null, c))
  6505. }
  6506. ;
  6507. goog.Promise.prototype.thenAlways = function (a, b) {
  6508. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("thenAlways"));
  6509. var c = goog.Promise.getCallbackEntry_(a, a, b);
  6510. c.always = !0;
  6511. this.addCallbackEntry_(c);
  6512. return this
  6513. }
  6514. ;
  6515. goog.Promise.prototype.thenCatch = function (a, b) {
  6516. goog.Promise.LONG_STACK_TRACES && this.addStackTrace_(Error("thenCatch"));
  6517. return this.addChildPromise_(null, a, b)
  6518. }
  6519. ;
  6520. goog.Promise.prototype.cancel = function (a) {
  6521. if (this.state_ == goog.Promise.State_.PENDING) {
  6522. var b = new goog.Promise.CancellationError(a);
  6523. goog.async.run(function () {
  6524. this.cancelInternal_(b)
  6525. }, this)
  6526. }
  6527. }
  6528. ;
  6529. goog.Promise.prototype.cancelInternal_ = function (a) {
  6530. this.state_ == goog.Promise.State_.PENDING && (this.parent_ ? (this.parent_.cancelChild_(this, a),
  6531. this.parent_ = null) : this.resolve_(goog.Promise.State_.REJECTED, a))
  6532. }
  6533. ;
  6534. goog.Promise.prototype.cancelChild_ = function (a, b) {
  6535. if (this.callbackEntries_) {
  6536. for (var c = 0, d = null, e = null, f = this.callbackEntries_; f && (f.always || (c++ ,
  6537. f.child == a && (d = f),
  6538. !(d && 1 < c))); f = f.next)
  6539. d || (e = f);
  6540. d && (this.state_ == goog.Promise.State_.PENDING && 1 == c ? this.cancelInternal_(b) : (e ? this.removeEntryAfter_(e) : this.popEntry_(),
  6541. this.executeCallback_(d, goog.Promise.State_.REJECTED, b)))
  6542. }
  6543. }
  6544. ;
  6545. goog.Promise.prototype.addCallbackEntry_ = function (a) {
  6546. this.hasEntry_() || this.state_ != goog.Promise.State_.FULFILLED && this.state_ != goog.Promise.State_.REJECTED || this.scheduleCallbacks_();
  6547. this.queueEntry_(a)
  6548. }
  6549. ;
  6550. goog.Promise.prototype.addChildPromise_ = function (a, b, c) {
  6551. var d = goog.Promise.getCallbackEntry_(null, null, null);
  6552. d.child = new goog.Promise(function (e, f) {
  6553. d.onFulfilled = a ? function (b) {
  6554. try {
  6555. var d = a.call(c, b);
  6556. e(d)
  6557. } catch (k) {
  6558. f(k)
  6559. }
  6560. }
  6561. : e;
  6562. d.onRejected = b ? function (a) {
  6563. try {
  6564. var d = b.call(c, a);
  6565. void 0 === d && a instanceof goog.Promise.CancellationError ? f(a) : e(d)
  6566. } catch (k) {
  6567. f(k)
  6568. }
  6569. }
  6570. : f
  6571. }
  6572. );
  6573. d.child.parent_ = this;
  6574. this.addCallbackEntry_(d);
  6575. return d.child
  6576. }
  6577. ;
  6578. goog.Promise.prototype.unblockAndFulfill_ = function (a) {
  6579. goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED);
  6580. this.state_ = goog.Promise.State_.PENDING;
  6581. this.resolve_(goog.Promise.State_.FULFILLED, a)
  6582. }
  6583. ;
  6584. goog.Promise.prototype.unblockAndReject_ = function (a) {
  6585. goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED);
  6586. this.state_ = goog.Promise.State_.PENDING;
  6587. this.resolve_(goog.Promise.State_.REJECTED, a)
  6588. }
  6589. ;
  6590. goog.Promise.prototype.resolve_ = function (a, b) {
  6591. this.state_ == goog.Promise.State_.PENDING && (this === b && (a = goog.Promise.State_.REJECTED,
  6592. b = new TypeError("Promise cannot resolve to itself")),
  6593. this.state_ = goog.Promise.State_.BLOCKED,
  6594. goog.Promise.maybeThen_(b, this.unblockAndFulfill_, this.unblockAndReject_, this) || (this.result_ = b,
  6595. this.state_ = a,
  6596. this.parent_ = null,
  6597. this.scheduleCallbacks_(),
  6598. a != goog.Promise.State_.REJECTED || b instanceof goog.Promise.CancellationError || goog.Promise.addUnhandledRejection_(this, b)))
  6599. }
  6600. ;
  6601. goog.Promise.maybeThen_ = function (a, b, c, d) {
  6602. if (a instanceof goog.Promise)
  6603. return a.thenVoid(b, c, d),
  6604. !0;
  6605. if (goog.Thenable.isImplementedBy(a))
  6606. return a.then(b, c, d),
  6607. !0;
  6608. if (goog.isObject(a))
  6609. try {
  6610. var e = a.then;
  6611. if (goog.isFunction(e))
  6612. return goog.Promise.tryThen_(a, e, b, c, d),
  6613. !0
  6614. } catch (f) {
  6615. return c.call(d, f),
  6616. !0
  6617. }
  6618. return !1
  6619. }
  6620. ;
  6621. goog.Promise.tryThen_ = function (a, b, c, d, e) {
  6622. var f = !1
  6623. , g = function (a) {
  6624. f || (f = !0,
  6625. c.call(e, a))
  6626. }
  6627. , h = function (a) {
  6628. f || (f = !0,
  6629. d.call(e, a))
  6630. };
  6631. try {
  6632. b.call(a, g, h)
  6633. } catch (k) {
  6634. h(k)
  6635. }
  6636. }
  6637. ;
  6638. goog.Promise.prototype.scheduleCallbacks_ = function () {
  6639. this.executing_ || (this.executing_ = !0,
  6640. goog.async.run(this.executeCallbacks_, this))
  6641. }
  6642. ;
  6643. goog.Promise.prototype.hasEntry_ = function () {
  6644. return !!this.callbackEntries_
  6645. }
  6646. ;
  6647. goog.Promise.prototype.queueEntry_ = function (a) {
  6648. goog.asserts.assert(null != a.onFulfilled);
  6649. this.callbackEntriesTail_ ? this.callbackEntriesTail_.next = a : this.callbackEntries_ = a;
  6650. this.callbackEntriesTail_ = a
  6651. }
  6652. ;
  6653. goog.Promise.prototype.popEntry_ = function () {
  6654. var a = null;
  6655. this.callbackEntries_ && (a = this.callbackEntries_,
  6656. this.callbackEntries_ = a.next,
  6657. a.next = null);
  6658. this.callbackEntries_ || (this.callbackEntriesTail_ = null);
  6659. null != a && goog.asserts.assert(null != a.onFulfilled);
  6660. return a
  6661. }
  6662. ;
  6663. goog.Promise.prototype.removeEntryAfter_ = function (a) {
  6664. goog.asserts.assert(this.callbackEntries_);
  6665. goog.asserts.assert(null != a);
  6666. a.next == this.callbackEntriesTail_ && (this.callbackEntriesTail_ = a);
  6667. a.next = a.next.next
  6668. }
  6669. ;
  6670. goog.Promise.prototype.executeCallbacks_ = function () {
  6671. for (var a; a = this.popEntry_();)
  6672. goog.Promise.LONG_STACK_TRACES && this.currentStep_++ ,
  6673. this.executeCallback_(a, this.state_, this.result_);
  6674. this.executing_ = !1
  6675. }
  6676. ;
  6677. goog.Promise.prototype.executeCallback_ = function (a, b, c) {
  6678. b == goog.Promise.State_.REJECTED && a.onRejected && !a.always && this.removeUnhandledRejection_();
  6679. if (a.child)
  6680. a.child.parent_ = null,
  6681. goog.Promise.invokeCallback_(a, b, c);
  6682. else
  6683. try {
  6684. a.always ? a.onFulfilled.call(a.context) : goog.Promise.invokeCallback_(a, b, c)
  6685. } catch (d) {
  6686. goog.Promise.handleRejection_.call(null, d)
  6687. }
  6688. goog.Promise.returnEntry_(a)
  6689. }
  6690. ;
  6691. goog.Promise.invokeCallback_ = function (a, b, c) {
  6692. b == goog.Promise.State_.FULFILLED ? a.onFulfilled.call(a.context, c) : a.onRejected && a.onRejected.call(a.context, c)
  6693. }
  6694. ;
  6695. goog.Promise.prototype.addStackTrace_ = function (a) {
  6696. if (goog.Promise.LONG_STACK_TRACES && "string" === typeof a.stack) {
  6697. var b = a.stack.split("\n", 4)[3];
  6698. a = a.message;
  6699. a += Array(11 - a.length).join(" ");
  6700. this.stack_.push(a + b)
  6701. }
  6702. }
  6703. ;
  6704. goog.Promise.prototype.appendLongStack_ = function (a) {
  6705. if (goog.Promise.LONG_STACK_TRACES && a && "string" === typeof a.stack && this.stack_.length) {
  6706. for (var b = ["Promise trace:"], c = this; c; c = c.parent_) {
  6707. for (var d = this.currentStep_; 0 <= d; d--)
  6708. b.push(c.stack_[d]);
  6709. b.push("Value: [" + (c.state_ == goog.Promise.State_.REJECTED ? "REJECTED" : "FULFILLED") + "] <" + String(c.result_) + ">")
  6710. }
  6711. a.stack += "\n\n" + b.join("\n")
  6712. }
  6713. }
  6714. ;
  6715. goog.Promise.prototype.removeUnhandledRejection_ = function () {
  6716. if (0 < goog.Promise.UNHANDLED_REJECTION_DELAY)
  6717. for (var a = this; a && a.unhandledRejectionId_; a = a.parent_)
  6718. goog.global.clearTimeout(a.unhandledRejectionId_),
  6719. a.unhandledRejectionId_ = 0;
  6720. else if (0 == goog.Promise.UNHANDLED_REJECTION_DELAY)
  6721. for (a = this; a && a.hadUnhandledRejection_; a = a.parent_)
  6722. a.hadUnhandledRejection_ = !1
  6723. }
  6724. ;
  6725. goog.Promise.addUnhandledRejection_ = function (a, b) {
  6726. 0 < goog.Promise.UNHANDLED_REJECTION_DELAY ? a.unhandledRejectionId_ = goog.global.setTimeout(function () {
  6727. a.appendLongStack_(b);
  6728. goog.Promise.handleRejection_.call(null, b)
  6729. }, goog.Promise.UNHANDLED_REJECTION_DELAY) : 0 == goog.Promise.UNHANDLED_REJECTION_DELAY && (a.hadUnhandledRejection_ = !0,
  6730. goog.async.run(function () {
  6731. a.hadUnhandledRejection_ && (a.appendLongStack_(b),
  6732. goog.Promise.handleRejection_.call(null, b))
  6733. }))
  6734. }
  6735. ;
  6736. goog.Promise.handleRejection_ = goog.async.throwException;
  6737. goog.Promise.setUnhandledRejectionHandler = function (a) {
  6738. goog.Promise.handleRejection_ = a
  6739. }
  6740. ;
  6741. goog.Promise.CancellationError = function (a) {
  6742. goog.debug.Error.call(this, a)
  6743. }
  6744. ;
  6745. goog.inherits(goog.Promise.CancellationError, goog.debug.Error);
  6746. goog.Promise.CancellationError.prototype.name = "cancel";
  6747. goog.Promise.Resolver_ = function (a, b, c) {
  6748. this.promise = a;
  6749. this.resolve = b;
  6750. this.reject = c
  6751. }
  6752. ;
  6753. goog.disposable = {};
  6754. goog.disposable.IDisposable = function () { }
  6755. ;
  6756. goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod;
  6757. goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod;
  6758. goog.Disposable = function () {
  6759. goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF && (goog.Disposable.INCLUDE_STACK_ON_CREATION && (this.creationStack = Error().stack),
  6760. goog.Disposable.instances_[goog.getUid(this)] = this);
  6761. this.disposed_ = this.disposed_;
  6762. this.onDisposeCallbacks_ = this.onDisposeCallbacks_
  6763. }
  6764. ;
  6765. goog.Disposable.MonitoringMode = {
  6766. OFF: 0,
  6767. PERMANENT: 1,
  6768. INTERACTIVE: 2
  6769. };
  6770. goog.Disposable.MONITORING_MODE = 0;
  6771. goog.Disposable.INCLUDE_STACK_ON_CREATION = !0;
  6772. goog.Disposable.instances_ = {};
  6773. goog.Disposable.getUndisposedObjects = function () {
  6774. var a = [], b;
  6775. for (b in goog.Disposable.instances_)
  6776. goog.Disposable.instances_.hasOwnProperty(b) && a.push(goog.Disposable.instances_[Number(b)]);
  6777. return a
  6778. }
  6779. ;
  6780. goog.Disposable.clearUndisposedObjects = function () {
  6781. goog.Disposable.instances_ = {}
  6782. }
  6783. ;
  6784. goog.Disposable.prototype.disposed_ = !1;
  6785. goog.Disposable.prototype.isDisposed = function () {
  6786. return this.disposed_
  6787. }
  6788. ;
  6789. goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed;
  6790. goog.Disposable.prototype.dispose = function () {
  6791. if (!this.disposed_ && (this.disposed_ = !0,
  6792. this.disposeInternal(),
  6793. goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF)) {
  6794. var a = goog.getUid(this);
  6795. if (goog.Disposable.MONITORING_MODE == goog.Disposable.MonitoringMode.PERMANENT && !goog.Disposable.instances_.hasOwnProperty(a))
  6796. throw Error(this + " did not call the goog.Disposable base constructor or was disposed of after a clearUndisposedObjects call");
  6797. if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF && this.onDisposeCallbacks_ && 0 < this.onDisposeCallbacks_.length)
  6798. throw Error(this + " did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");
  6799. delete goog.Disposable.instances_[a]
  6800. }
  6801. }
  6802. ;
  6803. goog.Disposable.prototype.registerDisposable = function (a) {
  6804. this.addOnDisposeCallback(goog.partial(goog.dispose, a))
  6805. }
  6806. ;
  6807. goog.Disposable.prototype.addOnDisposeCallback = function (a, b) {
  6808. this.disposed_ ? void 0 !== b ? a.call(b) : a() : (this.onDisposeCallbacks_ || (this.onDisposeCallbacks_ = []),
  6809. this.onDisposeCallbacks_.push(void 0 !== b ? goog.bind(a, b) : a))
  6810. }
  6811. ;
  6812. goog.Disposable.prototype.disposeInternal = function () {
  6813. if (this.onDisposeCallbacks_)
  6814. for (; this.onDisposeCallbacks_.length;)
  6815. this.onDisposeCallbacks_.shift()()
  6816. }
  6817. ;
  6818. goog.Disposable.isDisposed = function (a) {
  6819. return a && "function" == typeof a.isDisposed ? a.isDisposed() : !1
  6820. }
  6821. ;
  6822. goog.dispose = function (a) {
  6823. a && "function" == typeof a.dispose && a.dispose()
  6824. }
  6825. ;
  6826. goog.disposeAll = function (a) {
  6827. for (var b = 0, c = arguments.length; b < c; ++b) {
  6828. var d = arguments[b];
  6829. goog.isArrayLike(d) ? goog.disposeAll.apply(null, d) : goog.dispose(d)
  6830. }
  6831. }
  6832. ;
  6833. goog.debug.errorcontext = {};
  6834. goog.debug.errorcontext.addErrorContext = function (a, b, c) {
  6835. a[goog.debug.errorcontext.CONTEXT_KEY_] || (a[goog.debug.errorcontext.CONTEXT_KEY_] = {});
  6836. a[goog.debug.errorcontext.CONTEXT_KEY_][b] = c
  6837. }
  6838. ;
  6839. goog.debug.errorcontext.getErrorContext = function (a) {
  6840. return a[goog.debug.errorcontext.CONTEXT_KEY_] || {}
  6841. }
  6842. ;
  6843. goog.debug.errorcontext.CONTEXT_KEY_ = "__closure__error__context__984382";
  6844. goog.debug.LOGGING_ENABLED = goog.DEBUG;
  6845. goog.debug.FORCE_SLOPPY_STACKS = !1;
  6846. goog.debug.catchErrors = function (a, b, c) {
  6847. c = c || goog.global;
  6848. var d = c.onerror
  6849. , e = !!b;
  6850. goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("535.3") && (e = !e);
  6851. c.onerror = function (b, c, h, k, m) {
  6852. d && d(b, c, h, k, m);
  6853. a({
  6854. message: b,
  6855. fileName: c,
  6856. line: h,
  6857. lineNumber: h,
  6858. col: k,
  6859. error: m
  6860. });
  6861. return e
  6862. }
  6863. }
  6864. ;
  6865. goog.debug.expose = function (a, b) {
  6866. if ("undefined" == typeof a)
  6867. return "undefined";
  6868. if (null == a)
  6869. return "NULL";
  6870. var c = [], d;
  6871. for (d in a)
  6872. if (b || !goog.isFunction(a[d])) {
  6873. var e = d + " = ";
  6874. try {
  6875. e += a[d]
  6876. } catch (f) {
  6877. e += "*** " + f + " ***"
  6878. }
  6879. c.push(e)
  6880. }
  6881. return c.join("\n")
  6882. }
  6883. ;
  6884. goog.debug.deepExpose = function (a, b) {
  6885. var c = []
  6886. , d = []
  6887. , e = {}
  6888. , f = function (a, g) {
  6889. var h = g + " ";
  6890. try {
  6891. if (void 0 === a)
  6892. c.push("undefined");
  6893. else if (null === a)
  6894. c.push("NULL");
  6895. else if ("string" === typeof a)
  6896. c.push('"' + a.replace(/\n/g, "\n" + g) + '"');
  6897. else if (goog.isFunction(a))
  6898. c.push(String(a).replace(/\n/g, "\n" + g));
  6899. else if (goog.isObject(a)) {
  6900. goog.hasUid(a) || d.push(a);
  6901. var k = goog.getUid(a);
  6902. if (e[k])
  6903. c.push("*** reference loop detected (id=" + k + ") ***");
  6904. else {
  6905. e[k] = !0;
  6906. c.push("{");
  6907. for (var l in a)
  6908. if (b || !goog.isFunction(a[l]))
  6909. c.push("\n"),
  6910. c.push(h),
  6911. c.push(l + " = "),
  6912. f(a[l], h);
  6913. c.push("\n" + g + "}");
  6914. delete e[k]
  6915. }
  6916. } else
  6917. c.push(a)
  6918. } catch (n) {
  6919. c.push("*** " + n + " ***")
  6920. }
  6921. };
  6922. f(a, "");
  6923. for (var g = 0; g < d.length; g++)
  6924. goog.removeUid(d[g]);
  6925. return c.join("")
  6926. }
  6927. ;
  6928. goog.debug.exposeArray = function (a) {
  6929. for (var b = [], c = 0; c < a.length; c++)
  6930. goog.isArray(a[c]) ? b.push(goog.debug.exposeArray(a[c])) : b.push(a[c]);
  6931. return "[ " + b.join(", ") + " ]"
  6932. }
  6933. ;
  6934. goog.debug.normalizeErrorObject = function (a) {
  6935. var b = goog.getObjectByName("window.location.href");
  6936. null == a && (a = 'Unknown Error of type "null/undefined"');
  6937. if ("string" === typeof a)
  6938. return {
  6939. message: a,
  6940. name: "Unknown error",
  6941. lineNumber: "Not available",
  6942. fileName: b,
  6943. stack: "Not available"
  6944. };
  6945. var c = !1;
  6946. try {
  6947. var d = a.lineNumber || a.line || "Not available"
  6948. } catch (f) {
  6949. d = "Not available",
  6950. c = !0
  6951. }
  6952. try {
  6953. var e = a.fileName || a.filename || a.sourceURL || goog.global.$googDebugFname || b
  6954. } catch (f) {
  6955. e = "Not available",
  6956. c = !0
  6957. }
  6958. return !c && a.lineNumber && a.fileName && a.stack && a.message && a.name ? a : (b = a.message,
  6959. null == b && (b = a.constructor && a.constructor instanceof Function ? 'Unknown Error of type "' + (a.constructor.name ? a.constructor.name : goog.debug.getFunctionName(a.constructor)) + '"' : "Unknown Error of unknown type"),
  6960. {
  6961. message: b,
  6962. name: a.name || "UnknownError",
  6963. lineNumber: d,
  6964. fileName: e,
  6965. stack: a.stack || "Not available"
  6966. })
  6967. }
  6968. ;
  6969. goog.debug.enhanceError = function (a, b) {
  6970. if (a instanceof Error)
  6971. var c = a;
  6972. else
  6973. c = Error(a),
  6974. Error.captureStackTrace && Error.captureStackTrace(c, goog.debug.enhanceError);
  6975. c.stack || (c.stack = goog.debug.getStacktrace(goog.debug.enhanceError));
  6976. if (b) {
  6977. for (var d = 0; c["message" + d];)
  6978. ++d;
  6979. c["message" + d] = String(b)
  6980. }
  6981. return c
  6982. }
  6983. ;
  6984. goog.debug.enhanceErrorWithContext = function (a, b) {
  6985. var c = goog.debug.enhanceError(a);
  6986. if (b)
  6987. for (var d in b)
  6988. goog.debug.errorcontext.addErrorContext(c, d, b[d]);
  6989. return c
  6990. }
  6991. ;
  6992. goog.debug.getStacktraceSimple = function (a) {
  6993. if (!goog.debug.FORCE_SLOPPY_STACKS) {
  6994. var b = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);
  6995. if (b)
  6996. return b
  6997. }
  6998. b = [];
  6999. for (var c = arguments.callee.caller, d = 0; c && (!a || d < a);) {
  7000. b.push(goog.debug.getFunctionName(c));
  7001. b.push("()\n");
  7002. try {
  7003. c = c.caller
  7004. } catch (e) {
  7005. b.push("[exception trying to get caller]\n");
  7006. break
  7007. }
  7008. d++;
  7009. if (d >= goog.debug.MAX_STACK_DEPTH) {
  7010. b.push("[...long stack...]");
  7011. break
  7012. }
  7013. }
  7014. a && d >= a ? b.push("[...reached max depth limit...]") : b.push("[end]");
  7015. return b.join("")
  7016. }
  7017. ;
  7018. goog.debug.MAX_STACK_DEPTH = 50;
  7019. goog.debug.getNativeStackTrace_ = function (a) {
  7020. var b = Error();
  7021. if (Error.captureStackTrace)
  7022. return Error.captureStackTrace(b, a),
  7023. String(b.stack);
  7024. try {
  7025. throw b;
  7026. } catch (c) {
  7027. b = c
  7028. }
  7029. return (a = b.stack) ? String(a) : null
  7030. }
  7031. ;
  7032. goog.debug.getStacktrace = function (a) {
  7033. var b;
  7034. goog.debug.FORCE_SLOPPY_STACKS || (b = goog.debug.getNativeStackTrace_(a || goog.debug.getStacktrace));
  7035. b || (b = goog.debug.getStacktraceHelper_(a || arguments.callee.caller, []));
  7036. return b
  7037. }
  7038. ;
  7039. goog.debug.getStacktraceHelper_ = function (a, b) {
  7040. var c = [];
  7041. if (goog.array.contains(b, a))
  7042. c.push("[...circular reference...]");
  7043. else if (a && b.length < goog.debug.MAX_STACK_DEPTH) {
  7044. c.push(goog.debug.getFunctionName(a) + "(");
  7045. for (var d = a.arguments, e = 0; d && e < d.length; e++) {
  7046. 0 < e && c.push(", ");
  7047. var f = d[e];
  7048. switch (typeof f) {
  7049. case "object":
  7050. f = f ? "object" : "null";
  7051. break;
  7052. case "string":
  7053. break;
  7054. case "number":
  7055. f = String(f);
  7056. break;
  7057. case "boolean":
  7058. f = f ? "true" : "false";
  7059. break;
  7060. case "function":
  7061. f = (f = goog.debug.getFunctionName(f)) ? f : "[fn]";
  7062. break;
  7063. default:
  7064. f = typeof f
  7065. }
  7066. 40 < f.length && (f = f.substr(0, 40) + "...");
  7067. c.push(f)
  7068. }
  7069. b.push(a);
  7070. c.push(")\n");
  7071. try {
  7072. c.push(goog.debug.getStacktraceHelper_(a.caller, b))
  7073. } catch (g) {
  7074. c.push("[exception trying to get caller]\n")
  7075. }
  7076. } else
  7077. a ? c.push("[...long stack...]") : c.push("[end]");
  7078. return c.join("")
  7079. }
  7080. ;
  7081. goog.debug.getFunctionName = function (a) {
  7082. if (goog.debug.fnNameCache_[a])
  7083. return goog.debug.fnNameCache_[a];
  7084. a = String(a);
  7085. if (!goog.debug.fnNameCache_[a]) {
  7086. var b = /function\s+([^\(]+)/m.exec(a);
  7087. goog.debug.fnNameCache_[a] = b ? b[1] : "[Anonymous]"
  7088. }
  7089. return goog.debug.fnNameCache_[a]
  7090. }
  7091. ;
  7092. goog.debug.makeWhitespaceVisible = function (a) {
  7093. return a.replace(/ /g, "[_]").replace(/\f/g, "[f]").replace(/\n/g, "[n]\n").replace(/\r/g, "[r]").replace(/\t/g, "[t]")
  7094. }
  7095. ;
  7096. goog.debug.runtimeType = function (a) {
  7097. return a instanceof Function ? a.displayName || a.name || "unknown type name" : a instanceof Object ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : null === a ? "null" : typeof a
  7098. }
  7099. ;
  7100. goog.debug.fnNameCache_ = {};
  7101. goog.debug.freezeInternal_ = goog.DEBUG && Object.freeze || function (a) {
  7102. return a
  7103. }
  7104. ;
  7105. goog.debug.freeze = function (a) {
  7106. return goog.debug.freezeInternal_(a)
  7107. }
  7108. ;
  7109. goog.events = {};
  7110. $jscomp.scope.purify = function (a) {
  7111. return {
  7112. valueOf: a
  7113. }.valueOf()
  7114. }
  7115. ;
  7116. goog.events.BrowserFeature = {
  7117. HAS_W3C_BUTTON: !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9),
  7118. HAS_W3C_EVENT_SUPPORT: !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9),
  7119. SET_KEY_CODE_TO_PREVENT_DEFAULT: goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"),
  7120. HAS_NAVIGATOR_ONLINE_PROPERTY: !goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher("528"),
  7121. HAS_HTML5_NETWORK_EVENT_SUPPORT: goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9b") || goog.userAgent.IE && goog.userAgent.isVersionOrHigher("8") || goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher("9.5") || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("528"),
  7122. HTML5_NETWORK_EVENTS_FIRE_ON_BODY: goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher("8") || goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"),
  7123. TOUCH_ENABLED: "ontouchstart" in goog.global || !!(goog.global.document && document.documentElement && "ontouchstart" in document.documentElement) || !(!goog.global.navigator || !goog.global.navigator.maxTouchPoints && !goog.global.navigator.msMaxTouchPoints),
  7124. POINTER_EVENTS: "PointerEvent" in goog.global,
  7125. MSPOINTER_EVENTS: "MSPointerEvent" in goog.global && !(!goog.global.navigator || !goog.global.navigator.msPointerEnabled),
  7126. PASSIVE_EVENTS: (0,
  7127. $jscomp.scope.purify)(function () {
  7128. if (!goog.global.addEventListener || !Object.defineProperty)
  7129. return !1;
  7130. var a = !1
  7131. , b = Object.defineProperty({}, "passive", {
  7132. get: function () {
  7133. a = !0
  7134. }
  7135. });
  7136. try {
  7137. goog.global.addEventListener("test", goog.nullFunction, b),
  7138. goog.global.removeEventListener("test", goog.nullFunction, b)
  7139. } catch (c) { }
  7140. return a
  7141. })
  7142. };
  7143. goog.events.EventId = function (a) {
  7144. this.id = a
  7145. }
  7146. ;
  7147. goog.events.EventId.prototype.toString = function () {
  7148. return this.id
  7149. }
  7150. ;
  7151. goog.events.Event = function (a, b) {
  7152. this.type = a instanceof goog.events.EventId ? String(a) : a;
  7153. this.currentTarget = this.target = b;
  7154. this.defaultPrevented = this.propagationStopped_ = !1;
  7155. this.returnValue_ = !0
  7156. }
  7157. ;
  7158. goog.events.Event.prototype.stopPropagation = function () {
  7159. this.propagationStopped_ = !0
  7160. }
  7161. ;
  7162. goog.events.Event.prototype.preventDefault = function () {
  7163. this.defaultPrevented = !0;
  7164. this.returnValue_ = !1
  7165. }
  7166. ;
  7167. goog.events.Event.stopPropagation = function (a) {
  7168. a.stopPropagation()
  7169. }
  7170. ;
  7171. goog.events.Event.preventDefault = function (a) {
  7172. a.preventDefault()
  7173. }
  7174. ;
  7175. goog.events.getVendorPrefixedName_ = function (a) {
  7176. return goog.userAgent.WEBKIT ? "webkit" + a : goog.userAgent.OPERA ? "o" + a.toLowerCase() : a.toLowerCase()
  7177. }
  7178. ;
  7179. goog.events.EventType = {
  7180. CLICK: "click",
  7181. RIGHTCLICK: "rightclick",
  7182. DBLCLICK: "dblclick",
  7183. AUXCLICK: "auxclick",
  7184. MOUSEDOWN: "mousedown",
  7185. MOUSEUP: "mouseup",
  7186. MOUSEOVER: "mouseover",
  7187. MOUSEOUT: "mouseout",
  7188. MOUSEMOVE: "mousemove",
  7189. MOUSEENTER: "mouseenter",
  7190. MOUSELEAVE: "mouseleave",
  7191. MOUSECANCEL: "mousecancel",
  7192. SELECTIONCHANGE: "selectionchange",
  7193. SELECTSTART: "selectstart",
  7194. WHEEL: "wheel",
  7195. KEYPRESS: "keypress",
  7196. KEYDOWN: "keydown",
  7197. KEYUP: "keyup",
  7198. BLUR: "blur",
  7199. FOCUS: "focus",
  7200. DEACTIVATE: "deactivate",
  7201. FOCUSIN: "focusin",
  7202. FOCUSOUT: "focusout",
  7203. CHANGE: "change",
  7204. RESET: "reset",
  7205. SELECT: "select",
  7206. SUBMIT: "submit",
  7207. INPUT: "input",
  7208. PROPERTYCHANGE: "propertychange",
  7209. DRAGSTART: "dragstart",
  7210. DRAG: "drag",
  7211. DRAGENTER: "dragenter",
  7212. DRAGOVER: "dragover",
  7213. DRAGLEAVE: "dragleave",
  7214. DROP: "drop",
  7215. DRAGEND: "dragend",
  7216. TOUCHSTART: "touchstart",
  7217. TOUCHMOVE: "touchmove",
  7218. TOUCHEND: "touchend",
  7219. TOUCHCANCEL: "touchcancel",
  7220. BEFOREUNLOAD: "beforeunload",
  7221. CONSOLEMESSAGE: "consolemessage",
  7222. CONTEXTMENU: "contextmenu",
  7223. DEVICECHANGE: "devicechange",
  7224. DEVICEMOTION: "devicemotion",
  7225. DEVICEORIENTATION: "deviceorientation",
  7226. DOMCONTENTLOADED: "DOMContentLoaded",
  7227. ERROR: "error",
  7228. HELP: "help",
  7229. LOAD: "load",
  7230. LOSECAPTURE: "losecapture",
  7231. ORIENTATIONCHANGE: "orientationchange",
  7232. READYSTATECHANGE: "readystatechange",
  7233. RESIZE: "resize",
  7234. SCROLL: "scroll",
  7235. UNLOAD: "unload",
  7236. CANPLAY: "canplay",
  7237. CANPLAYTHROUGH: "canplaythrough",
  7238. DURATIONCHANGE: "durationchange",
  7239. EMPTIED: "emptied",
  7240. ENDED: "ended",
  7241. LOADEDDATA: "loadeddata",
  7242. LOADEDMETADATA: "loadedmetadata",
  7243. PAUSE: "pause",
  7244. PLAY: "play",
  7245. PLAYING: "playing",
  7246. PROGRESS: "progress",
  7247. RATECHANGE: "ratechange",
  7248. SEEKED: "seeked",
  7249. SEEKING: "seeking",
  7250. STALLED: "stalled",
  7251. SUSPEND: "suspend",
  7252. TIMEUPDATE: "timeupdate",
  7253. VOLUMECHANGE: "volumechange",
  7254. WAITING: "waiting",
  7255. SOURCEOPEN: "sourceopen",
  7256. SOURCEENDED: "sourceended",
  7257. SOURCECLOSED: "sourceclosed",
  7258. ABORT: "abort",
  7259. UPDATE: "update",
  7260. UPDATESTART: "updatestart",
  7261. UPDATEEND: "updateend",
  7262. HASHCHANGE: "hashchange",
  7263. PAGEHIDE: "pagehide",
  7264. PAGESHOW: "pageshow",
  7265. POPSTATE: "popstate",
  7266. COPY: "copy",
  7267. PASTE: "paste",
  7268. CUT: "cut",
  7269. BEFORECOPY: "beforecopy",
  7270. BEFORECUT: "beforecut",
  7271. BEFOREPASTE: "beforepaste",
  7272. ONLINE: "online",
  7273. OFFLINE: "offline",
  7274. MESSAGE: "message",
  7275. CONNECT: "connect",
  7276. INSTALL: "install",
  7277. ACTIVATE: "activate",
  7278. FETCH: "fetch",
  7279. FOREIGNFETCH: "foreignfetch",
  7280. MESSAGEERROR: "messageerror",
  7281. STATECHANGE: "statechange",
  7282. UPDATEFOUND: "updatefound",
  7283. CONTROLLERCHANGE: "controllerchange",
  7284. ANIMATIONSTART: goog.events.getVendorPrefixedName_("AnimationStart"),
  7285. ANIMATIONEND: goog.events.getVendorPrefixedName_("AnimationEnd"),
  7286. ANIMATIONITERATION: goog.events.getVendorPrefixedName_("AnimationIteration"),
  7287. TRANSITIONEND: goog.events.getVendorPrefixedName_("TransitionEnd"),
  7288. POINTERDOWN: "pointerdown",
  7289. POINTERUP: "pointerup",
  7290. POINTERCANCEL: "pointercancel",
  7291. POINTERMOVE: "pointermove",
  7292. POINTEROVER: "pointerover",
  7293. POINTEROUT: "pointerout",
  7294. POINTERENTER: "pointerenter",
  7295. POINTERLEAVE: "pointerleave",
  7296. GOTPOINTERCAPTURE: "gotpointercapture",
  7297. LOSTPOINTERCAPTURE: "lostpointercapture",
  7298. MSGESTURECHANGE: "MSGestureChange",
  7299. MSGESTUREEND: "MSGestureEnd",
  7300. MSGESTUREHOLD: "MSGestureHold",
  7301. MSGESTURESTART: "MSGestureStart",
  7302. MSGESTURETAP: "MSGestureTap",
  7303. MSGOTPOINTERCAPTURE: "MSGotPointerCapture",
  7304. MSINERTIASTART: "MSInertiaStart",
  7305. MSLOSTPOINTERCAPTURE: "MSLostPointerCapture",
  7306. MSPOINTERCANCEL: "MSPointerCancel",
  7307. MSPOINTERDOWN: "MSPointerDown",
  7308. MSPOINTERENTER: "MSPointerEnter",
  7309. MSPOINTERHOVER: "MSPointerHover",
  7310. MSPOINTERLEAVE: "MSPointerLeave",
  7311. MSPOINTERMOVE: "MSPointerMove",
  7312. MSPOINTEROUT: "MSPointerOut",
  7313. MSPOINTEROVER: "MSPointerOver",
  7314. MSPOINTERUP: "MSPointerUp",
  7315. TEXT: "text",
  7316. TEXTINPUT: goog.userAgent.IE ? "textinput" : "textInput",
  7317. COMPOSITIONSTART: "compositionstart",
  7318. COMPOSITIONUPDATE: "compositionupdate",
  7319. COMPOSITIONEND: "compositionend",
  7320. BEFOREINPUT: "beforeinput",
  7321. EXIT: "exit",
  7322. LOADABORT: "loadabort",
  7323. LOADCOMMIT: "loadcommit",
  7324. LOADREDIRECT: "loadredirect",
  7325. LOADSTART: "loadstart",
  7326. LOADSTOP: "loadstop",
  7327. RESPONSIVE: "responsive",
  7328. SIZECHANGED: "sizechanged",
  7329. UNRESPONSIVE: "unresponsive",
  7330. VISIBILITYCHANGE: "visibilitychange",
  7331. STORAGE: "storage",
  7332. DOMSUBTREEMODIFIED: "DOMSubtreeModified",
  7333. DOMNODEINSERTED: "DOMNodeInserted",
  7334. DOMNODEREMOVED: "DOMNodeRemoved",
  7335. DOMNODEREMOVEDFROMDOCUMENT: "DOMNodeRemovedFromDocument",
  7336. DOMNODEINSERTEDINTODOCUMENT: "DOMNodeInsertedIntoDocument",
  7337. DOMATTRMODIFIED: "DOMAttrModified",
  7338. DOMCHARACTERDATAMODIFIED: "DOMCharacterDataModified",
  7339. BEFOREPRINT: "beforeprint",
  7340. AFTERPRINT: "afterprint",
  7341. BEFOREINSTALLPROMPT: "beforeinstallprompt",
  7342. APPINSTALLED: "appinstalled"
  7343. };
  7344. goog.events.getPointerFallbackEventName_ = function (a, b, c) {
  7345. return goog.events.BrowserFeature.POINTER_EVENTS ? a : goog.events.BrowserFeature.MSPOINTER_EVENTS ? b : c
  7346. }
  7347. ;
  7348. goog.events.PointerFallbackEventType = {
  7349. POINTERDOWN: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERDOWN, goog.events.EventType.MSPOINTERDOWN, goog.events.EventType.MOUSEDOWN),
  7350. POINTERUP: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERUP, goog.events.EventType.MSPOINTERUP, goog.events.EventType.MOUSEUP),
  7351. POINTERCANCEL: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERCANCEL, goog.events.EventType.MSPOINTERCANCEL, goog.events.EventType.MOUSECANCEL),
  7352. POINTERMOVE: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERMOVE, goog.events.EventType.MSPOINTERMOVE, goog.events.EventType.MOUSEMOVE),
  7353. POINTEROVER: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTEROVER, goog.events.EventType.MSPOINTEROVER, goog.events.EventType.MOUSEOVER),
  7354. POINTEROUT: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTEROUT, goog.events.EventType.MSPOINTEROUT, goog.events.EventType.MOUSEOUT),
  7355. POINTERENTER: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERENTER, goog.events.EventType.MSPOINTERENTER, goog.events.EventType.MOUSEENTER),
  7356. POINTERLEAVE: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERLEAVE, goog.events.EventType.MSPOINTERLEAVE, goog.events.EventType.MOUSELEAVE)
  7357. };
  7358. goog.events.PointerTouchFallbackEventType = {
  7359. POINTERDOWN: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERDOWN, goog.events.EventType.MSPOINTERDOWN, goog.events.EventType.TOUCHSTART),
  7360. POINTERUP: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERUP, goog.events.EventType.MSPOINTERUP, goog.events.EventType.TOUCHEND),
  7361. POINTERCANCEL: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERCANCEL, goog.events.EventType.MSPOINTERCANCEL, goog.events.EventType.TOUCHCANCEL),
  7362. POINTERMOVE: goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERMOVE, goog.events.EventType.MSPOINTERMOVE, goog.events.EventType.TOUCHMOVE)
  7363. };
  7364. goog.events.PointerAsMouseEventType = {
  7365. MOUSEDOWN: goog.events.PointerFallbackEventType.POINTERDOWN,
  7366. MOUSEUP: goog.events.PointerFallbackEventType.POINTERUP,
  7367. MOUSECANCEL: goog.events.PointerFallbackEventType.POINTERCANCEL,
  7368. MOUSEMOVE: goog.events.PointerFallbackEventType.POINTERMOVE,
  7369. MOUSEOVER: goog.events.PointerFallbackEventType.POINTEROVER,
  7370. MOUSEOUT: goog.events.PointerFallbackEventType.POINTEROUT,
  7371. MOUSEENTER: goog.events.PointerFallbackEventType.POINTERENTER,
  7372. MOUSELEAVE: goog.events.PointerFallbackEventType.POINTERLEAVE
  7373. };
  7374. goog.events.MouseAsMouseEventType = {
  7375. MOUSEDOWN: goog.events.EventType.MOUSEDOWN,
  7376. MOUSEUP: goog.events.EventType.MOUSEUP,
  7377. MOUSECANCEL: goog.events.EventType.MOUSECANCEL,
  7378. MOUSEMOVE: goog.events.EventType.MOUSEMOVE,
  7379. MOUSEOVER: goog.events.EventType.MOUSEOVER,
  7380. MOUSEOUT: goog.events.EventType.MOUSEOUT,
  7381. MOUSEENTER: goog.events.EventType.MOUSEENTER,
  7382. MOUSELEAVE: goog.events.EventType.MOUSELEAVE
  7383. };
  7384. goog.events.PointerAsTouchEventType = {
  7385. TOUCHCANCEL: goog.events.PointerTouchFallbackEventType.POINTERCANCEL,
  7386. TOUCHEND: goog.events.PointerTouchFallbackEventType.POINTERUP,
  7387. TOUCHMOVE: goog.events.PointerTouchFallbackEventType.POINTERMOVE,
  7388. TOUCHSTART: goog.events.PointerTouchFallbackEventType.POINTERDOWN
  7389. };
  7390. goog.events.USE_LAYER_XY_AS_OFFSET_XY = !1;
  7391. goog.events.BrowserEvent = function (a, b) {
  7392. goog.events.Event.call(this, a ? a.type : "");
  7393. this.relatedTarget = this.currentTarget = this.target = null;
  7394. this.button = this.screenY = this.screenX = this.clientY = this.clientX = this.offsetY = this.offsetX = 0;
  7395. this.key = "";
  7396. this.charCode = this.keyCode = 0;
  7397. this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1;
  7398. this.state = null;
  7399. this.platformModifierKey = !1;
  7400. this.pointerId = 0;
  7401. this.pointerType = "";
  7402. this.event_ = null;
  7403. a && this.init(a, b)
  7404. }
  7405. ;
  7406. goog.inherits(goog.events.BrowserEvent, goog.events.Event);
  7407. goog.events.BrowserEvent.MouseButton = {
  7408. LEFT: 0,
  7409. MIDDLE: 1,
  7410. RIGHT: 2
  7411. };
  7412. goog.events.BrowserEvent.PointerType = {
  7413. MOUSE: "mouse",
  7414. PEN: "pen",
  7415. TOUCH: "touch"
  7416. };
  7417. goog.events.BrowserEvent.IEButtonMap = goog.debug.freeze([1, 4, 2]);
  7418. goog.events.BrowserEvent.IE_BUTTON_MAP = goog.events.BrowserEvent.IEButtonMap;
  7419. goog.events.BrowserEvent.IE_POINTER_TYPE_MAP = goog.debug.freeze({
  7420. 2: goog.events.BrowserEvent.PointerType.TOUCH,
  7421. 3: goog.events.BrowserEvent.PointerType.PEN,
  7422. 4: goog.events.BrowserEvent.PointerType.MOUSE
  7423. });
  7424. goog.events.BrowserEvent.prototype.init = function (a, b) {
  7425. var c = this.type = a.type
  7426. , d = a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : null;
  7427. this.target = a.target || a.srcElement;
  7428. this.currentTarget = b;
  7429. var e = a.relatedTarget;
  7430. e ? goog.userAgent.GECKO && (goog.reflect.canAccessProperty(e, "nodeName") || (e = null)) : c == goog.events.EventType.MOUSEOVER ? e = a.fromElement : c == goog.events.EventType.MOUSEOUT && (e = a.toElement);
  7431. this.relatedTarget = e;
  7432. d ? (this.clientX = void 0 !== d.clientX ? d.clientX : d.pageX,
  7433. this.clientY = void 0 !== d.clientY ? d.clientY : d.pageY,
  7434. this.screenX = d.screenX || 0,
  7435. this.screenY = d.screenY || 0) : (goog.events.USE_LAYER_XY_AS_OFFSET_XY ? (this.offsetX = void 0 !== a.layerX ? a.layerX : a.offsetX,
  7436. this.offsetY = void 0 !== a.layerY ? a.layerY : a.offsetY) : (this.offsetX = goog.userAgent.WEBKIT || void 0 !== a.offsetX ? a.offsetX : a.layerX,
  7437. this.offsetY = goog.userAgent.WEBKIT || void 0 !== a.offsetY ? a.offsetY : a.layerY),
  7438. this.clientX = void 0 !== a.clientX ? a.clientX : a.pageX,
  7439. this.clientY = void 0 !== a.clientY ? a.clientY : a.pageY,
  7440. this.screenX = a.screenX || 0,
  7441. this.screenY = a.screenY || 0);
  7442. this.button = a.button;
  7443. this.keyCode = a.keyCode || 0;
  7444. this.key = a.key || "";
  7445. this.charCode = a.charCode || ("keypress" == c ? a.keyCode : 0);
  7446. this.ctrlKey = a.ctrlKey;
  7447. this.altKey = a.altKey;
  7448. this.shiftKey = a.shiftKey;
  7449. this.metaKey = a.metaKey;
  7450. this.platformModifierKey = goog.userAgent.MAC ? a.metaKey : a.ctrlKey;
  7451. this.pointerId = a.pointerId || 0;
  7452. this.pointerType = goog.events.BrowserEvent.getPointerType_(a);
  7453. this.state = a.state;
  7454. this.event_ = a;
  7455. a.defaultPrevented && this.preventDefault()
  7456. }
  7457. ;
  7458. goog.events.BrowserEvent.prototype.isButton = function (a) {
  7459. return goog.events.BrowserFeature.HAS_W3C_BUTTON ? this.event_.button == a : "click" == this.type ? a == goog.events.BrowserEvent.MouseButton.LEFT : !!(this.event_.button & goog.events.BrowserEvent.IE_BUTTON_MAP[a])
  7460. }
  7461. ;
  7462. goog.events.BrowserEvent.prototype.isMouseActionButton = function () {
  7463. return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT) && !(goog.userAgent.WEBKIT && goog.userAgent.MAC && this.ctrlKey)
  7464. }
  7465. ;
  7466. goog.events.BrowserEvent.prototype.stopPropagation = function () {
  7467. goog.events.BrowserEvent.superClass_.stopPropagation.call(this);
  7468. this.event_.stopPropagation ? this.event_.stopPropagation() : this.event_.cancelBubble = !0
  7469. }
  7470. ;
  7471. goog.events.BrowserEvent.prototype.preventDefault = function () {
  7472. goog.events.BrowserEvent.superClass_.preventDefault.call(this);
  7473. var a = this.event_;
  7474. if (a.preventDefault)
  7475. a.preventDefault();
  7476. else if (a.returnValue = !1,
  7477. goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT)
  7478. try {
  7479. if (a.ctrlKey || 112 <= a.keyCode && 123 >= a.keyCode)
  7480. a.keyCode = -1
  7481. } catch (b) { }
  7482. }
  7483. ;
  7484. goog.events.BrowserEvent.prototype.getBrowserEvent = function () {
  7485. return this.event_
  7486. }
  7487. ;
  7488. goog.events.BrowserEvent.getPointerType_ = function (a) {
  7489. return "string" === typeof a.pointerType ? a.pointerType : goog.events.BrowserEvent.IE_POINTER_TYPE_MAP[a.pointerType] || ""
  7490. }
  7491. ;
  7492. goog.events.Listenable = function () { }
  7493. ;
  7494. goog.events.Listenable.IMPLEMENTED_BY_PROP = "closure_listenable_" + (1E6 * Math.random() | 0);
  7495. goog.events.Listenable.addImplementation = function (a) {
  7496. a.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP] = !0
  7497. }
  7498. ;
  7499. goog.events.Listenable.isImplementedBy = function (a) {
  7500. return !(!a || !a[goog.events.Listenable.IMPLEMENTED_BY_PROP])
  7501. }
  7502. ;
  7503. goog.events.ListenableKey = function () { }
  7504. ;
  7505. goog.events.ListenableKey.counter_ = 0;
  7506. goog.events.ListenableKey.reserveKey = function () {
  7507. return ++goog.events.ListenableKey.counter_
  7508. }
  7509. ;
  7510. goog.events.Listener = function (a, b, c, d, e, f) {
  7511. goog.events.Listener.ENABLE_MONITORING && (this.creationStack = Error().stack);
  7512. this.listener = a;
  7513. this.proxy = b;
  7514. this.src = c;
  7515. this.type = d;
  7516. this.capture = !!e;
  7517. this.handler = f;
  7518. this.key = goog.events.ListenableKey.reserveKey();
  7519. this.removed = this.callOnce = !1
  7520. }
  7521. ;
  7522. goog.events.Listener.ENABLE_MONITORING = !1;
  7523. goog.events.Listener.prototype.markAsRemoved = function () {
  7524. this.removed = !0;
  7525. this.handler = this.src = this.proxy = this.listener = null
  7526. }
  7527. ;
  7528. goog.events.ListenerMap = function (a) {
  7529. this.src = a;
  7530. this.listeners = {};
  7531. this.typeCount_ = 0
  7532. }
  7533. ;
  7534. goog.events.ListenerMap.prototype.getTypeCount = function () {
  7535. return this.typeCount_
  7536. }
  7537. ;
  7538. goog.events.ListenerMap.prototype.getListenerCount = function () {
  7539. var a = 0, b;
  7540. for (b in this.listeners)
  7541. a += this.listeners[b].length;
  7542. return a
  7543. }
  7544. ;
  7545. goog.events.ListenerMap.prototype.add = function (a, b, c, d, e) {
  7546. var f = a.toString();
  7547. a = this.listeners[f];
  7548. a || (a = this.listeners[f] = [],
  7549. this.typeCount_++);
  7550. var g = goog.events.ListenerMap.findListenerIndex_(a, b, d, e);
  7551. -1 < g ? (b = a[g],
  7552. c || (b.callOnce = !1)) : (b = new goog.events.Listener(b, null, this.src, f, !!d, e),
  7553. b.callOnce = c,
  7554. a.push(b));
  7555. return b
  7556. }
  7557. ;
  7558. goog.events.ListenerMap.prototype.remove = function (a, b, c, d) {
  7559. a = a.toString();
  7560. if (!(a in this.listeners))
  7561. return !1;
  7562. var e = this.listeners[a];
  7563. b = goog.events.ListenerMap.findListenerIndex_(e, b, c, d);
  7564. return -1 < b ? (e[b].markAsRemoved(),
  7565. goog.array.removeAt(e, b),
  7566. 0 == e.length && (delete this.listeners[a],
  7567. this.typeCount_--),
  7568. !0) : !1
  7569. }
  7570. ;
  7571. goog.events.ListenerMap.prototype.removeByKey = function (a) {
  7572. var b = a.type;
  7573. if (!(b in this.listeners))
  7574. return !1;
  7575. var c = goog.array.remove(this.listeners[b], a);
  7576. c && (a.markAsRemoved(),
  7577. 0 == this.listeners[b].length && (delete this.listeners[b],
  7578. this.typeCount_--));
  7579. return c
  7580. }
  7581. ;
  7582. goog.events.ListenerMap.prototype.removeAll = function (a) {
  7583. a = a && a.toString();
  7584. var b = 0, c;
  7585. for (c in this.listeners)
  7586. if (!a || c == a) {
  7587. for (var d = this.listeners[c], e = 0; e < d.length; e++)
  7588. ++b,
  7589. d[e].markAsRemoved();
  7590. delete this.listeners[c];
  7591. this.typeCount_--
  7592. }
  7593. return b
  7594. }
  7595. ;
  7596. goog.events.ListenerMap.prototype.getListeners = function (a, b) {
  7597. var c = this.listeners[a.toString()]
  7598. , d = [];
  7599. if (c)
  7600. for (var e = 0; e < c.length; ++e) {
  7601. var f = c[e];
  7602. f.capture == b && d.push(f)
  7603. }
  7604. return d
  7605. }
  7606. ;
  7607. goog.events.ListenerMap.prototype.getListener = function (a, b, c, d) {
  7608. a = this.listeners[a.toString()];
  7609. var e = -1;
  7610. a && (e = goog.events.ListenerMap.findListenerIndex_(a, b, c, d));
  7611. return -1 < e ? a[e] : null
  7612. }
  7613. ;
  7614. goog.events.ListenerMap.prototype.hasListener = function (a, b) {
  7615. var c = void 0 !== a
  7616. , d = c ? a.toString() : ""
  7617. , e = void 0 !== b;
  7618. return goog.object.some(this.listeners, function (a, g) {
  7619. for (var f = 0; f < a.length; ++f)
  7620. if (!(c && a[f].type != d || e && a[f].capture != b))
  7621. return !0;
  7622. return !1
  7623. })
  7624. }
  7625. ;
  7626. goog.events.ListenerMap.findListenerIndex_ = function (a, b, c, d) {
  7627. for (var e = 0; e < a.length; ++e) {
  7628. var f = a[e];
  7629. if (!f.removed && f.listener == b && f.capture == !!c && f.handler == d)
  7630. return e
  7631. }
  7632. return -1
  7633. }
  7634. ;
  7635. goog.events.LISTENER_MAP_PROP_ = "closure_lm_" + (1E6 * Math.random() | 0);
  7636. goog.events.onString_ = "on";
  7637. goog.events.onStringMap_ = {};
  7638. goog.events.CaptureSimulationMode = {
  7639. OFF_AND_FAIL: 0,
  7640. OFF_AND_SILENT: 1,
  7641. ON: 2
  7642. };
  7643. goog.events.CAPTURE_SIMULATION_MODE = 2;
  7644. goog.events.listenerCountEstimate_ = 0;
  7645. goog.events.listen = function (a, b, c, d, e) {
  7646. if (d && d.once)
  7647. return goog.events.listenOnce(a, b, c, d, e);
  7648. if (goog.isArray(b)) {
  7649. for (var f = 0; f < b.length; f++)
  7650. goog.events.listen(a, b[f], c, d, e);
  7651. return null
  7652. }
  7653. c = goog.events.wrapListener(c);
  7654. return goog.events.Listenable.isImplementedBy(a) ? (d = goog.isObject(d) ? !!d.capture : !!d,
  7655. a.listen(b, c, d, e)) : goog.events.listen_(a, b, c, !1, d, e)
  7656. }
  7657. ;
  7658. goog.events.listen_ = function (a, b, c, d, e, f) {
  7659. if (!b)
  7660. throw Error("Invalid event type");
  7661. var g = goog.isObject(e) ? !!e.capture : !!e;
  7662. if (g && !goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) {
  7663. if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_FAIL)
  7664. return goog.asserts.fail("Can not register capture listener in IE8-."),
  7665. null;
  7666. if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_SILENT)
  7667. return null
  7668. }
  7669. var h = goog.events.getListenerMap_(a);
  7670. h || (a[goog.events.LISTENER_MAP_PROP_] = h = new goog.events.ListenerMap(a));
  7671. c = h.add(b, c, d, g, f);
  7672. if (c.proxy)
  7673. return c;
  7674. d = goog.events.getProxy();
  7675. c.proxy = d;
  7676. d.src = a;
  7677. d.listener = c;
  7678. if (a.addEventListener)
  7679. goog.events.BrowserFeature.PASSIVE_EVENTS || (e = g),
  7680. void 0 === e && (e = !1),
  7681. a.addEventListener(b.toString(), d, e);
  7682. else if (a.attachEvent)
  7683. a.attachEvent(goog.events.getOnString_(b.toString()), d);
  7684. else if (a.addListener && a.removeListener)
  7685. goog.asserts.assert("change" === b, "MediaQueryList only has a change event"),
  7686. a.addListener(d);
  7687. else
  7688. throw Error("addEventListener and attachEvent are unavailable.");
  7689. goog.events.listenerCountEstimate_++;
  7690. return c
  7691. }
  7692. ;
  7693. goog.events.getProxy = function () {
  7694. var a = goog.events.handleBrowserEvent_
  7695. , b = goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT ? function (c) {
  7696. return a.call(b.src, b.listener, c)
  7697. }
  7698. : function (c) {
  7699. c = a.call(b.src, b.listener, c);
  7700. if (!c)
  7701. return c
  7702. }
  7703. ;
  7704. return b
  7705. }
  7706. ;
  7707. goog.events.listenOnce = function (a, b, c, d, e) {
  7708. if (goog.isArray(b)) {
  7709. for (var f = 0; f < b.length; f++)
  7710. goog.events.listenOnce(a, b[f], c, d, e);
  7711. return null
  7712. }
  7713. c = goog.events.wrapListener(c);
  7714. return goog.events.Listenable.isImplementedBy(a) ? (d = goog.isObject(d) ? !!d.capture : !!d,
  7715. a.listenOnce(b, c, d, e)) : goog.events.listen_(a, b, c, !0, d, e)
  7716. }
  7717. ;
  7718. goog.events.listenWithWrapper = function (a, b, c, d, e) {
  7719. b.listen(a, c, d, e)
  7720. }
  7721. ;
  7722. goog.events.unlisten = function (a, b, c, d, e) {
  7723. if (goog.isArray(b)) {
  7724. for (var f = 0; f < b.length; f++)
  7725. goog.events.unlisten(a, b[f], c, d, e);
  7726. return null
  7727. }
  7728. d = goog.isObject(d) ? !!d.capture : !!d;
  7729. c = goog.events.wrapListener(c);
  7730. if (goog.events.Listenable.isImplementedBy(a))
  7731. return a.unlisten(b, c, d, e);
  7732. if (!a)
  7733. return !1;
  7734. if (a = goog.events.getListenerMap_(a))
  7735. if (b = a.getListener(b, c, d, e))
  7736. return goog.events.unlistenByKey(b);
  7737. return !1
  7738. }
  7739. ;
  7740. goog.events.unlistenByKey = function (a) {
  7741. if ("number" === typeof a || !a || a.removed)
  7742. return !1;
  7743. var b = a.src;
  7744. if (goog.events.Listenable.isImplementedBy(b))
  7745. return b.unlistenByKey(a);
  7746. var c = a.type
  7747. , d = a.proxy;
  7748. b.removeEventListener ? b.removeEventListener(c, d, a.capture) : b.detachEvent ? b.detachEvent(goog.events.getOnString_(c), d) : b.addListener && b.removeListener && b.removeListener(d);
  7749. goog.events.listenerCountEstimate_--;
  7750. (c = goog.events.getListenerMap_(b)) ? (c.removeByKey(a),
  7751. 0 == c.getTypeCount() && (c.src = null,
  7752. b[goog.events.LISTENER_MAP_PROP_] = null)) : a.markAsRemoved();
  7753. return !0
  7754. }
  7755. ;
  7756. goog.events.unlistenWithWrapper = function (a, b, c, d, e) {
  7757. b.unlisten(a, c, d, e)
  7758. }
  7759. ;
  7760. goog.events.removeAll = function (a, b) {
  7761. if (!a)
  7762. return 0;
  7763. if (goog.events.Listenable.isImplementedBy(a))
  7764. return a.removeAllListeners(b);
  7765. var c = goog.events.getListenerMap_(a);
  7766. if (!c)
  7767. return 0;
  7768. var d = 0, e = b && b.toString(), f;
  7769. for (f in c.listeners)
  7770. if (!e || f == e)
  7771. for (var g = c.listeners[f].concat(), h = 0; h < g.length; ++h)
  7772. goog.events.unlistenByKey(g[h]) && ++d;
  7773. return d
  7774. }
  7775. ;
  7776. goog.events.getListeners = function (a, b, c) {
  7777. return goog.events.Listenable.isImplementedBy(a) ? a.getListeners(b, c) : a ? (a = goog.events.getListenerMap_(a)) ? a.getListeners(b, c) : [] : []
  7778. }
  7779. ;
  7780. goog.events.getListener = function (a, b, c, d, e) {
  7781. c = goog.events.wrapListener(c);
  7782. d = !!d;
  7783. return goog.events.Listenable.isImplementedBy(a) ? a.getListener(b, c, d, e) : a ? (a = goog.events.getListenerMap_(a)) ? a.getListener(b, c, d, e) : null : null
  7784. }
  7785. ;
  7786. goog.events.hasListener = function (a, b, c) {
  7787. if (goog.events.Listenable.isImplementedBy(a))
  7788. return a.hasListener(b, c);
  7789. a = goog.events.getListenerMap_(a);
  7790. return !!a && a.hasListener(b, c)
  7791. }
  7792. ;
  7793. goog.events.expose = function (a) {
  7794. var b = [], c;
  7795. for (c in a)
  7796. a[c] && a[c].id ? b.push(c + " = " + a[c] + " (" + a[c].id + ")") : b.push(c + " = " + a[c]);
  7797. return b.join("\n")
  7798. }
  7799. ;
  7800. goog.events.getOnString_ = function (a) {
  7801. return a in goog.events.onStringMap_ ? goog.events.onStringMap_[a] : goog.events.onStringMap_[a] = goog.events.onString_ + a
  7802. }
  7803. ;
  7804. goog.events.fireListeners = function (a, b, c, d) {
  7805. return goog.events.Listenable.isImplementedBy(a) ? a.fireListeners(b, c, d) : goog.events.fireListeners_(a, b, c, d)
  7806. }
  7807. ;
  7808. goog.events.fireListeners_ = function (a, b, c, d) {
  7809. var e = !0;
  7810. if (a = goog.events.getListenerMap_(a))
  7811. if (b = a.listeners[b.toString()])
  7812. for (b = b.concat(),
  7813. a = 0; a < b.length; a++) {
  7814. var f = b[a];
  7815. f && f.capture == c && !f.removed && (f = goog.events.fireListener(f, d),
  7816. e = e && !1 !== f)
  7817. }
  7818. return e
  7819. }
  7820. ;
  7821. goog.events.fireListener = function (a, b) {
  7822. var c = a.listener
  7823. , d = a.handler || a.src;
  7824. a.callOnce && goog.events.unlistenByKey(a);
  7825. return c.call(d, b)
  7826. }
  7827. ;
  7828. goog.events.getTotalListenerCount = function () {
  7829. return goog.events.listenerCountEstimate_
  7830. }
  7831. ;
  7832. goog.events.dispatchEvent = function (a, b) {
  7833. goog.asserts.assert(goog.events.Listenable.isImplementedBy(a), "Can not use goog.events.dispatchEvent with non-goog.events.Listenable instance.");
  7834. return a.dispatchEvent(b)
  7835. }
  7836. ;
  7837. goog.events.protectBrowserEventEntryPoint = function (a) {
  7838. goog.events.handleBrowserEvent_ = a.protectEntryPoint(goog.events.handleBrowserEvent_)
  7839. }
  7840. ;
  7841. goog.events.handleBrowserEvent_ = function (a, b) {
  7842. if (a.removed)
  7843. return !0;
  7844. if (!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) {
  7845. var c = b || goog.getObjectByName("window.event")
  7846. , d = new goog.events.BrowserEvent(c, this)
  7847. , e = !0;
  7848. if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.ON) {
  7849. if (!goog.events.isMarkedIeEvent_(c)) {
  7850. goog.events.markIeEvent_(c);
  7851. c = [];
  7852. for (var f = d.currentTarget; f; f = f.parentNode)
  7853. c.push(f);
  7854. f = a.type;
  7855. for (var g = c.length - 1; !d.propagationStopped_ && 0 <= g; g--) {
  7856. d.currentTarget = c[g];
  7857. var h = goog.events.fireListeners_(c[g], f, !0, d);
  7858. e = e && h
  7859. }
  7860. for (g = 0; !d.propagationStopped_ && g < c.length; g++)
  7861. d.currentTarget = c[g],
  7862. h = goog.events.fireListeners_(c[g], f, !1, d),
  7863. e = e && h
  7864. }
  7865. } else
  7866. e = goog.events.fireListener(a, d);
  7867. return e
  7868. }
  7869. return goog.events.fireListener(a, new goog.events.BrowserEvent(b, this))
  7870. }
  7871. ;
  7872. goog.events.markIeEvent_ = function (a) {
  7873. var b = !1;
  7874. if (0 == a.keyCode)
  7875. try {
  7876. a.keyCode = -1;
  7877. return
  7878. } catch (c) {
  7879. b = !0
  7880. }
  7881. if (b || void 0 == a.returnValue)
  7882. a.returnValue = !0
  7883. }
  7884. ;
  7885. goog.events.isMarkedIeEvent_ = function (a) {
  7886. return 0 > a.keyCode || void 0 != a.returnValue
  7887. }
  7888. ;
  7889. goog.events.uniqueIdCounter_ = 0;
  7890. goog.events.getUniqueId = function (a) {
  7891. return a + "_" + goog.events.uniqueIdCounter_++
  7892. }
  7893. ;
  7894. goog.events.getListenerMap_ = function (a) {
  7895. a = a[goog.events.LISTENER_MAP_PROP_];
  7896. return a instanceof goog.events.ListenerMap ? a : null
  7897. }
  7898. ;
  7899. goog.events.LISTENER_WRAPPER_PROP_ = "__closure_events_fn_" + (1E9 * Math.random() >>> 0);
  7900. goog.events.wrapListener = function (a) {
  7901. goog.asserts.assert(a, "Listener can not be null.");
  7902. if (goog.isFunction(a))
  7903. return a;
  7904. goog.asserts.assert(a.handleEvent, "An object listener must have handleEvent method.");
  7905. a[goog.events.LISTENER_WRAPPER_PROP_] || (a[goog.events.LISTENER_WRAPPER_PROP_] = function (b) {
  7906. return a.handleEvent(b)
  7907. }
  7908. );
  7909. return a[goog.events.LISTENER_WRAPPER_PROP_]
  7910. }
  7911. ;
  7912. goog.debug.entryPointRegistry.register(function (a) {
  7913. goog.events.handleBrowserEvent_ = a(goog.events.handleBrowserEvent_)
  7914. });
  7915. goog.events.EventTarget = function () {
  7916. goog.Disposable.call(this);
  7917. this.eventTargetListeners_ = new goog.events.ListenerMap(this);
  7918. this.actualEventTarget_ = this;
  7919. this.parentEventTarget_ = null
  7920. }
  7921. ;
  7922. goog.inherits(goog.events.EventTarget, goog.Disposable);
  7923. goog.events.Listenable.addImplementation(goog.events.EventTarget);
  7924. goog.events.EventTarget.MAX_ANCESTORS_ = 1E3;
  7925. goog.events.EventTarget.prototype.getParentEventTarget = function () {
  7926. return this.parentEventTarget_
  7927. }
  7928. ;
  7929. goog.events.EventTarget.prototype.setParentEventTarget = function (a) {
  7930. this.parentEventTarget_ = a
  7931. }
  7932. ;
  7933. goog.events.EventTarget.prototype.addEventListener = function (a, b, c, d) {
  7934. goog.events.listen(this, a, b, c, d)
  7935. }
  7936. ;
  7937. goog.events.EventTarget.prototype.removeEventListener = function (a, b, c, d) {
  7938. goog.events.unlisten(this, a, b, c, d)
  7939. }
  7940. ;
  7941. goog.events.EventTarget.prototype.dispatchEvent = function (a) {
  7942. this.assertInitialized_();
  7943. var b = this.getParentEventTarget();
  7944. if (b) {
  7945. var c = [];
  7946. for (var d = 1; b; b = b.getParentEventTarget())
  7947. c.push(b),
  7948. goog.asserts.assert(++d < goog.events.EventTarget.MAX_ANCESTORS_, "infinite loop")
  7949. }
  7950. return goog.events.EventTarget.dispatchEventInternal_(this.actualEventTarget_, a, c)
  7951. }
  7952. ;
  7953. goog.events.EventTarget.prototype.disposeInternal = function () {
  7954. goog.events.EventTarget.superClass_.disposeInternal.call(this);
  7955. this.removeAllListeners();
  7956. this.parentEventTarget_ = null
  7957. }
  7958. ;
  7959. goog.events.EventTarget.prototype.listen = function (a, b, c, d) {
  7960. this.assertInitialized_();
  7961. return this.eventTargetListeners_.add(String(a), b, !1, c, d)
  7962. }
  7963. ;
  7964. goog.events.EventTarget.prototype.listenOnce = function (a, b, c, d) {
  7965. return this.eventTargetListeners_.add(String(a), b, !0, c, d)
  7966. }
  7967. ;
  7968. goog.events.EventTarget.prototype.unlisten = function (a, b, c, d) {
  7969. return this.eventTargetListeners_.remove(String(a), b, c, d)
  7970. }
  7971. ;
  7972. goog.events.EventTarget.prototype.unlistenByKey = function (a) {
  7973. return this.eventTargetListeners_.removeByKey(a)
  7974. }
  7975. ;
  7976. goog.events.EventTarget.prototype.removeAllListeners = function (a) {
  7977. return this.eventTargetListeners_ ? this.eventTargetListeners_.removeAll(a) : 0
  7978. }
  7979. ;
  7980. goog.events.EventTarget.prototype.fireListeners = function (a, b, c) {
  7981. a = this.eventTargetListeners_.listeners[String(a)];
  7982. if (!a)
  7983. return !0;
  7984. a = a.concat();
  7985. for (var d = !0, e = 0; e < a.length; ++e) {
  7986. var f = a[e];
  7987. if (f && !f.removed && f.capture == b) {
  7988. var g = f.listener
  7989. , h = f.handler || f.src;
  7990. f.callOnce && this.unlistenByKey(f);
  7991. d = !1 !== g.call(h, c) && d
  7992. }
  7993. }
  7994. return d && 0 != c.returnValue_
  7995. }
  7996. ;
  7997. goog.events.EventTarget.prototype.getListeners = function (a, b) {
  7998. return this.eventTargetListeners_.getListeners(String(a), b)
  7999. }
  8000. ;
  8001. goog.events.EventTarget.prototype.getListener = function (a, b, c, d) {
  8002. return this.eventTargetListeners_.getListener(String(a), b, c, d)
  8003. }
  8004. ;
  8005. goog.events.EventTarget.prototype.hasListener = function (a, b) {
  8006. return this.eventTargetListeners_.hasListener(void 0 !== a ? String(a) : void 0, b)
  8007. }
  8008. ;
  8009. goog.events.EventTarget.prototype.setTargetForTesting = function (a) {
  8010. this.actualEventTarget_ = a
  8011. }
  8012. ;
  8013. goog.events.EventTarget.prototype.assertInitialized_ = function () {
  8014. goog.asserts.assert(this.eventTargetListeners_, "Event target is not initialized. Did you call the superclass (goog.events.EventTarget) constructor?")
  8015. }
  8016. ;
  8017. goog.events.EventTarget.dispatchEventInternal_ = function (a, b, c) {
  8018. var d = b.type || b;
  8019. if ("string" === typeof b)
  8020. b = new goog.events.Event(b, a);
  8021. else if (b instanceof goog.events.Event)
  8022. b.target = b.target || a;
  8023. else {
  8024. var e = b;
  8025. b = new goog.events.Event(d, a);
  8026. goog.object.extend(b, e)
  8027. }
  8028. e = !0;
  8029. if (c)
  8030. for (var f = c.length - 1; !b.propagationStopped_ && 0 <= f; f--) {
  8031. var g = b.currentTarget = c[f];
  8032. e = g.fireListeners(d, !0, b) && e
  8033. }
  8034. b.propagationStopped_ || (g = b.currentTarget = a,
  8035. e = g.fireListeners(d, !0, b) && e,
  8036. b.propagationStopped_ || (e = g.fireListeners(d, !1, b) && e));
  8037. if (c)
  8038. for (f = 0; !b.propagationStopped_ && f < c.length; f++)
  8039. g = b.currentTarget = c[f],
  8040. e = g.fireListeners(d, !1, b) && e;
  8041. return e
  8042. }
  8043. ;
  8044. goog.Timer = function (a, b) {
  8045. goog.events.EventTarget.call(this);
  8046. this.interval_ = a || 1;
  8047. this.timerObject_ = b || goog.Timer.defaultTimerObject;
  8048. this.boundTick_ = goog.bind(this.tick_, this);
  8049. this.last_ = goog.now()
  8050. }
  8051. ;
  8052. goog.inherits(goog.Timer, goog.events.EventTarget);
  8053. goog.Timer.MAX_TIMEOUT_ = 2147483647;
  8054. goog.Timer.INVALID_TIMEOUT_ID_ = -1;
  8055. goog.Timer.prototype.enabled = !1;
  8056. goog.Timer.defaultTimerObject = goog.global;
  8057. goog.Timer.intervalScale = .8;
  8058. goog.Timer.prototype.timer_ = null;
  8059. goog.Timer.prototype.getInterval = function () {
  8060. return this.interval_
  8061. }
  8062. ;
  8063. goog.Timer.prototype.setInterval = function (a) {
  8064. this.interval_ = a;
  8065. this.timer_ && this.enabled ? (this.stop(),
  8066. this.start()) : this.timer_ && this.stop()
  8067. }
  8068. ;
  8069. goog.Timer.prototype.tick_ = function () {
  8070. if (this.enabled) {
  8071. var a = goog.now() - this.last_;
  8072. 0 < a && a < this.interval_ * goog.Timer.intervalScale ? this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_ - a) : (this.timer_ && (this.timerObject_.clearTimeout(this.timer_),
  8073. this.timer_ = null),
  8074. this.dispatchTick(),
  8075. this.enabled && (this.stop(),
  8076. this.start()))
  8077. }
  8078. }
  8079. ;
  8080. goog.Timer.prototype.dispatchTick = function () {
  8081. this.dispatchEvent(goog.Timer.TICK)
  8082. }
  8083. ;
  8084. goog.Timer.prototype.start = function () {
  8085. this.enabled = !0;
  8086. this.timer_ || (this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_),
  8087. this.last_ = goog.now())
  8088. }
  8089. ;
  8090. goog.Timer.prototype.stop = function () {
  8091. this.enabled = !1;
  8092. this.timer_ && (this.timerObject_.clearTimeout(this.timer_),
  8093. this.timer_ = null)
  8094. }
  8095. ;
  8096. goog.Timer.prototype.disposeInternal = function () {
  8097. goog.Timer.superClass_.disposeInternal.call(this);
  8098. this.stop();
  8099. delete this.timerObject_
  8100. }
  8101. ;
  8102. goog.Timer.TICK = "tick";
  8103. goog.Timer.callOnce = function (a, b, c) {
  8104. if (goog.isFunction(a))
  8105. c && (a = goog.bind(a, c));
  8106. else if (a && "function" == typeof a.handleEvent)
  8107. a = goog.bind(a.handleEvent, a);
  8108. else
  8109. throw Error("Invalid listener argument");
  8110. return Number(b) > goog.Timer.MAX_TIMEOUT_ ? goog.Timer.INVALID_TIMEOUT_ID_ : goog.Timer.defaultTimerObject.setTimeout(a, b || 0)
  8111. }
  8112. ;
  8113. goog.Timer.clear = function (a) {
  8114. goog.Timer.defaultTimerObject.clearTimeout(a)
  8115. }
  8116. ;
  8117. goog.Timer.promise = function (a, b) {
  8118. var c = null;
  8119. return (new goog.Promise(function (d, e) {
  8120. c = goog.Timer.callOnce(function () {
  8121. d(b)
  8122. }, a);
  8123. c == goog.Timer.INVALID_TIMEOUT_ID_ && e(Error("Failed to schedule timer."))
  8124. }
  8125. )).thenCatch(function (a) {
  8126. goog.Timer.clear(c);
  8127. throw a;
  8128. })
  8129. }
  8130. ;
  8131. goog.color = {};
  8132. goog.color.names = {
  8133. aliceblue: "#f0f8ff",
  8134. antiquewhite: "#faebd7",
  8135. aqua: "#00ffff",
  8136. aquamarine: "#7fffd4",
  8137. azure: "#f0ffff",
  8138. beige: "#f5f5dc",
  8139. bisque: "#ffe4c4",
  8140. black: "#000000",
  8141. blanchedalmond: "#ffebcd",
  8142. blue: "#0000ff",
  8143. blueviolet: "#8a2be2",
  8144. brown: "#a52a2a",
  8145. burlywood: "#deb887",
  8146. cadetblue: "#5f9ea0",
  8147. chartreuse: "#7fff00",
  8148. chocolate: "#d2691e",
  8149. coral: "#ff7f50",
  8150. cornflowerblue: "#6495ed",
  8151. cornsilk: "#fff8dc",
  8152. crimson: "#dc143c",
  8153. cyan: "#00ffff",
  8154. darkblue: "#00008b",
  8155. darkcyan: "#008b8b",
  8156. darkgoldenrod: "#b8860b",
  8157. darkgray: "#a9a9a9",
  8158. darkgreen: "#006400",
  8159. darkgrey: "#a9a9a9",
  8160. darkkhaki: "#bdb76b",
  8161. darkmagenta: "#8b008b",
  8162. darkolivegreen: "#556b2f",
  8163. darkorange: "#ff8c00",
  8164. darkorchid: "#9932cc",
  8165. darkred: "#8b0000",
  8166. darksalmon: "#e9967a",
  8167. darkseagreen: "#8fbc8f",
  8168. darkslateblue: "#483d8b",
  8169. darkslategray: "#2f4f4f",
  8170. darkslategrey: "#2f4f4f",
  8171. darkturquoise: "#00ced1",
  8172. darkviolet: "#9400d3",
  8173. deeppink: "#ff1493",
  8174. deepskyblue: "#00bfff",
  8175. dimgray: "#696969",
  8176. dimgrey: "#696969",
  8177. dodgerblue: "#1e90ff",
  8178. firebrick: "#b22222",
  8179. floralwhite: "#fffaf0",
  8180. forestgreen: "#228b22",
  8181. fuchsia: "#ff00ff",
  8182. gainsboro: "#dcdcdc",
  8183. ghostwhite: "#f8f8ff",
  8184. gold: "#ffd700",
  8185. goldenrod: "#daa520",
  8186. gray: "#808080",
  8187. green: "#008000",
  8188. greenyellow: "#adff2f",
  8189. grey: "#808080",
  8190. honeydew: "#f0fff0",
  8191. hotpink: "#ff69b4",
  8192. indianred: "#cd5c5c",
  8193. indigo: "#4b0082",
  8194. ivory: "#fffff0",
  8195. khaki: "#f0e68c",
  8196. lavender: "#e6e6fa",
  8197. lavenderblush: "#fff0f5",
  8198. lawngreen: "#7cfc00",
  8199. lemonchiffon: "#fffacd",
  8200. lightblue: "#add8e6",
  8201. lightcoral: "#f08080",
  8202. lightcyan: "#e0ffff",
  8203. lightgoldenrodyellow: "#fafad2",
  8204. lightgray: "#d3d3d3",
  8205. lightgreen: "#90ee90",
  8206. lightgrey: "#d3d3d3",
  8207. lightpink: "#ffb6c1",
  8208. lightsalmon: "#ffa07a",
  8209. lightseagreen: "#20b2aa",
  8210. lightskyblue: "#87cefa",
  8211. lightslategray: "#778899",
  8212. lightslategrey: "#778899",
  8213. lightsteelblue: "#b0c4de",
  8214. lightyellow: "#ffffe0",
  8215. lime: "#00ff00",
  8216. limegreen: "#32cd32",
  8217. linen: "#faf0e6",
  8218. magenta: "#ff00ff",
  8219. maroon: "#800000",
  8220. mediumaquamarine: "#66cdaa",
  8221. mediumblue: "#0000cd",
  8222. mediumorchid: "#ba55d3",
  8223. mediumpurple: "#9370db",
  8224. mediumseagreen: "#3cb371",
  8225. mediumslateblue: "#7b68ee",
  8226. mediumspringgreen: "#00fa9a",
  8227. mediumturquoise: "#48d1cc",
  8228. mediumvioletred: "#c71585",
  8229. midnightblue: "#191970",
  8230. mintcream: "#f5fffa",
  8231. mistyrose: "#ffe4e1",
  8232. moccasin: "#ffe4b5",
  8233. navajowhite: "#ffdead",
  8234. navy: "#000080",
  8235. oldlace: "#fdf5e6",
  8236. olive: "#808000",
  8237. olivedrab: "#6b8e23",
  8238. orange: "#ffa500",
  8239. orangered: "#ff4500",
  8240. orchid: "#da70d6",
  8241. palegoldenrod: "#eee8aa",
  8242. palegreen: "#98fb98",
  8243. paleturquoise: "#afeeee",
  8244. palevioletred: "#db7093",
  8245. papayawhip: "#ffefd5",
  8246. peachpuff: "#ffdab9",
  8247. peru: "#cd853f",
  8248. pink: "#ffc0cb",
  8249. plum: "#dda0dd",
  8250. powderblue: "#b0e0e6",
  8251. purple: "#800080",
  8252. red: "#ff0000",
  8253. rosybrown: "#bc8f8f",
  8254. royalblue: "#4169e1",
  8255. saddlebrown: "#8b4513",
  8256. salmon: "#fa8072",
  8257. sandybrown: "#f4a460",
  8258. seagreen: "#2e8b57",
  8259. seashell: "#fff5ee",
  8260. sienna: "#a0522d",
  8261. silver: "#c0c0c0",
  8262. skyblue: "#87ceeb",
  8263. slateblue: "#6a5acd",
  8264. slategray: "#708090",
  8265. slategrey: "#708090",
  8266. snow: "#fffafa",
  8267. springgreen: "#00ff7f",
  8268. steelblue: "#4682b4",
  8269. tan: "#d2b48c",
  8270. teal: "#008080",
  8271. thistle: "#d8bfd8",
  8272. tomato: "#ff6347",
  8273. turquoise: "#40e0d0",
  8274. violet: "#ee82ee",
  8275. wheat: "#f5deb3",
  8276. white: "#ffffff",
  8277. whitesmoke: "#f5f5f5",
  8278. yellow: "#ffff00",
  8279. yellowgreen: "#9acd32"
  8280. };
  8281. goog.color.parse = function (a) {
  8282. var b = {};
  8283. a = String(a);
  8284. var c = goog.color.prependHashIfNecessaryHelper(a);
  8285. if (goog.color.isValidHexColor_(c))
  8286. return b.hex = goog.color.normalizeHex(c),
  8287. b.type = "hex",
  8288. b;
  8289. c = goog.color.isValidRgbColor_(a);
  8290. if (c.length)
  8291. return b.hex = goog.color.rgbArrayToHex(c),
  8292. b.type = "rgb",
  8293. b;
  8294. if (goog.color.names && (c = goog.color.names[a.toLowerCase()]))
  8295. return b.hex = c,
  8296. b.type = "named",
  8297. b;
  8298. throw Error(a + " is not a valid color string");
  8299. }
  8300. ;
  8301. goog.color.isValidColor = function (a) {
  8302. var b = goog.color.prependHashIfNecessaryHelper(a);
  8303. return !!(goog.color.isValidHexColor_(b) || goog.color.isValidRgbColor_(a).length || goog.color.names && goog.color.names[a.toLowerCase()])
  8304. }
  8305. ;
  8306. goog.color.parseRgb = function (a) {
  8307. var b = goog.color.isValidRgbColor_(a);
  8308. if (!b.length)
  8309. throw Error(a + " is not a valid RGB color");
  8310. return b
  8311. }
  8312. ;
  8313. goog.color.hexToRgbStyle = function (a) {
  8314. return goog.color.rgbStyle_(goog.color.hexToRgb(a))
  8315. }
  8316. ;
  8317. goog.color.hexTripletRe_ = /#(.)(.)(.)/;
  8318. goog.color.normalizeHex = function (a) {
  8319. if (!goog.color.isValidHexColor_(a))
  8320. throw Error("'" + a + "' is not a valid hex color");
  8321. 4 == a.length && (a = a.replace(goog.color.hexTripletRe_, "#$1$1$2$2$3$3"));
  8322. return a.toLowerCase()
  8323. }
  8324. ;
  8325. goog.color.hexToRgb = function (a) {
  8326. a = goog.color.normalizeHex(a);
  8327. a = parseInt(a.substr(1), 16);
  8328. return [a >> 16, a >> 8 & 255, a & 255]
  8329. }
  8330. ;
  8331. goog.color.rgbToHex = function (a, b, c) {
  8332. a = Number(a);
  8333. b = Number(b);
  8334. c = Number(c);
  8335. if (a != (a & 255) || b != (b & 255) || c != (c & 255))
  8336. throw Error('"(' + a + "," + b + "," + c + '") is not a valid RGB color');
  8337. b = a << 16 | b << 8 | c;
  8338. return 16 > a ? "#" + (16777216 | b).toString(16).substr(1) : "#" + b.toString(16)
  8339. }
  8340. ;
  8341. goog.color.rgbArrayToHex = function (a) {
  8342. return goog.color.rgbToHex(a[0], a[1], a[2])
  8343. }
  8344. ;
  8345. goog.color.rgbToHsl = function (a, b, c) {
  8346. a /= 255;
  8347. b /= 255;
  8348. c /= 255;
  8349. var d = Math.max(a, b, c)
  8350. , e = Math.min(a, b, c)
  8351. , f = 0
  8352. , g = 0
  8353. , h = .5 * (d + e);
  8354. d != e && (d == a ? f = 60 * (b - c) / (d - e) : d == b ? f = 60 * (c - a) / (d - e) + 120 : d == c && (f = 60 * (a - b) / (d - e) + 240),
  8355. g = 0 < h && .5 >= h ? (d - e) / (2 * h) : (d - e) / (2 - 2 * h));
  8356. return [Math.round(f + 360) % 360, g, h]
  8357. }
  8358. ;
  8359. goog.color.rgbArrayToHsl = function (a) {
  8360. return goog.color.rgbToHsl(a[0], a[1], a[2])
  8361. }
  8362. ;
  8363. goog.color.hueToRgb_ = function (a, b, c) {
  8364. 0 > c ? c += 1 : 1 < c && --c;
  8365. return 1 > 6 * c ? a + 6 * (b - a) * c : 1 > 2 * c ? b : 2 > 3 * c ? a + (b - a) * (2 / 3 - c) * 6 : a
  8366. }
  8367. ;
  8368. goog.color.hslToRgb = function (a, b, c) {
  8369. a /= 360;
  8370. if (0 == b)
  8371. c = b = a = 255 * c;
  8372. else {
  8373. var d = .5 > c ? c * (1 + b) : c + b - b * c;
  8374. var e = 2 * c - d;
  8375. c = 255 * goog.color.hueToRgb_(e, d, a + 1 / 3);
  8376. b = 255 * goog.color.hueToRgb_(e, d, a);
  8377. a = 255 * goog.color.hueToRgb_(e, d, a - 1 / 3)
  8378. }
  8379. return [Math.round(c), Math.round(b), Math.round(a)]
  8380. }
  8381. ;
  8382. goog.color.hslArrayToRgb = function (a) {
  8383. return goog.color.hslToRgb(a[0], a[1], a[2])
  8384. }
  8385. ;
  8386. goog.color.validHexColorRe_ = /^#(?:[0-9a-f]{3}){1,2}$/i;
  8387. goog.color.isValidHexColor_ = function (a) {
  8388. return goog.color.validHexColorRe_.test(a)
  8389. }
  8390. ;
  8391. goog.color.rgbColorRe_ = /^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;
  8392. goog.color.isValidRgbColor_ = function (a) {
  8393. var b = a.match(goog.color.rgbColorRe_);
  8394. if (b) {
  8395. a = Number(b[1]);
  8396. var c = Number(b[2]);
  8397. b = Number(b[3]);
  8398. if (0 <= a && 255 >= a && 0 <= c && 255 >= c && 0 <= b && 255 >= b)
  8399. return [a, c, b]
  8400. }
  8401. return []
  8402. }
  8403. ;
  8404. goog.color.prependZeroIfNecessaryHelper = function (a) {
  8405. return 1 == a.length ? "0" + a : a
  8406. }
  8407. ;
  8408. goog.color.prependHashIfNecessaryHelper = function (a) {
  8409. return "#" == a.charAt(0) ? a : "#" + a
  8410. }
  8411. ;
  8412. goog.color.rgbStyle_ = function (a) {
  8413. return "rgb(" + a.join(",") + ")"
  8414. }
  8415. ;
  8416. goog.color.hsvToRgb = function (a, b, c) {
  8417. var d = 0
  8418. , e = 0
  8419. , f = 0;
  8420. if (0 == b)
  8421. f = e = d = c;
  8422. else {
  8423. var g = Math.floor(a / 60)
  8424. , h = a / 60 - g;
  8425. a = c * (1 - b);
  8426. var k = c * (1 - b * h);
  8427. b = c * (1 - b * (1 - h));
  8428. switch (g) {
  8429. case 1:
  8430. d = k;
  8431. e = c;
  8432. f = a;
  8433. break;
  8434. case 2:
  8435. d = a;
  8436. e = c;
  8437. f = b;
  8438. break;
  8439. case 3:
  8440. d = a;
  8441. e = k;
  8442. f = c;
  8443. break;
  8444. case 4:
  8445. d = b;
  8446. e = a;
  8447. f = c;
  8448. break;
  8449. case 5:
  8450. d = c;
  8451. e = a;
  8452. f = k;
  8453. break;
  8454. case 6:
  8455. case 0:
  8456. d = c,
  8457. e = b,
  8458. f = a
  8459. }
  8460. }
  8461. return [Math.round(d), Math.round(e), Math.round(f)]
  8462. }
  8463. ;
  8464. goog.color.rgbToHsv = function (a, b, c) {
  8465. var d = Math.max(Math.max(a, b), c)
  8466. , e = Math.min(Math.min(a, b), c);
  8467. if (e == d)
  8468. e = a = 0;
  8469. else {
  8470. var f = d - e;
  8471. e = f / d;
  8472. a = 60 * (a == d ? (b - c) / f : b == d ? 2 + (c - a) / f : 4 + (a - b) / f);
  8473. 0 > a && (a += 360);
  8474. 360 < a && (a -= 360)
  8475. }
  8476. return [a, e, d]
  8477. }
  8478. ;
  8479. goog.color.rgbArrayToHsv = function (a) {
  8480. return goog.color.rgbToHsv(a[0], a[1], a[2])
  8481. }
  8482. ;
  8483. goog.color.hsvArrayToRgb = function (a) {
  8484. return goog.color.hsvToRgb(a[0], a[1], a[2])
  8485. }
  8486. ;
  8487. goog.color.hexToHsl = function (a) {
  8488. a = goog.color.hexToRgb(a);
  8489. return goog.color.rgbToHsl(a[0], a[1], a[2])
  8490. }
  8491. ;
  8492. goog.color.hslToHex = function (a, b, c) {
  8493. return goog.color.rgbArrayToHex(goog.color.hslToRgb(a, b, c))
  8494. }
  8495. ;
  8496. goog.color.hslArrayToHex = function (a) {
  8497. return goog.color.rgbArrayToHex(goog.color.hslToRgb(a[0], a[1], a[2]))
  8498. }
  8499. ;
  8500. goog.color.hexToHsv = function (a) {
  8501. return goog.color.rgbArrayToHsv(goog.color.hexToRgb(a))
  8502. }
  8503. ;
  8504. goog.color.hsvToHex = function (a, b, c) {
  8505. return goog.color.rgbArrayToHex(goog.color.hsvToRgb(a, b, c))
  8506. }
  8507. ;
  8508. goog.color.hsvArrayToHex = function (a) {
  8509. return goog.color.hsvToHex(a[0], a[1], a[2])
  8510. }
  8511. ;
  8512. goog.color.hslDistance = function (a, b) {
  8513. var c = .5 >= a[2] ? a[1] * a[2] : a[1] * (1 - a[2]);
  8514. var d = .5 >= b[2] ? b[1] * b[2] : b[1] * (1 - b[2]);
  8515. return (a[2] - b[2]) * (a[2] - b[2]) + c * c + d * d - 2 * c * d * Math.cos(2 * (a[0] / 360 - b[0] / 360) * Math.PI)
  8516. }
  8517. ;
  8518. goog.color.blend = function (a, b, c) {
  8519. c = goog.math.clamp(c, 0, 1);
  8520. return [Math.round(b[0] + c * (a[0] - b[0])), Math.round(b[1] + c * (a[1] - b[1])), Math.round(b[2] + c * (a[2] - b[2]))]
  8521. }
  8522. ;
  8523. goog.color.darken = function (a, b) {
  8524. return goog.color.blend([0, 0, 0], a, b)
  8525. }
  8526. ;
  8527. goog.color.lighten = function (a, b) {
  8528. return goog.color.blend([255, 255, 255], a, b)
  8529. }
  8530. ;
  8531. goog.color.highContrast = function (a, b) {
  8532. for (var c = [], d = 0; d < b.length; d++)
  8533. c.push({
  8534. color: b[d],
  8535. diff: goog.color.yiqBrightnessDiff_(b[d], a) + goog.color.colorDiff_(b[d], a)
  8536. });
  8537. c.sort(function (a, b) {
  8538. return b.diff - a.diff
  8539. });
  8540. return c[0].color
  8541. }
  8542. ;
  8543. goog.color.yiqBrightness_ = function (a) {
  8544. return Math.round((299 * a[0] + 587 * a[1] + 114 * a[2]) / 1E3)
  8545. }
  8546. ;
  8547. goog.color.yiqBrightnessDiff_ = function (a, b) {
  8548. return Math.abs(goog.color.yiqBrightness_(a) - goog.color.yiqBrightness_(b))
  8549. }
  8550. ;
  8551. goog.color.colorDiff_ = function (a, b) {
  8552. return Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]) + Math.abs(a[2] - b[2])
  8553. }
  8554. ;
  8555. goog.dom.vendor = {};
  8556. goog.dom.vendor.getVendorJsPrefix = function () {
  8557. return goog.userAgent.WEBKIT ? "Webkit" : goog.userAgent.GECKO ? "Moz" : goog.userAgent.IE ? "ms" : goog.userAgent.OPERA ? "O" : null
  8558. }
  8559. ;
  8560. goog.dom.vendor.getVendorPrefix = function () {
  8561. return goog.userAgent.WEBKIT ? "-webkit" : goog.userAgent.GECKO ? "-moz" : goog.userAgent.IE ? "-ms" : goog.userAgent.OPERA ? "-o" : null
  8562. }
  8563. ;
  8564. goog.dom.vendor.getPrefixedPropertyName = function (a, b) {
  8565. if (b && a in b)
  8566. return a;
  8567. var c = goog.dom.vendor.getVendorJsPrefix();
  8568. return c ? (c = c.toLowerCase(),
  8569. c += goog.string.toTitleCase(a),
  8570. void 0 === b || c in b ? c : null) : null
  8571. }
  8572. ;
  8573. goog.dom.vendor.getPrefixedEventType = function (a) {
  8574. return ((goog.dom.vendor.getVendorJsPrefix() || "") + a).toLowerCase()
  8575. }
  8576. ;
  8577. goog.math.Box = function (a, b, c, d) {
  8578. this.top = a;
  8579. this.right = b;
  8580. this.bottom = c;
  8581. this.left = d
  8582. }
  8583. ;
  8584. goog.math.Box.boundingBox = function (a) {
  8585. for (var b = new goog.math.Box(arguments[0].y, arguments[0].x, arguments[0].y, arguments[0].x), c = 1; c < arguments.length; c++)
  8586. b.expandToIncludeCoordinate(arguments[c]);
  8587. return b
  8588. }
  8589. ;
  8590. goog.math.Box.prototype.getWidth = function () {
  8591. return this.right - this.left
  8592. }
  8593. ;
  8594. goog.math.Box.prototype.getHeight = function () {
  8595. return this.bottom - this.top
  8596. }
  8597. ;
  8598. goog.math.Box.prototype.clone = function () {
  8599. return new goog.math.Box(this.top, this.right, this.bottom, this.left)
  8600. }
  8601. ;
  8602. goog.DEBUG && (goog.math.Box.prototype.toString = function () {
  8603. return "(" + this.top + "t, " + this.right + "r, " + this.bottom + "b, " + this.left + "l)"
  8604. }
  8605. );
  8606. goog.math.Box.prototype.contains = function (a) {
  8607. return goog.math.Box.contains(this, a)
  8608. }
  8609. ;
  8610. goog.math.Box.prototype.expand = function (a, b, c, d) {
  8611. goog.isObject(a) ? (this.top -= a.top,
  8612. this.right += a.right,
  8613. this.bottom += a.bottom,
  8614. this.left -= a.left) : (this.top -= a,
  8615. this.right += Number(b),
  8616. this.bottom += Number(c),
  8617. this.left -= Number(d));
  8618. return this
  8619. }
  8620. ;
  8621. goog.math.Box.prototype.expandToInclude = function (a) {
  8622. this.left = Math.min(this.left, a.left);
  8623. this.top = Math.min(this.top, a.top);
  8624. this.right = Math.max(this.right, a.right);
  8625. this.bottom = Math.max(this.bottom, a.bottom)
  8626. }
  8627. ;
  8628. goog.math.Box.prototype.expandToIncludeCoordinate = function (a) {
  8629. this.top = Math.min(this.top, a.y);
  8630. this.right = Math.max(this.right, a.x);
  8631. this.bottom = Math.max(this.bottom, a.y);
  8632. this.left = Math.min(this.left, a.x)
  8633. }
  8634. ;
  8635. goog.math.Box.equals = function (a, b) {
  8636. return a == b ? !0 : a && b ? a.top == b.top && a.right == b.right && a.bottom == b.bottom && a.left == b.left : !1
  8637. }
  8638. ;
  8639. goog.math.Box.contains = function (a, b) {
  8640. return a && b ? b instanceof goog.math.Box ? b.left >= a.left && b.right <= a.right && b.top >= a.top && b.bottom <= a.bottom : b.x >= a.left && b.x <= a.right && b.y >= a.top && b.y <= a.bottom : !1
  8641. }
  8642. ;
  8643. goog.math.Box.relativePositionX = function (a, b) {
  8644. return b.x < a.left ? b.x - a.left : b.x > a.right ? b.x - a.right : 0
  8645. }
  8646. ;
  8647. goog.math.Box.relativePositionY = function (a, b) {
  8648. return b.y < a.top ? b.y - a.top : b.y > a.bottom ? b.y - a.bottom : 0
  8649. }
  8650. ;
  8651. goog.math.Box.distance = function (a, b) {
  8652. var c = goog.math.Box.relativePositionX(a, b)
  8653. , d = goog.math.Box.relativePositionY(a, b);
  8654. return Math.sqrt(c * c + d * d)
  8655. }
  8656. ;
  8657. goog.math.Box.intersects = function (a, b) {
  8658. return a.left <= b.right && b.left <= a.right && a.top <= b.bottom && b.top <= a.bottom
  8659. }
  8660. ;
  8661. goog.math.Box.intersectsWithPadding = function (a, b, c) {
  8662. return a.left <= b.right + c && b.left <= a.right + c && a.top <= b.bottom + c && b.top <= a.bottom + c
  8663. }
  8664. ;
  8665. goog.math.Box.prototype.ceil = function () {
  8666. this.top = Math.ceil(this.top);
  8667. this.right = Math.ceil(this.right);
  8668. this.bottom = Math.ceil(this.bottom);
  8669. this.left = Math.ceil(this.left);
  8670. return this
  8671. }
  8672. ;
  8673. goog.math.Box.prototype.floor = function () {
  8674. this.top = Math.floor(this.top);
  8675. this.right = Math.floor(this.right);
  8676. this.bottom = Math.floor(this.bottom);
  8677. this.left = Math.floor(this.left);
  8678. return this
  8679. }
  8680. ;
  8681. goog.math.Box.prototype.round = function () {
  8682. this.top = Math.round(this.top);
  8683. this.right = Math.round(this.right);
  8684. this.bottom = Math.round(this.bottom);
  8685. this.left = Math.round(this.left);
  8686. return this
  8687. }
  8688. ;
  8689. goog.math.Box.prototype.translate = function (a, b) {
  8690. a instanceof goog.math.Coordinate ? (this.left += a.x,
  8691. this.right += a.x,
  8692. this.top += a.y,
  8693. this.bottom += a.y) : (goog.asserts.assertNumber(a),
  8694. this.left += a,
  8695. this.right += a,
  8696. "number" === typeof b && (this.top += b,
  8697. this.bottom += b));
  8698. return this
  8699. }
  8700. ;
  8701. goog.math.Box.prototype.scale = function (a, b) {
  8702. var c = "number" === typeof b ? b : a;
  8703. this.left *= a;
  8704. this.right *= a;
  8705. this.top *= c;
  8706. this.bottom *= c;
  8707. return this
  8708. }
  8709. ;
  8710. goog.math.IRect = function () { }
  8711. ;
  8712. goog.math.Rect = function (a, b, c, d) {
  8713. this.left = a;
  8714. this.top = b;
  8715. this.width = c;
  8716. this.height = d
  8717. }
  8718. ;
  8719. goog.math.Rect.prototype.clone = function () {
  8720. return new goog.math.Rect(this.left, this.top, this.width, this.height)
  8721. }
  8722. ;
  8723. goog.math.Rect.prototype.toBox = function () {
  8724. return new goog.math.Box(this.top, this.left + this.width, this.top + this.height, this.left)
  8725. }
  8726. ;
  8727. goog.math.Rect.createFromPositionAndSize = function (a, b) {
  8728. return new goog.math.Rect(a.x, a.y, b.width, b.height)
  8729. }
  8730. ;
  8731. goog.math.Rect.createFromBox = function (a) {
  8732. return new goog.math.Rect(a.left, a.top, a.right - a.left, a.bottom - a.top)
  8733. }
  8734. ;
  8735. goog.DEBUG && (goog.math.Rect.prototype.toString = function () {
  8736. return "(" + this.left + ", " + this.top + " - " + this.width + "w x " + this.height + "h)"
  8737. }
  8738. );
  8739. goog.math.Rect.equals = function (a, b) {
  8740. return a == b ? !0 : a && b ? a.left == b.left && a.width == b.width && a.top == b.top && a.height == b.height : !1
  8741. }
  8742. ;
  8743. goog.math.Rect.prototype.intersection = function (a) {
  8744. var b = Math.max(this.left, a.left)
  8745. , c = Math.min(this.left + this.width, a.left + a.width);
  8746. if (b <= c) {
  8747. var d = Math.max(this.top, a.top);
  8748. a = Math.min(this.top + this.height, a.top + a.height);
  8749. if (d <= a)
  8750. return this.left = b,
  8751. this.top = d,
  8752. this.width = c - b,
  8753. this.height = a - d,
  8754. !0
  8755. }
  8756. return !1
  8757. }
  8758. ;
  8759. goog.math.Rect.intersection = function (a, b) {
  8760. var c = Math.max(a.left, b.left)
  8761. , d = Math.min(a.left + a.width, b.left + b.width);
  8762. if (c <= d) {
  8763. var e = Math.max(a.top, b.top)
  8764. , f = Math.min(a.top + a.height, b.top + b.height);
  8765. if (e <= f)
  8766. return new goog.math.Rect(c, e, d - c, f - e)
  8767. }
  8768. return null
  8769. }
  8770. ;
  8771. goog.math.Rect.intersects = function (a, b) {
  8772. return a.left <= b.left + b.width && b.left <= a.left + a.width && a.top <= b.top + b.height && b.top <= a.top + a.height
  8773. }
  8774. ;
  8775. goog.math.Rect.prototype.intersects = function (a) {
  8776. return goog.math.Rect.intersects(this, a)
  8777. }
  8778. ;
  8779. goog.math.Rect.difference = function (a, b) {
  8780. var c = goog.math.Rect.intersection(a, b);
  8781. if (!c || !c.height || !c.width)
  8782. return [a.clone()];
  8783. c = [];
  8784. var d = a.top
  8785. , e = a.height
  8786. , f = a.left + a.width
  8787. , g = a.top + a.height
  8788. , h = b.left + b.width
  8789. , k = b.top + b.height;
  8790. b.top > a.top && (c.push(new goog.math.Rect(a.left, a.top, a.width, b.top - a.top)),
  8791. d = b.top,
  8792. e -= b.top - a.top);
  8793. k < g && (c.push(new goog.math.Rect(a.left, k, a.width, g - k)),
  8794. e = k - d);
  8795. b.left > a.left && c.push(new goog.math.Rect(a.left, d, b.left - a.left, e));
  8796. h < f && c.push(new goog.math.Rect(h, d, f - h, e));
  8797. return c
  8798. }
  8799. ;
  8800. goog.math.Rect.prototype.difference = function (a) {
  8801. return goog.math.Rect.difference(this, a)
  8802. }
  8803. ;
  8804. goog.math.Rect.prototype.boundingRect = function (a) {
  8805. var b = Math.max(this.left + this.width, a.left + a.width)
  8806. , c = Math.max(this.top + this.height, a.top + a.height);
  8807. this.left = Math.min(this.left, a.left);
  8808. this.top = Math.min(this.top, a.top);
  8809. this.width = b - this.left;
  8810. this.height = c - this.top
  8811. }
  8812. ;
  8813. goog.math.Rect.boundingRect = function (a, b) {
  8814. if (!a || !b)
  8815. return null;
  8816. var c = new goog.math.Rect(a.left, a.top, a.width, a.height);
  8817. c.boundingRect(b);
  8818. return c
  8819. }
  8820. ;
  8821. goog.math.Rect.prototype.contains = function (a) {
  8822. return a instanceof goog.math.Coordinate ? a.x >= this.left && a.x <= this.left + this.width && a.y >= this.top && a.y <= this.top + this.height : this.left <= a.left && this.left + this.width >= a.left + a.width && this.top <= a.top && this.top + this.height >= a.top + a.height
  8823. }
  8824. ;
  8825. goog.math.Rect.prototype.squaredDistance = function (a) {
  8826. var b = a.x < this.left ? this.left - a.x : Math.max(a.x - (this.left + this.width), 0);
  8827. a = a.y < this.top ? this.top - a.y : Math.max(a.y - (this.top + this.height), 0);
  8828. return b * b + a * a
  8829. }
  8830. ;
  8831. goog.math.Rect.prototype.distance = function (a) {
  8832. return Math.sqrt(this.squaredDistance(a))
  8833. }
  8834. ;
  8835. goog.math.Rect.prototype.getSize = function () {
  8836. return new goog.math.Size(this.width, this.height)
  8837. }
  8838. ;
  8839. goog.math.Rect.prototype.getTopLeft = function () {
  8840. return new goog.math.Coordinate(this.left, this.top)
  8841. }
  8842. ;
  8843. goog.math.Rect.prototype.getCenter = function () {
  8844. return new goog.math.Coordinate(this.left + this.width / 2, this.top + this.height / 2)
  8845. }
  8846. ;
  8847. goog.math.Rect.prototype.getBottomRight = function () {
  8848. return new goog.math.Coordinate(this.left + this.width, this.top + this.height)
  8849. }
  8850. ;
  8851. goog.math.Rect.prototype.ceil = function () {
  8852. this.left = Math.ceil(this.left);
  8853. this.top = Math.ceil(this.top);
  8854. this.width = Math.ceil(this.width);
  8855. this.height = Math.ceil(this.height);
  8856. return this
  8857. }
  8858. ;
  8859. goog.math.Rect.prototype.floor = function () {
  8860. this.left = Math.floor(this.left);
  8861. this.top = Math.floor(this.top);
  8862. this.width = Math.floor(this.width);
  8863. this.height = Math.floor(this.height);
  8864. return this
  8865. }
  8866. ;
  8867. goog.math.Rect.prototype.round = function () {
  8868. this.left = Math.round(this.left);
  8869. this.top = Math.round(this.top);
  8870. this.width = Math.round(this.width);
  8871. this.height = Math.round(this.height);
  8872. return this
  8873. }
  8874. ;
  8875. goog.math.Rect.prototype.translate = function (a, b) {
  8876. a instanceof goog.math.Coordinate ? (this.left += a.x,
  8877. this.top += a.y) : (this.left += goog.asserts.assertNumber(a),
  8878. "number" === typeof b && (this.top += b));
  8879. return this
  8880. }
  8881. ;
  8882. goog.math.Rect.prototype.scale = function (a, b) {
  8883. var c = "number" === typeof b ? b : a;
  8884. this.left *= a;
  8885. this.width *= a;
  8886. this.top *= c;
  8887. this.height *= c;
  8888. return this
  8889. }
  8890. ;
  8891. goog.style = {};
  8892. goog.style.setStyle = function (a, b, c) {
  8893. if ("string" === typeof b)
  8894. goog.style.setStyle_(a, c, b);
  8895. else
  8896. for (var d in b)
  8897. goog.style.setStyle_(a, b[d], d)
  8898. }
  8899. ;
  8900. goog.style.setStyle_ = function (a, b, c) {
  8901. (c = goog.style.getVendorJsStyleName_(a, c)) && (a.style[c] = b)
  8902. }
  8903. ;
  8904. goog.style.styleNameCache_ = {};
  8905. goog.style.getVendorJsStyleName_ = function (a, b) {
  8906. var c = goog.style.styleNameCache_[b];
  8907. if (!c) {
  8908. var d = goog.string.toCamelCase(b);
  8909. c = d;
  8910. void 0 === a.style[d] && (d = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(d),
  8911. void 0 !== a.style[d] && (c = d));
  8912. goog.style.styleNameCache_[b] = c
  8913. }
  8914. return c
  8915. }
  8916. ;
  8917. goog.style.getVendorStyleName_ = function (a, b) {
  8918. var c = goog.string.toCamelCase(b);
  8919. return void 0 === a.style[c] && (c = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(c),
  8920. void 0 !== a.style[c]) ? goog.dom.vendor.getVendorPrefix() + "-" + b : b
  8921. }
  8922. ;
  8923. goog.style.getStyle = function (a, b) {
  8924. var c = a.style[goog.string.toCamelCase(b)];
  8925. return "undefined" !== typeof c ? c : a.style[goog.style.getVendorJsStyleName_(a, b)] || ""
  8926. }
  8927. ;
  8928. goog.style.getComputedStyle = function (a, b) {
  8929. var c = goog.dom.getOwnerDocument(a);
  8930. return c.defaultView && c.defaultView.getComputedStyle && (c = c.defaultView.getComputedStyle(a, null)) ? c[b] || c.getPropertyValue(b) || "" : ""
  8931. }
  8932. ;
  8933. goog.style.getCascadedStyle = function (a, b) {
  8934. return a.currentStyle ? a.currentStyle[b] : null
  8935. }
  8936. ;
  8937. goog.style.getStyle_ = function (a, b) {
  8938. return goog.style.getComputedStyle(a, b) || goog.style.getCascadedStyle(a, b) || a.style && a.style[b]
  8939. }
  8940. ;
  8941. goog.style.getComputedBoxSizing = function (a) {
  8942. return goog.style.getStyle_(a, "boxSizing") || goog.style.getStyle_(a, "MozBoxSizing") || goog.style.getStyle_(a, "WebkitBoxSizing") || null
  8943. }
  8944. ;
  8945. goog.style.getComputedPosition = function (a) {
  8946. return goog.style.getStyle_(a, "position")
  8947. }
  8948. ;
  8949. goog.style.getBackgroundColor = function (a) {
  8950. return goog.style.getStyle_(a, "backgroundColor")
  8951. }
  8952. ;
  8953. goog.style.getComputedOverflowX = function (a) {
  8954. return goog.style.getStyle_(a, "overflowX")
  8955. }
  8956. ;
  8957. goog.style.getComputedOverflowY = function (a) {
  8958. return goog.style.getStyle_(a, "overflowY")
  8959. }
  8960. ;
  8961. goog.style.getComputedZIndex = function (a) {
  8962. return goog.style.getStyle_(a, "zIndex")
  8963. }
  8964. ;
  8965. goog.style.getComputedTextAlign = function (a) {
  8966. return goog.style.getStyle_(a, "textAlign")
  8967. }
  8968. ;
  8969. goog.style.getComputedCursor = function (a) {
  8970. return goog.style.getStyle_(a, "cursor")
  8971. }
  8972. ;
  8973. goog.style.getComputedTransform = function (a) {
  8974. var b = goog.style.getVendorStyleName_(a, "transform");
  8975. return goog.style.getStyle_(a, b) || goog.style.getStyle_(a, "transform")
  8976. }
  8977. ;
  8978. goog.style.setPosition = function (a, b, c) {
  8979. if (b instanceof goog.math.Coordinate) {
  8980. var d = b.x;
  8981. b = b.y
  8982. } else
  8983. d = b,
  8984. b = c;
  8985. a.style.left = goog.style.getPixelStyleValue_(d, !1);
  8986. a.style.top = goog.style.getPixelStyleValue_(b, !1)
  8987. }
  8988. ;
  8989. goog.style.getPosition = function (a) {
  8990. return new goog.math.Coordinate(a.offsetLeft, a.offsetTop)
  8991. }
  8992. ;
  8993. goog.style.getClientViewportElement = function (a) {
  8994. a = a ? goog.dom.getOwnerDocument(a) : goog.dom.getDocument();
  8995. return !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9) || goog.dom.getDomHelper(a).isCss1CompatMode() ? a.documentElement : a.body
  8996. }
  8997. ;
  8998. goog.style.getViewportPageOffset = function (a) {
  8999. var b = a.body;
  9000. a = a.documentElement;
  9001. return new goog.math.Coordinate(b.scrollLeft || a.scrollLeft, b.scrollTop || a.scrollTop)
  9002. }
  9003. ;
  9004. goog.style.getBoundingClientRect_ = function (a) {
  9005. try {
  9006. var b = a.getBoundingClientRect()
  9007. } catch (c) {
  9008. return {
  9009. left: 0,
  9010. top: 0,
  9011. right: 0,
  9012. bottom: 0
  9013. }
  9014. }
  9015. goog.userAgent.IE && a.ownerDocument.body && (a = a.ownerDocument,
  9016. b.left -= a.documentElement.clientLeft + a.body.clientLeft,
  9017. b.top -= a.documentElement.clientTop + a.body.clientTop);
  9018. return b
  9019. }
  9020. ;
  9021. goog.style.getOffsetParent = function (a) {
  9022. if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(8))
  9023. return goog.asserts.assert(a && "offsetParent" in a),
  9024. a.offsetParent;
  9025. var b = goog.dom.getOwnerDocument(a)
  9026. , c = goog.style.getStyle_(a, "position")
  9027. , d = "fixed" == c || "absolute" == c;
  9028. for (a = a.parentNode; a && a != b; a = a.parentNode)
  9029. if (a.nodeType == goog.dom.NodeType.DOCUMENT_FRAGMENT && a.host && (a = a.host),
  9030. c = goog.style.getStyle_(a, "position"),
  9031. d = d && "static" == c && a != b.documentElement && a != b.body,
  9032. !d && (a.scrollWidth > a.clientWidth || a.scrollHeight > a.clientHeight || "fixed" == c || "absolute" == c || "relative" == c))
  9033. return a;
  9034. return null
  9035. }
  9036. ;
  9037. goog.style.getVisibleRectForElement = function (a) {
  9038. for (var b = new goog.math.Box(0, Infinity, Infinity, 0), c = goog.dom.getDomHelper(a), d = c.getDocument().body, e = c.getDocument().documentElement, f = c.getDocumentScrollElement(); a = goog.style.getOffsetParent(a);)
  9039. if (!(goog.userAgent.IE && 0 == a.clientWidth || goog.userAgent.WEBKIT && 0 == a.clientHeight && a == d) && a != d && a != e && "visible" != goog.style.getStyle_(a, "overflow")) {
  9040. var g = goog.style.getPageOffset(a)
  9041. , h = goog.style.getClientLeftTop(a);
  9042. g.x += h.x;
  9043. g.y += h.y;
  9044. b.top = Math.max(b.top, g.y);
  9045. b.right = Math.min(b.right, g.x + a.clientWidth);
  9046. b.bottom = Math.min(b.bottom, g.y + a.clientHeight);
  9047. b.left = Math.max(b.left, g.x)
  9048. }
  9049. d = f.scrollLeft;
  9050. f = f.scrollTop;
  9051. b.left = Math.max(b.left, d);
  9052. b.top = Math.max(b.top, f);
  9053. c = c.getViewportSize();
  9054. b.right = Math.min(b.right, d + c.width);
  9055. b.bottom = Math.min(b.bottom, f + c.height);
  9056. return 0 <= b.top && 0 <= b.left && b.bottom > b.top && b.right > b.left ? b : null
  9057. }
  9058. ;
  9059. goog.style.getContainerOffsetToScrollInto = function (a, b, c) {
  9060. var d = b || goog.dom.getDocumentScrollElement()
  9061. , e = goog.style.getPageOffset(a)
  9062. , f = goog.style.getPageOffset(d)
  9063. , g = goog.style.getBorderBox(d);
  9064. d == goog.dom.getDocumentScrollElement() ? (b = e.x - d.scrollLeft,
  9065. e = e.y - d.scrollTop,
  9066. goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(10) && (b += g.left,
  9067. e += g.top)) : (b = e.x - f.x - g.left,
  9068. e = e.y - f.y - g.top);
  9069. g = goog.style.getSizeWithDisplay_(a);
  9070. a = d.clientWidth - g.width;
  9071. g = d.clientHeight - g.height;
  9072. f = d.scrollLeft;
  9073. d = d.scrollTop;
  9074. c ? (f += b - a / 2,
  9075. d += e - g / 2) : (f += Math.min(b, Math.max(b - a, 0)),
  9076. d += Math.min(e, Math.max(e - g, 0)));
  9077. return new goog.math.Coordinate(f, d)
  9078. }
  9079. ;
  9080. goog.style.scrollIntoContainerView = function (a, b, c) {
  9081. b = b || goog.dom.getDocumentScrollElement();
  9082. a = goog.style.getContainerOffsetToScrollInto(a, b, c);
  9083. b.scrollLeft = a.x;
  9084. b.scrollTop = a.y
  9085. }
  9086. ;
  9087. goog.style.getClientLeftTop = function (a) {
  9088. return new goog.math.Coordinate(a.clientLeft, a.clientTop)
  9089. }
  9090. ;
  9091. goog.style.getPageOffset = function (a) {
  9092. var b = goog.dom.getOwnerDocument(a);
  9093. goog.asserts.assertObject(a, "Parameter is required");
  9094. var c = new goog.math.Coordinate(0, 0)
  9095. , d = goog.style.getClientViewportElement(b);
  9096. if (a == d)
  9097. return c;
  9098. a = goog.style.getBoundingClientRect_(a);
  9099. b = goog.dom.getDomHelper(b).getDocumentScroll();
  9100. c.x = a.left + b.x;
  9101. c.y = a.top + b.y;
  9102. return c
  9103. }
  9104. ;
  9105. goog.style.getPageOffsetLeft = function (a) {
  9106. return goog.style.getPageOffset(a).x
  9107. }
  9108. ;
  9109. goog.style.getPageOffsetTop = function (a) {
  9110. return goog.style.getPageOffset(a).y
  9111. }
  9112. ;
  9113. goog.style.getFramedPageOffset = function (a, b) {
  9114. var c = new goog.math.Coordinate(0, 0)
  9115. , d = goog.dom.getWindow(goog.dom.getOwnerDocument(a));
  9116. if (!goog.reflect.canAccessProperty(d, "parent"))
  9117. return c;
  9118. var e = a;
  9119. do {
  9120. var f = d == b ? goog.style.getPageOffset(e) : goog.style.getClientPositionForElement_(goog.asserts.assert(e));
  9121. c.x += f.x;
  9122. c.y += f.y
  9123. } while (d && d != b && d != d.parent && (e = d.frameElement) && (d = d.parent)); return c
  9124. }
  9125. ;
  9126. goog.style.translateRectForAnotherFrame = function (a, b, c) {
  9127. if (b.getDocument() != c.getDocument()) {
  9128. var d = b.getDocument().body;
  9129. c = goog.style.getFramedPageOffset(d, c.getWindow());
  9130. c = goog.math.Coordinate.difference(c, goog.style.getPageOffset(d));
  9131. !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9) || b.isCss1CompatMode() || (c = goog.math.Coordinate.difference(c, b.getDocumentScroll()));
  9132. a.left += c.x;
  9133. a.top += c.y
  9134. }
  9135. }
  9136. ;
  9137. goog.style.getRelativePosition = function (a, b) {
  9138. var c = goog.style.getClientPosition(a)
  9139. , d = goog.style.getClientPosition(b);
  9140. return new goog.math.Coordinate(c.x - d.x, c.y - d.y)
  9141. }
  9142. ;
  9143. goog.style.getClientPositionForElement_ = function (a) {
  9144. a = goog.style.getBoundingClientRect_(a);
  9145. return new goog.math.Coordinate(a.left, a.top)
  9146. }
  9147. ;
  9148. goog.style.getClientPosition = function (a) {
  9149. goog.asserts.assert(a);
  9150. if (a.nodeType == goog.dom.NodeType.ELEMENT)
  9151. return goog.style.getClientPositionForElement_(a);
  9152. a = a.changedTouches ? a.changedTouches[0] : a;
  9153. return new goog.math.Coordinate(a.clientX, a.clientY)
  9154. }
  9155. ;
  9156. goog.style.setPageOffset = function (a, b, c) {
  9157. var d = goog.style.getPageOffset(a);
  9158. b instanceof goog.math.Coordinate && (c = b.y,
  9159. b = b.x);
  9160. b = goog.asserts.assertNumber(b) - d.x;
  9161. goog.style.setPosition(a, a.offsetLeft + b, a.offsetTop + (Number(c) - d.y))
  9162. }
  9163. ;
  9164. goog.style.setSize = function (a, b, c) {
  9165. if (b instanceof goog.math.Size)
  9166. c = b.height,
  9167. b = b.width;
  9168. else if (void 0 == c)
  9169. throw Error("missing height argument");
  9170. goog.style.setWidth(a, b);
  9171. goog.style.setHeight(a, c)
  9172. }
  9173. ;
  9174. goog.style.getPixelStyleValue_ = function (a, b) {
  9175. "number" == typeof a && (a = (b ? Math.round(a) : a) + "px");
  9176. return a
  9177. }
  9178. ;
  9179. goog.style.setHeight = function (a, b) {
  9180. a.style.height = goog.style.getPixelStyleValue_(b, !0)
  9181. }
  9182. ;
  9183. goog.style.setWidth = function (a, b) {
  9184. a.style.width = goog.style.getPixelStyleValue_(b, !0)
  9185. }
  9186. ;
  9187. goog.style.getSize = function (a) {
  9188. return goog.style.evaluateWithTemporaryDisplay_(goog.style.getSizeWithDisplay_, a)
  9189. }
  9190. ;
  9191. goog.style.evaluateWithTemporaryDisplay_ = function (a, b) {
  9192. if ("none" != goog.style.getStyle_(b, "display"))
  9193. return a(b);
  9194. var c = b.style
  9195. , d = c.display
  9196. , e = c.visibility
  9197. , f = c.position;
  9198. c.visibility = "hidden";
  9199. c.position = "absolute";
  9200. c.display = "inline";
  9201. var g = a(b);
  9202. c.display = d;
  9203. c.position = f;
  9204. c.visibility = e;
  9205. return g
  9206. }
  9207. ;
  9208. goog.style.getSizeWithDisplay_ = function (a) {
  9209. var b = a.offsetWidth
  9210. , c = a.offsetHeight
  9211. , d = goog.userAgent.WEBKIT && !b && !c;
  9212. return (void 0 === b || d) && a.getBoundingClientRect ? (a = goog.style.getBoundingClientRect_(a),
  9213. new goog.math.Size(a.right - a.left, a.bottom - a.top)) : new goog.math.Size(b, c)
  9214. }
  9215. ;
  9216. goog.style.getTransformedSize = function (a) {
  9217. if (!a.getBoundingClientRect)
  9218. return null;
  9219. a = goog.style.evaluateWithTemporaryDisplay_(goog.style.getBoundingClientRect_, a);
  9220. return new goog.math.Size(a.right - a.left, a.bottom - a.top)
  9221. }
  9222. ;
  9223. goog.style.getBounds = function (a) {
  9224. var b = goog.style.getPageOffset(a);
  9225. a = goog.style.getSize(a);
  9226. return new goog.math.Rect(b.x, b.y, a.width, a.height)
  9227. }
  9228. ;
  9229. goog.style.toCamelCase = function (a) {
  9230. return goog.string.toCamelCase(String(a))
  9231. }
  9232. ;
  9233. goog.style.toSelectorCase = function (a) {
  9234. return goog.string.toSelectorCase(a)
  9235. }
  9236. ;
  9237. goog.style.getOpacity = function (a) {
  9238. goog.asserts.assert(a);
  9239. var b = a.style;
  9240. a = "";
  9241. "opacity" in b ? a = b.opacity : "MozOpacity" in b ? a = b.MozOpacity : "filter" in b && (b = b.filter.match(/alpha\(opacity=([\d.]+)\)/)) && (a = String(b[1] / 100));
  9242. return "" == a ? a : Number(a)
  9243. }
  9244. ;
  9245. goog.style.setOpacity = function (a, b) {
  9246. goog.asserts.assert(a);
  9247. var c = a.style;
  9248. "opacity" in c ? c.opacity = b : "MozOpacity" in c ? c.MozOpacity = b : "filter" in c && (c.filter = "" === b ? "" : "alpha(opacity=" + 100 * Number(b) + ")")
  9249. }
  9250. ;
  9251. goog.style.setTransparentBackgroundImage = function (a, b) {
  9252. var c = a.style;
  9253. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? c.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + b + '", sizingMethod="crop")' : (c.backgroundImage = "url(" + b + ")",
  9254. c.backgroundPosition = "top left",
  9255. c.backgroundRepeat = "no-repeat")
  9256. }
  9257. ;
  9258. goog.style.clearTransparentBackgroundImage = function (a) {
  9259. a = a.style;
  9260. "filter" in a ? a.filter = "" : a.backgroundImage = "none"
  9261. }
  9262. ;
  9263. goog.style.showElement = function (a, b) {
  9264. goog.style.setElementShown(a, b)
  9265. }
  9266. ;
  9267. goog.style.setElementShown = function (a, b) {
  9268. a.style.display = b ? "" : "none"
  9269. }
  9270. ;
  9271. goog.style.isElementShown = function (a) {
  9272. return "none" != a.style.display
  9273. }
  9274. ;
  9275. goog.style.installSafeStyleSheet = function (a, b) {
  9276. var c = goog.dom.getDomHelper(b)
  9277. , d = c.getDocument();
  9278. if (goog.userAgent.IE && d.createStyleSheet)
  9279. return c = d.createStyleSheet(),
  9280. goog.style.setSafeStyleSheet(c, a),
  9281. c;
  9282. d = c.getElementsByTagNameAndClass("HEAD")[0];
  9283. if (!d) {
  9284. var e = c.getElementsByTagNameAndClass("BODY")[0];
  9285. d = c.createDom("HEAD");
  9286. e.parentNode.insertBefore(d, e)
  9287. }
  9288. e = c.createDom("STYLE");
  9289. goog.style.setSafeStyleSheet(e, a);
  9290. c.appendChild(d, e);
  9291. return e
  9292. }
  9293. ;
  9294. goog.style.uninstallStyles = function (a) {
  9295. goog.dom.removeNode(a.ownerNode || a.owningElement || a)
  9296. }
  9297. ;
  9298. goog.style.setSafeStyleSheet = function (a, b) {
  9299. var c = goog.html.SafeStyleSheet.unwrap(b);
  9300. goog.userAgent.IE && void 0 !== a.cssText ? a.cssText = c : a.innerHTML = c
  9301. }
  9302. ;
  9303. goog.style.setPreWrap = function (a) {
  9304. a = a.style;
  9305. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? (a.whiteSpace = "pre",
  9306. a.wordWrap = "break-word") : a.whiteSpace = goog.userAgent.GECKO ? "-moz-pre-wrap" : "pre-wrap"
  9307. }
  9308. ;
  9309. goog.style.setInlineBlock = function (a) {
  9310. a = a.style;
  9311. a.position = "relative";
  9312. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8") ? (a.zoom = "1",
  9313. a.display = "inline") : a.display = "inline-block"
  9314. }
  9315. ;
  9316. goog.style.isRightToLeft = function (a) {
  9317. return "rtl" == goog.style.getStyle_(a, "direction")
  9318. }
  9319. ;
  9320. goog.style.unselectableStyle_ = goog.userAgent.GECKO ? "MozUserSelect" : goog.userAgent.WEBKIT || goog.userAgent.EDGE ? "WebkitUserSelect" : null;
  9321. goog.style.isUnselectable = function (a) {
  9322. return goog.style.unselectableStyle_ ? "none" == a.style[goog.style.unselectableStyle_].toLowerCase() : goog.userAgent.IE || goog.userAgent.OPERA ? "on" == a.getAttribute("unselectable") : !1
  9323. }
  9324. ;
  9325. goog.style.setUnselectable = function (a, b, c) {
  9326. c = c ? null : a.getElementsByTagName("*");
  9327. var d = goog.style.unselectableStyle_;
  9328. if (d) {
  9329. if (b = b ? "none" : "",
  9330. a.style && (a.style[d] = b),
  9331. c) {
  9332. a = 0;
  9333. for (var e; e = c[a]; a++)
  9334. e.style && (e.style[d] = b)
  9335. }
  9336. } else if (goog.userAgent.IE || goog.userAgent.OPERA)
  9337. if (b = b ? "on" : "",
  9338. a.setAttribute("unselectable", b),
  9339. c)
  9340. for (a = 0; e = c[a]; a++)
  9341. e.setAttribute("unselectable", b)
  9342. }
  9343. ;
  9344. goog.style.getBorderBoxSize = function (a) {
  9345. return new goog.math.Size(a.offsetWidth, a.offsetHeight)
  9346. }
  9347. ;
  9348. goog.style.setBorderBoxSize = function (a, b) {
  9349. var c = goog.dom.getOwnerDocument(a)
  9350. , d = goog.dom.getDomHelper(c).isCss1CompatMode();
  9351. if (!goog.userAgent.IE || goog.userAgent.isVersionOrHigher("10") || d && goog.userAgent.isVersionOrHigher("8"))
  9352. goog.style.setBoxSizingSize_(a, b, "border-box");
  9353. else if (c = a.style,
  9354. d) {
  9355. d = goog.style.getPaddingBox(a);
  9356. var e = goog.style.getBorderBox(a);
  9357. c.pixelWidth = b.width - e.left - d.left - d.right - e.right;
  9358. c.pixelHeight = b.height - e.top - d.top - d.bottom - e.bottom
  9359. } else
  9360. c.pixelWidth = b.width,
  9361. c.pixelHeight = b.height
  9362. }
  9363. ;
  9364. goog.style.getContentBoxSize = function (a) {
  9365. var b = goog.dom.getOwnerDocument(a)
  9366. , c = goog.userAgent.IE && a.currentStyle;
  9367. if (c && goog.dom.getDomHelper(b).isCss1CompatMode() && "auto" != c.width && "auto" != c.height && !c.boxSizing)
  9368. return b = goog.style.getIePixelValue_(a, c.width, "width", "pixelWidth"),
  9369. a = goog.style.getIePixelValue_(a, c.height, "height", "pixelHeight"),
  9370. new goog.math.Size(b, a);
  9371. c = goog.style.getBorderBoxSize(a);
  9372. b = goog.style.getPaddingBox(a);
  9373. a = goog.style.getBorderBox(a);
  9374. return new goog.math.Size(c.width - a.left - b.left - b.right - a.right, c.height - a.top - b.top - b.bottom - a.bottom)
  9375. }
  9376. ;
  9377. goog.style.setContentBoxSize = function (a, b) {
  9378. var c = goog.dom.getOwnerDocument(a)
  9379. , d = goog.dom.getDomHelper(c).isCss1CompatMode();
  9380. if (!goog.userAgent.IE || goog.userAgent.isVersionOrHigher("10") || d && goog.userAgent.isVersionOrHigher("8"))
  9381. goog.style.setBoxSizingSize_(a, b, "content-box");
  9382. else if (c = a.style,
  9383. d)
  9384. c.pixelWidth = b.width,
  9385. c.pixelHeight = b.height;
  9386. else {
  9387. d = goog.style.getPaddingBox(a);
  9388. var e = goog.style.getBorderBox(a);
  9389. c.pixelWidth = b.width + e.left + d.left + d.right + e.right;
  9390. c.pixelHeight = b.height + e.top + d.top + d.bottom + e.bottom
  9391. }
  9392. }
  9393. ;
  9394. goog.style.setBoxSizingSize_ = function (a, b, c) {
  9395. a = a.style;
  9396. goog.userAgent.GECKO ? a.MozBoxSizing = c : goog.userAgent.WEBKIT ? a.WebkitBoxSizing = c : a.boxSizing = c;
  9397. a.width = Math.max(b.width, 0) + "px";
  9398. a.height = Math.max(b.height, 0) + "px"
  9399. }
  9400. ;
  9401. goog.style.getIePixelValue_ = function (a, b, c, d) {
  9402. if (/^\d+px?$/.test(b))
  9403. return parseInt(b, 10);
  9404. var e = a.style[c]
  9405. , f = a.runtimeStyle[c];
  9406. a.runtimeStyle[c] = a.currentStyle[c];
  9407. a.style[c] = b;
  9408. b = a.style[d];
  9409. a.style[c] = e;
  9410. a.runtimeStyle[c] = f;
  9411. return +b
  9412. }
  9413. ;
  9414. goog.style.getIePixelDistance_ = function (a, b) {
  9415. var c = goog.style.getCascadedStyle(a, b);
  9416. return c ? goog.style.getIePixelValue_(a, c, "left", "pixelLeft") : 0
  9417. }
  9418. ;
  9419. goog.style.getBox_ = function (a, b) {
  9420. if (goog.userAgent.IE) {
  9421. var c = goog.style.getIePixelDistance_(a, b + "Left")
  9422. , d = goog.style.getIePixelDistance_(a, b + "Right")
  9423. , e = goog.style.getIePixelDistance_(a, b + "Top")
  9424. , f = goog.style.getIePixelDistance_(a, b + "Bottom");
  9425. return new goog.math.Box(e, d, f, c)
  9426. }
  9427. c = goog.style.getComputedStyle(a, b + "Left");
  9428. d = goog.style.getComputedStyle(a, b + "Right");
  9429. e = goog.style.getComputedStyle(a, b + "Top");
  9430. f = goog.style.getComputedStyle(a, b + "Bottom");
  9431. return new goog.math.Box(parseFloat(e), parseFloat(d), parseFloat(f), parseFloat(c))
  9432. }
  9433. ;
  9434. goog.style.getPaddingBox = function (a) {
  9435. return goog.style.getBox_(a, "padding")
  9436. }
  9437. ;
  9438. goog.style.getMarginBox = function (a) {
  9439. return goog.style.getBox_(a, "margin")
  9440. }
  9441. ;
  9442. goog.style.ieBorderWidthKeywords_ = {
  9443. thin: 2,
  9444. medium: 4,
  9445. thick: 6
  9446. };
  9447. goog.style.getIePixelBorder_ = function (a, b) {
  9448. if ("none" == goog.style.getCascadedStyle(a, b + "Style"))
  9449. return 0;
  9450. var c = goog.style.getCascadedStyle(a, b + "Width");
  9451. return c in goog.style.ieBorderWidthKeywords_ ? goog.style.ieBorderWidthKeywords_[c] : goog.style.getIePixelValue_(a, c, "left", "pixelLeft")
  9452. }
  9453. ;
  9454. goog.style.getBorderBox = function (a) {
  9455. if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
  9456. var b = goog.style.getIePixelBorder_(a, "borderLeft")
  9457. , c = goog.style.getIePixelBorder_(a, "borderRight")
  9458. , d = goog.style.getIePixelBorder_(a, "borderTop");
  9459. a = goog.style.getIePixelBorder_(a, "borderBottom");
  9460. return new goog.math.Box(d, c, a, b)
  9461. }
  9462. b = goog.style.getComputedStyle(a, "borderLeftWidth");
  9463. c = goog.style.getComputedStyle(a, "borderRightWidth");
  9464. d = goog.style.getComputedStyle(a, "borderTopWidth");
  9465. a = goog.style.getComputedStyle(a, "borderBottomWidth");
  9466. return new goog.math.Box(parseFloat(d), parseFloat(c), parseFloat(a), parseFloat(b))
  9467. }
  9468. ;
  9469. goog.style.getFontFamily = function (a) {
  9470. var b = goog.dom.getOwnerDocument(a)
  9471. , c = "";
  9472. if (b.body.createTextRange && goog.dom.contains(b, a)) {
  9473. b = b.body.createTextRange();
  9474. b.moveToElementText(a);
  9475. try {
  9476. c = b.queryCommandValue("FontName")
  9477. } catch (d) {
  9478. c = ""
  9479. }
  9480. }
  9481. c || (c = goog.style.getStyle_(a, "fontFamily"));
  9482. a = c.split(",");
  9483. 1 < a.length && (c = a[0]);
  9484. return goog.string.stripQuotes(c, "\"'")
  9485. }
  9486. ;
  9487. goog.style.lengthUnitRegex_ = /[^\d]+$/;
  9488. goog.style.getLengthUnits = function (a) {
  9489. return (a = a.match(goog.style.lengthUnitRegex_)) && a[0] || null
  9490. }
  9491. ;
  9492. goog.style.ABSOLUTE_CSS_LENGTH_UNITS_ = {
  9493. cm: 1,
  9494. "in": 1,
  9495. mm: 1,
  9496. pc: 1,
  9497. pt: 1
  9498. };
  9499. goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_ = {
  9500. em: 1,
  9501. ex: 1
  9502. };
  9503. goog.style.getFontSize = function (a) {
  9504. var b = goog.style.getStyle_(a, "fontSize")
  9505. , c = goog.style.getLengthUnits(b);
  9506. if (b && "px" == c)
  9507. return parseInt(b, 10);
  9508. if (goog.userAgent.IE) {
  9509. if (String(c) in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_)
  9510. return goog.style.getIePixelValue_(a, b, "left", "pixelLeft");
  9511. if (a.parentNode && a.parentNode.nodeType == goog.dom.NodeType.ELEMENT && String(c) in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_)
  9512. return a = a.parentNode,
  9513. c = goog.style.getStyle_(a, "fontSize"),
  9514. goog.style.getIePixelValue_(a, b == c ? "1em" : b, "left", "pixelLeft")
  9515. }
  9516. c = goog.dom.createDom("SPAN", {
  9517. style: "visibility:hidden;position:absolute;line-height:0;padding:0;margin:0;border:0;height:1em;"
  9518. });
  9519. goog.dom.appendChild(a, c);
  9520. b = c.offsetHeight;
  9521. goog.dom.removeNode(c);
  9522. return b
  9523. }
  9524. ;
  9525. goog.style.parseStyleAttribute = function (a) {
  9526. var b = {};
  9527. goog.array.forEach(a.split(/\s*;\s*/), function (a) {
  9528. var c = a.match(/\s*([\w-]+)\s*:(.+)/);
  9529. c && (a = c[1],
  9530. c = goog.string.trim(c[2]),
  9531. b[goog.string.toCamelCase(a.toLowerCase())] = c)
  9532. });
  9533. return b
  9534. }
  9535. ;
  9536. goog.style.toStyleAttribute = function (a) {
  9537. var b = [];
  9538. goog.object.forEach(a, function (a, d) {
  9539. b.push(goog.string.toSelectorCase(d), ":", a, ";")
  9540. });
  9541. return b.join("")
  9542. }
  9543. ;
  9544. goog.style.setFloat = function (a, b) {
  9545. a.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] = b
  9546. }
  9547. ;
  9548. goog.style.getFloat = function (a) {
  9549. return a.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] || ""
  9550. }
  9551. ;
  9552. goog.style.getScrollbarWidth = function (a) {
  9553. var b = goog.dom.createElement("DIV");
  9554. a && (b.className = a);
  9555. b.style.cssText = "overflow:auto;position:absolute;top:0;width:100px;height:100px";
  9556. a = goog.dom.createElement("DIV");
  9557. goog.style.setSize(a, "200px", "200px");
  9558. b.appendChild(a);
  9559. goog.dom.appendChild(goog.dom.getDocument().body, b);
  9560. a = b.offsetWidth - b.clientWidth;
  9561. goog.dom.removeNode(b);
  9562. return a
  9563. }
  9564. ;
  9565. goog.style.MATRIX_TRANSLATION_REGEX_ = /matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;
  9566. goog.style.getCssTranslation = function (a) {
  9567. a = goog.style.getComputedTransform(a);
  9568. return a ? (a = a.match(goog.style.MATRIX_TRANSLATION_REGEX_)) ? new goog.math.Coordinate(parseFloat(a[1]), parseFloat(a[2])) : new goog.math.Coordinate(0, 0) : new goog.math.Coordinate(0, 0)
  9569. }
  9570. ;
  9571. goog.events.EventHandler = function (a) {
  9572. goog.Disposable.call(this);
  9573. this.handler_ = a;
  9574. this.keys_ = {}
  9575. }
  9576. ;
  9577. goog.inherits(goog.events.EventHandler, goog.Disposable);
  9578. goog.events.EventHandler.typeArray_ = [];
  9579. goog.events.EventHandler.prototype.listen = function (a, b, c, d) {
  9580. return this.listen_(a, b, c, d)
  9581. }
  9582. ;
  9583. goog.events.EventHandler.prototype.listenWithScope = function (a, b, c, d, e) {
  9584. return this.listen_(a, b, c, d, e)
  9585. }
  9586. ;
  9587. goog.events.EventHandler.prototype.listen_ = function (a, b, c, d, e) {
  9588. goog.isArray(b) || (b && (goog.events.EventHandler.typeArray_[0] = b.toString()),
  9589. b = goog.events.EventHandler.typeArray_);
  9590. for (var f = 0; f < b.length; f++) {
  9591. var g = goog.events.listen(a, b[f], c || this.handleEvent, d || !1, e || this.handler_ || this);
  9592. if (!g)
  9593. break;
  9594. this.keys_[g.key] = g
  9595. }
  9596. return this
  9597. }
  9598. ;
  9599. goog.events.EventHandler.prototype.listenOnce = function (a, b, c, d) {
  9600. return this.listenOnce_(a, b, c, d)
  9601. }
  9602. ;
  9603. goog.events.EventHandler.prototype.listenOnceWithScope = function (a, b, c, d, e) {
  9604. return this.listenOnce_(a, b, c, d, e)
  9605. }
  9606. ;
  9607. goog.events.EventHandler.prototype.listenOnce_ = function (a, b, c, d, e) {
  9608. if (goog.isArray(b))
  9609. for (var f = 0; f < b.length; f++)
  9610. this.listenOnce_(a, b[f], c, d, e);
  9611. else {
  9612. a = goog.events.listenOnce(a, b, c || this.handleEvent, d, e || this.handler_ || this);
  9613. if (!a)
  9614. return this;
  9615. this.keys_[a.key] = a
  9616. }
  9617. return this
  9618. }
  9619. ;
  9620. goog.events.EventHandler.prototype.listenWithWrapper = function (a, b, c, d) {
  9621. return this.listenWithWrapper_(a, b, c, d)
  9622. }
  9623. ;
  9624. goog.events.EventHandler.prototype.listenWithWrapperAndScope = function (a, b, c, d, e) {
  9625. return this.listenWithWrapper_(a, b, c, d, e)
  9626. }
  9627. ;
  9628. goog.events.EventHandler.prototype.listenWithWrapper_ = function (a, b, c, d, e) {
  9629. b.listen(a, c, d, e || this.handler_ || this, this);
  9630. return this
  9631. }
  9632. ;
  9633. goog.events.EventHandler.prototype.getListenerCount = function () {
  9634. var a = 0, b;
  9635. for (b in this.keys_)
  9636. Object.prototype.hasOwnProperty.call(this.keys_, b) && a++;
  9637. return a
  9638. }
  9639. ;
  9640. goog.events.EventHandler.prototype.unlisten = function (a, b, c, d, e) {
  9641. if (goog.isArray(b))
  9642. for (var f = 0; f < b.length; f++)
  9643. this.unlisten(a, b[f], c, d, e);
  9644. else if (d = goog.isObject(d) ? !!d.capture : !!d,
  9645. a = goog.events.getListener(a, b, c || this.handleEvent, d, e || this.handler_ || this))
  9646. goog.events.unlistenByKey(a),
  9647. delete this.keys_[a.key];
  9648. return this
  9649. }
  9650. ;
  9651. goog.events.EventHandler.prototype.unlistenWithWrapper = function (a, b, c, d, e) {
  9652. b.unlisten(a, c, d, e || this.handler_ || this, this);
  9653. return this
  9654. }
  9655. ;
  9656. goog.events.EventHandler.prototype.removeAll = function () {
  9657. goog.object.forEach(this.keys_, function (a, b) {
  9658. this.keys_.hasOwnProperty(b) && goog.events.unlistenByKey(a)
  9659. }, this);
  9660. this.keys_ = {}
  9661. }
  9662. ;
  9663. goog.events.EventHandler.prototype.disposeInternal = function () {
  9664. goog.events.EventHandler.superClass_.disposeInternal.call(this);
  9665. this.removeAll()
  9666. }
  9667. ;
  9668. goog.events.EventHandler.prototype.handleEvent = function (a) {
  9669. throw Error("EventHandler.handleEvent not implemented");
  9670. }
  9671. ;
  9672. goog.ui = {};
  9673. goog.ui.IdGenerator = function () { }
  9674. ;
  9675. goog.addSingletonGetter(goog.ui.IdGenerator);
  9676. goog.ui.IdGenerator.prototype.nextId_ = 0;
  9677. goog.ui.IdGenerator.prototype.idPrefix_ = "";
  9678. goog.ui.IdGenerator.prototype.setIdPrefix = function (a) {
  9679. this.idPrefix_ = a
  9680. }
  9681. ;
  9682. goog.ui.IdGenerator.prototype.getNextUniqueId = function () {
  9683. return this.idPrefix_ + ":" + (this.nextId_++).toString(36)
  9684. }
  9685. ;
  9686. goog.ui.Component = function (a) {
  9687. goog.events.EventTarget.call(this);
  9688. this.dom_ = a || goog.dom.getDomHelper();
  9689. this.rightToLeft_ = goog.ui.Component.defaultRightToLeft_;
  9690. this.id_ = null;
  9691. this.inDocument_ = !1;
  9692. this.element_ = null;
  9693. this.googUiComponentHandler_ = void 0;
  9694. this.childIndex_ = this.children_ = this.parent_ = this.model_ = null;
  9695. this.pointerEventsEnabled_ = this.wasDecorated_ = !1
  9696. }
  9697. ;
  9698. goog.inherits(goog.ui.Component, goog.events.EventTarget);
  9699. goog.ui.Component.ALLOW_DETACHED_DECORATION = !1;
  9700. goog.ui.Component.prototype.idGenerator_ = goog.ui.IdGenerator.getInstance();
  9701. goog.ui.Component.DEFAULT_BIDI_DIR = 0;
  9702. goog.ui.Component.defaultRightToLeft_ = 1 == goog.ui.Component.DEFAULT_BIDI_DIR ? !1 : -1 == goog.ui.Component.DEFAULT_BIDI_DIR ? !0 : null;
  9703. goog.ui.Component.EventType = {
  9704. BEFORE_SHOW: "beforeshow",
  9705. SHOW: "show",
  9706. HIDE: "hide",
  9707. DISABLE: "disable",
  9708. ENABLE: "enable",
  9709. HIGHLIGHT: "highlight",
  9710. UNHIGHLIGHT: "unhighlight",
  9711. ACTIVATE: "activate",
  9712. DEACTIVATE: "deactivate",
  9713. SELECT: "select",
  9714. UNSELECT: "unselect",
  9715. CHECK: "check",
  9716. UNCHECK: "uncheck",
  9717. FOCUS: "focus",
  9718. BLUR: "blur",
  9719. OPEN: "open",
  9720. CLOSE: "close",
  9721. ENTER: "enter",
  9722. LEAVE: "leave",
  9723. ACTION: "action",
  9724. CHANGE: "change"
  9725. };
  9726. goog.ui.Component.Error = {
  9727. NOT_SUPPORTED: "Method not supported",
  9728. DECORATE_INVALID: "Invalid element to decorate",
  9729. ALREADY_RENDERED: "Component already rendered",
  9730. PARENT_UNABLE_TO_BE_SET: "Unable to set parent component",
  9731. CHILD_INDEX_OUT_OF_BOUNDS: "Child component index out of bounds",
  9732. NOT_OUR_CHILD: "Child is not in parent component",
  9733. NOT_IN_DOCUMENT: "Operation not supported while component is not in document",
  9734. STATE_INVALID: "Invalid component state"
  9735. };
  9736. goog.ui.Component.State = {
  9737. ALL: 255,
  9738. DISABLED: 1,
  9739. HOVER: 2,
  9740. ACTIVE: 4,
  9741. SELECTED: 8,
  9742. CHECKED: 16,
  9743. FOCUSED: 32,
  9744. OPENED: 64
  9745. };
  9746. goog.ui.Component.getStateTransitionEvent = function (a, b) {
  9747. switch (a) {
  9748. case goog.ui.Component.State.DISABLED:
  9749. return b ? goog.ui.Component.EventType.DISABLE : goog.ui.Component.EventType.ENABLE;
  9750. case goog.ui.Component.State.HOVER:
  9751. return b ? goog.ui.Component.EventType.HIGHLIGHT : goog.ui.Component.EventType.UNHIGHLIGHT;
  9752. case goog.ui.Component.State.ACTIVE:
  9753. return b ? goog.ui.Component.EventType.ACTIVATE : goog.ui.Component.EventType.DEACTIVATE;
  9754. case goog.ui.Component.State.SELECTED:
  9755. return b ? goog.ui.Component.EventType.SELECT : goog.ui.Component.EventType.UNSELECT;
  9756. case goog.ui.Component.State.CHECKED:
  9757. return b ? goog.ui.Component.EventType.CHECK : goog.ui.Component.EventType.UNCHECK;
  9758. case goog.ui.Component.State.FOCUSED:
  9759. return b ? goog.ui.Component.EventType.FOCUS : goog.ui.Component.EventType.BLUR;
  9760. case goog.ui.Component.State.OPENED:
  9761. return b ? goog.ui.Component.EventType.OPEN : goog.ui.Component.EventType.CLOSE
  9762. }
  9763. throw Error(goog.ui.Component.Error.STATE_INVALID);
  9764. }
  9765. ;
  9766. goog.ui.Component.setDefaultRightToLeft = function (a) {
  9767. goog.ui.Component.defaultRightToLeft_ = a
  9768. }
  9769. ;
  9770. goog.ui.Component.prototype.getId = function () {
  9771. return this.id_ || (this.id_ = this.idGenerator_.getNextUniqueId())
  9772. }
  9773. ;
  9774. goog.ui.Component.prototype.setId = function (a) {
  9775. this.parent_ && this.parent_.childIndex_ && (goog.object.remove(this.parent_.childIndex_, this.id_),
  9776. goog.object.add(this.parent_.childIndex_, a, this));
  9777. this.id_ = a
  9778. }
  9779. ;
  9780. goog.ui.Component.prototype.getElement = function () {
  9781. return this.element_
  9782. }
  9783. ;
  9784. goog.ui.Component.prototype.getElementStrict = function () {
  9785. var a = this.element_;
  9786. goog.asserts.assert(a, "Can not call getElementStrict before rendering/decorating.");
  9787. return a
  9788. }
  9789. ;
  9790. goog.ui.Component.prototype.setElementInternal = function (a) {
  9791. this.element_ = a
  9792. }
  9793. ;
  9794. goog.ui.Component.prototype.getElementsByClass = function (a) {
  9795. return this.element_ ? this.dom_.getElementsByClass(a, this.element_) : []
  9796. }
  9797. ;
  9798. goog.ui.Component.prototype.getElementByClass = function (a) {
  9799. return this.element_ ? this.dom_.getElementByClass(a, this.element_) : null
  9800. }
  9801. ;
  9802. goog.ui.Component.prototype.getRequiredElementByClass = function (a) {
  9803. var b = this.getElementByClass(a);
  9804. goog.asserts.assert(b, "Expected element in component with class: %s", a);
  9805. return b
  9806. }
  9807. ;
  9808. goog.ui.Component.prototype.getHandler = function () {
  9809. this.googUiComponentHandler_ || (this.googUiComponentHandler_ = new goog.events.EventHandler(this));
  9810. return goog.asserts.assert(this.googUiComponentHandler_)
  9811. }
  9812. ;
  9813. goog.ui.Component.prototype.setParent = function (a) {
  9814. if (this == a)
  9815. throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);
  9816. if (a && this.parent_ && this.id_ && this.parent_.getChild(this.id_) && this.parent_ != a)
  9817. throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);
  9818. this.parent_ = a;
  9819. goog.ui.Component.superClass_.setParentEventTarget.call(this, a)
  9820. }
  9821. ;
  9822. goog.ui.Component.prototype.getParent = function () {
  9823. return this.parent_
  9824. }
  9825. ;
  9826. goog.ui.Component.prototype.setParentEventTarget = function (a) {
  9827. if (this.parent_ && this.parent_ != a)
  9828. throw Error(goog.ui.Component.Error.NOT_SUPPORTED);
  9829. goog.ui.Component.superClass_.setParentEventTarget.call(this, a)
  9830. }
  9831. ;
  9832. goog.ui.Component.prototype.getDomHelper = function () {
  9833. return this.dom_
  9834. }
  9835. ;
  9836. goog.ui.Component.prototype.isInDocument = function () {
  9837. return this.inDocument_
  9838. }
  9839. ;
  9840. goog.ui.Component.prototype.createDom = function () {
  9841. this.element_ = this.dom_.createElement("DIV")
  9842. }
  9843. ;
  9844. goog.ui.Component.prototype.render = function (a) {
  9845. this.render_(a)
  9846. }
  9847. ;
  9848. goog.ui.Component.prototype.renderBefore = function (a) {
  9849. this.render_(a.parentNode, a)
  9850. }
  9851. ;
  9852. goog.ui.Component.prototype.render_ = function (a, b) {
  9853. if (this.inDocument_)
  9854. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9855. this.element_ || this.createDom();
  9856. a ? a.insertBefore(this.element_, b || null) : this.dom_.getDocument().body.appendChild(this.element_);
  9857. this.parent_ && !this.parent_.isInDocument() || this.enterDocument()
  9858. }
  9859. ;
  9860. goog.ui.Component.prototype.decorate = function (a) {
  9861. if (this.inDocument_)
  9862. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9863. if (a && this.canDecorate(a)) {
  9864. this.wasDecorated_ = !0;
  9865. var b = goog.dom.getOwnerDocument(a);
  9866. this.dom_ && this.dom_.getDocument() == b || (this.dom_ = goog.dom.getDomHelper(a));
  9867. this.decorateInternal(a);
  9868. goog.ui.Component.ALLOW_DETACHED_DECORATION && !goog.dom.contains(b, a) || this.enterDocument()
  9869. } else
  9870. throw Error(goog.ui.Component.Error.DECORATE_INVALID);
  9871. }
  9872. ;
  9873. goog.ui.Component.prototype.canDecorate = function (a) {
  9874. return !0
  9875. }
  9876. ;
  9877. goog.ui.Component.prototype.wasDecorated = function () {
  9878. return this.wasDecorated_
  9879. }
  9880. ;
  9881. goog.ui.Component.prototype.decorateInternal = function (a) {
  9882. this.element_ = a
  9883. }
  9884. ;
  9885. goog.ui.Component.prototype.enterDocument = function () {
  9886. this.inDocument_ = !0;
  9887. this.forEachChild(function (a) {
  9888. !a.isInDocument() && a.getElement() && a.enterDocument()
  9889. })
  9890. }
  9891. ;
  9892. goog.ui.Component.prototype.exitDocument = function () {
  9893. this.forEachChild(function (a) {
  9894. a.isInDocument() && a.exitDocument()
  9895. });
  9896. this.googUiComponentHandler_ && this.googUiComponentHandler_.removeAll();
  9897. this.inDocument_ = !1
  9898. }
  9899. ;
  9900. goog.ui.Component.prototype.disposeInternal = function () {
  9901. this.inDocument_ && this.exitDocument();
  9902. this.googUiComponentHandler_ && (this.googUiComponentHandler_.dispose(),
  9903. delete this.googUiComponentHandler_);
  9904. this.forEachChild(function (a) {
  9905. a.dispose()
  9906. });
  9907. !this.wasDecorated_ && this.element_ && goog.dom.removeNode(this.element_);
  9908. this.parent_ = this.model_ = this.element_ = this.childIndex_ = this.children_ = null;
  9909. goog.ui.Component.superClass_.disposeInternal.call(this)
  9910. }
  9911. ;
  9912. goog.ui.Component.prototype.makeId = function (a) {
  9913. return this.getId() + "." + a
  9914. }
  9915. ;
  9916. goog.ui.Component.prototype.makeIds = function (a) {
  9917. var b = {}, c;
  9918. for (c in a)
  9919. b[c] = this.makeId(a[c]);
  9920. return b
  9921. }
  9922. ;
  9923. goog.ui.Component.prototype.getModel = function () {
  9924. return this.model_
  9925. }
  9926. ;
  9927. goog.ui.Component.prototype.setModel = function (a) {
  9928. this.model_ = a
  9929. }
  9930. ;
  9931. goog.ui.Component.prototype.getFragmentFromId = function (a) {
  9932. return a.substring(this.getId().length + 1)
  9933. }
  9934. ;
  9935. goog.ui.Component.prototype.getElementByFragment = function (a) {
  9936. if (!this.inDocument_)
  9937. throw Error(goog.ui.Component.Error.NOT_IN_DOCUMENT);
  9938. return this.dom_.getElement(this.makeId(a))
  9939. }
  9940. ;
  9941. goog.ui.Component.prototype.addChild = function (a, b) {
  9942. this.addChildAt(a, this.getChildCount(), b)
  9943. }
  9944. ;
  9945. goog.ui.Component.prototype.addChildAt = function (a, b, c) {
  9946. goog.asserts.assert(!!a, "Provided element must not be null.");
  9947. if (a.inDocument_ && (c || !this.inDocument_))
  9948. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9949. if (0 > b || b > this.getChildCount())
  9950. throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS);
  9951. this.childIndex_ && this.children_ || (this.childIndex_ = {},
  9952. this.children_ = []);
  9953. a.getParent() == this ? (goog.object.set(this.childIndex_, a.getId(), a),
  9954. goog.array.remove(this.children_, a)) : goog.object.add(this.childIndex_, a.getId(), a);
  9955. a.setParent(this);
  9956. goog.array.insertAt(this.children_, a, b);
  9957. a.inDocument_ && this.inDocument_ && a.getParent() == this ? (c = this.getContentElement(),
  9958. b = c.childNodes[b] || null,
  9959. b != a.getElement() && c.insertBefore(a.getElement(), b)) : c ? (this.element_ || this.createDom(),
  9960. b = this.getChildAt(b + 1),
  9961. a.render_(this.getContentElement(), b ? b.element_ : null)) : this.inDocument_ && !a.inDocument_ && a.element_ && a.element_.parentNode && a.element_.parentNode.nodeType == goog.dom.NodeType.ELEMENT && a.enterDocument()
  9962. }
  9963. ;
  9964. goog.ui.Component.prototype.getContentElement = function () {
  9965. return this.element_
  9966. }
  9967. ;
  9968. goog.ui.Component.prototype.isRightToLeft = function () {
  9969. null == this.rightToLeft_ && (this.rightToLeft_ = goog.style.isRightToLeft(this.inDocument_ ? this.element_ : this.dom_.getDocument().body));
  9970. return this.rightToLeft_
  9971. }
  9972. ;
  9973. goog.ui.Component.prototype.setRightToLeft = function (a) {
  9974. if (this.inDocument_)
  9975. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  9976. this.rightToLeft_ = a
  9977. }
  9978. ;
  9979. goog.ui.Component.prototype.hasChildren = function () {
  9980. return !!this.children_ && 0 != this.children_.length
  9981. }
  9982. ;
  9983. goog.ui.Component.prototype.getChildCount = function () {
  9984. return this.children_ ? this.children_.length : 0
  9985. }
  9986. ;
  9987. goog.ui.Component.prototype.getChildIds = function () {
  9988. var a = [];
  9989. this.forEachChild(function (b) {
  9990. a.push(b.getId())
  9991. });
  9992. return a
  9993. }
  9994. ;
  9995. goog.ui.Component.prototype.getChild = function (a) {
  9996. return this.childIndex_ && a ? goog.object.get(this.childIndex_, a) || null : null
  9997. }
  9998. ;
  9999. goog.ui.Component.prototype.getChildAt = function (a) {
  10000. return this.children_ ? this.children_[a] || null : null
  10001. }
  10002. ;
  10003. goog.ui.Component.prototype.forEachChild = function (a, b) {
  10004. this.children_ && goog.array.forEach(this.children_, a, b)
  10005. }
  10006. ;
  10007. goog.ui.Component.prototype.indexOfChild = function (a) {
  10008. return this.children_ && a ? goog.array.indexOf(this.children_, a) : -1
  10009. }
  10010. ;
  10011. goog.ui.Component.prototype.removeChild = function (a, b) {
  10012. if (a) {
  10013. var c = "string" === typeof a ? a : a.getId();
  10014. a = this.getChild(c);
  10015. c && a && (goog.object.remove(this.childIndex_, c),
  10016. goog.array.remove(this.children_, a),
  10017. b && (a.exitDocument(),
  10018. a.element_ && goog.dom.removeNode(a.element_)),
  10019. a.setParent(null))
  10020. }
  10021. if (!a)
  10022. throw Error(goog.ui.Component.Error.NOT_OUR_CHILD);
  10023. return a
  10024. }
  10025. ;
  10026. goog.ui.Component.prototype.removeChildAt = function (a, b) {
  10027. return this.removeChild(this.getChildAt(a), b)
  10028. }
  10029. ;
  10030. goog.ui.Component.prototype.removeChildren = function (a) {
  10031. for (var b = []; this.hasChildren();)
  10032. b.push(this.removeChildAt(0, a));
  10033. return b
  10034. }
  10035. ;
  10036. goog.ui.Component.prototype.pointerEventsEnabled = function () {
  10037. return this.pointerEventsEnabled_
  10038. }
  10039. ;
  10040. goog.ui.Component.prototype.setPointerEventsEnabled = function (a) {
  10041. if (this.inDocument_)
  10042. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  10043. this.pointerEventsEnabled_ = a
  10044. }
  10045. ;
  10046. goog.a11y = {};
  10047. goog.a11y.aria = {};
  10048. goog.a11y.aria.Role = {
  10049. ALERT: "alert",
  10050. ALERTDIALOG: "alertdialog",
  10051. APPLICATION: "application",
  10052. ARTICLE: "article",
  10053. BANNER: "banner",
  10054. BUTTON: "button",
  10055. CHECKBOX: "checkbox",
  10056. COLUMNHEADER: "columnheader",
  10057. COMBOBOX: "combobox",
  10058. COMPLEMENTARY: "complementary",
  10059. CONTENTINFO: "contentinfo",
  10060. DEFINITION: "definition",
  10061. DIALOG: "dialog",
  10062. DIRECTORY: "directory",
  10063. DOCUMENT: "document",
  10064. FORM: "form",
  10065. GRID: "grid",
  10066. GRIDCELL: "gridcell",
  10067. GROUP: "group",
  10068. HEADING: "heading",
  10069. IMG: "img",
  10070. LINK: "link",
  10071. LIST: "list",
  10072. LISTBOX: "listbox",
  10073. LISTITEM: "listitem",
  10074. LOG: "log",
  10075. MAIN: "main",
  10076. MARQUEE: "marquee",
  10077. MATH: "math",
  10078. MENU: "menu",
  10079. MENUBAR: "menubar",
  10080. MENU_ITEM: "menuitem",
  10081. MENU_ITEM_CHECKBOX: "menuitemcheckbox",
  10082. MENU_ITEM_RADIO: "menuitemradio",
  10083. NAVIGATION: "navigation",
  10084. NOTE: "note",
  10085. OPTION: "option",
  10086. PRESENTATION: "presentation",
  10087. PROGRESSBAR: "progressbar",
  10088. RADIO: "radio",
  10089. RADIOGROUP: "radiogroup",
  10090. REGION: "region",
  10091. ROW: "row",
  10092. ROWGROUP: "rowgroup",
  10093. ROWHEADER: "rowheader",
  10094. SCROLLBAR: "scrollbar",
  10095. SEARCH: "search",
  10096. SEPARATOR: "separator",
  10097. SLIDER: "slider",
  10098. SPINBUTTON: "spinbutton",
  10099. STATUS: "status",
  10100. TAB: "tab",
  10101. TAB_LIST: "tablist",
  10102. TAB_PANEL: "tabpanel",
  10103. TEXTBOX: "textbox",
  10104. TEXTINFO: "textinfo",
  10105. TIMER: "timer",
  10106. TOOLBAR: "toolbar",
  10107. TOOLTIP: "tooltip",
  10108. TREE: "tree",
  10109. TREEGRID: "treegrid",
  10110. TREEITEM: "treeitem"
  10111. };
  10112. goog.a11y.aria.State = {
  10113. ACTIVEDESCENDANT: "activedescendant",
  10114. ATOMIC: "atomic",
  10115. AUTOCOMPLETE: "autocomplete",
  10116. BUSY: "busy",
  10117. CHECKED: "checked",
  10118. COLINDEX: "colindex",
  10119. CONTROLS: "controls",
  10120. DESCRIBEDBY: "describedby",
  10121. DISABLED: "disabled",
  10122. DROPEFFECT: "dropeffect",
  10123. EXPANDED: "expanded",
  10124. FLOWTO: "flowto",
  10125. GRABBED: "grabbed",
  10126. HASPOPUP: "haspopup",
  10127. HIDDEN: "hidden",
  10128. INVALID: "invalid",
  10129. LABEL: "label",
  10130. LABELLEDBY: "labelledby",
  10131. LEVEL: "level",
  10132. LIVE: "live",
  10133. MULTILINE: "multiline",
  10134. MULTISELECTABLE: "multiselectable",
  10135. ORIENTATION: "orientation",
  10136. OWNS: "owns",
  10137. POSINSET: "posinset",
  10138. PRESSED: "pressed",
  10139. READONLY: "readonly",
  10140. RELEVANT: "relevant",
  10141. REQUIRED: "required",
  10142. ROWINDEX: "rowindex",
  10143. SELECTED: "selected",
  10144. SETSIZE: "setsize",
  10145. SORT: "sort",
  10146. VALUEMAX: "valuemax",
  10147. VALUEMIN: "valuemin",
  10148. VALUENOW: "valuenow",
  10149. VALUETEXT: "valuetext"
  10150. };
  10151. goog.a11y.aria.AutoCompleteValues = {
  10152. INLINE: "inline",
  10153. LIST: "list",
  10154. BOTH: "both",
  10155. NONE: "none"
  10156. };
  10157. goog.a11y.aria.DropEffectValues = {
  10158. COPY: "copy",
  10159. MOVE: "move",
  10160. LINK: "link",
  10161. EXECUTE: "execute",
  10162. POPUP: "popup",
  10163. NONE: "none"
  10164. };
  10165. goog.a11y.aria.LivePriority = {
  10166. OFF: "off",
  10167. POLITE: "polite",
  10168. ASSERTIVE: "assertive"
  10169. };
  10170. goog.a11y.aria.OrientationValues = {
  10171. VERTICAL: "vertical",
  10172. HORIZONTAL: "horizontal"
  10173. };
  10174. goog.a11y.aria.RelevantValues = {
  10175. ADDITIONS: "additions",
  10176. REMOVALS: "removals",
  10177. TEXT: "text",
  10178. ALL: "all"
  10179. };
  10180. goog.a11y.aria.SortValues = {
  10181. ASCENDING: "ascending",
  10182. DESCENDING: "descending",
  10183. NONE: "none",
  10184. OTHER: "other"
  10185. };
  10186. goog.a11y.aria.CheckedValues = {
  10187. TRUE: "true",
  10188. FALSE: "false",
  10189. MIXED: "mixed",
  10190. UNDEFINED: "undefined"
  10191. };
  10192. goog.a11y.aria.ExpandedValues = {
  10193. TRUE: "true",
  10194. FALSE: "false",
  10195. UNDEFINED: "undefined"
  10196. };
  10197. goog.a11y.aria.GrabbedValues = {
  10198. TRUE: "true",
  10199. FALSE: "false",
  10200. UNDEFINED: "undefined"
  10201. };
  10202. goog.a11y.aria.InvalidValues = {
  10203. FALSE: "false",
  10204. TRUE: "true",
  10205. GRAMMAR: "grammar",
  10206. SPELLING: "spelling"
  10207. };
  10208. goog.a11y.aria.PressedValues = {
  10209. TRUE: "true",
  10210. FALSE: "false",
  10211. MIXED: "mixed",
  10212. UNDEFINED: "undefined"
  10213. };
  10214. goog.a11y.aria.SelectedValues = {
  10215. TRUE: "true",
  10216. FALSE: "false",
  10217. UNDEFINED: "undefined"
  10218. };
  10219. goog.a11y.aria.datatables = {};
  10220. goog.a11y.aria.datatables.getDefaultValuesMap = function () {
  10221. goog.a11y.aria.DefaultStateValueMap_ || (goog.a11y.aria.DefaultStateValueMap_ = goog.object.create(goog.a11y.aria.State.ATOMIC, !1, goog.a11y.aria.State.AUTOCOMPLETE, "none", goog.a11y.aria.State.DROPEFFECT, "none", goog.a11y.aria.State.HASPOPUP, !1, goog.a11y.aria.State.LIVE, "off", goog.a11y.aria.State.MULTILINE, !1, goog.a11y.aria.State.MULTISELECTABLE, !1, goog.a11y.aria.State.ORIENTATION, "vertical", goog.a11y.aria.State.READONLY, !1, goog.a11y.aria.State.RELEVANT, "additions text", goog.a11y.aria.State.REQUIRED, !1, goog.a11y.aria.State.SORT, "none", goog.a11y.aria.State.BUSY, !1, goog.a11y.aria.State.DISABLED, !1, goog.a11y.aria.State.HIDDEN, !1, goog.a11y.aria.State.INVALID, "false"));
  10222. return goog.a11y.aria.DefaultStateValueMap_
  10223. }
  10224. ;
  10225. goog.a11y.aria.ARIA_PREFIX_ = "aria-";
  10226. goog.a11y.aria.ROLE_ATTRIBUTE_ = "role";
  10227. goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = goog.object.createSet("A AREA BUTTON HEAD INPUT LINK MENU META OPTGROUP OPTION PROGRESS STYLE SELECT SOURCE TEXTAREA TITLE TRACK".split(" "));
  10228. goog.a11y.aria.CONTAINER_ROLES_ = [goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.Role.GRID, goog.a11y.aria.Role.GROUP, goog.a11y.aria.Role.LISTBOX, goog.a11y.aria.Role.MENU, goog.a11y.aria.Role.MENUBAR, goog.a11y.aria.Role.RADIOGROUP, goog.a11y.aria.Role.ROW, goog.a11y.aria.Role.ROWGROUP, goog.a11y.aria.Role.TAB_LIST, goog.a11y.aria.Role.TEXTBOX, goog.a11y.aria.Role.TOOLBAR, goog.a11y.aria.Role.TREE, goog.a11y.aria.Role.TREEGRID];
  10229. goog.a11y.aria.setRole = function (a, b) {
  10230. b ? (goog.asserts.ENABLE_ASSERTS && goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.Role, b), "No such ARIA role " + b),
  10231. a.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_, b)) : goog.a11y.aria.removeRole(a)
  10232. }
  10233. ;
  10234. goog.a11y.aria.getRole = function (a) {
  10235. return a.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_) || null
  10236. }
  10237. ;
  10238. goog.a11y.aria.removeRole = function (a) {
  10239. a.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_)
  10240. }
  10241. ;
  10242. goog.a11y.aria.setState = function (a, b, c) {
  10243. goog.isArray(c) && (c = c.join(" "));
  10244. var d = goog.a11y.aria.getAriaAttributeName_(b);
  10245. "" === c || void 0 == c ? (c = goog.a11y.aria.datatables.getDefaultValuesMap(),
  10246. b in c ? a.setAttribute(d, c[b]) : a.removeAttribute(d)) : a.setAttribute(d, c)
  10247. }
  10248. ;
  10249. goog.a11y.aria.toggleState = function (a, b) {
  10250. var c = goog.a11y.aria.getState(a, b);
  10251. goog.string.isEmptyOrWhitespace(goog.string.makeSafe(c)) || "true" == c || "false" == c ? goog.a11y.aria.setState(a, b, "true" == c ? "false" : "true") : goog.a11y.aria.removeState(a, b)
  10252. }
  10253. ;
  10254. goog.a11y.aria.removeState = function (a, b) {
  10255. a.removeAttribute(goog.a11y.aria.getAriaAttributeName_(b))
  10256. }
  10257. ;
  10258. goog.a11y.aria.getState = function (a, b) {
  10259. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10260. return null == c || void 0 == c ? "" : String(c)
  10261. }
  10262. ;
  10263. goog.a11y.aria.getActiveDescendant = function (a) {
  10264. var b = goog.a11y.aria.getState(a, goog.a11y.aria.State.ACTIVEDESCENDANT);
  10265. return goog.dom.getOwnerDocument(a).getElementById(b)
  10266. }
  10267. ;
  10268. goog.a11y.aria.setActiveDescendant = function (a, b) {
  10269. var c = "";
  10270. b && (c = b.id,
  10271. goog.asserts.assert(c, "The active element should have an id."));
  10272. goog.a11y.aria.setState(a, goog.a11y.aria.State.ACTIVEDESCENDANT, c)
  10273. }
  10274. ;
  10275. goog.a11y.aria.getLabel = function (a) {
  10276. return goog.a11y.aria.getState(a, goog.a11y.aria.State.LABEL)
  10277. }
  10278. ;
  10279. goog.a11y.aria.setLabel = function (a, b) {
  10280. goog.a11y.aria.setState(a, goog.a11y.aria.State.LABEL, b)
  10281. }
  10282. ;
  10283. goog.a11y.aria.assertRoleIsSetInternalUtil = function (a, b) {
  10284. if (!goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_[a.tagName]) {
  10285. var c = goog.a11y.aria.getRole(a);
  10286. goog.asserts.assert(null != c, "The element ARIA role cannot be null.");
  10287. goog.asserts.assert(goog.array.contains(b, c), 'Non existing or incorrect role set for element.The role set is "' + c + '". The role should be any of "' + b + '". Check the ARIA specification for more details http://www.w3.org/TR/wai-aria/roles.')
  10288. }
  10289. }
  10290. ;
  10291. goog.a11y.aria.getStateBoolean = function (a, b) {
  10292. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10293. goog.asserts.assert("boolean" === typeof c || null == c || "true" == c || "false" == c);
  10294. return null == c ? c : "boolean" === typeof c ? c : "true" == c
  10295. }
  10296. ;
  10297. goog.a11y.aria.getStateNumber = function (a, b) {
  10298. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10299. goog.asserts.assert((null == c || !isNaN(Number(c))) && "boolean" !== typeof c);
  10300. return null == c ? null : Number(c)
  10301. }
  10302. ;
  10303. goog.a11y.aria.getStateString = function (a, b) {
  10304. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10305. goog.asserts.assert((null == c || "string" === typeof c) && ("" == c || isNaN(Number(c))) && "true" != c && "false" != c);
  10306. return null == c || "" == c ? null : c
  10307. }
  10308. ;
  10309. goog.a11y.aria.getStringArrayStateInternalUtil = function (a, b) {
  10310. var c = a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));
  10311. return goog.a11y.aria.splitStringOnWhitespace_(c)
  10312. }
  10313. ;
  10314. goog.a11y.aria.hasState = function (a, b) {
  10315. return a.hasAttribute(goog.a11y.aria.getAriaAttributeName_(b))
  10316. }
  10317. ;
  10318. goog.a11y.aria.isContainerRole = function (a) {
  10319. a = goog.a11y.aria.getRole(a);
  10320. return goog.array.contains(goog.a11y.aria.CONTAINER_ROLES_, a)
  10321. }
  10322. ;
  10323. goog.a11y.aria.splitStringOnWhitespace_ = function (a) {
  10324. return a ? a.split(/\s+/) : []
  10325. }
  10326. ;
  10327. goog.a11y.aria.getAriaAttributeName_ = function (a) {
  10328. goog.asserts.ENABLE_ASSERTS && (goog.asserts.assert(a, "ARIA attribute cannot be empty."),
  10329. goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.State, a), "No such ARIA attribute " + a));
  10330. return goog.a11y.aria.ARIA_PREFIX_ + a
  10331. }
  10332. ;
  10333. goog.events.KeyCodes = {
  10334. WIN_KEY_FF_LINUX: 0,
  10335. MAC_ENTER: 3,
  10336. BACKSPACE: 8,
  10337. TAB: 9,
  10338. NUM_CENTER: 12,
  10339. ENTER: 13,
  10340. SHIFT: 16,
  10341. CTRL: 17,
  10342. ALT: 18,
  10343. PAUSE: 19,
  10344. CAPS_LOCK: 20,
  10345. ESC: 27,
  10346. SPACE: 32,
  10347. PAGE_UP: 33,
  10348. PAGE_DOWN: 34,
  10349. END: 35,
  10350. HOME: 36,
  10351. LEFT: 37,
  10352. UP: 38,
  10353. RIGHT: 39,
  10354. DOWN: 40,
  10355. PLUS_SIGN: 43,
  10356. PRINT_SCREEN: 44,
  10357. INSERT: 45,
  10358. DELETE: 46,
  10359. ZERO: 48,
  10360. ONE: 49,
  10361. TWO: 50,
  10362. THREE: 51,
  10363. FOUR: 52,
  10364. FIVE: 53,
  10365. SIX: 54,
  10366. SEVEN: 55,
  10367. EIGHT: 56,
  10368. NINE: 57,
  10369. FF_SEMICOLON: 59,
  10370. FF_EQUALS: 61,
  10371. FF_DASH: 173,
  10372. FF_HASH: 163,
  10373. FF_JP_QUOTE: 58,
  10374. QUESTION_MARK: 63,
  10375. AT_SIGN: 64,
  10376. A: 65,
  10377. B: 66,
  10378. C: 67,
  10379. D: 68,
  10380. E: 69,
  10381. F: 70,
  10382. G: 71,
  10383. H: 72,
  10384. I: 73,
  10385. J: 74,
  10386. K: 75,
  10387. L: 76,
  10388. M: 77,
  10389. N: 78,
  10390. O: 79,
  10391. P: 80,
  10392. Q: 81,
  10393. R: 82,
  10394. S: 83,
  10395. T: 84,
  10396. U: 85,
  10397. V: 86,
  10398. W: 87,
  10399. X: 88,
  10400. Y: 89,
  10401. Z: 90,
  10402. META: 91,
  10403. WIN_KEY_RIGHT: 92,
  10404. CONTEXT_MENU: 93,
  10405. NUM_ZERO: 96,
  10406. NUM_ONE: 97,
  10407. NUM_TWO: 98,
  10408. NUM_THREE: 99,
  10409. NUM_FOUR: 100,
  10410. NUM_FIVE: 101,
  10411. NUM_SIX: 102,
  10412. NUM_SEVEN: 103,
  10413. NUM_EIGHT: 104,
  10414. NUM_NINE: 105,
  10415. NUM_MULTIPLY: 106,
  10416. NUM_PLUS: 107,
  10417. NUM_MINUS: 109,
  10418. NUM_PERIOD: 110,
  10419. NUM_DIVISION: 111,
  10420. F1: 112,
  10421. F2: 113,
  10422. F3: 114,
  10423. F4: 115,
  10424. F5: 116,
  10425. F6: 117,
  10426. F7: 118,
  10427. F8: 119,
  10428. F9: 120,
  10429. F10: 121,
  10430. F11: 122,
  10431. F12: 123,
  10432. NUMLOCK: 144,
  10433. SCROLL_LOCK: 145,
  10434. FIRST_MEDIA_KEY: 166,
  10435. LAST_MEDIA_KEY: 183,
  10436. SEMICOLON: 186,
  10437. DASH: 189,
  10438. EQUALS: 187,
  10439. COMMA: 188,
  10440. PERIOD: 190,
  10441. SLASH: 191,
  10442. APOSTROPHE: 192,
  10443. TILDE: 192,
  10444. SINGLE_QUOTE: 222,
  10445. OPEN_SQUARE_BRACKET: 219,
  10446. BACKSLASH: 220,
  10447. CLOSE_SQUARE_BRACKET: 221,
  10448. WIN_KEY: 224,
  10449. MAC_FF_META: 224,
  10450. MAC_WK_CMD_LEFT: 91,
  10451. MAC_WK_CMD_RIGHT: 93,
  10452. WIN_IME: 229,
  10453. VK_NONAME: 252,
  10454. PHANTOM: 255
  10455. };
  10456. goog.events.KeyCodes.isTextModifyingKeyEvent = function (a) {
  10457. if (a.altKey && !a.ctrlKey || a.metaKey || a.keyCode >= goog.events.KeyCodes.F1 && a.keyCode <= goog.events.KeyCodes.F12)
  10458. return !1;
  10459. if (goog.events.KeyCodes.isCharacterKey(a.keyCode))
  10460. return !0;
  10461. switch (a.keyCode) {
  10462. case goog.events.KeyCodes.ALT:
  10463. case goog.events.KeyCodes.CAPS_LOCK:
  10464. case goog.events.KeyCodes.CONTEXT_MENU:
  10465. case goog.events.KeyCodes.CTRL:
  10466. case goog.events.KeyCodes.DOWN:
  10467. case goog.events.KeyCodes.END:
  10468. case goog.events.KeyCodes.ESC:
  10469. case goog.events.KeyCodes.HOME:
  10470. case goog.events.KeyCodes.INSERT:
  10471. case goog.events.KeyCodes.LEFT:
  10472. case goog.events.KeyCodes.MAC_FF_META:
  10473. case goog.events.KeyCodes.META:
  10474. case goog.events.KeyCodes.NUMLOCK:
  10475. case goog.events.KeyCodes.NUM_CENTER:
  10476. case goog.events.KeyCodes.PAGE_DOWN:
  10477. case goog.events.KeyCodes.PAGE_UP:
  10478. case goog.events.KeyCodes.PAUSE:
  10479. case goog.events.KeyCodes.PHANTOM:
  10480. case goog.events.KeyCodes.PRINT_SCREEN:
  10481. case goog.events.KeyCodes.RIGHT:
  10482. case goog.events.KeyCodes.SCROLL_LOCK:
  10483. case goog.events.KeyCodes.SHIFT:
  10484. case goog.events.KeyCodes.UP:
  10485. case goog.events.KeyCodes.VK_NONAME:
  10486. case goog.events.KeyCodes.WIN_KEY:
  10487. case goog.events.KeyCodes.WIN_KEY_RIGHT:
  10488. return !1;
  10489. case goog.events.KeyCodes.WIN_KEY_FF_LINUX:
  10490. return !goog.userAgent.GECKO;
  10491. default:
  10492. return a.keyCode < goog.events.KeyCodes.FIRST_MEDIA_KEY || a.keyCode > goog.events.KeyCodes.LAST_MEDIA_KEY
  10493. }
  10494. }
  10495. ;
  10496. goog.events.KeyCodes.firesKeyPressEvent = function (a, b, c, d, e, f) {
  10497. if (goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("525"))
  10498. return !0;
  10499. if (goog.userAgent.MAC && e)
  10500. return goog.events.KeyCodes.isCharacterKey(a);
  10501. if (e && !d)
  10502. return !1;
  10503. if (!goog.userAgent.GECKO) {
  10504. "number" === typeof b && (b = goog.events.KeyCodes.normalizeKeyCode(b));
  10505. var g = b == goog.events.KeyCodes.CTRL || b == goog.events.KeyCodes.ALT || goog.userAgent.MAC && b == goog.events.KeyCodes.META
  10506. , h = b == goog.events.KeyCodes.SHIFT && (d || f);
  10507. if ((!c || goog.userAgent.MAC) && g || goog.userAgent.MAC && h)
  10508. return !1
  10509. }
  10510. if ((goog.userAgent.WEBKIT || goog.userAgent.EDGE) && d && c)
  10511. switch (a) {
  10512. case goog.events.KeyCodes.BACKSLASH:
  10513. case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:
  10514. case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:
  10515. case goog.events.KeyCodes.TILDE:
  10516. case goog.events.KeyCodes.SEMICOLON:
  10517. case goog.events.KeyCodes.DASH:
  10518. case goog.events.KeyCodes.EQUALS:
  10519. case goog.events.KeyCodes.COMMA:
  10520. case goog.events.KeyCodes.PERIOD:
  10521. case goog.events.KeyCodes.SLASH:
  10522. case goog.events.KeyCodes.APOSTROPHE:
  10523. case goog.events.KeyCodes.SINGLE_QUOTE:
  10524. return !1
  10525. }
  10526. if (goog.userAgent.IE && d && b == a)
  10527. return !1;
  10528. switch (a) {
  10529. case goog.events.KeyCodes.ENTER:
  10530. return goog.userAgent.GECKO ? f || e ? !1 : !(c && d) : !0;
  10531. case goog.events.KeyCodes.ESC:
  10532. return !(goog.userAgent.WEBKIT || goog.userAgent.EDGE || goog.userAgent.GECKO)
  10533. }
  10534. return goog.userAgent.GECKO && (d || e || f) ? !1 : goog.events.KeyCodes.isCharacterKey(a)
  10535. }
  10536. ;
  10537. goog.events.KeyCodes.isCharacterKey = function (a) {
  10538. if (a >= goog.events.KeyCodes.ZERO && a <= goog.events.KeyCodes.NINE || a >= goog.events.KeyCodes.NUM_ZERO && a <= goog.events.KeyCodes.NUM_MULTIPLY || a >= goog.events.KeyCodes.A && a <= goog.events.KeyCodes.Z || (goog.userAgent.WEBKIT || goog.userAgent.EDGE) && 0 == a)
  10539. return !0;
  10540. switch (a) {
  10541. case goog.events.KeyCodes.SPACE:
  10542. case goog.events.KeyCodes.PLUS_SIGN:
  10543. case goog.events.KeyCodes.QUESTION_MARK:
  10544. case goog.events.KeyCodes.AT_SIGN:
  10545. case goog.events.KeyCodes.NUM_PLUS:
  10546. case goog.events.KeyCodes.NUM_MINUS:
  10547. case goog.events.KeyCodes.NUM_PERIOD:
  10548. case goog.events.KeyCodes.NUM_DIVISION:
  10549. case goog.events.KeyCodes.SEMICOLON:
  10550. case goog.events.KeyCodes.FF_SEMICOLON:
  10551. case goog.events.KeyCodes.DASH:
  10552. case goog.events.KeyCodes.EQUALS:
  10553. case goog.events.KeyCodes.FF_EQUALS:
  10554. case goog.events.KeyCodes.COMMA:
  10555. case goog.events.KeyCodes.PERIOD:
  10556. case goog.events.KeyCodes.SLASH:
  10557. case goog.events.KeyCodes.APOSTROPHE:
  10558. case goog.events.KeyCodes.SINGLE_QUOTE:
  10559. case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:
  10560. case goog.events.KeyCodes.BACKSLASH:
  10561. case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:
  10562. case goog.events.KeyCodes.FF_HASH:
  10563. case goog.events.KeyCodes.FF_JP_QUOTE:
  10564. return !0;
  10565. case goog.events.KeyCodes.FF_DASH:
  10566. return goog.userAgent.GECKO;
  10567. default:
  10568. return !1
  10569. }
  10570. }
  10571. ;
  10572. goog.events.KeyCodes.normalizeKeyCode = function (a) {
  10573. return goog.userAgent.GECKO ? goog.events.KeyCodes.normalizeGeckoKeyCode(a) : goog.userAgent.MAC && goog.userAgent.WEBKIT ? goog.events.KeyCodes.normalizeMacWebKitKeyCode(a) : a
  10574. }
  10575. ;
  10576. goog.events.KeyCodes.normalizeGeckoKeyCode = function (a) {
  10577. switch (a) {
  10578. case goog.events.KeyCodes.FF_EQUALS:
  10579. return goog.events.KeyCodes.EQUALS;
  10580. case goog.events.KeyCodes.FF_SEMICOLON:
  10581. return goog.events.KeyCodes.SEMICOLON;
  10582. case goog.events.KeyCodes.FF_DASH:
  10583. return goog.events.KeyCodes.DASH;
  10584. case goog.events.KeyCodes.MAC_FF_META:
  10585. return goog.events.KeyCodes.META;
  10586. case goog.events.KeyCodes.WIN_KEY_FF_LINUX:
  10587. return goog.events.KeyCodes.WIN_KEY;
  10588. default:
  10589. return a
  10590. }
  10591. }
  10592. ;
  10593. goog.events.KeyCodes.normalizeMacWebKitKeyCode = function (a) {
  10594. switch (a) {
  10595. case goog.events.KeyCodes.MAC_WK_CMD_RIGHT:
  10596. return goog.events.KeyCodes.META;
  10597. default:
  10598. return a
  10599. }
  10600. }
  10601. ;
  10602. goog.events.KeyHandler = function (a, b) {
  10603. goog.events.EventTarget.call(this);
  10604. a && this.attach(a, b)
  10605. }
  10606. ;
  10607. goog.inherits(goog.events.KeyHandler, goog.events.EventTarget);
  10608. goog.events.KeyHandler.prototype.element_ = null;
  10609. goog.events.KeyHandler.prototype.keyPressKey_ = null;
  10610. goog.events.KeyHandler.prototype.keyDownKey_ = null;
  10611. goog.events.KeyHandler.prototype.keyUpKey_ = null;
  10612. goog.events.KeyHandler.prototype.lastKey_ = -1;
  10613. goog.events.KeyHandler.prototype.keyCode_ = -1;
  10614. goog.events.KeyHandler.prototype.altKey_ = !1;
  10615. goog.events.KeyHandler.EventType = {
  10616. KEY: "key"
  10617. };
  10618. goog.events.KeyHandler.safariKey_ = {
  10619. 3: goog.events.KeyCodes.ENTER,
  10620. 12: goog.events.KeyCodes.NUMLOCK,
  10621. 63232: goog.events.KeyCodes.UP,
  10622. 63233: goog.events.KeyCodes.DOWN,
  10623. 63234: goog.events.KeyCodes.LEFT,
  10624. 63235: goog.events.KeyCodes.RIGHT,
  10625. 63236: goog.events.KeyCodes.F1,
  10626. 63237: goog.events.KeyCodes.F2,
  10627. 63238: goog.events.KeyCodes.F3,
  10628. 63239: goog.events.KeyCodes.F4,
  10629. 63240: goog.events.KeyCodes.F5,
  10630. 63241: goog.events.KeyCodes.F6,
  10631. 63242: goog.events.KeyCodes.F7,
  10632. 63243: goog.events.KeyCodes.F8,
  10633. 63244: goog.events.KeyCodes.F9,
  10634. 63245: goog.events.KeyCodes.F10,
  10635. 63246: goog.events.KeyCodes.F11,
  10636. 63247: goog.events.KeyCodes.F12,
  10637. 63248: goog.events.KeyCodes.PRINT_SCREEN,
  10638. 63272: goog.events.KeyCodes.DELETE,
  10639. 63273: goog.events.KeyCodes.HOME,
  10640. 63275: goog.events.KeyCodes.END,
  10641. 63276: goog.events.KeyCodes.PAGE_UP,
  10642. 63277: goog.events.KeyCodes.PAGE_DOWN,
  10643. 63289: goog.events.KeyCodes.NUMLOCK,
  10644. 63302: goog.events.KeyCodes.INSERT
  10645. };
  10646. goog.events.KeyHandler.keyIdentifier_ = {
  10647. Up: goog.events.KeyCodes.UP,
  10648. Down: goog.events.KeyCodes.DOWN,
  10649. Left: goog.events.KeyCodes.LEFT,
  10650. Right: goog.events.KeyCodes.RIGHT,
  10651. Enter: goog.events.KeyCodes.ENTER,
  10652. F1: goog.events.KeyCodes.F1,
  10653. F2: goog.events.KeyCodes.F2,
  10654. F3: goog.events.KeyCodes.F3,
  10655. F4: goog.events.KeyCodes.F4,
  10656. F5: goog.events.KeyCodes.F5,
  10657. F6: goog.events.KeyCodes.F6,
  10658. F7: goog.events.KeyCodes.F7,
  10659. F8: goog.events.KeyCodes.F8,
  10660. F9: goog.events.KeyCodes.F9,
  10661. F10: goog.events.KeyCodes.F10,
  10662. F11: goog.events.KeyCodes.F11,
  10663. F12: goog.events.KeyCodes.F12,
  10664. "U+007F": goog.events.KeyCodes.DELETE,
  10665. Home: goog.events.KeyCodes.HOME,
  10666. End: goog.events.KeyCodes.END,
  10667. PageUp: goog.events.KeyCodes.PAGE_UP,
  10668. PageDown: goog.events.KeyCodes.PAGE_DOWN,
  10669. Insert: goog.events.KeyCodes.INSERT
  10670. };
  10671. goog.events.KeyHandler.USES_KEYDOWN_ = !goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher("525");
  10672. goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ = goog.userAgent.MAC && goog.userAgent.GECKO;
  10673. goog.events.KeyHandler.prototype.handleKeyDown_ = function (a) {
  10674. (goog.userAgent.WEBKIT || goog.userAgent.EDGE) && (this.lastKey_ == goog.events.KeyCodes.CTRL && !a.ctrlKey || this.lastKey_ == goog.events.KeyCodes.ALT && !a.altKey || goog.userAgent.MAC && this.lastKey_ == goog.events.KeyCodes.META && !a.metaKey) && this.resetState();
  10675. -1 == this.lastKey_ && (a.ctrlKey && a.keyCode != goog.events.KeyCodes.CTRL ? this.lastKey_ = goog.events.KeyCodes.CTRL : a.altKey && a.keyCode != goog.events.KeyCodes.ALT ? this.lastKey_ = goog.events.KeyCodes.ALT : a.metaKey && a.keyCode != goog.events.KeyCodes.META && (this.lastKey_ = goog.events.KeyCodes.META));
  10676. goog.events.KeyHandler.USES_KEYDOWN_ && !goog.events.KeyCodes.firesKeyPressEvent(a.keyCode, this.lastKey_, a.shiftKey, a.ctrlKey, a.altKey, a.metaKey) ? this.handleEvent(a) : (this.keyCode_ = goog.events.KeyCodes.normalizeKeyCode(a.keyCode),
  10677. goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ && (this.altKey_ = a.altKey))
  10678. }
  10679. ;
  10680. goog.events.KeyHandler.prototype.resetState = function () {
  10681. this.keyCode_ = this.lastKey_ = -1
  10682. }
  10683. ;
  10684. goog.events.KeyHandler.prototype.handleKeyup_ = function (a) {
  10685. this.resetState();
  10686. this.altKey_ = a.altKey
  10687. }
  10688. ;
  10689. goog.events.KeyHandler.prototype.handleEvent = function (a) {
  10690. var b = a.getBrowserEvent()
  10691. , c = b.altKey;
  10692. if (goog.userAgent.IE && a.type == goog.events.EventType.KEYPRESS) {
  10693. var d = this.keyCode_;
  10694. var e = d != goog.events.KeyCodes.ENTER && d != goog.events.KeyCodes.ESC ? b.keyCode : 0
  10695. } else
  10696. (goog.userAgent.WEBKIT || goog.userAgent.EDGE) && a.type == goog.events.EventType.KEYPRESS ? (d = this.keyCode_,
  10697. e = 0 <= b.charCode && 63232 > b.charCode && goog.events.KeyCodes.isCharacterKey(d) ? b.charCode : 0) : goog.userAgent.OPERA && !goog.userAgent.WEBKIT ? (d = this.keyCode_,
  10698. e = goog.events.KeyCodes.isCharacterKey(d) ? b.keyCode : 0) : (a.type == goog.events.EventType.KEYPRESS ? (goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_ && (c = this.altKey_),
  10699. b.keyCode == b.charCode ? 32 > b.keyCode ? (d = b.keyCode,
  10700. e = 0) : (d = this.keyCode_,
  10701. e = b.charCode) : (d = b.keyCode || this.keyCode_,
  10702. e = b.charCode || 0)) : (d = b.keyCode || this.keyCode_,
  10703. e = b.charCode || 0),
  10704. goog.userAgent.MAC && e == goog.events.KeyCodes.QUESTION_MARK && d == goog.events.KeyCodes.WIN_KEY && (d = goog.events.KeyCodes.SLASH));
  10705. var f = d = goog.events.KeyCodes.normalizeKeyCode(d);
  10706. d ? 63232 <= d && d in goog.events.KeyHandler.safariKey_ ? f = goog.events.KeyHandler.safariKey_[d] : 25 == d && a.shiftKey && (f = 9) : b.keyIdentifier && b.keyIdentifier in goog.events.KeyHandler.keyIdentifier_ && (f = goog.events.KeyHandler.keyIdentifier_[b.keyIdentifier]);
  10707. goog.userAgent.GECKO && goog.events.KeyHandler.USES_KEYDOWN_ && a.type == goog.events.EventType.KEYPRESS && !goog.events.KeyCodes.firesKeyPressEvent(f, this.lastKey_, a.shiftKey, a.ctrlKey, c, a.metaKey) || (a = f == this.lastKey_,
  10708. this.lastKey_ = f,
  10709. b = new goog.events.KeyEvent(f, e, a, b),
  10710. b.altKey = c,
  10711. this.dispatchEvent(b))
  10712. }
  10713. ;
  10714. goog.events.KeyHandler.prototype.getElement = function () {
  10715. return this.element_
  10716. }
  10717. ;
  10718. goog.events.KeyHandler.prototype.attach = function (a, b) {
  10719. this.keyUpKey_ && this.detach();
  10720. this.element_ = a;
  10721. this.keyPressKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYPRESS, this, b);
  10722. this.keyDownKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYDOWN, this.handleKeyDown_, b, this);
  10723. this.keyUpKey_ = goog.events.listen(this.element_, goog.events.EventType.KEYUP, this.handleKeyup_, b, this)
  10724. }
  10725. ;
  10726. goog.events.KeyHandler.prototype.detach = function () {
  10727. this.keyPressKey_ && (goog.events.unlistenByKey(this.keyPressKey_),
  10728. goog.events.unlistenByKey(this.keyDownKey_),
  10729. goog.events.unlistenByKey(this.keyUpKey_),
  10730. this.keyUpKey_ = this.keyDownKey_ = this.keyPressKey_ = null);
  10731. this.element_ = null;
  10732. this.keyCode_ = this.lastKey_ = -1
  10733. }
  10734. ;
  10735. goog.events.KeyHandler.prototype.disposeInternal = function () {
  10736. goog.events.KeyHandler.superClass_.disposeInternal.call(this);
  10737. this.detach()
  10738. }
  10739. ;
  10740. goog.events.KeyEvent = function (a, b, c, d) {
  10741. goog.events.BrowserEvent.call(this, d);
  10742. this.type = goog.events.KeyHandler.EventType.KEY;
  10743. this.keyCode = a;
  10744. this.charCode = b;
  10745. this.repeat = c
  10746. }
  10747. ;
  10748. goog.inherits(goog.events.KeyEvent, goog.events.BrowserEvent);
  10749. goog.ui.ComponentUtil = {};
  10750. goog.ui.ComponentUtil.getMouseEventType = function (a) {
  10751. return a.pointerEventsEnabled() ? goog.events.PointerAsMouseEventType : goog.events.MouseAsMouseEventType
  10752. }
  10753. ;
  10754. goog.dom.classlist = {};
  10755. goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST = !1;
  10756. goog.dom.classlist.getClassName_ = function (a) {
  10757. return "string" == typeof a.className ? a.className : a.getAttribute && a.getAttribute("class") || ""
  10758. }
  10759. ;
  10760. goog.dom.classlist.get = function (a) {
  10761. return goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? a.classList : goog.dom.classlist.getClassName_(a).match(/\S+/g) || []
  10762. }
  10763. ;
  10764. goog.dom.classlist.set = function (a, b) {
  10765. "string" == typeof a.className ? a.className = b : a.setAttribute && a.setAttribute("class", b)
  10766. }
  10767. ;
  10768. goog.dom.classlist.contains = function (a, b) {
  10769. return goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? a.classList.contains(b) : goog.array.contains(goog.dom.classlist.get(a), b)
  10770. }
  10771. ;
  10772. goog.dom.classlist.add = function (a, b) {
  10773. if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList)
  10774. a.classList.add(b);
  10775. else if (!goog.dom.classlist.contains(a, b)) {
  10776. var c = goog.dom.classlist.getClassName_(a);
  10777. goog.dom.classlist.set(a, c + (0 < c.length ? " " + b : b))
  10778. }
  10779. }
  10780. ;
  10781. goog.dom.classlist.addAll = function (a, b) {
  10782. if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList)
  10783. goog.array.forEach(b, function (b) {
  10784. goog.dom.classlist.add(a, b)
  10785. });
  10786. else {
  10787. var c = {};
  10788. goog.array.forEach(goog.dom.classlist.get(a), function (a) {
  10789. c[a] = !0
  10790. });
  10791. goog.array.forEach(b, function (a) {
  10792. c[a] = !0
  10793. });
  10794. var d = "", e;
  10795. for (e in c)
  10796. d += 0 < d.length ? " " + e : e;
  10797. goog.dom.classlist.set(a, d)
  10798. }
  10799. }
  10800. ;
  10801. goog.dom.classlist.remove = function (a, b) {
  10802. goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? a.classList.remove(b) : goog.dom.classlist.contains(a, b) && goog.dom.classlist.set(a, goog.array.filter(goog.dom.classlist.get(a), function (a) {
  10803. return a != b
  10804. }).join(" "))
  10805. }
  10806. ;
  10807. goog.dom.classlist.removeAll = function (a, b) {
  10808. goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || a.classList ? goog.array.forEach(b, function (b) {
  10809. goog.dom.classlist.remove(a, b)
  10810. }) : goog.dom.classlist.set(a, goog.array.filter(goog.dom.classlist.get(a), function (a) {
  10811. return !goog.array.contains(b, a)
  10812. }).join(" "))
  10813. }
  10814. ;
  10815. goog.dom.classlist.enable = function (a, b, c) {
  10816. c ? goog.dom.classlist.add(a, b) : goog.dom.classlist.remove(a, b)
  10817. }
  10818. ;
  10819. goog.dom.classlist.enableAll = function (a, b, c) {
  10820. (c ? goog.dom.classlist.addAll : goog.dom.classlist.removeAll)(a, b)
  10821. }
  10822. ;
  10823. goog.dom.classlist.swap = function (a, b, c) {
  10824. return goog.dom.classlist.contains(a, b) ? (goog.dom.classlist.remove(a, b),
  10825. goog.dom.classlist.add(a, c),
  10826. !0) : !1
  10827. }
  10828. ;
  10829. goog.dom.classlist.toggle = function (a, b) {
  10830. var c = !goog.dom.classlist.contains(a, b);
  10831. goog.dom.classlist.enable(a, b, c);
  10832. return c
  10833. }
  10834. ;
  10835. goog.dom.classlist.addRemove = function (a, b, c) {
  10836. goog.dom.classlist.remove(a, b);
  10837. goog.dom.classlist.add(a, c)
  10838. }
  10839. ;
  10840. goog.ui.registry = {};
  10841. goog.ui.registry.getDefaultRenderer = function (a) {
  10842. for (var b; a;) {
  10843. b = goog.getUid(a);
  10844. if (b = goog.ui.registry.defaultRenderers_[b])
  10845. break;
  10846. a = a.superClass_ ? a.superClass_.constructor : null
  10847. }
  10848. return b ? goog.isFunction(b.getInstance) ? b.getInstance() : new b : null
  10849. }
  10850. ;
  10851. goog.ui.registry.setDefaultRenderer = function (a, b) {
  10852. if (!goog.isFunction(a))
  10853. throw Error("Invalid component class " + a);
  10854. if (!goog.isFunction(b))
  10855. throw Error("Invalid renderer class " + b);
  10856. var c = goog.getUid(a);
  10857. goog.ui.registry.defaultRenderers_[c] = b
  10858. }
  10859. ;
  10860. goog.ui.registry.getDecoratorByClassName = function (a) {
  10861. return a in goog.ui.registry.decoratorFunctions_ ? goog.ui.registry.decoratorFunctions_[a]() : null
  10862. }
  10863. ;
  10864. goog.ui.registry.setDecoratorByClassName = function (a, b) {
  10865. if (!a)
  10866. throw Error("Invalid class name " + a);
  10867. if (!goog.isFunction(b))
  10868. throw Error("Invalid decorator function " + b);
  10869. goog.ui.registry.decoratorFunctions_[a] = b
  10870. }
  10871. ;
  10872. goog.ui.registry.getDecorator = function (a) {
  10873. goog.asserts.assert(a);
  10874. for (var b = goog.dom.classlist.get(a), c = 0, d = b.length; c < d; c++)
  10875. if (a = goog.ui.registry.getDecoratorByClassName(b[c]))
  10876. return a;
  10877. return null
  10878. }
  10879. ;
  10880. goog.ui.registry.reset = function () {
  10881. goog.ui.registry.defaultRenderers_ = {};
  10882. goog.ui.registry.decoratorFunctions_ = {}
  10883. }
  10884. ;
  10885. goog.ui.registry.defaultRenderers_ = {};
  10886. goog.ui.registry.decoratorFunctions_ = {};
  10887. goog.ui.ContainerRenderer = function (a) {
  10888. this.ariaRole_ = a
  10889. }
  10890. ;
  10891. goog.addSingletonGetter(goog.ui.ContainerRenderer);
  10892. goog.ui.ContainerRenderer.getCustomRenderer = function (a, b) {
  10893. var c = new a;
  10894. c.getCssClass = function () {
  10895. return b
  10896. }
  10897. ;
  10898. return c
  10899. }
  10900. ;
  10901. goog.ui.ContainerRenderer.CSS_CLASS = "goog-container";
  10902. goog.ui.ContainerRenderer.prototype.getAriaRole = function () {
  10903. return this.ariaRole_
  10904. }
  10905. ;
  10906. goog.ui.ContainerRenderer.prototype.enableTabIndex = function (a, b) {
  10907. a && (a.tabIndex = b ? 0 : -1)
  10908. }
  10909. ;
  10910. goog.ui.ContainerRenderer.prototype.createDom = function (a) {
  10911. return a.getDomHelper().createDom("DIV", this.getClassNames(a).join(" "))
  10912. }
  10913. ;
  10914. goog.ui.ContainerRenderer.prototype.getContentElement = function (a) {
  10915. return a
  10916. }
  10917. ;
  10918. goog.ui.ContainerRenderer.prototype.canDecorate = function (a) {
  10919. return "DIV" == a.tagName
  10920. }
  10921. ;
  10922. goog.ui.ContainerRenderer.prototype.decorate = function (a, b) {
  10923. b.id && a.setId(b.id);
  10924. var c = this.getCssClass()
  10925. , d = !1
  10926. , e = goog.dom.classlist.get(b);
  10927. e && goog.array.forEach(e, function (b) {
  10928. b == c ? d = !0 : b && this.setStateFromClassName(a, b, c)
  10929. }, this);
  10930. d || goog.dom.classlist.add(b, c);
  10931. this.decorateChildren(a, this.getContentElement(b));
  10932. return b
  10933. }
  10934. ;
  10935. goog.ui.ContainerRenderer.prototype.setStateFromClassName = function (a, b, c) {
  10936. b == c + "-disabled" ? a.setEnabled(!1) : b == c + "-horizontal" ? a.setOrientation(goog.ui.Container.Orientation.HORIZONTAL) : b == c + "-vertical" && a.setOrientation(goog.ui.Container.Orientation.VERTICAL)
  10937. }
  10938. ;
  10939. goog.ui.ContainerRenderer.prototype.decorateChildren = function (a, b, c) {
  10940. if (b) {
  10941. c = c || b.firstChild;
  10942. for (var d; c && c.parentNode == b;) {
  10943. d = c.nextSibling;
  10944. if (c.nodeType == goog.dom.NodeType.ELEMENT) {
  10945. var e = this.getDecoratorForChild(c);
  10946. e && (e.setElementInternal(c),
  10947. a.isEnabled() || e.setEnabled(!1),
  10948. a.addChild(e),
  10949. e.decorate(c))
  10950. } else
  10951. c.nodeValue && "" != goog.string.trim(c.nodeValue) || b.removeChild(c);
  10952. c = d
  10953. }
  10954. }
  10955. }
  10956. ;
  10957. goog.ui.ContainerRenderer.prototype.getDecoratorForChild = function (a) {
  10958. return goog.ui.registry.getDecorator(a)
  10959. }
  10960. ;
  10961. goog.ui.ContainerRenderer.prototype.initializeDom = function (a) {
  10962. a = a.getElement();
  10963. goog.asserts.assert(a, "The container DOM element cannot be null.");
  10964. goog.style.setUnselectable(a, !0, goog.userAgent.GECKO);
  10965. goog.userAgent.IE && (a.hideFocus = !0);
  10966. var b = this.getAriaRole();
  10967. b && goog.a11y.aria.setRole(a, b)
  10968. }
  10969. ;
  10970. goog.ui.ContainerRenderer.prototype.getKeyEventTarget = function (a) {
  10971. return a.getElement()
  10972. }
  10973. ;
  10974. goog.ui.ContainerRenderer.prototype.getCssClass = function () {
  10975. return goog.ui.ContainerRenderer.CSS_CLASS
  10976. }
  10977. ;
  10978. goog.ui.ContainerRenderer.prototype.getClassNames = function (a) {
  10979. var b = this.getCssClass()
  10980. , c = a.getOrientation() == goog.ui.Container.Orientation.HORIZONTAL;
  10981. c = [b, c ? b + "-horizontal" : b + "-vertical"];
  10982. a.isEnabled() || c.push(b + "-disabled");
  10983. return c
  10984. }
  10985. ;
  10986. goog.ui.ContainerRenderer.prototype.getDefaultOrientation = function () {
  10987. return goog.ui.Container.Orientation.VERTICAL
  10988. }
  10989. ;
  10990. goog.ui.ControlRenderer = function () { }
  10991. ;
  10992. goog.addSingletonGetter(goog.ui.ControlRenderer);
  10993. goog.tagUnsealableClass(goog.ui.ControlRenderer);
  10994. goog.ui.ControlRenderer.getCustomRenderer = function (a, b) {
  10995. var c = new a;
  10996. c.getCssClass = function () {
  10997. return b
  10998. }
  10999. ;
  11000. return c
  11001. }
  11002. ;
  11003. goog.ui.ControlRenderer.CSS_CLASS = "goog-control";
  11004. goog.ui.ControlRenderer.IE6_CLASS_COMBINATIONS = [];
  11005. goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_ = goog.object.create(goog.a11y.aria.Role.BUTTON, goog.a11y.aria.State.PRESSED, goog.a11y.aria.Role.CHECKBOX, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.MENU_ITEM, goog.a11y.aria.State.SELECTED, goog.a11y.aria.Role.MENU_ITEM_CHECKBOX, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.MENU_ITEM_RADIO, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.RADIO, goog.a11y.aria.State.CHECKED, goog.a11y.aria.Role.TAB, goog.a11y.aria.State.SELECTED, goog.a11y.aria.Role.TREEITEM, goog.a11y.aria.State.SELECTED);
  11006. goog.ui.ControlRenderer.prototype.getAriaRole = function () { }
  11007. ;
  11008. goog.ui.ControlRenderer.prototype.createDom = function (a) {
  11009. return a.getDomHelper().createDom("DIV", this.getClassNames(a).join(" "), a.getContent())
  11010. }
  11011. ;
  11012. goog.ui.ControlRenderer.prototype.getContentElement = function (a) {
  11013. return a
  11014. }
  11015. ;
  11016. goog.ui.ControlRenderer.prototype.enableClassName = function (a, b, c) {
  11017. if (a = a.getElement ? a.getElement() : a) {
  11018. var d = [b];
  11019. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7") && (d = this.getAppliedCombinedClassNames_(goog.dom.classlist.get(a), b),
  11020. d.push(b));
  11021. goog.dom.classlist.enableAll(a, d, c)
  11022. }
  11023. }
  11024. ;
  11025. goog.ui.ControlRenderer.prototype.enableExtraClassName = function (a, b, c) {
  11026. this.enableClassName(a, b, c)
  11027. }
  11028. ;
  11029. goog.ui.ControlRenderer.prototype.canDecorate = function (a) {
  11030. return !0
  11031. }
  11032. ;
  11033. goog.ui.ControlRenderer.prototype.decorate = function (a, b) {
  11034. b.id && a.setId(b.id);
  11035. var c = this.getContentElement(b);
  11036. c && c.firstChild ? a.setContentInternal(c.firstChild.nextSibling ? goog.array.clone(c.childNodes) : c.firstChild) : a.setContentInternal(null);
  11037. var d = 0
  11038. , e = this.getCssClass()
  11039. , f = this.getStructuralCssClass()
  11040. , g = !1
  11041. , h = !1
  11042. , k = !1
  11043. , m = goog.array.toArray(goog.dom.classlist.get(b));
  11044. goog.array.forEach(m, function (a) {
  11045. g || a != e ? h || a != f ? d |= this.getStateFromClass(a) : h = !0 : (g = !0,
  11046. f == e && (h = !0));
  11047. this.getStateFromClass(a) == goog.ui.Component.State.DISABLED && (goog.asserts.assertElement(c),
  11048. goog.dom.isFocusableTabIndex(c) && goog.dom.setFocusableTabIndex(c, !1))
  11049. }, this);
  11050. a.setStateInternal(d);
  11051. g || (m.push(e),
  11052. f == e && (h = !0));
  11053. h || m.push(f);
  11054. var p = a.getExtraClassNames();
  11055. p && m.push.apply(m, p);
  11056. if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7")) {
  11057. var l = this.getAppliedCombinedClassNames_(m);
  11058. 0 < l.length && (m.push.apply(m, l),
  11059. k = !0)
  11060. }
  11061. g && h && !p && !k || goog.dom.classlist.set(b, m.join(" "));
  11062. return b
  11063. }
  11064. ;
  11065. goog.ui.ControlRenderer.prototype.initializeDom = function (a) {
  11066. a.isRightToLeft() && this.setRightToLeft(a.getElement(), !0);
  11067. a.isEnabled() && this.setFocusable(a, a.isVisible())
  11068. }
  11069. ;
  11070. goog.ui.ControlRenderer.prototype.setAriaRole = function (a, b) {
  11071. var c = b || this.getAriaRole();
  11072. if (c) {
  11073. goog.asserts.assert(a, "The element passed as a first parameter cannot be null.");
  11074. var d = goog.a11y.aria.getRole(a);
  11075. c != d && goog.a11y.aria.setRole(a, c)
  11076. }
  11077. }
  11078. ;
  11079. goog.ui.ControlRenderer.prototype.setAriaStates = function (a, b) {
  11080. goog.asserts.assert(a);
  11081. goog.asserts.assert(b);
  11082. var c = a.getAriaLabel();
  11083. null != c && this.setAriaLabel(b, c);
  11084. a.isVisible() || goog.a11y.aria.setState(b, goog.a11y.aria.State.HIDDEN, !a.isVisible());
  11085. a.isEnabled() || this.updateAriaState(b, goog.ui.Component.State.DISABLED, !a.isEnabled());
  11086. a.isSupportedState(goog.ui.Component.State.SELECTED) && this.updateAriaState(b, goog.ui.Component.State.SELECTED, a.isSelected());
  11087. a.isSupportedState(goog.ui.Component.State.CHECKED) && this.updateAriaState(b, goog.ui.Component.State.CHECKED, a.isChecked());
  11088. a.isSupportedState(goog.ui.Component.State.OPENED) && this.updateAriaState(b, goog.ui.Component.State.OPENED, a.isOpen())
  11089. }
  11090. ;
  11091. goog.ui.ControlRenderer.prototype.setAriaLabel = function (a, b) {
  11092. goog.a11y.aria.setLabel(a, b)
  11093. }
  11094. ;
  11095. goog.ui.ControlRenderer.prototype.setAllowTextSelection = function (a, b) {
  11096. goog.style.setUnselectable(a, !b, !goog.userAgent.IE && !goog.userAgent.OPERA)
  11097. }
  11098. ;
  11099. goog.ui.ControlRenderer.prototype.setRightToLeft = function (a, b) {
  11100. this.enableClassName(a, this.getStructuralCssClass() + "-rtl", b)
  11101. }
  11102. ;
  11103. goog.ui.ControlRenderer.prototype.isFocusable = function (a) {
  11104. var b;
  11105. return a.isSupportedState(goog.ui.Component.State.FOCUSED) && (b = a.getKeyEventTarget()) ? goog.dom.isFocusableTabIndex(b) : !1
  11106. }
  11107. ;
  11108. goog.ui.ControlRenderer.prototype.setFocusable = function (a, b) {
  11109. var c;
  11110. if (a.isSupportedState(goog.ui.Component.State.FOCUSED) && (c = a.getKeyEventTarget())) {
  11111. if (!b && a.isFocused()) {
  11112. try {
  11113. c.blur()
  11114. } catch (d) { }
  11115. a.isFocused() && a.handleBlur(null)
  11116. }
  11117. goog.dom.isFocusableTabIndex(c) != b && goog.dom.setFocusableTabIndex(c, b)
  11118. }
  11119. }
  11120. ;
  11121. goog.ui.ControlRenderer.prototype.setVisible = function (a, b) {
  11122. goog.style.setElementShown(a, b);
  11123. a && goog.a11y.aria.setState(a, goog.a11y.aria.State.HIDDEN, !b)
  11124. }
  11125. ;
  11126. goog.ui.ControlRenderer.prototype.setState = function (a, b, c) {
  11127. var d = a.getElement();
  11128. if (d) {
  11129. var e = this.getClassForState(b);
  11130. e && this.enableClassName(a, e, c);
  11131. this.updateAriaState(d, b, c)
  11132. }
  11133. }
  11134. ;
  11135. goog.ui.ControlRenderer.prototype.updateAriaState = function (a, b, c) {
  11136. goog.ui.ControlRenderer.ariaAttributeMap_ || (goog.ui.ControlRenderer.ariaAttributeMap_ = goog.object.create(goog.ui.Component.State.DISABLED, goog.a11y.aria.State.DISABLED, goog.ui.Component.State.SELECTED, goog.a11y.aria.State.SELECTED, goog.ui.Component.State.CHECKED, goog.a11y.aria.State.CHECKED, goog.ui.Component.State.OPENED, goog.a11y.aria.State.EXPANDED));
  11137. goog.asserts.assert(a, "The element passed as a first parameter cannot be null.");
  11138. (b = goog.ui.ControlRenderer.getAriaStateForAriaRole_(a, goog.ui.ControlRenderer.ariaAttributeMap_[b])) && goog.a11y.aria.setState(a, b, c)
  11139. }
  11140. ;
  11141. goog.ui.ControlRenderer.getAriaStateForAriaRole_ = function (a, b) {
  11142. var c = goog.a11y.aria.getRole(a);
  11143. if (!c)
  11144. return b;
  11145. c = goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_[c] || b;
  11146. return goog.ui.ControlRenderer.isAriaState_(b) ? c : b
  11147. }
  11148. ;
  11149. goog.ui.ControlRenderer.isAriaState_ = function (a) {
  11150. return a == goog.a11y.aria.State.CHECKED || a == goog.a11y.aria.State.SELECTED
  11151. }
  11152. ;
  11153. goog.ui.ControlRenderer.prototype.setContent = function (a, b) {
  11154. var c = this.getContentElement(a);
  11155. if (c && (goog.dom.removeChildren(c),
  11156. b))
  11157. if ("string" === typeof b)
  11158. goog.dom.setTextContent(c, b);
  11159. else {
  11160. var d = function (a) {
  11161. if (a) {
  11162. var b = goog.dom.getOwnerDocument(c);
  11163. c.appendChild("string" === typeof a ? b.createTextNode(a) : a)
  11164. }
  11165. };
  11166. goog.isArray(b) ? goog.array.forEach(b, d) : !goog.isArrayLike(b) || "nodeType" in b ? d(b) : goog.array.forEach(goog.array.clone(b), d)
  11167. }
  11168. }
  11169. ;
  11170. goog.ui.ControlRenderer.prototype.getKeyEventTarget = function (a) {
  11171. return a.getElement()
  11172. }
  11173. ;
  11174. goog.ui.ControlRenderer.prototype.getCssClass = function () {
  11175. return goog.ui.ControlRenderer.CSS_CLASS
  11176. }
  11177. ;
  11178. goog.ui.ControlRenderer.prototype.getIe6ClassCombinations = function () {
  11179. return []
  11180. }
  11181. ;
  11182. goog.ui.ControlRenderer.prototype.getStructuralCssClass = function () {
  11183. return this.getCssClass()
  11184. }
  11185. ;
  11186. goog.ui.ControlRenderer.prototype.getClassNames = function (a) {
  11187. var b = this.getCssClass()
  11188. , c = [b]
  11189. , d = this.getStructuralCssClass();
  11190. d != b && c.push(d);
  11191. b = this.getClassNamesForState(a.getState());
  11192. c.push.apply(c, b);
  11193. (a = a.getExtraClassNames()) && c.push.apply(c, a);
  11194. goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7") && c.push.apply(c, this.getAppliedCombinedClassNames_(c));
  11195. return c
  11196. }
  11197. ;
  11198. goog.ui.ControlRenderer.prototype.getAppliedCombinedClassNames_ = function (a, b) {
  11199. var c = [];
  11200. b && (a = goog.array.concat(a, [b]));
  11201. goog.array.forEach(this.getIe6ClassCombinations(), function (d) {
  11202. !goog.array.every(d, goog.partial(goog.array.contains, a)) || b && !goog.array.contains(d, b) || c.push(d.join("_"))
  11203. });
  11204. return c
  11205. }
  11206. ;
  11207. goog.ui.ControlRenderer.prototype.getClassNamesForState = function (a) {
  11208. for (var b = []; a;) {
  11209. var c = a & -a;
  11210. b.push(this.getClassForState(c));
  11211. a &= ~c
  11212. }
  11213. return b
  11214. }
  11215. ;
  11216. goog.ui.ControlRenderer.prototype.getClassForState = function (a) {
  11217. this.classByState_ || this.createClassByStateMap_();
  11218. return this.classByState_[a]
  11219. }
  11220. ;
  11221. goog.ui.ControlRenderer.prototype.getStateFromClass = function (a) {
  11222. this.stateByClass_ || this.createStateByClassMap_();
  11223. a = parseInt(this.stateByClass_[a], 10);
  11224. return isNaN(a) ? 0 : a
  11225. }
  11226. ;
  11227. goog.ui.ControlRenderer.prototype.createClassByStateMap_ = function () {
  11228. var a = this.getStructuralCssClass()
  11229. , b = !goog.string.contains(goog.string.normalizeWhitespace(a), " ");
  11230. goog.asserts.assert(b, "ControlRenderer has an invalid css class: '" + a + "'");
  11231. this.classByState_ = goog.object.create(goog.ui.Component.State.DISABLED, a + "-disabled", goog.ui.Component.State.HOVER, a + "-hover", goog.ui.Component.State.ACTIVE, a + "-active", goog.ui.Component.State.SELECTED, a + "-selected", goog.ui.Component.State.CHECKED, a + "-checked", goog.ui.Component.State.FOCUSED, a + "-focused", goog.ui.Component.State.OPENED, a + "-open")
  11232. }
  11233. ;
  11234. goog.ui.ControlRenderer.prototype.createStateByClassMap_ = function () {
  11235. this.classByState_ || this.createClassByStateMap_();
  11236. this.stateByClass_ = goog.object.transpose(this.classByState_)
  11237. }
  11238. ;
  11239. goog.ui.Control = function (a, b, c) {
  11240. goog.ui.Component.call(this, c);
  11241. this.renderer_ = b || goog.ui.registry.getDefaultRenderer(this.constructor);
  11242. this.setContentInternal(void 0 !== a ? a : null);
  11243. this.ariaLabel_ = null
  11244. }
  11245. ;
  11246. goog.inherits(goog.ui.Control, goog.ui.Component);
  11247. goog.tagUnsealableClass(goog.ui.Control);
  11248. goog.ui.Control.registerDecorator = goog.ui.registry.setDecoratorByClassName;
  11249. goog.ui.Control.getDecorator = goog.ui.registry.getDecorator;
  11250. goog.ui.Control.prototype.content_ = null;
  11251. goog.ui.Control.prototype.state_ = 0;
  11252. goog.ui.Control.prototype.supportedStates_ = goog.ui.Component.State.DISABLED | goog.ui.Component.State.HOVER | goog.ui.Component.State.ACTIVE | goog.ui.Component.State.FOCUSED;
  11253. goog.ui.Control.prototype.autoStates_ = goog.ui.Component.State.ALL;
  11254. goog.ui.Control.prototype.statesWithTransitionEvents_ = 0;
  11255. goog.ui.Control.prototype.visible_ = !0;
  11256. goog.ui.Control.prototype.extraClassNames_ = null;
  11257. goog.ui.Control.prototype.handleMouseEvents_ = !0;
  11258. goog.ui.Control.prototype.allowTextSelection_ = !1;
  11259. goog.ui.Control.prototype.preferredAriaRole_ = null;
  11260. goog.ui.Control.prototype.isHandleMouseEvents = function () {
  11261. return this.handleMouseEvents_
  11262. }
  11263. ;
  11264. goog.ui.Control.prototype.setHandleMouseEvents = function (a) {
  11265. this.isInDocument() && a != this.handleMouseEvents_ && this.enableMouseEventHandling_(a);
  11266. this.handleMouseEvents_ = a
  11267. }
  11268. ;
  11269. goog.ui.Control.prototype.getKeyEventTarget = function () {
  11270. return this.renderer_.getKeyEventTarget(this)
  11271. }
  11272. ;
  11273. goog.ui.Control.prototype.getKeyHandler = function () {
  11274. return this.keyHandler_ || (this.keyHandler_ = new goog.events.KeyHandler)
  11275. }
  11276. ;
  11277. goog.ui.Control.prototype.getRenderer = function () {
  11278. return this.renderer_
  11279. }
  11280. ;
  11281. goog.ui.Control.prototype.setRenderer = function (a) {
  11282. if (this.isInDocument())
  11283. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11284. this.getElement() && this.setElementInternal(null);
  11285. this.renderer_ = a
  11286. }
  11287. ;
  11288. goog.ui.Control.prototype.getExtraClassNames = function () {
  11289. return this.extraClassNames_
  11290. }
  11291. ;
  11292. goog.ui.Control.prototype.addClassName = function (a) {
  11293. a && (this.extraClassNames_ ? goog.array.contains(this.extraClassNames_, a) || this.extraClassNames_.push(a) : this.extraClassNames_ = [a],
  11294. this.renderer_.enableExtraClassName(this, a, !0))
  11295. }
  11296. ;
  11297. goog.ui.Control.prototype.removeClassName = function (a) {
  11298. a && this.extraClassNames_ && goog.array.remove(this.extraClassNames_, a) && (0 == this.extraClassNames_.length && (this.extraClassNames_ = null),
  11299. this.renderer_.enableExtraClassName(this, a, !1))
  11300. }
  11301. ;
  11302. goog.ui.Control.prototype.enableClassName = function (a, b) {
  11303. b ? this.addClassName(a) : this.removeClassName(a)
  11304. }
  11305. ;
  11306. goog.ui.Control.prototype.createDom = function () {
  11307. var a = this.renderer_.createDom(this);
  11308. this.setElementInternal(a);
  11309. this.renderer_.setAriaRole(a, this.getPreferredAriaRole());
  11310. this.isAllowTextSelection() || this.renderer_.setAllowTextSelection(a, !1);
  11311. this.isVisible() || this.renderer_.setVisible(a, !1)
  11312. }
  11313. ;
  11314. goog.ui.Control.prototype.getPreferredAriaRole = function () {
  11315. return this.preferredAriaRole_
  11316. }
  11317. ;
  11318. goog.ui.Control.prototype.setPreferredAriaRole = function (a) {
  11319. this.preferredAriaRole_ = a
  11320. }
  11321. ;
  11322. goog.ui.Control.prototype.getAriaLabel = function () {
  11323. return this.ariaLabel_
  11324. }
  11325. ;
  11326. goog.ui.Control.prototype.setAriaLabel = function (a) {
  11327. this.ariaLabel_ = a;
  11328. var b = this.getElement();
  11329. b && this.renderer_.setAriaLabel(b, a)
  11330. }
  11331. ;
  11332. goog.ui.Control.prototype.getContentElement = function () {
  11333. return this.renderer_.getContentElement(this.getElement())
  11334. }
  11335. ;
  11336. goog.ui.Control.prototype.canDecorate = function (a) {
  11337. return this.renderer_.canDecorate(a)
  11338. }
  11339. ;
  11340. goog.ui.Control.prototype.decorateInternal = function (a) {
  11341. a = this.renderer_.decorate(this, a);
  11342. this.setElementInternal(a);
  11343. this.renderer_.setAriaRole(a, this.getPreferredAriaRole());
  11344. this.isAllowTextSelection() || this.renderer_.setAllowTextSelection(a, !1);
  11345. this.visible_ = "none" != a.style.display
  11346. }
  11347. ;
  11348. goog.ui.Control.prototype.enterDocument = function () {
  11349. goog.ui.Control.superClass_.enterDocument.call(this);
  11350. this.renderer_.setAriaStates(this, this.getElementStrict());
  11351. this.renderer_.initializeDom(this);
  11352. if (this.supportedStates_ & ~goog.ui.Component.State.DISABLED && (this.isHandleMouseEvents() && this.enableMouseEventHandling_(!0),
  11353. this.isSupportedState(goog.ui.Component.State.FOCUSED))) {
  11354. var a = this.getKeyEventTarget();
  11355. if (a) {
  11356. var b = this.getKeyHandler();
  11357. b.attach(a);
  11358. this.getHandler().listen(b, goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent).listen(a, goog.events.EventType.FOCUS, this.handleFocus).listen(a, goog.events.EventType.BLUR, this.handleBlur)
  11359. }
  11360. }
  11361. }
  11362. ;
  11363. goog.ui.Control.prototype.enableMouseEventHandling_ = function (a) {
  11364. var b = goog.ui.ComponentUtil.getMouseEventType(this)
  11365. , c = this.getHandler()
  11366. , d = this.getElement();
  11367. a ? (c.listen(d, b.MOUSEDOWN, this.handleMouseDown).listen(d, [b.MOUSEUP, b.MOUSECANCEL], this.handleMouseUp).listen(d, goog.events.EventType.MOUSEOVER, this.handleMouseOver).listen(d, goog.events.EventType.MOUSEOUT, this.handleMouseOut),
  11368. this.pointerEventsEnabled() && c.listen(d, goog.events.EventType.GOTPOINTERCAPTURE, this.preventPointerCapture_),
  11369. this.handleContextMenu != goog.nullFunction && c.listen(d, goog.events.EventType.CONTEXTMENU, this.handleContextMenu),
  11370. goog.userAgent.IE && (goog.userAgent.isVersionOrHigher(9) || c.listen(d, goog.events.EventType.DBLCLICK, this.handleDblClick),
  11371. this.ieMouseEventSequenceSimulator_ || (this.ieMouseEventSequenceSimulator_ = new goog.ui.Control.IeMouseEventSequenceSimulator_(this),
  11372. this.registerDisposable(this.ieMouseEventSequenceSimulator_)))) : (c.unlisten(d, b.MOUSEDOWN, this.handleMouseDown).unlisten(d, [b.MOUSEUP, b.MOUSECANCEL], this.handleMouseUp).unlisten(d, goog.events.EventType.MOUSEOVER, this.handleMouseOver).unlisten(d, goog.events.EventType.MOUSEOUT, this.handleMouseOut),
  11373. this.pointerEventsEnabled() && c.unlisten(d, goog.events.EventType.GOTPOINTERCAPTURE, this.preventPointerCapture_),
  11374. this.handleContextMenu != goog.nullFunction && c.unlisten(d, goog.events.EventType.CONTEXTMENU, this.handleContextMenu),
  11375. goog.userAgent.IE && (goog.userAgent.isVersionOrHigher(9) || c.unlisten(d, goog.events.EventType.DBLCLICK, this.handleDblClick),
  11376. goog.dispose(this.ieMouseEventSequenceSimulator_),
  11377. this.ieMouseEventSequenceSimulator_ = null))
  11378. }
  11379. ;
  11380. goog.ui.Control.prototype.exitDocument = function () {
  11381. goog.ui.Control.superClass_.exitDocument.call(this);
  11382. this.keyHandler_ && this.keyHandler_.detach();
  11383. this.isVisible() && this.isEnabled() && this.renderer_.setFocusable(this, !1)
  11384. }
  11385. ;
  11386. goog.ui.Control.prototype.disposeInternal = function () {
  11387. goog.ui.Control.superClass_.disposeInternal.call(this);
  11388. this.keyHandler_ && (this.keyHandler_.dispose(),
  11389. delete this.keyHandler_);
  11390. delete this.renderer_;
  11391. this.ieMouseEventSequenceSimulator_ = this.extraClassNames_ = this.content_ = null
  11392. }
  11393. ;
  11394. goog.ui.Control.prototype.getContent = function () {
  11395. return this.content_
  11396. }
  11397. ;
  11398. goog.ui.Control.prototype.setContent = function (a) {
  11399. this.renderer_.setContent(this.getElement(), a);
  11400. this.setContentInternal(a)
  11401. }
  11402. ;
  11403. goog.ui.Control.prototype.setContentInternal = function (a) {
  11404. this.content_ = a
  11405. }
  11406. ;
  11407. goog.ui.Control.prototype.getCaption = function () {
  11408. var a = this.getContent();
  11409. if (!a)
  11410. return "";
  11411. a = "string" === typeof a ? a : goog.isArray(a) ? goog.array.map(a, goog.dom.getRawTextContent).join("") : goog.dom.getTextContent(a);
  11412. return goog.string.collapseBreakingSpaces(a)
  11413. }
  11414. ;
  11415. goog.ui.Control.prototype.setCaption = function (a) {
  11416. this.setContent(a)
  11417. }
  11418. ;
  11419. goog.ui.Control.prototype.setRightToLeft = function (a) {
  11420. goog.ui.Control.superClass_.setRightToLeft.call(this, a);
  11421. var b = this.getElement();
  11422. b && this.renderer_.setRightToLeft(b, a)
  11423. }
  11424. ;
  11425. goog.ui.Control.prototype.isAllowTextSelection = function () {
  11426. return this.allowTextSelection_
  11427. }
  11428. ;
  11429. goog.ui.Control.prototype.setAllowTextSelection = function (a) {
  11430. this.allowTextSelection_ = a;
  11431. var b = this.getElement();
  11432. b && this.renderer_.setAllowTextSelection(b, a)
  11433. }
  11434. ;
  11435. goog.ui.Control.prototype.isVisible = function () {
  11436. return this.visible_
  11437. }
  11438. ;
  11439. goog.ui.Control.prototype.setVisible = function (a, b) {
  11440. if (b || this.visible_ != a && this.dispatchEvent(a ? goog.ui.Component.EventType.SHOW : goog.ui.Component.EventType.HIDE)) {
  11441. var c = this.getElement();
  11442. c && this.renderer_.setVisible(c, a);
  11443. this.isEnabled() && this.renderer_.setFocusable(this, a);
  11444. this.visible_ = a;
  11445. return !0
  11446. }
  11447. return !1
  11448. }
  11449. ;
  11450. goog.ui.Control.prototype.isEnabled = function () {
  11451. return !this.hasState(goog.ui.Component.State.DISABLED)
  11452. }
  11453. ;
  11454. goog.ui.Control.prototype.isParentDisabled_ = function () {
  11455. var a = this.getParent();
  11456. return !!a && "function" == typeof a.isEnabled && !a.isEnabled()
  11457. }
  11458. ;
  11459. goog.ui.Control.prototype.setEnabled = function (a) {
  11460. !this.isParentDisabled_() && this.isTransitionAllowed(goog.ui.Component.State.DISABLED, !a) && (a || (this.setActive(!1),
  11461. this.setHighlighted(!1)),
  11462. this.isVisible() && this.renderer_.setFocusable(this, a),
  11463. this.setState(goog.ui.Component.State.DISABLED, !a, !0))
  11464. }
  11465. ;
  11466. goog.ui.Control.prototype.isHighlighted = function () {
  11467. return this.hasState(goog.ui.Component.State.HOVER)
  11468. }
  11469. ;
  11470. goog.ui.Control.prototype.setHighlighted = function (a) {
  11471. this.isTransitionAllowed(goog.ui.Component.State.HOVER, a) && this.setState(goog.ui.Component.State.HOVER, a)
  11472. }
  11473. ;
  11474. goog.ui.Control.prototype.isActive = function () {
  11475. return this.hasState(goog.ui.Component.State.ACTIVE)
  11476. }
  11477. ;
  11478. goog.ui.Control.prototype.setActive = function (a) {
  11479. this.isTransitionAllowed(goog.ui.Component.State.ACTIVE, a) && this.setState(goog.ui.Component.State.ACTIVE, a)
  11480. }
  11481. ;
  11482. goog.ui.Control.prototype.isSelected = function () {
  11483. return this.hasState(goog.ui.Component.State.SELECTED)
  11484. }
  11485. ;
  11486. goog.ui.Control.prototype.setSelected = function (a) {
  11487. this.isTransitionAllowed(goog.ui.Component.State.SELECTED, a) && this.setState(goog.ui.Component.State.SELECTED, a)
  11488. }
  11489. ;
  11490. goog.ui.Control.prototype.isChecked = function () {
  11491. return this.hasState(goog.ui.Component.State.CHECKED)
  11492. }
  11493. ;
  11494. goog.ui.Control.prototype.setChecked = function (a) {
  11495. this.isTransitionAllowed(goog.ui.Component.State.CHECKED, a) && this.setState(goog.ui.Component.State.CHECKED, a)
  11496. }
  11497. ;
  11498. goog.ui.Control.prototype.isFocused = function () {
  11499. return this.hasState(goog.ui.Component.State.FOCUSED)
  11500. }
  11501. ;
  11502. goog.ui.Control.prototype.setFocused = function (a) {
  11503. this.isTransitionAllowed(goog.ui.Component.State.FOCUSED, a) && this.setState(goog.ui.Component.State.FOCUSED, a)
  11504. }
  11505. ;
  11506. goog.ui.Control.prototype.isOpen = function () {
  11507. return this.hasState(goog.ui.Component.State.OPENED)
  11508. }
  11509. ;
  11510. goog.ui.Control.prototype.setOpen = function (a) {
  11511. this.isTransitionAllowed(goog.ui.Component.State.OPENED, a) && this.setState(goog.ui.Component.State.OPENED, a)
  11512. }
  11513. ;
  11514. goog.ui.Control.prototype.getState = function () {
  11515. return this.state_
  11516. }
  11517. ;
  11518. goog.ui.Control.prototype.hasState = function (a) {
  11519. return !!(this.state_ & a)
  11520. }
  11521. ;
  11522. goog.ui.Control.prototype.setState = function (a, b, c) {
  11523. c || a != goog.ui.Component.State.DISABLED ? this.isSupportedState(a) && b != this.hasState(a) && (this.renderer_.setState(this, a, b),
  11524. this.state_ = b ? this.state_ | a : this.state_ & ~a) : this.setEnabled(!b)
  11525. }
  11526. ;
  11527. goog.ui.Control.prototype.setStateInternal = function (a) {
  11528. this.state_ = a
  11529. }
  11530. ;
  11531. goog.ui.Control.prototype.isSupportedState = function (a) {
  11532. return !!(this.supportedStates_ & a)
  11533. }
  11534. ;
  11535. goog.ui.Control.prototype.setSupportedState = function (a, b) {
  11536. if (this.isInDocument() && this.hasState(a) && !b)
  11537. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11538. !b && this.hasState(a) && this.setState(a, !1);
  11539. this.supportedStates_ = b ? this.supportedStates_ | a : this.supportedStates_ & ~a
  11540. }
  11541. ;
  11542. goog.ui.Control.prototype.isAutoState = function (a) {
  11543. return !!(this.autoStates_ & a) && this.isSupportedState(a)
  11544. }
  11545. ;
  11546. goog.ui.Control.prototype.setAutoStates = function (a, b) {
  11547. this.autoStates_ = b ? this.autoStates_ | a : this.autoStates_ & ~a
  11548. }
  11549. ;
  11550. goog.ui.Control.prototype.isDispatchTransitionEvents = function (a) {
  11551. return !!(this.statesWithTransitionEvents_ & a) && this.isSupportedState(a)
  11552. }
  11553. ;
  11554. goog.ui.Control.prototype.setDispatchTransitionEvents = function (a, b) {
  11555. this.statesWithTransitionEvents_ = b ? this.statesWithTransitionEvents_ | a : this.statesWithTransitionEvents_ & ~a
  11556. }
  11557. ;
  11558. goog.ui.Control.prototype.isTransitionAllowed = function (a, b) {
  11559. return this.isSupportedState(a) && this.hasState(a) != b && (!(this.statesWithTransitionEvents_ & a) || this.dispatchEvent(goog.ui.Component.getStateTransitionEvent(a, b))) && !this.isDisposed()
  11560. }
  11561. ;
  11562. goog.ui.Control.prototype.handleMouseOver = function (a) {
  11563. !goog.ui.Control.isMouseEventWithinElement_(a, this.getElement()) && this.dispatchEvent(goog.ui.Component.EventType.ENTER) && this.isEnabled() && this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0)
  11564. }
  11565. ;
  11566. goog.ui.Control.prototype.handleMouseOut = function (a) {
  11567. !goog.ui.Control.isMouseEventWithinElement_(a, this.getElement()) && this.dispatchEvent(goog.ui.Component.EventType.LEAVE) && (this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1),
  11568. this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!1))
  11569. }
  11570. ;
  11571. goog.ui.Control.prototype.preventPointerCapture_ = function (a) {
  11572. var b = a.target;
  11573. b.releasePointerCapture && b.releasePointerCapture(a.pointerId)
  11574. }
  11575. ;
  11576. goog.ui.Control.prototype.handleContextMenu = goog.nullFunction;
  11577. goog.ui.Control.isMouseEventWithinElement_ = function (a, b) {
  11578. return !!a.relatedTarget && goog.dom.contains(b, a.relatedTarget)
  11579. }
  11580. ;
  11581. goog.ui.Control.prototype.handleMouseDown = function (a) {
  11582. this.isEnabled() && (this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0),
  11583. a.isMouseActionButton() && (this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!0),
  11584. this.renderer_ && this.renderer_.isFocusable(this) && this.getKeyEventTarget().focus()));
  11585. !this.isAllowTextSelection() && a.isMouseActionButton() && a.preventDefault()
  11586. }
  11587. ;
  11588. goog.ui.Control.prototype.handleMouseUp = function (a) {
  11589. this.isEnabled() && (this.isAutoState(goog.ui.Component.State.HOVER) && this.setHighlighted(!0),
  11590. this.isActive() && this.performActionInternal(a) && this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1))
  11591. }
  11592. ;
  11593. goog.ui.Control.prototype.handleDblClick = function (a) {
  11594. this.isEnabled() && this.performActionInternal(a)
  11595. }
  11596. ;
  11597. goog.ui.Control.prototype.performActionInternal = function (a) {
  11598. this.isAutoState(goog.ui.Component.State.CHECKED) && this.setChecked(!this.isChecked());
  11599. this.isAutoState(goog.ui.Component.State.SELECTED) && this.setSelected(!0);
  11600. this.isAutoState(goog.ui.Component.State.OPENED) && this.setOpen(!this.isOpen());
  11601. var b = new goog.events.Event(goog.ui.Component.EventType.ACTION, this);
  11602. a && (b.altKey = a.altKey,
  11603. b.ctrlKey = a.ctrlKey,
  11604. b.metaKey = a.metaKey,
  11605. b.shiftKey = a.shiftKey,
  11606. b.platformModifierKey = a.platformModifierKey);
  11607. return this.dispatchEvent(b)
  11608. }
  11609. ;
  11610. goog.ui.Control.prototype.handleFocus = function (a) {
  11611. this.isAutoState(goog.ui.Component.State.FOCUSED) && this.setFocused(!0)
  11612. }
  11613. ;
  11614. goog.ui.Control.prototype.handleBlur = function (a) {
  11615. this.isAutoState(goog.ui.Component.State.ACTIVE) && this.setActive(!1);
  11616. this.isAutoState(goog.ui.Component.State.FOCUSED) && this.setFocused(!1)
  11617. }
  11618. ;
  11619. goog.ui.Control.prototype.handleKeyEvent = function (a) {
  11620. return this.isVisible() && this.isEnabled() && this.handleKeyEventInternal(a) ? (a.preventDefault(),
  11621. a.stopPropagation(),
  11622. !0) : !1
  11623. }
  11624. ;
  11625. goog.ui.Control.prototype.handleKeyEventInternal = function (a) {
  11626. return a.keyCode == goog.events.KeyCodes.ENTER && this.performActionInternal(a)
  11627. }
  11628. ;
  11629. goog.ui.registry.setDefaultRenderer(goog.ui.Control, goog.ui.ControlRenderer);
  11630. goog.ui.registry.setDecoratorByClassName(goog.ui.ControlRenderer.CSS_CLASS, function () {
  11631. return new goog.ui.Control(null)
  11632. });
  11633. goog.ui.Control.IeMouseEventSequenceSimulator_ = function (a) {
  11634. goog.Disposable.call(this);
  11635. this.control_ = a;
  11636. this.clickExpected_ = !1;
  11637. this.handler_ = new goog.events.EventHandler(this);
  11638. this.registerDisposable(this.handler_);
  11639. var b = this.control_.getElementStrict();
  11640. a = goog.ui.ComponentUtil.getMouseEventType(a);
  11641. this.handler_.listen(b, a.MOUSEDOWN, this.handleMouseDown_).listen(b, a.MOUSEUP, this.handleMouseUp_).listen(b, goog.events.EventType.CLICK, this.handleClick_)
  11642. }
  11643. ;
  11644. goog.inherits(goog.ui.Control.IeMouseEventSequenceSimulator_, goog.Disposable);
  11645. goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_ = !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9);
  11646. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleMouseDown_ = function () {
  11647. this.clickExpected_ = !1
  11648. }
  11649. ;
  11650. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleMouseUp_ = function () {
  11651. this.clickExpected_ = !0
  11652. }
  11653. ;
  11654. goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_ = function (a, b) {
  11655. if (!goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_)
  11656. return a.button = goog.events.BrowserEvent.MouseButton.LEFT,
  11657. a.type = b,
  11658. a;
  11659. var c = document.createEvent("MouseEvents");
  11660. c.initMouseEvent(b, a.bubbles, a.cancelable, a.view || null, a.detail, a.screenX, a.screenY, a.clientX, a.clientY, a.ctrlKey, a.altKey, a.shiftKey, a.metaKey, goog.events.BrowserEvent.MouseButton.LEFT, a.relatedTarget || null);
  11661. return c
  11662. }
  11663. ;
  11664. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleClick_ = function (a) {
  11665. if (this.clickExpected_)
  11666. this.clickExpected_ = !1;
  11667. else {
  11668. var b = a.getBrowserEvent()
  11669. , c = b.button
  11670. , d = b.type
  11671. , e = goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_(b, goog.events.EventType.MOUSEDOWN);
  11672. this.control_.handleMouseDown(new goog.events.BrowserEvent(e, a.currentTarget));
  11673. e = goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_(b, goog.events.EventType.MOUSEUP);
  11674. this.control_.handleMouseUp(new goog.events.BrowserEvent(e, a.currentTarget));
  11675. goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_ || (b.button = c,
  11676. b.type = d)
  11677. }
  11678. }
  11679. ;
  11680. goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.disposeInternal = function () {
  11681. this.control_ = null;
  11682. goog.ui.Control.IeMouseEventSequenceSimulator_.superClass_.disposeInternal.call(this)
  11683. }
  11684. ;
  11685. goog.ui.Container = function (a, b, c) {
  11686. goog.ui.Component.call(this, c);
  11687. this.renderer_ = b || goog.ui.ContainerRenderer.getInstance();
  11688. this.orientation_ = a || this.renderer_.getDefaultOrientation()
  11689. }
  11690. ;
  11691. goog.inherits(goog.ui.Container, goog.ui.Component);
  11692. goog.tagUnsealableClass(goog.ui.Container);
  11693. goog.ui.Container.EventType = {
  11694. AFTER_SHOW: "aftershow",
  11695. AFTER_HIDE: "afterhide"
  11696. };
  11697. goog.ui.Container.Orientation = {
  11698. HORIZONTAL: "horizontal",
  11699. VERTICAL: "vertical"
  11700. };
  11701. goog.ui.Container.prototype.keyEventTarget_ = null;
  11702. goog.ui.Container.prototype.keyHandler_ = null;
  11703. goog.ui.Container.prototype.renderer_ = null;
  11704. goog.ui.Container.prototype.orientation_ = null;
  11705. goog.ui.Container.prototype.visible_ = !0;
  11706. goog.ui.Container.prototype.enabled_ = !0;
  11707. goog.ui.Container.prototype.focusable_ = !0;
  11708. goog.ui.Container.prototype.highlightedIndex_ = -1;
  11709. goog.ui.Container.prototype.openItem_ = null;
  11710. goog.ui.Container.prototype.mouseButtonPressed_ = !1;
  11711. goog.ui.Container.prototype.allowFocusableChildren_ = !1;
  11712. goog.ui.Container.prototype.openFollowsHighlight_ = !0;
  11713. goog.ui.Container.prototype.childElementIdMap_ = null;
  11714. goog.ui.Container.prototype.getKeyEventTarget = function () {
  11715. return this.keyEventTarget_ || this.renderer_.getKeyEventTarget(this)
  11716. }
  11717. ;
  11718. goog.ui.Container.prototype.setKeyEventTarget = function (a) {
  11719. if (this.focusable_) {
  11720. var b = this.getKeyEventTarget()
  11721. , c = this.isInDocument();
  11722. this.keyEventTarget_ = a;
  11723. var d = this.getKeyEventTarget();
  11724. c && (this.keyEventTarget_ = b,
  11725. this.enableFocusHandling_(!1),
  11726. this.keyEventTarget_ = a,
  11727. this.getKeyHandler().attach(d),
  11728. this.enableFocusHandling_(!0))
  11729. } else
  11730. throw Error("Can't set key event target for container that doesn't support keyboard focus!");
  11731. }
  11732. ;
  11733. goog.ui.Container.prototype.getKeyHandler = function () {
  11734. return this.keyHandler_ || (this.keyHandler_ = new goog.events.KeyHandler(this.getKeyEventTarget()))
  11735. }
  11736. ;
  11737. goog.ui.Container.prototype.getRenderer = function () {
  11738. return this.renderer_
  11739. }
  11740. ;
  11741. goog.ui.Container.prototype.setRenderer = function (a) {
  11742. if (this.getElement())
  11743. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11744. this.renderer_ = a
  11745. }
  11746. ;
  11747. goog.ui.Container.prototype.createDom = function () {
  11748. this.setElementInternal(this.renderer_.createDom(this))
  11749. }
  11750. ;
  11751. goog.ui.Container.prototype.getContentElement = function () {
  11752. return this.renderer_.getContentElement(this.getElement())
  11753. }
  11754. ;
  11755. goog.ui.Container.prototype.canDecorate = function (a) {
  11756. return this.renderer_.canDecorate(a)
  11757. }
  11758. ;
  11759. goog.ui.Container.prototype.decorateInternal = function (a) {
  11760. this.setElementInternal(this.renderer_.decorate(this, a));
  11761. "none" == a.style.display && (this.visible_ = !1)
  11762. }
  11763. ;
  11764. goog.ui.Container.prototype.enterDocument = function () {
  11765. goog.ui.Container.superClass_.enterDocument.call(this);
  11766. this.forEachChild(function (a) {
  11767. a.isInDocument() && this.registerChildId_(a)
  11768. }, this);
  11769. var a = this.getElement();
  11770. this.renderer_.initializeDom(this);
  11771. this.setVisible(this.visible_, !0);
  11772. var b = goog.ui.ComponentUtil.getMouseEventType(this);
  11773. this.getHandler().listen(this, goog.ui.Component.EventType.ENTER, this.handleEnterItem).listen(this, goog.ui.Component.EventType.HIGHLIGHT, this.handleHighlightItem).listen(this, goog.ui.Component.EventType.UNHIGHLIGHT, this.handleUnHighlightItem).listen(this, goog.ui.Component.EventType.OPEN, this.handleOpenItem).listen(this, goog.ui.Component.EventType.CLOSE, this.handleCloseItem).listen(a, b.MOUSEDOWN, this.handleMouseDown).listen(goog.dom.getOwnerDocument(a), [b.MOUSEUP, b.MOUSECANCEL], this.handleDocumentMouseUp).listen(a, [b.MOUSEDOWN, b.MOUSEUP, b.MOUSECANCEL, goog.events.EventType.MOUSEOVER, goog.events.EventType.MOUSEOUT, goog.events.EventType.CONTEXTMENU], this.handleChildMouseEvents);
  11774. this.pointerEventsEnabled() && this.getHandler().listen(a, goog.events.EventType.GOTPOINTERCAPTURE, this.preventPointerCapture_);
  11775. this.isFocusable() && this.enableFocusHandling_(!0)
  11776. }
  11777. ;
  11778. goog.ui.Container.prototype.preventPointerCapture_ = function (a) {
  11779. var b = a.target;
  11780. b.releasePointerCapture && b.releasePointerCapture(a.pointerId)
  11781. }
  11782. ;
  11783. goog.ui.Container.prototype.enableFocusHandling_ = function (a) {
  11784. var b = this.getHandler()
  11785. , c = this.getKeyEventTarget();
  11786. a ? b.listen(c, goog.events.EventType.FOCUS, this.handleFocus).listen(c, goog.events.EventType.BLUR, this.handleBlur).listen(this.getKeyHandler(), goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent) : b.unlisten(c, goog.events.EventType.FOCUS, this.handleFocus).unlisten(c, goog.events.EventType.BLUR, this.handleBlur).unlisten(this.getKeyHandler(), goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent)
  11787. }
  11788. ;
  11789. goog.ui.Container.prototype.exitDocument = function () {
  11790. this.setHighlightedIndex(-1);
  11791. this.openItem_ && this.openItem_.setOpen(!1);
  11792. this.mouseButtonPressed_ = !1;
  11793. goog.ui.Container.superClass_.exitDocument.call(this)
  11794. }
  11795. ;
  11796. goog.ui.Container.prototype.disposeInternal = function () {
  11797. goog.ui.Container.superClass_.disposeInternal.call(this);
  11798. this.keyHandler_ && (this.keyHandler_.dispose(),
  11799. this.keyHandler_ = null);
  11800. this.renderer_ = this.openItem_ = this.childElementIdMap_ = this.keyEventTarget_ = null
  11801. }
  11802. ;
  11803. goog.ui.Container.prototype.handleEnterItem = function (a) {
  11804. return !0
  11805. }
  11806. ;
  11807. goog.ui.Container.prototype.handleHighlightItem = function (a) {
  11808. var b = this.indexOfChild(a.target);
  11809. if (-1 < b && b != this.highlightedIndex_) {
  11810. var c = this.getHighlighted();
  11811. c && c.setHighlighted(!1);
  11812. this.highlightedIndex_ = b;
  11813. c = this.getHighlighted();
  11814. this.isMouseButtonPressed() && c.setActive(!0);
  11815. this.openFollowsHighlight_ && this.openItem_ && c != this.openItem_ && (c.isSupportedState(goog.ui.Component.State.OPENED) ? c.setOpen(!0) : this.openItem_.setOpen(!1))
  11816. }
  11817. b = this.getElement();
  11818. goog.asserts.assert(b, "The DOM element for the container cannot be null.");
  11819. null != a.target.getElement() && goog.a11y.aria.setState(b, goog.a11y.aria.State.ACTIVEDESCENDANT, a.target.getElement().id)
  11820. }
  11821. ;
  11822. goog.ui.Container.prototype.handleUnHighlightItem = function (a) {
  11823. a.target == this.getHighlighted() && (this.highlightedIndex_ = -1);
  11824. a = this.getElement();
  11825. goog.asserts.assert(a, "The DOM element for the container cannot be null.");
  11826. goog.a11y.aria.removeState(a, goog.a11y.aria.State.ACTIVEDESCENDANT)
  11827. }
  11828. ;
  11829. goog.ui.Container.prototype.handleOpenItem = function (a) {
  11830. (a = a.target) && a != this.openItem_ && a.getParent() == this && (this.openItem_ && this.openItem_.setOpen(!1),
  11831. this.openItem_ = a)
  11832. }
  11833. ;
  11834. goog.ui.Container.prototype.handleCloseItem = function (a) {
  11835. a.target == this.openItem_ && (this.openItem_ = null);
  11836. var b = this.getElement()
  11837. , c = a.target.getElement();
  11838. b && a.target.isHighlighted() && c && goog.a11y.aria.setActiveDescendant(b, c)
  11839. }
  11840. ;
  11841. goog.ui.Container.prototype.handleMouseDown = function (a) {
  11842. this.enabled_ && this.setMouseButtonPressed(!0);
  11843. var b = this.getKeyEventTarget();
  11844. b && goog.dom.isFocusableTabIndex(b) ? b.focus() : a.preventDefault()
  11845. }
  11846. ;
  11847. goog.ui.Container.prototype.handleDocumentMouseUp = function (a) {
  11848. this.setMouseButtonPressed(!1)
  11849. }
  11850. ;
  11851. goog.ui.Container.prototype.handleChildMouseEvents = function (a) {
  11852. var b = goog.ui.ComponentUtil.getMouseEventType(this)
  11853. , c = this.getOwnerControl(a.target);
  11854. if (c)
  11855. switch (a.type) {
  11856. case b.MOUSEDOWN:
  11857. c.handleMouseDown(a);
  11858. break;
  11859. case b.MOUSEUP:
  11860. case b.MOUSECANCEL:
  11861. c.handleMouseUp(a);
  11862. break;
  11863. case goog.events.EventType.MOUSEOVER:
  11864. c.handleMouseOver(a);
  11865. break;
  11866. case goog.events.EventType.MOUSEOUT:
  11867. c.handleMouseOut(a);
  11868. break;
  11869. case goog.events.EventType.CONTEXTMENU:
  11870. c.handleContextMenu(a)
  11871. }
  11872. }
  11873. ;
  11874. goog.ui.Container.prototype.getOwnerControl = function (a) {
  11875. if (this.childElementIdMap_)
  11876. for (var b = this.getElement(); a && a !== b;) {
  11877. var c = a.id;
  11878. if (c in this.childElementIdMap_)
  11879. return this.childElementIdMap_[c];
  11880. a = a.parentNode
  11881. }
  11882. return null
  11883. }
  11884. ;
  11885. goog.ui.Container.prototype.handleFocus = function (a) { }
  11886. ;
  11887. goog.ui.Container.prototype.handleBlur = function (a) {
  11888. this.setHighlightedIndex(-1);
  11889. this.setMouseButtonPressed(!1);
  11890. this.openItem_ && this.openItem_.setOpen(!1)
  11891. }
  11892. ;
  11893. goog.ui.Container.prototype.handleKeyEvent = function (a) {
  11894. return this.isEnabled() && this.isVisible() && (0 != this.getChildCount() || this.keyEventTarget_) && this.handleKeyEventInternal(a) ? (a.preventDefault(),
  11895. a.stopPropagation(),
  11896. !0) : !1
  11897. }
  11898. ;
  11899. goog.ui.Container.prototype.handleKeyEventInternal = function (a) {
  11900. var b = this.getHighlighted();
  11901. if (b && "function" == typeof b.handleKeyEvent && b.handleKeyEvent(a) || this.openItem_ && this.openItem_ != b && "function" == typeof this.openItem_.handleKeyEvent && this.openItem_.handleKeyEvent(a))
  11902. return !0;
  11903. if (a.shiftKey || a.ctrlKey || a.metaKey || a.altKey)
  11904. return !1;
  11905. switch (a.keyCode) {
  11906. case goog.events.KeyCodes.ESC:
  11907. if (this.isFocusable())
  11908. this.getKeyEventTarget().blur();
  11909. else
  11910. return !1;
  11911. break;
  11912. case goog.events.KeyCodes.HOME:
  11913. this.highlightFirst();
  11914. break;
  11915. case goog.events.KeyCodes.END:
  11916. this.highlightLast();
  11917. break;
  11918. case goog.events.KeyCodes.UP:
  11919. if (this.orientation_ == goog.ui.Container.Orientation.VERTICAL)
  11920. this.highlightPrevious();
  11921. else
  11922. return !1;
  11923. break;
  11924. case goog.events.KeyCodes.LEFT:
  11925. if (this.orientation_ == goog.ui.Container.Orientation.HORIZONTAL)
  11926. this.isRightToLeft() ? this.highlightNext() : this.highlightPrevious();
  11927. else
  11928. return !1;
  11929. break;
  11930. case goog.events.KeyCodes.DOWN:
  11931. if (this.orientation_ == goog.ui.Container.Orientation.VERTICAL)
  11932. this.highlightNext();
  11933. else
  11934. return !1;
  11935. break;
  11936. case goog.events.KeyCodes.RIGHT:
  11937. if (this.orientation_ == goog.ui.Container.Orientation.HORIZONTAL)
  11938. this.isRightToLeft() ? this.highlightPrevious() : this.highlightNext();
  11939. else
  11940. return !1;
  11941. break;
  11942. default:
  11943. return !1
  11944. }
  11945. return !0
  11946. }
  11947. ;
  11948. goog.ui.Container.prototype.registerChildId_ = function (a) {
  11949. var b = a.getElement();
  11950. b = b.id || (b.id = a.getId());
  11951. this.childElementIdMap_ || (this.childElementIdMap_ = {});
  11952. this.childElementIdMap_[b] = a
  11953. }
  11954. ;
  11955. goog.ui.Container.prototype.addChild = function (a, b) {
  11956. goog.asserts.assertInstanceof(a, goog.ui.Control, "The child of a container must be a control");
  11957. goog.ui.Container.superClass_.addChild.call(this, a, b)
  11958. }
  11959. ;
  11960. goog.ui.Container.prototype.addChildAt = function (a, b, c) {
  11961. goog.asserts.assertInstanceof(a, goog.ui.Control);
  11962. a.setDispatchTransitionEvents(goog.ui.Component.State.HOVER, !0);
  11963. a.setDispatchTransitionEvents(goog.ui.Component.State.OPENED, !0);
  11964. !this.isFocusable() && this.isFocusableChildrenAllowed() || a.setSupportedState(goog.ui.Component.State.FOCUSED, !1);
  11965. a.setHandleMouseEvents(!1);
  11966. var d = a.getParent() == this ? this.indexOfChild(a) : -1;
  11967. goog.ui.Container.superClass_.addChildAt.call(this, a, b, c);
  11968. a.isInDocument() && this.isInDocument() && this.registerChildId_(a);
  11969. this.updateHighlightedIndex_(d, b)
  11970. }
  11971. ;
  11972. goog.ui.Container.prototype.updateHighlightedIndex_ = function (a, b) {
  11973. -1 == a && (a = this.getChildCount());
  11974. a == this.highlightedIndex_ ? this.highlightedIndex_ = Math.min(this.getChildCount() - 1, b) : a > this.highlightedIndex_ && b <= this.highlightedIndex_ ? this.highlightedIndex_++ : a < this.highlightedIndex_ && b > this.highlightedIndex_ && this.highlightedIndex_--
  11975. }
  11976. ;
  11977. goog.ui.Container.prototype.removeChild = function (a, b) {
  11978. a = "string" === typeof a ? this.getChild(a) : a;
  11979. goog.asserts.assertInstanceof(a, goog.ui.Control);
  11980. if (a) {
  11981. var c = this.indexOfChild(a);
  11982. -1 != c && (c == this.highlightedIndex_ ? (a.setHighlighted(!1),
  11983. this.highlightedIndex_ = -1) : c < this.highlightedIndex_ && this.highlightedIndex_--);
  11984. (c = a.getElement()) && c.id && this.childElementIdMap_ && goog.object.remove(this.childElementIdMap_, c.id)
  11985. }
  11986. a = goog.ui.Container.superClass_.removeChild.call(this, a, b);
  11987. a.setHandleMouseEvents(!0);
  11988. return a
  11989. }
  11990. ;
  11991. goog.ui.Container.prototype.getOrientation = function () {
  11992. return this.orientation_
  11993. }
  11994. ;
  11995. goog.ui.Container.prototype.setOrientation = function (a) {
  11996. if (this.getElement())
  11997. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  11998. this.orientation_ = a
  11999. }
  12000. ;
  12001. goog.ui.Container.prototype.isVisible = function () {
  12002. return this.visible_
  12003. }
  12004. ;
  12005. goog.ui.Container.prototype.setVisible = function (a, b) {
  12006. if (b || this.visible_ != a && this.dispatchEvent(a ? goog.ui.Component.EventType.SHOW : goog.ui.Component.EventType.HIDE)) {
  12007. this.visible_ = a;
  12008. var c = this.getElement();
  12009. c && (goog.style.setElementShown(c, a),
  12010. this.isFocusable() && this.renderer_.enableTabIndex(this.getKeyEventTarget(), this.enabled_ && this.visible_),
  12011. b || this.dispatchEvent(this.visible_ ? goog.ui.Container.EventType.AFTER_SHOW : goog.ui.Container.EventType.AFTER_HIDE));
  12012. return !0
  12013. }
  12014. return !1
  12015. }
  12016. ;
  12017. goog.ui.Container.prototype.isEnabled = function () {
  12018. return this.enabled_
  12019. }
  12020. ;
  12021. goog.ui.Container.prototype.setEnabled = function (a) {
  12022. this.enabled_ != a && this.dispatchEvent(a ? goog.ui.Component.EventType.ENABLE : goog.ui.Component.EventType.DISABLE) && (a ? (this.enabled_ = !0,
  12023. this.forEachChild(function (a) {
  12024. a.wasDisabled ? delete a.wasDisabled : a.setEnabled(!0)
  12025. })) : (this.forEachChild(function (a) {
  12026. a.isEnabled() ? a.setEnabled(!1) : a.wasDisabled = !0
  12027. }),
  12028. this.enabled_ = !1,
  12029. this.setMouseButtonPressed(!1)),
  12030. this.isFocusable() && this.renderer_.enableTabIndex(this.getKeyEventTarget(), a && this.visible_))
  12031. }
  12032. ;
  12033. goog.ui.Container.prototype.isFocusable = function () {
  12034. return this.focusable_
  12035. }
  12036. ;
  12037. goog.ui.Container.prototype.setFocusable = function (a) {
  12038. a != this.focusable_ && this.isInDocument() && this.enableFocusHandling_(a);
  12039. this.focusable_ = a;
  12040. this.enabled_ && this.visible_ && this.renderer_.enableTabIndex(this.getKeyEventTarget(), a)
  12041. }
  12042. ;
  12043. goog.ui.Container.prototype.isFocusableChildrenAllowed = function () {
  12044. return this.allowFocusableChildren_
  12045. }
  12046. ;
  12047. goog.ui.Container.prototype.setFocusableChildrenAllowed = function (a) {
  12048. this.allowFocusableChildren_ = a
  12049. }
  12050. ;
  12051. goog.ui.Container.prototype.isOpenFollowsHighlight = function () {
  12052. return this.openFollowsHighlight_
  12053. }
  12054. ;
  12055. goog.ui.Container.prototype.setOpenFollowsHighlight = function (a) {
  12056. this.openFollowsHighlight_ = a
  12057. }
  12058. ;
  12059. goog.ui.Container.prototype.getHighlightedIndex = function () {
  12060. return this.highlightedIndex_
  12061. }
  12062. ;
  12063. goog.ui.Container.prototype.setHighlightedIndex = function (a) {
  12064. (a = this.getChildAt(a)) ? a.setHighlighted(!0) : -1 < this.highlightedIndex_ && this.getHighlighted().setHighlighted(!1)
  12065. }
  12066. ;
  12067. goog.ui.Container.prototype.setHighlighted = function (a) {
  12068. this.setHighlightedIndex(this.indexOfChild(a))
  12069. }
  12070. ;
  12071. goog.ui.Container.prototype.getHighlighted = function () {
  12072. return this.getChildAt(this.highlightedIndex_)
  12073. }
  12074. ;
  12075. goog.ui.Container.prototype.highlightFirst = function () {
  12076. this.highlightHelper(function (a, b) {
  12077. return (a + 1) % b
  12078. }, this.getChildCount() - 1)
  12079. }
  12080. ;
  12081. goog.ui.Container.prototype.highlightLast = function () {
  12082. this.highlightHelper(function (a, b) {
  12083. a--;
  12084. return 0 > a ? b - 1 : a
  12085. }, 0)
  12086. }
  12087. ;
  12088. goog.ui.Container.prototype.highlightNext = function () {
  12089. this.highlightHelper(function (a, b) {
  12090. return (a + 1) % b
  12091. }, this.highlightedIndex_)
  12092. }
  12093. ;
  12094. goog.ui.Container.prototype.highlightPrevious = function () {
  12095. this.highlightHelper(function (a, b) {
  12096. a--;
  12097. return 0 > a ? b - 1 : a
  12098. }, this.highlightedIndex_)
  12099. }
  12100. ;
  12101. goog.ui.Container.prototype.highlightHelper = function (a, b) {
  12102. var c = 0 > b ? this.indexOfChild(this.openItem_) : b
  12103. , d = this.getChildCount();
  12104. c = a.call(this, c, d);
  12105. for (var e = 0; e <= d;) {
  12106. var f = this.getChildAt(c);
  12107. if (f && this.canHighlightItem(f))
  12108. return this.setHighlightedIndexFromKeyEvent(c),
  12109. !0;
  12110. e++;
  12111. c = a.call(this, c, d)
  12112. }
  12113. return !1
  12114. }
  12115. ;
  12116. goog.ui.Container.prototype.canHighlightItem = function (a) {
  12117. return a.isVisible() && a.isEnabled() && a.isSupportedState(goog.ui.Component.State.HOVER)
  12118. }
  12119. ;
  12120. goog.ui.Container.prototype.setHighlightedIndexFromKeyEvent = function (a) {
  12121. this.setHighlightedIndex(a)
  12122. }
  12123. ;
  12124. goog.ui.Container.prototype.getOpenItem = function () {
  12125. return this.openItem_
  12126. }
  12127. ;
  12128. goog.ui.Container.prototype.isMouseButtonPressed = function () {
  12129. return this.mouseButtonPressed_
  12130. }
  12131. ;
  12132. goog.ui.Container.prototype.setMouseButtonPressed = function (a) {
  12133. this.mouseButtonPressed_ = a
  12134. }
  12135. ;
  12136. goog.ui.MenuHeaderRenderer = function () {
  12137. goog.ui.ControlRenderer.call(this)
  12138. }
  12139. ;
  12140. goog.inherits(goog.ui.MenuHeaderRenderer, goog.ui.ControlRenderer);
  12141. goog.addSingletonGetter(goog.ui.MenuHeaderRenderer);
  12142. goog.ui.MenuHeaderRenderer.CSS_CLASS = "goog-menuheader";
  12143. goog.ui.MenuHeaderRenderer.prototype.getCssClass = function () {
  12144. return goog.ui.MenuHeaderRenderer.CSS_CLASS
  12145. }
  12146. ;
  12147. goog.ui.MenuHeader = function (a, b, c) {
  12148. goog.ui.Control.call(this, a, c || goog.ui.MenuHeaderRenderer.getInstance(), b);
  12149. this.setSupportedState(goog.ui.Component.State.DISABLED, !1);
  12150. this.setSupportedState(goog.ui.Component.State.HOVER, !1);
  12151. this.setSupportedState(goog.ui.Component.State.ACTIVE, !1);
  12152. this.setSupportedState(goog.ui.Component.State.FOCUSED, !1);
  12153. this.setStateInternal(goog.ui.Component.State.DISABLED)
  12154. }
  12155. ;
  12156. goog.inherits(goog.ui.MenuHeader, goog.ui.Control);
  12157. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuHeaderRenderer.CSS_CLASS, function () {
  12158. return new goog.ui.MenuHeader(null)
  12159. });
  12160. goog.ui.MenuItemRenderer = function () {
  12161. goog.ui.ControlRenderer.call(this);
  12162. this.classNameCache_ = []
  12163. }
  12164. ;
  12165. goog.inherits(goog.ui.MenuItemRenderer, goog.ui.ControlRenderer);
  12166. goog.addSingletonGetter(goog.ui.MenuItemRenderer);
  12167. goog.ui.MenuItemRenderer.CSS_CLASS = "goog-menuitem";
  12168. goog.ui.MenuItemRenderer.CompositeCssClassIndex_ = {
  12169. HOVER: 0,
  12170. CHECKBOX: 1,
  12171. CONTENT: 2
  12172. };
  12173. goog.ui.MenuItemRenderer.prototype.getCompositeCssClass_ = function (a) {
  12174. var b = this.classNameCache_[a];
  12175. if (!b) {
  12176. switch (a) {
  12177. case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER:
  12178. b = this.getStructuralCssClass() + "-highlight";
  12179. break;
  12180. case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX:
  12181. b = this.getStructuralCssClass() + "-checkbox";
  12182. break;
  12183. case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT:
  12184. b = this.getStructuralCssClass() + "-content"
  12185. }
  12186. this.classNameCache_[a] = b
  12187. }
  12188. return b
  12189. }
  12190. ;
  12191. goog.ui.MenuItemRenderer.prototype.getAriaRole = function () {
  12192. return goog.a11y.aria.Role.MENU_ITEM
  12193. }
  12194. ;
  12195. goog.ui.MenuItemRenderer.prototype.createDom = function (a) {
  12196. var b = a.getDomHelper().createDom("DIV", this.getClassNames(a).join(" "), this.createContent(a.getContent(), a.getDomHelper()));
  12197. this.setEnableCheckBoxStructure(a, b, a.isSupportedState(goog.ui.Component.State.SELECTED) || a.isSupportedState(goog.ui.Component.State.CHECKED));
  12198. return b
  12199. }
  12200. ;
  12201. goog.ui.MenuItemRenderer.prototype.getContentElement = function (a) {
  12202. return a && a.firstChild
  12203. }
  12204. ;
  12205. goog.ui.MenuItemRenderer.prototype.decorate = function (a, b) {
  12206. goog.asserts.assert(b);
  12207. this.hasContentStructure(b) || b.appendChild(this.createContent(b.childNodes, a.getDomHelper()));
  12208. goog.dom.classlist.contains(b, "goog-option") && (a.setCheckable(!0),
  12209. this.setCheckable(a, b, !0));
  12210. return goog.ui.MenuItemRenderer.superClass_.decorate.call(this, a, b)
  12211. }
  12212. ;
  12213. goog.ui.MenuItemRenderer.prototype.setContent = function (a, b) {
  12214. var c = this.getContentElement(a)
  12215. , d = this.hasCheckBoxStructure(a) ? c.firstChild : null;
  12216. goog.ui.MenuItemRenderer.superClass_.setContent.call(this, a, b);
  12217. d && !this.hasCheckBoxStructure(a) && c.insertBefore(d, c.firstChild || null)
  12218. }
  12219. ;
  12220. goog.ui.MenuItemRenderer.prototype.hasContentStructure = function (a) {
  12221. a = goog.dom.getFirstElementChild(a);
  12222. var b = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT);
  12223. return !!a && goog.dom.classlist.contains(a, b)
  12224. }
  12225. ;
  12226. goog.ui.MenuItemRenderer.prototype.createContent = function (a, b) {
  12227. var c = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT);
  12228. return b.createDom("DIV", c, a)
  12229. }
  12230. ;
  12231. goog.ui.MenuItemRenderer.prototype.setSelectable = function (a, b, c) {
  12232. a && b && this.setEnableCheckBoxStructure(a, b, c)
  12233. }
  12234. ;
  12235. goog.ui.MenuItemRenderer.prototype.setCheckable = function (a, b, c) {
  12236. a && b && this.setEnableCheckBoxStructure(a, b, c)
  12237. }
  12238. ;
  12239. goog.ui.MenuItemRenderer.prototype.hasCheckBoxStructure = function (a) {
  12240. if (a = this.getContentElement(a)) {
  12241. a = a.firstChild;
  12242. var b = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX);
  12243. return !!a && goog.dom.isElement(a) && goog.dom.classlist.contains(a, b)
  12244. }
  12245. return !1
  12246. }
  12247. ;
  12248. goog.ui.MenuItemRenderer.prototype.setEnableCheckBoxStructure = function (a, b, c) {
  12249. this.setAriaRole(b, a.getPreferredAriaRole());
  12250. this.setAriaStates(a, b);
  12251. c != this.hasCheckBoxStructure(b) && (goog.dom.classlist.enable(b, "goog-option", c),
  12252. b = this.getContentElement(b),
  12253. c ? (c = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX),
  12254. b.insertBefore(a.getDomHelper().createDom("DIV", c), b.firstChild || null)) : b.removeChild(b.firstChild))
  12255. }
  12256. ;
  12257. goog.ui.MenuItemRenderer.prototype.getClassForState = function (a) {
  12258. switch (a) {
  12259. case goog.ui.Component.State.HOVER:
  12260. return this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER);
  12261. case goog.ui.Component.State.CHECKED:
  12262. case goog.ui.Component.State.SELECTED:
  12263. return "goog-option-selected";
  12264. default:
  12265. return goog.ui.MenuItemRenderer.superClass_.getClassForState.call(this, a)
  12266. }
  12267. }
  12268. ;
  12269. goog.ui.MenuItemRenderer.prototype.getStateFromClass = function (a) {
  12270. var b = this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER);
  12271. switch (a) {
  12272. case "goog-option-selected":
  12273. return goog.ui.Component.State.CHECKED;
  12274. case b:
  12275. return goog.ui.Component.State.HOVER;
  12276. default:
  12277. return goog.ui.MenuItemRenderer.superClass_.getStateFromClass.call(this, a)
  12278. }
  12279. }
  12280. ;
  12281. goog.ui.MenuItemRenderer.prototype.getCssClass = function () {
  12282. return goog.ui.MenuItemRenderer.CSS_CLASS
  12283. }
  12284. ;
  12285. goog.ui.MenuItem = function (a, b, c, d) {
  12286. goog.ui.Control.call(this, a, d || goog.ui.MenuItemRenderer.getInstance(), c);
  12287. this.setValue(b)
  12288. }
  12289. ;
  12290. goog.inherits(goog.ui.MenuItem, goog.ui.Control);
  12291. goog.tagUnsealableClass(goog.ui.MenuItem);
  12292. goog.ui.MenuItem.MNEMONIC_WRAPPER_CLASS_ = "goog-menuitem-mnemonic-separator";
  12293. goog.ui.MenuItem.ACCELERATOR_CLASS = "goog-menuitem-accel";
  12294. goog.ui.MenuItem.prototype.getValue = function () {
  12295. var a = this.getModel();
  12296. return null != a ? a : this.getCaption()
  12297. }
  12298. ;
  12299. goog.ui.MenuItem.prototype.setValue = function (a) {
  12300. this.setModel(a)
  12301. }
  12302. ;
  12303. goog.ui.MenuItem.prototype.setSupportedState = function (a, b) {
  12304. goog.ui.MenuItem.superClass_.setSupportedState.call(this, a, b);
  12305. switch (a) {
  12306. case goog.ui.Component.State.SELECTED:
  12307. this.setSelectableInternal_(b);
  12308. break;
  12309. case goog.ui.Component.State.CHECKED:
  12310. this.setCheckableInternal_(b)
  12311. }
  12312. }
  12313. ;
  12314. goog.ui.MenuItem.prototype.setSelectable = function (a) {
  12315. this.setSupportedState(goog.ui.Component.State.SELECTED, a)
  12316. }
  12317. ;
  12318. goog.ui.MenuItem.prototype.setSelectableInternal_ = function (a) {
  12319. this.isChecked() && !a && this.setChecked(!1);
  12320. var b = this.getElement();
  12321. b && this.getRenderer().setSelectable(this, b, a)
  12322. }
  12323. ;
  12324. goog.ui.MenuItem.prototype.setCheckable = function (a) {
  12325. this.setSupportedState(goog.ui.Component.State.CHECKED, a)
  12326. }
  12327. ;
  12328. goog.ui.MenuItem.prototype.setCheckableInternal_ = function (a) {
  12329. var b = this.getElement();
  12330. b && this.getRenderer().setCheckable(this, b, a)
  12331. }
  12332. ;
  12333. goog.ui.MenuItem.prototype.getCaption = function () {
  12334. var a = this.getContent();
  12335. if (goog.isArray(a)) {
  12336. var b = goog.ui.MenuItem.ACCELERATOR_CLASS
  12337. , c = goog.ui.MenuItem.MNEMONIC_WRAPPER_CLASS_;
  12338. a = goog.array.map(a, function (a) {
  12339. return goog.dom.isElement(a) && (goog.dom.classlist.contains(a, b) || goog.dom.classlist.contains(a, c)) ? "" : goog.dom.getRawTextContent(a)
  12340. }).join("");
  12341. return goog.string.collapseBreakingSpaces(a)
  12342. }
  12343. return goog.ui.MenuItem.superClass_.getCaption.call(this)
  12344. }
  12345. ;
  12346. goog.ui.MenuItem.prototype.getAccelerator = function () {
  12347. var a = this.getDomHelper()
  12348. , b = this.getContent();
  12349. return goog.isArray(b) && (b = goog.array.find(b, function (a) {
  12350. return goog.dom.classlist.contains(a, goog.ui.MenuItem.ACCELERATOR_CLASS)
  12351. })) ? a.getTextContent(b) : null
  12352. }
  12353. ;
  12354. goog.ui.MenuItem.prototype.handleMouseUp = function (a) {
  12355. var b = this.getParent();
  12356. if (b) {
  12357. var c = b.openingCoords;
  12358. b.openingCoords = null;
  12359. if (c && "number" === typeof a.clientX && (b = new goog.math.Coordinate(a.clientX, a.clientY),
  12360. goog.math.Coordinate.equals(c, b)))
  12361. return
  12362. }
  12363. goog.ui.MenuItem.superClass_.handleMouseUp.call(this, a)
  12364. }
  12365. ;
  12366. goog.ui.MenuItem.prototype.handleKeyEventInternal = function (a) {
  12367. return a.keyCode == this.getMnemonic() && this.performActionInternal(a) ? !0 : goog.ui.MenuItem.superClass_.handleKeyEventInternal.call(this, a)
  12368. }
  12369. ;
  12370. goog.ui.MenuItem.prototype.setMnemonic = function (a) {
  12371. this.mnemonicKey_ = a
  12372. }
  12373. ;
  12374. goog.ui.MenuItem.prototype.getMnemonic = function () {
  12375. return this.mnemonicKey_
  12376. }
  12377. ;
  12378. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuItemRenderer.CSS_CLASS, function () {
  12379. return new goog.ui.MenuItem(null)
  12380. });
  12381. goog.ui.MenuItem.prototype.getPreferredAriaRole = function () {
  12382. return this.isSupportedState(goog.ui.Component.State.CHECKED) ? goog.a11y.aria.Role.MENU_ITEM_CHECKBOX : this.isSupportedState(goog.ui.Component.State.SELECTED) ? goog.a11y.aria.Role.MENU_ITEM_RADIO : goog.ui.MenuItem.superClass_.getPreferredAriaRole.call(this)
  12383. }
  12384. ;
  12385. goog.ui.MenuItem.prototype.getParent = function () {
  12386. return goog.ui.Control.prototype.getParent.call(this)
  12387. }
  12388. ;
  12389. goog.ui.MenuItem.prototype.getParentEventTarget = function () {
  12390. return goog.ui.Control.prototype.getParentEventTarget.call(this)
  12391. }
  12392. ;
  12393. goog.ui.MenuSeparatorRenderer = function () {
  12394. goog.ui.ControlRenderer.call(this)
  12395. }
  12396. ;
  12397. goog.inherits(goog.ui.MenuSeparatorRenderer, goog.ui.ControlRenderer);
  12398. goog.addSingletonGetter(goog.ui.MenuSeparatorRenderer);
  12399. goog.ui.MenuSeparatorRenderer.CSS_CLASS = "goog-menuseparator";
  12400. goog.ui.MenuSeparatorRenderer.prototype.createDom = function (a) {
  12401. return a.getDomHelper().createDom("DIV", this.getCssClass())
  12402. }
  12403. ;
  12404. goog.ui.MenuSeparatorRenderer.prototype.decorate = function (a, b) {
  12405. b.id && a.setId(b.id);
  12406. if ("HR" == b.tagName) {
  12407. var c = b;
  12408. b = this.createDom(a);
  12409. goog.dom.insertSiblingBefore(b, c);
  12410. goog.dom.removeNode(c)
  12411. } else
  12412. goog.dom.classlist.add(b, this.getCssClass());
  12413. return b
  12414. }
  12415. ;
  12416. goog.ui.MenuSeparatorRenderer.prototype.setContent = function (a, b) { }
  12417. ;
  12418. goog.ui.MenuSeparatorRenderer.prototype.getCssClass = function () {
  12419. return goog.ui.MenuSeparatorRenderer.CSS_CLASS
  12420. }
  12421. ;
  12422. goog.ui.Separator = function (a, b) {
  12423. goog.ui.Control.call(this, null, a || goog.ui.MenuSeparatorRenderer.getInstance(), b);
  12424. this.setSupportedState(goog.ui.Component.State.DISABLED, !1);
  12425. this.setSupportedState(goog.ui.Component.State.HOVER, !1);
  12426. this.setSupportedState(goog.ui.Component.State.ACTIVE, !1);
  12427. this.setSupportedState(goog.ui.Component.State.FOCUSED, !1);
  12428. this.setStateInternal(goog.ui.Component.State.DISABLED)
  12429. }
  12430. ;
  12431. goog.inherits(goog.ui.Separator, goog.ui.Control);
  12432. goog.ui.Separator.prototype.enterDocument = function () {
  12433. goog.ui.Separator.superClass_.enterDocument.call(this);
  12434. var a = this.getElement();
  12435. goog.asserts.assert(a, "The DOM element for the separator cannot be null.");
  12436. goog.a11y.aria.setRole(a, "separator")
  12437. }
  12438. ;
  12439. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuSeparatorRenderer.CSS_CLASS, function () {
  12440. return new goog.ui.Separator
  12441. });
  12442. goog.ui.MenuRenderer = function (a) {
  12443. goog.ui.ContainerRenderer.call(this, a || goog.a11y.aria.Role.MENU)
  12444. }
  12445. ;
  12446. goog.inherits(goog.ui.MenuRenderer, goog.ui.ContainerRenderer);
  12447. goog.addSingletonGetter(goog.ui.MenuRenderer);
  12448. goog.ui.MenuRenderer.CSS_CLASS = "goog-menu";
  12449. goog.ui.MenuRenderer.prototype.canDecorate = function (a) {
  12450. return "UL" == a.tagName || goog.ui.MenuRenderer.superClass_.canDecorate.call(this, a)
  12451. }
  12452. ;
  12453. goog.ui.MenuRenderer.prototype.getDecoratorForChild = function (a) {
  12454. return "HR" == a.tagName ? new goog.ui.Separator : goog.ui.MenuRenderer.superClass_.getDecoratorForChild.call(this, a)
  12455. }
  12456. ;
  12457. goog.ui.MenuRenderer.prototype.containsElement = function (a, b) {
  12458. return goog.dom.contains(a.getElement(), b)
  12459. }
  12460. ;
  12461. goog.ui.MenuRenderer.prototype.getCssClass = function () {
  12462. return goog.ui.MenuRenderer.CSS_CLASS
  12463. }
  12464. ;
  12465. goog.ui.MenuRenderer.prototype.initializeDom = function (a) {
  12466. goog.ui.MenuRenderer.superClass_.initializeDom.call(this, a);
  12467. a = a.getElement();
  12468. goog.asserts.assert(a, "The menu DOM element cannot be null.");
  12469. goog.a11y.aria.setState(a, goog.a11y.aria.State.HASPOPUP, "true")
  12470. }
  12471. ;
  12472. goog.ui.MenuSeparator = function (a) {
  12473. goog.ui.Separator.call(this, goog.ui.MenuSeparatorRenderer.getInstance(), a)
  12474. }
  12475. ;
  12476. goog.inherits(goog.ui.MenuSeparator, goog.ui.Separator);
  12477. goog.ui.registry.setDecoratorByClassName(goog.ui.MenuSeparatorRenderer.CSS_CLASS, function () {
  12478. return new goog.ui.Separator
  12479. });
  12480. goog.ui.Menu = function (a, b) {
  12481. goog.ui.Container.call(this, goog.ui.Container.Orientation.VERTICAL, b || goog.ui.MenuRenderer.getInstance(), a);
  12482. this.setFocusable(!1)
  12483. }
  12484. ;
  12485. goog.inherits(goog.ui.Menu, goog.ui.Container);
  12486. goog.tagUnsealableClass(goog.ui.Menu);
  12487. goog.ui.Menu.EventType = {
  12488. BEFORE_SHOW: goog.ui.Component.EventType.BEFORE_SHOW,
  12489. SHOW: goog.ui.Component.EventType.SHOW,
  12490. BEFORE_HIDE: goog.ui.Component.EventType.HIDE,
  12491. HIDE: goog.ui.Component.EventType.HIDE
  12492. };
  12493. goog.ui.Menu.CSS_CLASS = goog.ui.MenuRenderer.CSS_CLASS;
  12494. goog.ui.Menu.prototype.allowAutoFocus_ = !0;
  12495. goog.ui.Menu.prototype.allowHighlightDisabled_ = !1;
  12496. goog.ui.Menu.prototype.getCssClass = function () {
  12497. return this.getRenderer().getCssClass()
  12498. }
  12499. ;
  12500. goog.ui.Menu.prototype.containsElement = function (a) {
  12501. if (this.getRenderer().containsElement(this, a))
  12502. return !0;
  12503. for (var b = 0, c = this.getChildCount(); b < c; b++) {
  12504. var d = this.getChildAt(b);
  12505. if ("function" == typeof d.containsElement && d.containsElement(a))
  12506. return !0
  12507. }
  12508. return !1
  12509. }
  12510. ;
  12511. goog.ui.Menu.prototype.addItem = function (a) {
  12512. this.addChild(a, !0)
  12513. }
  12514. ;
  12515. goog.ui.Menu.prototype.addItemAt = function (a, b) {
  12516. this.addChildAt(a, b, !0)
  12517. }
  12518. ;
  12519. goog.ui.Menu.prototype.removeItem = function (a) {
  12520. (a = this.removeChild(a, !0)) && a.dispose()
  12521. }
  12522. ;
  12523. goog.ui.Menu.prototype.removeItemAt = function (a) {
  12524. (a = this.removeChildAt(a, !0)) && a.dispose()
  12525. }
  12526. ;
  12527. goog.ui.Menu.prototype.getItemAt = function (a) {
  12528. return this.getChildAt(a)
  12529. }
  12530. ;
  12531. goog.ui.Menu.prototype.getItemCount = function () {
  12532. return this.getChildCount()
  12533. }
  12534. ;
  12535. goog.ui.Menu.prototype.getItems = function () {
  12536. var a = [];
  12537. this.forEachChild(function (b) {
  12538. a.push(b)
  12539. });
  12540. return a
  12541. }
  12542. ;
  12543. goog.ui.Menu.prototype.setPosition = function (a, b) {
  12544. var c = this.isVisible();
  12545. c || goog.style.setElementShown(this.getElement(), !0);
  12546. goog.style.setPageOffset(this.getElement(), a, b);
  12547. c || goog.style.setElementShown(this.getElement(), !1)
  12548. }
  12549. ;
  12550. goog.ui.Menu.prototype.getPosition = function () {
  12551. return this.isVisible() ? goog.style.getPageOffset(this.getElement()) : null
  12552. }
  12553. ;
  12554. goog.ui.Menu.prototype.setAllowAutoFocus = function (a) {
  12555. (this.allowAutoFocus_ = a) && this.setFocusable(!0)
  12556. }
  12557. ;
  12558. goog.ui.Menu.prototype.getAllowAutoFocus = function () {
  12559. return this.allowAutoFocus_
  12560. }
  12561. ;
  12562. goog.ui.Menu.prototype.setAllowHighlightDisabled = function (a) {
  12563. this.allowHighlightDisabled_ = a
  12564. }
  12565. ;
  12566. goog.ui.Menu.prototype.getAllowHighlightDisabled = function () {
  12567. return this.allowHighlightDisabled_
  12568. }
  12569. ;
  12570. goog.ui.Menu.prototype.setVisible = function (a, b, c) {
  12571. (b = goog.ui.Menu.superClass_.setVisible.call(this, a, b)) && a && this.isInDocument() && this.allowAutoFocus_ && this.getKeyEventTarget().focus();
  12572. this.openingCoords = a && c && "number" === typeof c.clientX ? new goog.math.Coordinate(c.clientX, c.clientY) : null;
  12573. return b
  12574. }
  12575. ;
  12576. goog.ui.Menu.prototype.handleEnterItem = function (a) {
  12577. this.allowAutoFocus_ && this.getKeyEventTarget().focus();
  12578. return goog.ui.Menu.superClass_.handleEnterItem.call(this, a)
  12579. }
  12580. ;
  12581. goog.ui.Menu.prototype.highlightNextPrefix = function (a) {
  12582. var b = new RegExp("^" + goog.string.regExpEscape(a), "i");
  12583. return this.highlightHelper(function (a, d) {
  12584. var c = 0 > a ? 0 : a
  12585. , f = !1;
  12586. do {
  12587. ++a;
  12588. a == d && (a = 0,
  12589. f = !0);
  12590. var g = this.getChildAt(a).getCaption();
  12591. if (g && g.match(b))
  12592. return a
  12593. } while (!f || a != c); return this.getHighlightedIndex()
  12594. }, this.getHighlightedIndex())
  12595. }
  12596. ;
  12597. goog.ui.Menu.prototype.canHighlightItem = function (a) {
  12598. return (this.allowHighlightDisabled_ || a.isEnabled()) && a.isVisible() && a.isSupportedState(goog.ui.Component.State.HOVER)
  12599. }
  12600. ;
  12601. goog.ui.Menu.prototype.decorateInternal = function (a) {
  12602. this.decorateContent(a);
  12603. goog.ui.Menu.superClass_.decorateInternal.call(this, a)
  12604. }
  12605. ;
  12606. goog.ui.Menu.prototype.handleKeyEventInternal = function (a) {
  12607. var b = goog.ui.Menu.superClass_.handleKeyEventInternal.call(this, a);
  12608. b || this.forEachChild(function (c) {
  12609. !b && c.getMnemonic && c.getMnemonic() == a.keyCode && (this.isEnabled() && this.setHighlighted(c),
  12610. b = c.handleKeyEvent(a))
  12611. }, this);
  12612. return b
  12613. }
  12614. ;
  12615. goog.ui.Menu.prototype.setHighlightedIndex = function (a) {
  12616. goog.ui.Menu.superClass_.setHighlightedIndex.call(this, a);
  12617. (a = this.getChildAt(a)) && goog.style.scrollIntoContainerView(a.getElement(), this.getElement())
  12618. }
  12619. ;
  12620. goog.ui.Menu.prototype.decorateContent = function (a) {
  12621. var b = this.getRenderer();
  12622. a = this.getDomHelper().getElementsByTagNameAndClass("DIV", b.getCssClass() + "-content", a);
  12623. for (var c = a.length, d = 0; d < c; d++)
  12624. b.decorateChildren(this, a[d])
  12625. }
  12626. ;
  12627. goog.iter = {};
  12628. goog.iter.StopIteration = "StopIteration" in goog.global ? goog.global.StopIteration : {
  12629. message: "StopIteration",
  12630. stack: ""
  12631. };
  12632. goog.iter.Iterator = function () { }
  12633. ;
  12634. goog.iter.Iterator.prototype.next = function () {
  12635. throw goog.iter.StopIteration;
  12636. }
  12637. ;
  12638. goog.iter.Iterator.prototype.__iterator__ = function (a) {
  12639. return this
  12640. }
  12641. ;
  12642. goog.iter.toIterator = function (a) {
  12643. if (a instanceof goog.iter.Iterator)
  12644. return a;
  12645. if ("function" == typeof a.__iterator__)
  12646. return a.__iterator__(!1);
  12647. if (goog.isArrayLike(a)) {
  12648. var b = 0
  12649. , c = new goog.iter.Iterator;
  12650. c.next = function () {
  12651. for (; ;) {
  12652. if (b >= a.length)
  12653. throw goog.iter.StopIteration;
  12654. if (b in a)
  12655. return a[b++];
  12656. b++
  12657. }
  12658. }
  12659. ;
  12660. return c
  12661. }
  12662. throw Error("Not implemented");
  12663. }
  12664. ;
  12665. goog.iter.forEach = function (a, b, c) {
  12666. if (goog.isArrayLike(a))
  12667. try {
  12668. goog.array.forEach(a, b, c)
  12669. } catch (d) {
  12670. if (d !== goog.iter.StopIteration)
  12671. throw d;
  12672. }
  12673. else {
  12674. a = goog.iter.toIterator(a);
  12675. try {
  12676. for (; ;)
  12677. b.call(c, a.next(), void 0, a)
  12678. } catch (d) {
  12679. if (d !== goog.iter.StopIteration)
  12680. throw d;
  12681. }
  12682. }
  12683. }
  12684. ;
  12685. goog.iter.filter = function (a, b, c) {
  12686. var d = goog.iter.toIterator(a);
  12687. a = new goog.iter.Iterator;
  12688. a.next = function () {
  12689. for (; ;) {
  12690. var a = d.next();
  12691. if (b.call(c, a, void 0, d))
  12692. return a
  12693. }
  12694. }
  12695. ;
  12696. return a
  12697. }
  12698. ;
  12699. goog.iter.filterFalse = function (a, b, c) {
  12700. return goog.iter.filter(a, goog.functions.not(b), c)
  12701. }
  12702. ;
  12703. goog.iter.range = function (a, b, c) {
  12704. var d = 0
  12705. , e = a
  12706. , f = c || 1;
  12707. 1 < arguments.length && (d = a,
  12708. e = +b);
  12709. if (0 == f)
  12710. throw Error("Range step argument must not be zero");
  12711. var g = new goog.iter.Iterator;
  12712. g.next = function () {
  12713. if (0 < f && d >= e || 0 > f && d <= e)
  12714. throw goog.iter.StopIteration;
  12715. var a = d;
  12716. d += f;
  12717. return a
  12718. }
  12719. ;
  12720. return g
  12721. }
  12722. ;
  12723. goog.iter.join = function (a, b) {
  12724. return goog.iter.toArray(a).join(b)
  12725. }
  12726. ;
  12727. goog.iter.map = function (a, b, c) {
  12728. var d = goog.iter.toIterator(a);
  12729. a = new goog.iter.Iterator;
  12730. a.next = function () {
  12731. var a = d.next();
  12732. return b.call(c, a, void 0, d)
  12733. }
  12734. ;
  12735. return a
  12736. }
  12737. ;
  12738. goog.iter.reduce = function (a, b, c, d) {
  12739. var e = c;
  12740. goog.iter.forEach(a, function (a) {
  12741. e = b.call(d, e, a)
  12742. });
  12743. return e
  12744. }
  12745. ;
  12746. goog.iter.some = function (a, b, c) {
  12747. a = goog.iter.toIterator(a);
  12748. try {
  12749. for (; ;)
  12750. if (b.call(c, a.next(), void 0, a))
  12751. return !0
  12752. } catch (d) {
  12753. if (d !== goog.iter.StopIteration)
  12754. throw d;
  12755. }
  12756. return !1
  12757. }
  12758. ;
  12759. goog.iter.every = function (a, b, c) {
  12760. a = goog.iter.toIterator(a);
  12761. try {
  12762. for (; ;)
  12763. if (!b.call(c, a.next(), void 0, a))
  12764. return !1
  12765. } catch (d) {
  12766. if (d !== goog.iter.StopIteration)
  12767. throw d;
  12768. }
  12769. return !0
  12770. }
  12771. ;
  12772. goog.iter.chain = function (a) {
  12773. return goog.iter.chainFromIterable(arguments)
  12774. }
  12775. ;
  12776. goog.iter.chainFromIterable = function (a) {
  12777. var b = goog.iter.toIterator(a);
  12778. a = new goog.iter.Iterator;
  12779. var c = null;
  12780. a.next = function () {
  12781. for (; ;) {
  12782. if (null == c) {
  12783. var a = b.next();
  12784. c = goog.iter.toIterator(a)
  12785. }
  12786. try {
  12787. return c.next()
  12788. } catch (e) {
  12789. if (e !== goog.iter.StopIteration)
  12790. throw e;
  12791. c = null
  12792. }
  12793. }
  12794. }
  12795. ;
  12796. return a
  12797. }
  12798. ;
  12799. goog.iter.dropWhile = function (a, b, c) {
  12800. var d = goog.iter.toIterator(a);
  12801. a = new goog.iter.Iterator;
  12802. var e = !0;
  12803. a.next = function () {
  12804. for (; ;) {
  12805. var a = d.next();
  12806. if (!e || !b.call(c, a, void 0, d))
  12807. return e = !1,
  12808. a
  12809. }
  12810. }
  12811. ;
  12812. return a
  12813. }
  12814. ;
  12815. goog.iter.takeWhile = function (a, b, c) {
  12816. var d = goog.iter.toIterator(a);
  12817. a = new goog.iter.Iterator;
  12818. a.next = function () {
  12819. var a = d.next();
  12820. if (b.call(c, a, void 0, d))
  12821. return a;
  12822. throw goog.iter.StopIteration;
  12823. }
  12824. ;
  12825. return a
  12826. }
  12827. ;
  12828. goog.iter.toArray = function (a) {
  12829. if (goog.isArrayLike(a))
  12830. return goog.array.toArray(a);
  12831. a = goog.iter.toIterator(a);
  12832. var b = [];
  12833. goog.iter.forEach(a, function (a) {
  12834. b.push(a)
  12835. });
  12836. return b
  12837. }
  12838. ;
  12839. goog.iter.equals = function (a, b, c) {
  12840. a = goog.iter.zipLongest({}, a, b);
  12841. var d = c || goog.array.defaultCompareEquality;
  12842. return goog.iter.every(a, function (a) {
  12843. return d(a[0], a[1])
  12844. })
  12845. }
  12846. ;
  12847. goog.iter.nextOrValue = function (a, b) {
  12848. try {
  12849. return goog.iter.toIterator(a).next()
  12850. } catch (c) {
  12851. if (c != goog.iter.StopIteration)
  12852. throw c;
  12853. return b
  12854. }
  12855. }
  12856. ;
  12857. goog.iter.product = function (a) {
  12858. if (goog.array.some(arguments, function (a) {
  12859. return !a.length
  12860. }) || !arguments.length)
  12861. return new goog.iter.Iterator;
  12862. var b = new goog.iter.Iterator
  12863. , c = arguments
  12864. , d = goog.array.repeat(0, c.length);
  12865. b.next = function () {
  12866. if (d) {
  12867. for (var a = goog.array.map(d, function (a, b) {
  12868. return c[b][a]
  12869. }), b = d.length - 1; 0 <= b; b--) {
  12870. goog.asserts.assert(d);
  12871. if (d[b] < c[b].length - 1) {
  12872. d[b]++;
  12873. break
  12874. }
  12875. if (0 == b) {
  12876. d = null;
  12877. break
  12878. }
  12879. d[b] = 0
  12880. }
  12881. return a
  12882. }
  12883. throw goog.iter.StopIteration;
  12884. }
  12885. ;
  12886. return b
  12887. }
  12888. ;
  12889. goog.iter.cycle = function (a) {
  12890. var b = goog.iter.toIterator(a)
  12891. , c = []
  12892. , d = 0;
  12893. a = new goog.iter.Iterator;
  12894. var e = !1;
  12895. a.next = function () {
  12896. var a = null;
  12897. if (!e)
  12898. try {
  12899. return a = b.next(),
  12900. c.push(a),
  12901. a
  12902. } catch (g) {
  12903. if (g != goog.iter.StopIteration || goog.array.isEmpty(c))
  12904. throw g;
  12905. e = !0
  12906. }
  12907. a = c[d];
  12908. d = (d + 1) % c.length;
  12909. return a
  12910. }
  12911. ;
  12912. return a
  12913. }
  12914. ;
  12915. goog.iter.count = function (a, b) {
  12916. var c = a || 0
  12917. , d = void 0 !== b ? b : 1
  12918. , e = new goog.iter.Iterator;
  12919. e.next = function () {
  12920. var a = c;
  12921. c += d;
  12922. return a
  12923. }
  12924. ;
  12925. return e
  12926. }
  12927. ;
  12928. goog.iter.repeat = function (a) {
  12929. var b = new goog.iter.Iterator;
  12930. b.next = goog.functions.constant(a);
  12931. return b
  12932. }
  12933. ;
  12934. goog.iter.accumulate = function (a) {
  12935. var b = goog.iter.toIterator(a)
  12936. , c = 0;
  12937. a = new goog.iter.Iterator;
  12938. a.next = function () {
  12939. return c += b.next()
  12940. }
  12941. ;
  12942. return a
  12943. }
  12944. ;
  12945. goog.iter.zip = function (a) {
  12946. var b = arguments
  12947. , c = new goog.iter.Iterator;
  12948. if (0 < b.length) {
  12949. var d = goog.array.map(b, goog.iter.toIterator);
  12950. c.next = function () {
  12951. return goog.array.map(d, function (a) {
  12952. return a.next()
  12953. })
  12954. }
  12955. }
  12956. return c
  12957. }
  12958. ;
  12959. goog.iter.zipLongest = function (a, b) {
  12960. var c = goog.array.slice(arguments, 1)
  12961. , d = new goog.iter.Iterator;
  12962. if (0 < c.length) {
  12963. var e = goog.array.map(c, goog.iter.toIterator);
  12964. d.next = function () {
  12965. var b = !1
  12966. , c = goog.array.map(e, function (c) {
  12967. try {
  12968. var d = c.next();
  12969. b = !0
  12970. } catch (m) {
  12971. if (m !== goog.iter.StopIteration)
  12972. throw m;
  12973. d = a
  12974. }
  12975. return d
  12976. });
  12977. if (!b)
  12978. throw goog.iter.StopIteration;
  12979. return c
  12980. }
  12981. }
  12982. return d
  12983. }
  12984. ;
  12985. goog.iter.compress = function (a, b) {
  12986. var c = goog.iter.toIterator(b);
  12987. return goog.iter.filter(a, function () {
  12988. return !!c.next()
  12989. })
  12990. }
  12991. ;
  12992. goog.iter.GroupByIterator_ = function (a, b) {
  12993. this.iterator = goog.iter.toIterator(a);
  12994. this.keyFunc = b || goog.functions.identity
  12995. }
  12996. ;
  12997. goog.inherits(goog.iter.GroupByIterator_, goog.iter.Iterator);
  12998. goog.iter.GroupByIterator_.prototype.next = function () {
  12999. for (; this.currentKey == this.targetKey;)
  13000. this.currentValue = this.iterator.next(),
  13001. this.currentKey = this.keyFunc(this.currentValue);
  13002. this.targetKey = this.currentKey;
  13003. return [this.currentKey, this.groupItems_(this.targetKey)]
  13004. }
  13005. ;
  13006. goog.iter.GroupByIterator_.prototype.groupItems_ = function (a) {
  13007. for (var b = []; this.currentKey == a;) {
  13008. b.push(this.currentValue);
  13009. try {
  13010. this.currentValue = this.iterator.next()
  13011. } catch (c) {
  13012. if (c !== goog.iter.StopIteration)
  13013. throw c;
  13014. break
  13015. }
  13016. this.currentKey = this.keyFunc(this.currentValue)
  13017. }
  13018. return b
  13019. }
  13020. ;
  13021. goog.iter.groupBy = function (a, b) {
  13022. return new goog.iter.GroupByIterator_(a, b)
  13023. }
  13024. ;
  13025. goog.iter.starMap = function (a, b, c) {
  13026. var d = goog.iter.toIterator(a);
  13027. a = new goog.iter.Iterator;
  13028. a.next = function () {
  13029. var a = goog.iter.toArray(d.next());
  13030. return b.apply(c, goog.array.concat(a, void 0, d))
  13031. }
  13032. ;
  13033. return a
  13034. }
  13035. ;
  13036. goog.iter.tee = function (a, b) {
  13037. var c = goog.iter.toIterator(a)
  13038. , d = goog.array.map(goog.array.range("number" === typeof b ? b : 2), function () {
  13039. return []
  13040. })
  13041. , e = function () {
  13042. var a = c.next();
  13043. goog.array.forEach(d, function (b) {
  13044. b.push(a)
  13045. })
  13046. };
  13047. return goog.array.map(d, function (a) {
  13048. var b = new goog.iter.Iterator;
  13049. b.next = function () {
  13050. goog.array.isEmpty(a) && e();
  13051. goog.asserts.assert(!goog.array.isEmpty(a));
  13052. return a.shift()
  13053. }
  13054. ;
  13055. return b
  13056. })
  13057. }
  13058. ;
  13059. goog.iter.enumerate = function (a, b) {
  13060. return goog.iter.zip(goog.iter.count(b), a)
  13061. }
  13062. ;
  13063. goog.iter.limit = function (a, b) {
  13064. goog.asserts.assert(goog.math.isInt(b) && 0 <= b);
  13065. var c = goog.iter.toIterator(a)
  13066. , d = new goog.iter.Iterator
  13067. , e = b;
  13068. d.next = function () {
  13069. if (0 < e--)
  13070. return c.next();
  13071. throw goog.iter.StopIteration;
  13072. }
  13073. ;
  13074. return d
  13075. }
  13076. ;
  13077. goog.iter.consume = function (a, b) {
  13078. goog.asserts.assert(goog.math.isInt(b) && 0 <= b);
  13079. for (var c = goog.iter.toIterator(a); 0 < b--;)
  13080. goog.iter.nextOrValue(c, null);
  13081. return c
  13082. }
  13083. ;
  13084. goog.iter.slice = function (a, b, c) {
  13085. goog.asserts.assert(goog.math.isInt(b) && 0 <= b);
  13086. a = goog.iter.consume(a, b);
  13087. "number" === typeof c && (goog.asserts.assert(goog.math.isInt(c) && c >= b),
  13088. a = goog.iter.limit(a, c - b));
  13089. return a
  13090. }
  13091. ;
  13092. goog.iter.hasDuplicates_ = function (a) {
  13093. var b = [];
  13094. goog.array.removeDuplicates(a, b);
  13095. return a.length != b.length
  13096. }
  13097. ;
  13098. goog.iter.permutations = function (a, b) {
  13099. var c = goog.iter.toArray(a);
  13100. c = goog.array.repeat(c, "number" === typeof b ? b : c.length);
  13101. c = goog.iter.product.apply(void 0, c);
  13102. return goog.iter.filter(c, function (a) {
  13103. return !goog.iter.hasDuplicates_(a)
  13104. })
  13105. }
  13106. ;
  13107. goog.iter.combinations = function (a, b) {
  13108. function c(a) {
  13109. return d[a]
  13110. }
  13111. var d = goog.iter.toArray(a)
  13112. , e = goog.iter.range(d.length);
  13113. e = goog.iter.permutations(e, b);
  13114. var f = goog.iter.filter(e, function (a) {
  13115. return goog.array.isSorted(a)
  13116. });
  13117. e = new goog.iter.Iterator;
  13118. e.next = function () {
  13119. return goog.array.map(f.next(), c)
  13120. }
  13121. ;
  13122. return e
  13123. }
  13124. ;
  13125. goog.iter.combinationsWithReplacement = function (a, b) {
  13126. function c(a) {
  13127. return d[a]
  13128. }
  13129. var d = goog.iter.toArray(a)
  13130. , e = goog.array.range(d.length);
  13131. e = goog.array.repeat(e, b);
  13132. e = goog.iter.product.apply(void 0, e);
  13133. var f = goog.iter.filter(e, function (a) {
  13134. return goog.array.isSorted(a)
  13135. });
  13136. e = new goog.iter.Iterator;
  13137. e.next = function () {
  13138. return goog.array.map(f.next(), c)
  13139. }
  13140. ;
  13141. return e
  13142. }
  13143. ;
  13144. goog.dom.TagWalkType = {
  13145. START_TAG: 1,
  13146. OTHER: 0,
  13147. END_TAG: -1
  13148. };
  13149. goog.dom.TagIterator = function (a, b, c, d, e) {
  13150. this.reversed = !!b;
  13151. this.node = null;
  13152. this.tagType = goog.dom.TagWalkType.OTHER;
  13153. this.started_ = !1;
  13154. this.constrained = !c;
  13155. a && this.setPosition(a, d);
  13156. this.depth = void 0 != e ? e : this.tagType || 0;
  13157. this.reversed && (this.depth *= -1)
  13158. }
  13159. ;
  13160. goog.inherits(goog.dom.TagIterator, goog.iter.Iterator);
  13161. goog.dom.TagIterator.prototype.setPosition = function (a, b, c) {
  13162. if (this.node = a)
  13163. this.tagType = "number" === typeof b ? b : this.node.nodeType != goog.dom.NodeType.ELEMENT ? goog.dom.TagWalkType.OTHER : this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
  13164. "number" === typeof c && (this.depth = c)
  13165. }
  13166. ;
  13167. goog.dom.TagIterator.prototype.copyFrom = function (a) {
  13168. this.node = a.node;
  13169. this.tagType = a.tagType;
  13170. this.depth = a.depth;
  13171. this.reversed = a.reversed;
  13172. this.constrained = a.constrained
  13173. }
  13174. ;
  13175. goog.dom.TagIterator.prototype.clone = function () {
  13176. return new goog.dom.TagIterator(this.node, this.reversed, !this.constrained, this.tagType, this.depth)
  13177. }
  13178. ;
  13179. goog.dom.TagIterator.prototype.skipTag = function () {
  13180. var a = this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
  13181. this.tagType == a && (this.tagType = -1 * a,
  13182. this.depth += this.tagType * (this.reversed ? -1 : 1))
  13183. }
  13184. ;
  13185. goog.dom.TagIterator.prototype.restartTag = function () {
  13186. var a = this.reversed ? goog.dom.TagWalkType.START_TAG : goog.dom.TagWalkType.END_TAG;
  13187. this.tagType == a && (this.tagType = -1 * a,
  13188. this.depth += this.tagType * (this.reversed ? -1 : 1))
  13189. }
  13190. ;
  13191. goog.dom.TagIterator.prototype.next = function () {
  13192. if (this.started_) {
  13193. if (!this.node || this.constrained && 0 == this.depth)
  13194. throw goog.iter.StopIteration;
  13195. var a = this.node;
  13196. var b = this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
  13197. if (this.tagType == b) {
  13198. var c = this.reversed ? a.lastChild : a.firstChild;
  13199. c ? this.setPosition(c) : this.setPosition(a, -1 * b)
  13200. } else
  13201. (c = this.reversed ? a.previousSibling : a.nextSibling) ? this.setPosition(c) : this.setPosition(a.parentNode, -1 * b);
  13202. this.depth += this.tagType * (this.reversed ? -1 : 1)
  13203. } else
  13204. this.started_ = !0;
  13205. a = this.node;
  13206. if (!this.node)
  13207. throw goog.iter.StopIteration;
  13208. return a
  13209. }
  13210. ;
  13211. goog.dom.TagIterator.prototype.isStarted = function () {
  13212. return this.started_
  13213. }
  13214. ;
  13215. goog.dom.TagIterator.prototype.isStartTag = function () {
  13216. return this.tagType == goog.dom.TagWalkType.START_TAG
  13217. }
  13218. ;
  13219. goog.dom.TagIterator.prototype.isEndTag = function () {
  13220. return this.tagType == goog.dom.TagWalkType.END_TAG
  13221. }
  13222. ;
  13223. goog.dom.TagIterator.prototype.isNonElement = function () {
  13224. return this.tagType == goog.dom.TagWalkType.OTHER
  13225. }
  13226. ;
  13227. goog.dom.TagIterator.prototype.equals = function (a) {
  13228. return a.node == this.node && (!this.node || a.tagType == this.tagType)
  13229. }
  13230. ;
  13231. goog.dom.TagIterator.prototype.splice = function (a) {
  13232. var b = this.node;
  13233. this.restartTag();
  13234. this.reversed = !this.reversed;
  13235. goog.dom.TagIterator.prototype.next.call(this);
  13236. this.reversed = !this.reversed;
  13237. for (var c = goog.isArrayLike(arguments[0]) ? arguments[0] : arguments, d = c.length - 1; 0 <= d; d--)
  13238. goog.dom.insertSiblingAfter(c[d], b);
  13239. goog.dom.removeNode(b)
  13240. }
  13241. ;
  13242. goog.dom.NodeIterator = function (a, b, c, d) {
  13243. goog.dom.TagIterator.call(this, a, b, c, null, d)
  13244. }
  13245. ;
  13246. goog.inherits(goog.dom.NodeIterator, goog.dom.TagIterator);
  13247. goog.dom.NodeIterator.prototype.next = function () {
  13248. do
  13249. goog.dom.NodeIterator.superClass_.next.call(this);
  13250. while (this.isEndTag()); return this.node
  13251. }
  13252. ;
  13253. goog.userAgent.product = {};
  13254. goog.userAgent.product.ASSUME_FIREFOX = !1;
  13255. goog.userAgent.product.ASSUME_IPHONE = !1;
  13256. goog.userAgent.product.ASSUME_IPAD = !1;
  13257. goog.userAgent.product.ASSUME_ANDROID = !1;
  13258. goog.userAgent.product.ASSUME_CHROME = !1;
  13259. goog.userAgent.product.ASSUME_SAFARI = !1;
  13260. goog.userAgent.product.PRODUCT_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_OPERA || goog.userAgent.product.ASSUME_FIREFOX || goog.userAgent.product.ASSUME_IPHONE || goog.userAgent.product.ASSUME_IPAD || goog.userAgent.product.ASSUME_ANDROID || goog.userAgent.product.ASSUME_CHROME || goog.userAgent.product.ASSUME_SAFARI;
  13261. goog.userAgent.product.OPERA = goog.userAgent.OPERA;
  13262. goog.userAgent.product.IE = goog.userAgent.IE;
  13263. goog.userAgent.product.EDGE = goog.userAgent.EDGE;
  13264. goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_FIREFOX : goog.labs.userAgent.browser.isFirefox();
  13265. goog.userAgent.product.isIphoneOrIpod_ = function () {
  13266. return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpod()
  13267. }
  13268. ;
  13269. goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPHONE : goog.userAgent.product.isIphoneOrIpod_();
  13270. goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();
  13271. goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_ANDROID : goog.labs.userAgent.browser.isAndroidBrowser();
  13272. goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_CHROME : goog.labs.userAgent.browser.isChrome();
  13273. goog.userAgent.product.isSafariDesktop_ = function () {
  13274. return goog.labs.userAgent.browser.isSafari() && !goog.labs.userAgent.platform.isIos()
  13275. }
  13276. ;
  13277. goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_SAFARI : goog.userAgent.product.isSafariDesktop_();
  13278. goog.dom.dataset = {};
  13279. goog.dom.dataset.ALLOWED_ = !goog.userAgent.product.IE && !goog.labs.userAgent.browser.isSafari();
  13280. goog.dom.dataset.PREFIX_ = "data-";
  13281. goog.dom.dataset.isValidProperty_ = function (a) {
  13282. return !/-[a-z]/.test(a)
  13283. }
  13284. ;
  13285. goog.dom.dataset.set = function (a, b, c) {
  13286. if (goog.dom.dataset.ALLOWED_ && a.dataset)
  13287. a.dataset[b] = c;
  13288. else if (goog.dom.dataset.isValidProperty_(b))
  13289. a.setAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b), c);
  13290. else
  13291. throw Error(goog.DEBUG ? '"' + b + '" is not a valid dataset property name.' : "");
  13292. }
  13293. ;
  13294. goog.dom.dataset.get = function (a, b) {
  13295. if (!goog.dom.dataset.isValidProperty_(b))
  13296. return null;
  13297. if (goog.dom.dataset.ALLOWED_ && a.dataset) {
  13298. if (goog.labs.userAgent.browser.isAndroidBrowser() && !(b in a.dataset))
  13299. return null;
  13300. var c = a.dataset[b];
  13301. return void 0 === c ? null : c
  13302. }
  13303. return a.getAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b))
  13304. }
  13305. ;
  13306. goog.dom.dataset.remove = function (a, b) {
  13307. goog.dom.dataset.isValidProperty_(b) && (goog.dom.dataset.ALLOWED_ && a.dataset ? goog.dom.dataset.has(a, b) && delete a.dataset[b] : a.removeAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b)))
  13308. }
  13309. ;
  13310. goog.dom.dataset.has = function (a, b) {
  13311. return goog.dom.dataset.isValidProperty_(b) ? goog.dom.dataset.ALLOWED_ && a.dataset ? b in a.dataset : a.hasAttribute ? a.hasAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b)) : !!a.getAttribute(goog.dom.dataset.PREFIX_ + goog.string.toSelectorCase(b)) : !1
  13312. }
  13313. ;
  13314. goog.dom.dataset.getAll = function (a) {
  13315. if (goog.dom.dataset.ALLOWED_ && a.dataset)
  13316. return a.dataset;
  13317. var b = {};
  13318. a = a.attributes;
  13319. for (var c = 0; c < a.length; ++c) {
  13320. var d = a[c];
  13321. if (goog.string.startsWith(d.name, goog.dom.dataset.PREFIX_)) {
  13322. var e = goog.string.toCamelCase(d.name.substr(5));
  13323. b[e] = d.value
  13324. }
  13325. }
  13326. return b
  13327. }
  13328. ;
  13329. goog.ui.PaletteRenderer = function () {
  13330. goog.ui.ControlRenderer.call(this)
  13331. }
  13332. ;
  13333. goog.inherits(goog.ui.PaletteRenderer, goog.ui.ControlRenderer);
  13334. goog.addSingletonGetter(goog.ui.PaletteRenderer);
  13335. goog.ui.PaletteRenderer.cellId_ = 0;
  13336. goog.ui.PaletteRenderer.CSS_CLASS = "goog-palette";
  13337. goog.ui.PaletteRenderer.GRID_WIDTH_ATTRIBUTE = "gridWidth";
  13338. goog.ui.PaletteRenderer.prototype.createDom = function (a) {
  13339. var b = this.getClassNames(a);
  13340. b = a.getDomHelper().createDom("DIV", b, this.createGrid(a.getContent(), a.getSize(), a.getDomHelper()));
  13341. goog.a11y.aria.setRole(b, goog.a11y.aria.Role.GRID);
  13342. goog.dom.dataset.set(b, goog.ui.PaletteRenderer.GRID_WIDTH_ATTRIBUTE, a.getSize().width);
  13343. return b
  13344. }
  13345. ;
  13346. goog.ui.PaletteRenderer.prototype.createGrid = function (a, b, c) {
  13347. for (var d = [], e = 0, f = 0; e < b.height; e++) {
  13348. for (var g = [], h = 0; h < b.width; h++) {
  13349. var k = a && a[f++];
  13350. g.push(this.createCell(k, c))
  13351. }
  13352. d.push(this.createRow(g, c))
  13353. }
  13354. return this.createTable(d, c)
  13355. }
  13356. ;
  13357. goog.ui.PaletteRenderer.prototype.createTable = function (a, b) {
  13358. var c = b.createDom("TABLE", this.getCssClass() + "-table", b.createDom("TBODY", this.getCssClass() + "-body", a));
  13359. c.cellSpacing = "0";
  13360. c.cellPadding = "0";
  13361. return c
  13362. }
  13363. ;
  13364. goog.ui.PaletteRenderer.prototype.createRow = function (a, b) {
  13365. var c = b.createDom("TR", this.getCssClass() + "-row", a);
  13366. goog.a11y.aria.setRole(c, goog.a11y.aria.Role.ROW);
  13367. return c
  13368. }
  13369. ;
  13370. goog.ui.PaletteRenderer.prototype.createCell = function (a, b) {
  13371. var c = b.createDom("TD", {
  13372. "class": this.getCssClass() + "-cell",
  13373. id: this.getCssClass() + "-cell-" + goog.ui.PaletteRenderer.cellId_++
  13374. }, a);
  13375. goog.a11y.aria.setRole(c, goog.a11y.aria.Role.GRIDCELL);
  13376. goog.a11y.aria.setState(c, goog.a11y.aria.State.SELECTED, !1);
  13377. this.maybeUpdateAriaLabel_(c);
  13378. return c
  13379. }
  13380. ;
  13381. goog.ui.PaletteRenderer.prototype.maybeUpdateAriaLabel_ = function (a) {
  13382. if (!goog.dom.getTextContent(a) && !goog.a11y.aria.getLabel(a)) {
  13383. for (var b = new goog.dom.NodeIterator(a), c = "", d; !c && (d = goog.iter.nextOrValue(b, null));)
  13384. d.nodeType == goog.dom.NodeType.ELEMENT && (c = goog.a11y.aria.getLabel(d) || d.title);
  13385. c && goog.a11y.aria.setLabel(a, c)
  13386. }
  13387. }
  13388. ;
  13389. goog.ui.PaletteRenderer.prototype.canDecorate = function (a) {
  13390. return !1
  13391. }
  13392. ;
  13393. goog.ui.PaletteRenderer.prototype.decorate = function (a, b) {
  13394. return null
  13395. }
  13396. ;
  13397. goog.ui.PaletteRenderer.prototype.setContent = function (a, b) {
  13398. if (a) {
  13399. var c = goog.dom.getElementsByTagNameAndClass("TBODY", this.getCssClass() + "-body", a)[0];
  13400. if (c) {
  13401. var d = 0;
  13402. goog.array.forEach(c.rows, function (a) {
  13403. goog.array.forEach(a.cells, function (a) {
  13404. goog.dom.removeChildren(a);
  13405. goog.a11y.aria.removeState(a, goog.a11y.aria.State.LABEL);
  13406. if (b) {
  13407. var c = b[d++];
  13408. c && (goog.dom.appendChild(a, c),
  13409. this.maybeUpdateAriaLabel_(a))
  13410. }
  13411. }, this)
  13412. }, this);
  13413. if (d < b.length) {
  13414. for (var e = [], f = goog.dom.getDomHelper(a), g = goog.dom.dataset.get(a, goog.ui.PaletteRenderer.GRID_WIDTH_ATTRIBUTE); d < b.length;) {
  13415. var h = b[d++];
  13416. e.push(this.createCell(h, f));
  13417. e.length == g && (h = this.createRow(e, f),
  13418. goog.dom.appendChild(c, h),
  13419. e.length = 0)
  13420. }
  13421. if (0 < e.length) {
  13422. for (; e.length < g;)
  13423. e.push(this.createCell("", f));
  13424. h = this.createRow(e, f);
  13425. goog.dom.appendChild(c, h)
  13426. }
  13427. }
  13428. }
  13429. goog.style.setUnselectable(a, !0, goog.userAgent.GECKO)
  13430. }
  13431. }
  13432. ;
  13433. goog.ui.PaletteRenderer.prototype.getContainingItem = function (a, b) {
  13434. for (var c = a.getElement(); b && b.nodeType == goog.dom.NodeType.ELEMENT && b != c;) {
  13435. if ("TD" == b.tagName && goog.dom.classlist.contains(b, this.getCssClass() + "-cell"))
  13436. return b.firstChild;
  13437. b = b.parentNode
  13438. }
  13439. return null
  13440. }
  13441. ;
  13442. goog.ui.PaletteRenderer.prototype.highlightCell = function (a, b, c) {
  13443. b && (b = this.getCellForItem(b),
  13444. goog.asserts.assert(b),
  13445. goog.dom.classlist.enable(b, this.getCssClass() + "-cell-hover", c),
  13446. c ? goog.a11y.aria.setState(a.getElementStrict(), goog.a11y.aria.State.ACTIVEDESCENDANT, b.id) : b.id == goog.a11y.aria.getState(a.getElementStrict(), goog.a11y.aria.State.ACTIVEDESCENDANT) && goog.a11y.aria.removeState(a.getElementStrict(), goog.a11y.aria.State.ACTIVEDESCENDANT))
  13447. }
  13448. ;
  13449. goog.ui.PaletteRenderer.prototype.getCellForItem = function (a) {
  13450. return a ? a.parentNode : null
  13451. }
  13452. ;
  13453. goog.ui.PaletteRenderer.prototype.selectCell = function (a, b, c) {
  13454. b && (a = b.parentNode,
  13455. goog.dom.classlist.enable(a, this.getCssClass() + "-cell-selected", c),
  13456. goog.a11y.aria.setState(a, goog.a11y.aria.State.SELECTED, c))
  13457. }
  13458. ;
  13459. goog.ui.PaletteRenderer.prototype.getCssClass = function () {
  13460. return goog.ui.PaletteRenderer.CSS_CLASS
  13461. }
  13462. ;
  13463. goog.ui.SelectionModel = function (a) {
  13464. goog.events.EventTarget.call(this);
  13465. this.items_ = [];
  13466. this.addItems(a)
  13467. }
  13468. ;
  13469. goog.inherits(goog.ui.SelectionModel, goog.events.EventTarget);
  13470. goog.tagUnsealableClass(goog.ui.SelectionModel);
  13471. goog.ui.SelectionModel.prototype.selectedItem_ = null;
  13472. goog.ui.SelectionModel.prototype.selectionHandler_ = null;
  13473. goog.ui.SelectionModel.prototype.getSelectionHandler = function () {
  13474. return this.selectionHandler_
  13475. }
  13476. ;
  13477. goog.ui.SelectionModel.prototype.setSelectionHandler = function (a) {
  13478. this.selectionHandler_ = a
  13479. }
  13480. ;
  13481. goog.ui.SelectionModel.prototype.getItemCount = function () {
  13482. return this.items_.length
  13483. }
  13484. ;
  13485. goog.ui.SelectionModel.prototype.indexOfItem = function (a) {
  13486. return a ? goog.array.indexOf(this.items_, a) : -1
  13487. }
  13488. ;
  13489. goog.ui.SelectionModel.prototype.getFirst = function () {
  13490. return this.items_[0]
  13491. }
  13492. ;
  13493. goog.ui.SelectionModel.prototype.getLast = function () {
  13494. return this.items_[this.items_.length - 1]
  13495. }
  13496. ;
  13497. goog.ui.SelectionModel.prototype.getItemAt = function (a) {
  13498. return this.items_[a] || null
  13499. }
  13500. ;
  13501. goog.ui.SelectionModel.prototype.addItems = function (a) {
  13502. a && (goog.array.forEach(a, function (a) {
  13503. this.selectItem_(a, !1)
  13504. }, this),
  13505. goog.array.extend(this.items_, a))
  13506. }
  13507. ;
  13508. goog.ui.SelectionModel.prototype.addItem = function (a) {
  13509. this.addItemAt(a, this.getItemCount())
  13510. }
  13511. ;
  13512. goog.ui.SelectionModel.prototype.addItemAt = function (a, b) {
  13513. a && (this.selectItem_(a, !1),
  13514. goog.array.insertAt(this.items_, a, b))
  13515. }
  13516. ;
  13517. goog.ui.SelectionModel.prototype.removeItem = function (a) {
  13518. a && goog.array.remove(this.items_, a) && a == this.selectedItem_ && (this.selectedItem_ = null,
  13519. this.dispatchEvent(goog.events.EventType.SELECT))
  13520. }
  13521. ;
  13522. goog.ui.SelectionModel.prototype.removeItemAt = function (a) {
  13523. this.removeItem(this.getItemAt(a))
  13524. }
  13525. ;
  13526. goog.ui.SelectionModel.prototype.getSelectedItem = function () {
  13527. return this.selectedItem_
  13528. }
  13529. ;
  13530. goog.ui.SelectionModel.prototype.getItems = function () {
  13531. return goog.array.clone(this.items_)
  13532. }
  13533. ;
  13534. goog.ui.SelectionModel.prototype.setSelectedItem = function (a) {
  13535. a != this.selectedItem_ && (this.selectItem_(this.selectedItem_, !1),
  13536. this.selectedItem_ = a,
  13537. this.selectItem_(a, !0));
  13538. this.dispatchEvent(goog.events.EventType.SELECT)
  13539. }
  13540. ;
  13541. goog.ui.SelectionModel.prototype.getSelectedIndex = function () {
  13542. return this.indexOfItem(this.selectedItem_)
  13543. }
  13544. ;
  13545. goog.ui.SelectionModel.prototype.setSelectedIndex = function (a) {
  13546. this.setSelectedItem(this.getItemAt(a))
  13547. }
  13548. ;
  13549. goog.ui.SelectionModel.prototype.clear = function () {
  13550. goog.array.clear(this.items_);
  13551. this.selectedItem_ = null
  13552. }
  13553. ;
  13554. goog.ui.SelectionModel.prototype.disposeInternal = function () {
  13555. goog.ui.SelectionModel.superClass_.disposeInternal.call(this);
  13556. delete this.items_;
  13557. this.selectedItem_ = null
  13558. }
  13559. ;
  13560. goog.ui.SelectionModel.prototype.selectItem_ = function (a, b) {
  13561. a && ("function" == typeof this.selectionHandler_ ? this.selectionHandler_(a, b) : "function" == typeof a.setSelected && a.setSelected(b))
  13562. }
  13563. ;
  13564. goog.ui.Palette = function (a, b, c) {
  13565. goog.ui.Control.call(this, a, b || goog.ui.PaletteRenderer.getInstance(), c);
  13566. this.setAutoStates(goog.ui.Component.State.CHECKED | goog.ui.Component.State.SELECTED | goog.ui.Component.State.OPENED, !1);
  13567. this.currentCellControl_ = new goog.ui.Palette.CurrentCell_;
  13568. this.currentCellControl_.setParentEventTarget(this);
  13569. this.lastHighlightedIndex_ = -1
  13570. }
  13571. ;
  13572. goog.inherits(goog.ui.Palette, goog.ui.Control);
  13573. goog.tagUnsealableClass(goog.ui.Palette);
  13574. goog.ui.Palette.EventType = {
  13575. AFTER_HIGHLIGHT: goog.events.getUniqueId("afterhighlight")
  13576. };
  13577. goog.ui.Palette.prototype.size_ = null;
  13578. goog.ui.Palette.prototype.highlightedIndex_ = -1;
  13579. goog.ui.Palette.prototype.selectionModel_ = null;
  13580. goog.ui.Palette.prototype.disposeInternal = function () {
  13581. goog.ui.Palette.superClass_.disposeInternal.call(this);
  13582. this.selectionModel_ && (this.selectionModel_.dispose(),
  13583. this.selectionModel_ = null);
  13584. this.size_ = null;
  13585. this.currentCellControl_.dispose()
  13586. }
  13587. ;
  13588. goog.ui.Palette.prototype.setContentInternal = function (a) {
  13589. goog.ui.Palette.superClass_.setContentInternal.call(this, a);
  13590. this.adjustSize_();
  13591. this.selectionModel_ ? (this.selectionModel_.clear(),
  13592. this.selectionModel_.addItems(a)) : (this.selectionModel_ = new goog.ui.SelectionModel(a),
  13593. this.selectionModel_.setSelectionHandler(goog.bind(this.selectItem_, this)),
  13594. this.getHandler().listen(this.selectionModel_, goog.events.EventType.SELECT, this.handleSelectionChange));
  13595. this.highlightedIndex_ = -1
  13596. }
  13597. ;
  13598. goog.ui.Palette.prototype.getCaption = function () {
  13599. return ""
  13600. }
  13601. ;
  13602. goog.ui.Palette.prototype.setCaption = function (a) { }
  13603. ;
  13604. goog.ui.Palette.prototype.handleMouseOver = function (a) {
  13605. goog.ui.Palette.superClass_.handleMouseOver.call(this, a);
  13606. var b = this.getRenderer().getContainingItem(this, a.target);
  13607. b && a.relatedTarget && goog.dom.contains(b, a.relatedTarget) || b != this.getHighlightedItem() && this.setHighlightedItem(b)
  13608. }
  13609. ;
  13610. goog.ui.Palette.prototype.handleMouseDown = function (a) {
  13611. goog.ui.Palette.superClass_.handleMouseDown.call(this, a);
  13612. this.isActive() && (a = this.getRenderer().getContainingItem(this, a.target),
  13613. a != this.getHighlightedItem() && this.setHighlightedItem(a))
  13614. }
  13615. ;
  13616. goog.ui.Palette.prototype.performActionInternal = function (a) {
  13617. var b = this.getHighlightedItem();
  13618. return b ? (a && this.shouldSelectHighlightedItem_(a) && this.setSelectedItem(b),
  13619. goog.ui.Palette.superClass_.performActionInternal.call(this, a)) : !1
  13620. }
  13621. ;
  13622. goog.ui.Palette.prototype.shouldSelectHighlightedItem_ = function (a) {
  13623. return this.getSelectedItem() ? "mouseup" != a.type ? !0 : !!this.getRenderer().getContainingItem(this, a.target) : !0
  13624. }
  13625. ;
  13626. goog.ui.Palette.prototype.handleKeyEvent = function (a) {
  13627. var b = this.getContent();
  13628. b = b ? b.length : 0;
  13629. var c = this.size_.width;
  13630. if (0 == b || !this.isEnabled())
  13631. return !1;
  13632. if (a.keyCode == goog.events.KeyCodes.ENTER || a.keyCode == goog.events.KeyCodes.SPACE)
  13633. return this.performActionInternal(a);
  13634. if (a.keyCode == goog.events.KeyCodes.HOME)
  13635. return this.setHighlightedIndex(0),
  13636. !0;
  13637. if (a.keyCode == goog.events.KeyCodes.END)
  13638. return this.setHighlightedIndex(b - 1),
  13639. !0;
  13640. var d = 0 > this.highlightedIndex_ ? this.getSelectedIndex() : this.highlightedIndex_;
  13641. switch (a.keyCode) {
  13642. case goog.events.KeyCodes.LEFT:
  13643. if (-1 == d || 0 == d)
  13644. d = b;
  13645. this.setHighlightedIndex(d - 1);
  13646. a.preventDefault();
  13647. return !0;
  13648. case goog.events.KeyCodes.RIGHT:
  13649. return d == b - 1 && (d = -1),
  13650. this.setHighlightedIndex(d + 1),
  13651. a.preventDefault(),
  13652. !0;
  13653. case goog.events.KeyCodes.UP:
  13654. -1 == d && (d = b + c - 1);
  13655. if (d >= c)
  13656. return this.setHighlightedIndex(d - c),
  13657. a.preventDefault(),
  13658. !0;
  13659. break;
  13660. case goog.events.KeyCodes.DOWN:
  13661. if (-1 == d && (d = -c),
  13662. d < b - c)
  13663. return this.setHighlightedIndex(d + c),
  13664. a.preventDefault(),
  13665. !0
  13666. }
  13667. return !1
  13668. }
  13669. ;
  13670. goog.ui.Palette.prototype.handleSelectionChange = function (a) { }
  13671. ;
  13672. goog.ui.Palette.prototype.getSize = function () {
  13673. return this.size_
  13674. }
  13675. ;
  13676. goog.ui.Palette.prototype.setSize = function (a, b) {
  13677. if (this.getElement())
  13678. throw Error(goog.ui.Component.Error.ALREADY_RENDERED);
  13679. this.size_ = "number" === typeof a ? new goog.math.Size(a, b) : a;
  13680. this.adjustSize_()
  13681. }
  13682. ;
  13683. goog.ui.Palette.prototype.getHighlightedIndex = function () {
  13684. return this.highlightedIndex_
  13685. }
  13686. ;
  13687. goog.ui.Palette.prototype.getHighlightedItem = function () {
  13688. var a = this.getContent();
  13689. return a && a[this.highlightedIndex_]
  13690. }
  13691. ;
  13692. goog.ui.Palette.prototype.getHighlightedCellElement_ = function () {
  13693. return this.getRenderer().getCellForItem(this.getHighlightedItem())
  13694. }
  13695. ;
  13696. goog.ui.Palette.prototype.setHighlightedIndex = function (a) {
  13697. a != this.highlightedIndex_ && (this.highlightIndex_(this.highlightedIndex_, !1),
  13698. this.lastHighlightedIndex_ = this.highlightedIndex_,
  13699. this.highlightedIndex_ = a,
  13700. this.highlightIndex_(a, !0),
  13701. this.dispatchEvent(goog.ui.Palette.EventType.AFTER_HIGHLIGHT))
  13702. }
  13703. ;
  13704. goog.ui.Palette.prototype.setHighlightedItem = function (a) {
  13705. var b = this.getContent();
  13706. this.setHighlightedIndex(b && a ? goog.array.indexOf(b, a) : -1)
  13707. }
  13708. ;
  13709. goog.ui.Palette.prototype.getSelectedIndex = function () {
  13710. return this.selectionModel_ ? this.selectionModel_.getSelectedIndex() : -1
  13711. }
  13712. ;
  13713. goog.ui.Palette.prototype.getSelectedItem = function () {
  13714. return this.selectionModel_ ? this.selectionModel_.getSelectedItem() : null
  13715. }
  13716. ;
  13717. goog.ui.Palette.prototype.setSelectedIndex = function (a) {
  13718. this.selectionModel_ && this.selectionModel_.setSelectedIndex(a)
  13719. }
  13720. ;
  13721. goog.ui.Palette.prototype.setSelectedItem = function (a) {
  13722. this.selectionModel_ && this.selectionModel_.setSelectedItem(a)
  13723. }
  13724. ;
  13725. goog.ui.Palette.prototype.highlightIndex_ = function (a, b) {
  13726. if (this.getElement()) {
  13727. var c = this.getContent();
  13728. if (c && 0 <= a && a < c.length) {
  13729. var d = this.getHighlightedCellElement_();
  13730. this.currentCellControl_.getElement() != d && this.currentCellControl_.setElementInternal(d);
  13731. this.currentCellControl_.tryHighlight(b) && this.getRenderer().highlightCell(this, c[a], b)
  13732. }
  13733. }
  13734. }
  13735. ;
  13736. goog.ui.Palette.prototype.setHighlighted = function (a) {
  13737. a && -1 == this.highlightedIndex_ ? this.setHighlightedIndex(-1 < this.lastHighlightedIndex_ ? this.lastHighlightedIndex_ : 0) : a || this.setHighlightedIndex(-1);
  13738. goog.ui.Palette.superClass_.setHighlighted.call(this, a)
  13739. }
  13740. ;
  13741. goog.ui.Palette.prototype.selectItem_ = function (a, b) {
  13742. this.getElement() && this.getRenderer().selectCell(this, a, b)
  13743. }
  13744. ;
  13745. goog.ui.Palette.prototype.adjustSize_ = function () {
  13746. var a = this.getContent();
  13747. if (a)
  13748. if (this.size_ && this.size_.width) {
  13749. if (a = Math.ceil(a.length / this.size_.width),
  13750. "number" !== typeof this.size_.height || this.size_.height < a)
  13751. this.size_.height = a
  13752. } else
  13753. a = Math.ceil(Math.sqrt(a.length)),
  13754. this.size_ = new goog.math.Size(a, a);
  13755. else
  13756. this.size_ = new goog.math.Size(0, 0)
  13757. }
  13758. ;
  13759. goog.ui.Palette.CurrentCell_ = function () {
  13760. goog.ui.Control.call(this, null);
  13761. this.setDispatchTransitionEvents(goog.ui.Component.State.HOVER, !0)
  13762. }
  13763. ;
  13764. goog.inherits(goog.ui.Palette.CurrentCell_, goog.ui.Control);
  13765. goog.ui.Palette.CurrentCell_.prototype.tryHighlight = function (a) {
  13766. this.setHighlighted(a);
  13767. return this.isHighlighted() == a
  13768. }
  13769. ;
  13770. goog.ui.ColorPalette = function (a, b, c) {
  13771. this.colors_ = a || [];
  13772. goog.ui.Palette.call(this, null, b || goog.ui.PaletteRenderer.getInstance(), c);
  13773. this.setColors(this.colors_)
  13774. }
  13775. ;
  13776. goog.inherits(goog.ui.ColorPalette, goog.ui.Palette);
  13777. goog.tagUnsealableClass(goog.ui.ColorPalette);
  13778. goog.ui.ColorPalette.prototype.normalizedColors_ = null;
  13779. goog.ui.ColorPalette.prototype.labels_ = null;
  13780. goog.ui.ColorPalette.prototype.getColors = function () {
  13781. return this.colors_
  13782. }
  13783. ;
  13784. goog.ui.ColorPalette.prototype.setColors = function (a, b) {
  13785. this.colors_ = a;
  13786. this.labels_ = b || null;
  13787. this.normalizedColors_ = null;
  13788. this.setContent(this.createColorNodes())
  13789. }
  13790. ;
  13791. goog.ui.ColorPalette.prototype.getSelectedColor = function () {
  13792. var a = this.getSelectedItem();
  13793. return a ? (a = goog.style.getStyle(a, "background-color"),
  13794. goog.ui.ColorPalette.parseColor_(a)) : null
  13795. }
  13796. ;
  13797. goog.ui.ColorPalette.prototype.setSelectedColor = function (a) {
  13798. a = goog.ui.ColorPalette.parseColor_(a);
  13799. this.normalizedColors_ || (this.normalizedColors_ = goog.array.map(this.colors_, function (a) {
  13800. return goog.ui.ColorPalette.parseColor_(a)
  13801. }));
  13802. this.setSelectedIndex(a ? goog.array.indexOf(this.normalizedColors_, a) : -1)
  13803. }
  13804. ;
  13805. goog.ui.ColorPalette.prototype.createColorNodes = function () {
  13806. return goog.array.map(this.colors_, function (a, b) {
  13807. var c = this.getDomHelper().createDom("DIV", {
  13808. "class": this.getRenderer().getCssClass() + "-colorswatch",
  13809. style: "background-color:" + a
  13810. });
  13811. c.title = this.labels_ && this.labels_[b] ? this.labels_[b] : "#" == a.charAt(0) ? "RGB (" + goog.color.hexToRgb(a).join(", ") + ")" : a;
  13812. return c
  13813. }, this)
  13814. }
  13815. ;
  13816. goog.ui.ColorPalette.parseColor_ = function (a) {
  13817. if (a)
  13818. try {
  13819. return goog.color.parse(a).hex
  13820. } catch (b) { }
  13821. return null
  13822. }
  13823. ;
  13824. goog.ui.ColorPicker = function (a, b) {
  13825. goog.ui.Component.call(this, a);
  13826. this.colorPalette_ = b || null;
  13827. this.getHandler().listen(this, goog.ui.Component.EventType.ACTION, this.onColorPaletteAction_)
  13828. }
  13829. ;
  13830. goog.inherits(goog.ui.ColorPicker, goog.ui.Component);
  13831. goog.ui.ColorPicker.DEFAULT_NUM_COLS = 5;
  13832. goog.ui.ColorPicker.EventType = {
  13833. CHANGE: "change"
  13834. };
  13835. goog.ui.ColorPicker.prototype.focusable_ = !0;
  13836. goog.ui.ColorPicker.prototype.getColors = function () {
  13837. return this.colorPalette_ ? this.colorPalette_.getColors() : null
  13838. }
  13839. ;
  13840. goog.ui.ColorPicker.prototype.setColors = function (a) {
  13841. this.colorPalette_ ? this.colorPalette_.setColors(a) : this.createColorPalette_(a)
  13842. }
  13843. ;
  13844. goog.ui.ColorPicker.prototype.addColors = function (a) {
  13845. this.setColors(a)
  13846. }
  13847. ;
  13848. goog.ui.ColorPicker.prototype.setSize = function (a) {
  13849. this.colorPalette_ || this.createColorPalette_([]);
  13850. this.colorPalette_.setSize(a)
  13851. }
  13852. ;
  13853. goog.ui.ColorPicker.prototype.getSize = function () {
  13854. return this.colorPalette_ ? this.colorPalette_.getSize() : null
  13855. }
  13856. ;
  13857. goog.ui.ColorPicker.prototype.setColumnCount = function (a) {
  13858. this.setSize(a)
  13859. }
  13860. ;
  13861. goog.ui.ColorPicker.prototype.getSelectedIndex = function () {
  13862. return this.colorPalette_ ? this.colorPalette_.getSelectedIndex() : -1
  13863. }
  13864. ;
  13865. goog.ui.ColorPicker.prototype.setSelectedIndex = function (a) {
  13866. this.colorPalette_ && this.colorPalette_.setSelectedIndex(a)
  13867. }
  13868. ;
  13869. goog.ui.ColorPicker.prototype.getSelectedColor = function () {
  13870. return this.colorPalette_ ? this.colorPalette_.getSelectedColor() : null
  13871. }
  13872. ;
  13873. goog.ui.ColorPicker.prototype.setSelectedColor = function (a) {
  13874. this.colorPalette_ && this.colorPalette_.setSelectedColor(a)
  13875. }
  13876. ;
  13877. goog.ui.ColorPicker.prototype.isFocusable = function () {
  13878. return this.focusable_
  13879. }
  13880. ;
  13881. goog.ui.ColorPicker.prototype.setFocusable = function (a) {
  13882. this.focusable_ = a;
  13883. this.colorPalette_ && this.colorPalette_.setSupportedState(goog.ui.Component.State.FOCUSED, a)
  13884. }
  13885. ;
  13886. goog.ui.ColorPicker.prototype.canDecorate = function (a) {
  13887. return !1
  13888. }
  13889. ;
  13890. goog.ui.ColorPicker.prototype.enterDocument = function () {
  13891. goog.ui.ColorPicker.superClass_.enterDocument.call(this);
  13892. this.colorPalette_ && this.colorPalette_.render(this.getElement());
  13893. this.getElement().unselectable = "on"
  13894. }
  13895. ;
  13896. goog.ui.ColorPicker.prototype.disposeInternal = function () {
  13897. goog.ui.ColorPicker.superClass_.disposeInternal.call(this);
  13898. this.colorPalette_ && (this.colorPalette_.dispose(),
  13899. this.colorPalette_ = null)
  13900. }
  13901. ;
  13902. goog.ui.ColorPicker.prototype.focus = function () {
  13903. this.colorPalette_ && this.colorPalette_.getElement().focus()
  13904. }
  13905. ;
  13906. goog.ui.ColorPicker.prototype.onColorPaletteAction_ = function (a) {
  13907. a.stopPropagation();
  13908. this.dispatchEvent(goog.ui.ColorPicker.EventType.CHANGE)
  13909. }
  13910. ;
  13911. goog.ui.ColorPicker.prototype.createColorPalette_ = function (a) {
  13912. a = new goog.ui.ColorPalette(a, null, this.getDomHelper());
  13913. a.setSize(goog.ui.ColorPicker.DEFAULT_NUM_COLS);
  13914. a.setSupportedState(goog.ui.Component.State.FOCUSED, this.focusable_);
  13915. this.addChild(a);
  13916. this.colorPalette_ = a;
  13917. this.isInDocument() && this.colorPalette_.render(this.getElement())
  13918. }
  13919. ;
  13920. goog.ui.ColorPicker.createSimpleColorGrid = function (a) {
  13921. a = new goog.ui.ColorPicker(a);
  13922. a.setSize(7);
  13923. a.setColors(goog.ui.ColorPicker.SIMPLE_GRID_COLORS);
  13924. return a
  13925. }
  13926. ;
  13927. goog.ui.ColorPicker.SIMPLE_GRID_COLORS = "#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" ");
  13928. goog.events.FocusHandler = function (a) {
  13929. goog.events.EventTarget.call(this);
  13930. this.element_ = a;
  13931. a = goog.userAgent.IE ? "focusout" : "blur";
  13932. this.listenKeyIn_ = goog.events.listen(this.element_, goog.userAgent.IE ? "focusin" : "focus", this, !goog.userAgent.IE);
  13933. this.listenKeyOut_ = goog.events.listen(this.element_, a, this, !goog.userAgent.IE)
  13934. }
  13935. ;
  13936. goog.inherits(goog.events.FocusHandler, goog.events.EventTarget);
  13937. goog.events.FocusHandler.EventType = {
  13938. FOCUSIN: "focusin",
  13939. FOCUSOUT: "focusout"
  13940. };
  13941. goog.events.FocusHandler.prototype.handleEvent = function (a) {
  13942. var b = a.getBrowserEvent();
  13943. b = new goog.events.BrowserEvent(b);
  13944. b.type = "focusin" == a.type || "focus" == a.type ? goog.events.FocusHandler.EventType.FOCUSIN : goog.events.FocusHandler.EventType.FOCUSOUT;
  13945. this.dispatchEvent(b)
  13946. }
  13947. ;
  13948. goog.events.FocusHandler.prototype.disposeInternal = function () {
  13949. goog.events.FocusHandler.superClass_.disposeInternal.call(this);
  13950. goog.events.unlistenByKey(this.listenKeyIn_);
  13951. goog.events.unlistenByKey(this.listenKeyOut_);
  13952. delete this.element_
  13953. }
  13954. ;
  13955. goog.debug.LogRecord = function (a, b, c, d, e) {
  13956. this.reset(a, b, c, d, e)
  13957. }
  13958. ;
  13959. goog.debug.LogRecord.prototype.sequenceNumber_ = 0;
  13960. goog.debug.LogRecord.prototype.exception_ = null;
  13961. goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS = !0;
  13962. goog.debug.LogRecord.nextSequenceNumber_ = 0;
  13963. goog.debug.LogRecord.prototype.reset = function (a, b, c, d, e) {
  13964. goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS && (this.sequenceNumber_ = "number" == typeof e ? e : goog.debug.LogRecord.nextSequenceNumber_++);
  13965. this.time_ = d || goog.now();
  13966. this.level_ = a;
  13967. this.msg_ = b;
  13968. this.loggerName_ = c;
  13969. delete this.exception_
  13970. }
  13971. ;
  13972. goog.debug.LogRecord.prototype.getLoggerName = function () {
  13973. return this.loggerName_
  13974. }
  13975. ;
  13976. goog.debug.LogRecord.prototype.getException = function () {
  13977. return this.exception_
  13978. }
  13979. ;
  13980. goog.debug.LogRecord.prototype.setException = function (a) {
  13981. this.exception_ = a
  13982. }
  13983. ;
  13984. goog.debug.LogRecord.prototype.setLoggerName = function (a) {
  13985. this.loggerName_ = a
  13986. }
  13987. ;
  13988. goog.debug.LogRecord.prototype.getLevel = function () {
  13989. return this.level_
  13990. }
  13991. ;
  13992. goog.debug.LogRecord.prototype.setLevel = function (a) {
  13993. this.level_ = a
  13994. }
  13995. ;
  13996. goog.debug.LogRecord.prototype.getMessage = function () {
  13997. return this.msg_
  13998. }
  13999. ;
  14000. goog.debug.LogRecord.prototype.setMessage = function (a) {
  14001. this.msg_ = a
  14002. }
  14003. ;
  14004. goog.debug.LogRecord.prototype.getMillis = function () {
  14005. return this.time_
  14006. }
  14007. ;
  14008. goog.debug.LogRecord.prototype.setMillis = function (a) {
  14009. this.time_ = a
  14010. }
  14011. ;
  14012. goog.debug.LogRecord.prototype.getSequenceNumber = function () {
  14013. return this.sequenceNumber_
  14014. }
  14015. ;
  14016. goog.debug.LogBuffer = function () {
  14017. goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(), "Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY.");
  14018. this.clear()
  14019. }
  14020. ;
  14021. goog.debug.LogBuffer.getInstance = function () {
  14022. goog.debug.LogBuffer.instance_ || (goog.debug.LogBuffer.instance_ = new goog.debug.LogBuffer);
  14023. return goog.debug.LogBuffer.instance_
  14024. }
  14025. ;
  14026. goog.debug.LogBuffer.CAPACITY = 0;
  14027. goog.debug.LogBuffer.prototype.addRecord = function (a, b, c) {
  14028. var d = (this.curIndex_ + 1) % goog.debug.LogBuffer.CAPACITY;
  14029. this.curIndex_ = d;
  14030. if (this.isFull_)
  14031. return d = this.buffer_[d],
  14032. d.reset(a, b, c),
  14033. d;
  14034. this.isFull_ = d == goog.debug.LogBuffer.CAPACITY - 1;
  14035. return this.buffer_[d] = new goog.debug.LogRecord(a, b, c)
  14036. }
  14037. ;
  14038. goog.debug.LogBuffer.isBufferingEnabled = function () {
  14039. return 0 < goog.debug.LogBuffer.CAPACITY
  14040. }
  14041. ;
  14042. goog.debug.LogBuffer.prototype.clear = function () {
  14043. this.buffer_ = Array(goog.debug.LogBuffer.CAPACITY);
  14044. this.curIndex_ = -1;
  14045. this.isFull_ = !1
  14046. }
  14047. ;
  14048. goog.debug.LogBuffer.prototype.forEachRecord = function (a) {
  14049. var b = this.buffer_;
  14050. if (b[0]) {
  14051. var c = this.curIndex_
  14052. , d = this.isFull_ ? c : -1;
  14053. do
  14054. d = (d + 1) % goog.debug.LogBuffer.CAPACITY,
  14055. a(b[d]);
  14056. while (d != c)
  14057. }
  14058. }
  14059. ;
  14060. goog.debug.Logger = function (a) {
  14061. this.name_ = a;
  14062. this.handlers_ = this.children_ = this.level_ = this.parent_ = null
  14063. }
  14064. ;
  14065. goog.debug.Logger.ROOT_LOGGER_NAME = "";
  14066. goog.debug.Logger.ENABLE_HIERARCHY = !0;
  14067. goog.debug.Logger.ENABLE_PROFILER_LOGGING = !1;
  14068. goog.debug.Logger.ENABLE_HIERARCHY || (goog.debug.Logger.rootHandlers_ = []);
  14069. goog.debug.Logger.Level = function (a, b) {
  14070. this.name = a;
  14071. this.value = b
  14072. }
  14073. ;
  14074. goog.debug.Logger.Level.prototype.toString = function () {
  14075. return this.name
  14076. }
  14077. ;
  14078. goog.debug.Logger.Level.OFF = new goog.debug.Logger.Level("OFF", Infinity);
  14079. goog.debug.Logger.Level.SHOUT = new goog.debug.Logger.Level("SHOUT", 1200);
  14080. goog.debug.Logger.Level.SEVERE = new goog.debug.Logger.Level("SEVERE", 1E3);
  14081. goog.debug.Logger.Level.WARNING = new goog.debug.Logger.Level("WARNING", 900);
  14082. goog.debug.Logger.Level.INFO = new goog.debug.Logger.Level("INFO", 800);
  14083. goog.debug.Logger.Level.CONFIG = new goog.debug.Logger.Level("CONFIG", 700);
  14084. goog.debug.Logger.Level.FINE = new goog.debug.Logger.Level("FINE", 500);
  14085. goog.debug.Logger.Level.FINER = new goog.debug.Logger.Level("FINER", 400);
  14086. goog.debug.Logger.Level.FINEST = new goog.debug.Logger.Level("FINEST", 300);
  14087. goog.debug.Logger.Level.ALL = new goog.debug.Logger.Level("ALL", 0);
  14088. goog.debug.Logger.Level.PREDEFINED_LEVELS = [goog.debug.Logger.Level.OFF, goog.debug.Logger.Level.SHOUT, goog.debug.Logger.Level.SEVERE, goog.debug.Logger.Level.WARNING, goog.debug.Logger.Level.INFO, goog.debug.Logger.Level.CONFIG, goog.debug.Logger.Level.FINE, goog.debug.Logger.Level.FINER, goog.debug.Logger.Level.FINEST, goog.debug.Logger.Level.ALL];
  14089. goog.debug.Logger.Level.predefinedLevelsCache_ = null;
  14090. goog.debug.Logger.Level.createPredefinedLevelsCache_ = function () {
  14091. goog.debug.Logger.Level.predefinedLevelsCache_ = {};
  14092. for (var a = 0, b; b = goog.debug.Logger.Level.PREDEFINED_LEVELS[a]; a++)
  14093. goog.debug.Logger.Level.predefinedLevelsCache_[b.value] = b,
  14094. goog.debug.Logger.Level.predefinedLevelsCache_[b.name] = b
  14095. }
  14096. ;
  14097. goog.debug.Logger.Level.getPredefinedLevel = function (a) {
  14098. goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_();
  14099. return goog.debug.Logger.Level.predefinedLevelsCache_[a] || null
  14100. }
  14101. ;
  14102. goog.debug.Logger.Level.getPredefinedLevelByValue = function (a) {
  14103. goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_();
  14104. if (a in goog.debug.Logger.Level.predefinedLevelsCache_)
  14105. return goog.debug.Logger.Level.predefinedLevelsCache_[a];
  14106. for (var b = 0; b < goog.debug.Logger.Level.PREDEFINED_LEVELS.length; ++b) {
  14107. var c = goog.debug.Logger.Level.PREDEFINED_LEVELS[b];
  14108. if (c.value <= a)
  14109. return c
  14110. }
  14111. return null
  14112. }
  14113. ;
  14114. goog.debug.Logger.getLogger = function (a) {
  14115. return goog.debug.LogManager.getLogger(a)
  14116. }
  14117. ;
  14118. goog.debug.Logger.logToProfilers = function (a) {
  14119. if (goog.debug.Logger.ENABLE_PROFILER_LOGGING) {
  14120. var b = goog.global.msWriteProfilerMark;
  14121. b ? b(a) : (b = goog.global.console) && b.timeStamp && b.timeStamp(a)
  14122. }
  14123. }
  14124. ;
  14125. goog.debug.Logger.prototype.getName = function () {
  14126. return this.name_
  14127. }
  14128. ;
  14129. goog.debug.Logger.prototype.addHandler = function (a) {
  14130. goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? (this.handlers_ || (this.handlers_ = []),
  14131. this.handlers_.push(a)) : (goog.asserts.assert(!this.name_, "Cannot call addHandler on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),
  14132. goog.debug.Logger.rootHandlers_.push(a)))
  14133. }
  14134. ;
  14135. goog.debug.Logger.prototype.removeHandler = function (a) {
  14136. if (goog.debug.LOGGING_ENABLED) {
  14137. var b = goog.debug.Logger.ENABLE_HIERARCHY ? this.handlers_ : goog.debug.Logger.rootHandlers_;
  14138. return !!b && goog.array.remove(b, a)
  14139. }
  14140. return !1
  14141. }
  14142. ;
  14143. goog.debug.Logger.prototype.getParent = function () {
  14144. return this.parent_
  14145. }
  14146. ;
  14147. goog.debug.Logger.prototype.getChildren = function () {
  14148. this.children_ || (this.children_ = {});
  14149. return this.children_
  14150. }
  14151. ;
  14152. goog.debug.Logger.prototype.setLevel = function (a) {
  14153. goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? this.level_ = a : (goog.asserts.assert(!this.name_, "Cannot call setLevel() on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),
  14154. goog.debug.Logger.rootLevel_ = a))
  14155. }
  14156. ;
  14157. goog.debug.Logger.prototype.getLevel = function () {
  14158. return goog.debug.LOGGING_ENABLED ? this.level_ : goog.debug.Logger.Level.OFF
  14159. }
  14160. ;
  14161. goog.debug.Logger.prototype.getEffectiveLevel = function () {
  14162. if (!goog.debug.LOGGING_ENABLED)
  14163. return goog.debug.Logger.Level.OFF;
  14164. if (!goog.debug.Logger.ENABLE_HIERARCHY)
  14165. return goog.debug.Logger.rootLevel_;
  14166. if (this.level_)
  14167. return this.level_;
  14168. if (this.parent_)
  14169. return this.parent_.getEffectiveLevel();
  14170. goog.asserts.fail("Root logger has no level set.");
  14171. return null
  14172. }
  14173. ;
  14174. goog.debug.Logger.prototype.isLoggable = function (a) {
  14175. return goog.debug.LOGGING_ENABLED && a.value >= this.getEffectiveLevel().value
  14176. }
  14177. ;
  14178. goog.debug.Logger.prototype.log = function (a, b, c) {
  14179. goog.debug.LOGGING_ENABLED && this.isLoggable(a) && (goog.isFunction(b) && (b = b()),
  14180. this.doLogRecord_(this.getLogRecord(a, b, c)))
  14181. }
  14182. ;
  14183. goog.debug.Logger.prototype.getLogRecord = function (a, b, c) {
  14184. a = goog.debug.LogBuffer.isBufferingEnabled() ? goog.debug.LogBuffer.getInstance().addRecord(a, b, this.name_) : new goog.debug.LogRecord(a, String(b), this.name_);
  14185. c && a.setException(c);
  14186. return a
  14187. }
  14188. ;
  14189. goog.debug.Logger.prototype.shout = function (a, b) {
  14190. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.SHOUT, a, b)
  14191. }
  14192. ;
  14193. goog.debug.Logger.prototype.severe = function (a, b) {
  14194. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.SEVERE, a, b)
  14195. }
  14196. ;
  14197. goog.debug.Logger.prototype.warning = function (a, b) {
  14198. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.WARNING, a, b)
  14199. }
  14200. ;
  14201. goog.debug.Logger.prototype.info = function (a, b) {
  14202. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.INFO, a, b)
  14203. }
  14204. ;
  14205. goog.debug.Logger.prototype.config = function (a, b) {
  14206. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.CONFIG, a, b)
  14207. }
  14208. ;
  14209. goog.debug.Logger.prototype.fine = function (a, b) {
  14210. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINE, a, b)
  14211. }
  14212. ;
  14213. goog.debug.Logger.prototype.finer = function (a, b) {
  14214. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINER, a, b)
  14215. }
  14216. ;
  14217. goog.debug.Logger.prototype.finest = function (a, b) {
  14218. goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINEST, a, b)
  14219. }
  14220. ;
  14221. goog.debug.Logger.prototype.logRecord = function (a) {
  14222. goog.debug.LOGGING_ENABLED && this.isLoggable(a.getLevel()) && this.doLogRecord_(a)
  14223. }
  14224. ;
  14225. goog.debug.Logger.prototype.doLogRecord_ = function (a) {
  14226. goog.debug.Logger.ENABLE_PROFILER_LOGGING && goog.debug.Logger.logToProfilers("log:" + a.getMessage());
  14227. if (goog.debug.Logger.ENABLE_HIERARCHY)
  14228. for (var b = this; b;)
  14229. b.callPublish_(a),
  14230. b = b.getParent();
  14231. else {
  14232. b = 0;
  14233. for (var c; c = goog.debug.Logger.rootHandlers_[b++];)
  14234. c(a)
  14235. }
  14236. }
  14237. ;
  14238. goog.debug.Logger.prototype.callPublish_ = function (a) {
  14239. if (this.handlers_)
  14240. for (var b = 0, c; c = this.handlers_[b]; b++)
  14241. c(a)
  14242. }
  14243. ;
  14244. goog.debug.Logger.prototype.setParent_ = function (a) {
  14245. this.parent_ = a
  14246. }
  14247. ;
  14248. goog.debug.Logger.prototype.addChild_ = function (a, b) {
  14249. this.getChildren()[a] = b
  14250. }
  14251. ;
  14252. goog.debug.LogManager = {};
  14253. goog.debug.LogManager.loggers_ = {};
  14254. goog.debug.LogManager.rootLogger_ = null;
  14255. goog.debug.LogManager.initialize = function () {
  14256. goog.debug.LogManager.rootLogger_ || (goog.debug.LogManager.rootLogger_ = new goog.debug.Logger(goog.debug.Logger.ROOT_LOGGER_NAME),
  14257. goog.debug.LogManager.loggers_[goog.debug.Logger.ROOT_LOGGER_NAME] = goog.debug.LogManager.rootLogger_,
  14258. goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG))
  14259. }
  14260. ;
  14261. goog.debug.LogManager.getLoggers = function () {
  14262. return goog.debug.LogManager.loggers_
  14263. }
  14264. ;
  14265. goog.debug.LogManager.getRoot = function () {
  14266. goog.debug.LogManager.initialize();
  14267. return goog.debug.LogManager.rootLogger_
  14268. }
  14269. ;
  14270. goog.debug.LogManager.getLogger = function (a) {
  14271. goog.debug.LogManager.initialize();
  14272. return goog.debug.LogManager.loggers_[a] || goog.debug.LogManager.createLogger_(a)
  14273. }
  14274. ;
  14275. goog.debug.LogManager.createFunctionForCatchErrors = function (a) {
  14276. return function (b) {
  14277. (a || goog.debug.LogManager.getRoot()).severe("Error: " + b.message + " (" + b.fileName + " @ Line: " + b.line + ")")
  14278. }
  14279. }
  14280. ;
  14281. goog.debug.LogManager.createLogger_ = function (a) {
  14282. var b = new goog.debug.Logger(a);
  14283. if (goog.debug.Logger.ENABLE_HIERARCHY) {
  14284. var c = a.lastIndexOf(".")
  14285. , d = a.substr(0, c);
  14286. c = a.substr(c + 1);
  14287. d = goog.debug.LogManager.getLogger(d);
  14288. d.addChild_(c, b);
  14289. b.setParent_(d)
  14290. }
  14291. return goog.debug.LogManager.loggers_[a] = b
  14292. }
  14293. ;
  14294. goog.log = {};
  14295. goog.log.ENABLED = goog.debug.LOGGING_ENABLED;
  14296. goog.log.ROOT_LOGGER_NAME = goog.debug.Logger.ROOT_LOGGER_NAME;
  14297. goog.log.Logger = goog.debug.Logger;
  14298. goog.log.Level = goog.debug.Logger.Level;
  14299. goog.log.LogRecord = goog.debug.LogRecord;
  14300. goog.log.getLogger = function (a, b) {
  14301. if (goog.log.ENABLED) {
  14302. var c = goog.debug.LogManager.getLogger(a);
  14303. b && c && c.setLevel(b);
  14304. return c
  14305. }
  14306. return null
  14307. }
  14308. ;
  14309. goog.log.addHandler = function (a, b) {
  14310. goog.log.ENABLED && a && a.addHandler(b)
  14311. }
  14312. ;
  14313. goog.log.removeHandler = function (a, b) {
  14314. return goog.log.ENABLED && a ? a.removeHandler(b) : !1
  14315. }
  14316. ;
  14317. goog.log.log = function (a, b, c, d) {
  14318. goog.log.ENABLED && a && a.log(b, c, d)
  14319. }
  14320. ;
  14321. goog.log.error = function (a, b, c) {
  14322. goog.log.ENABLED && a && a.severe(b, c)
  14323. }
  14324. ;
  14325. goog.log.warning = function (a, b, c) {
  14326. goog.log.ENABLED && a && a.warning(b, c)
  14327. }
  14328. ;
  14329. goog.log.info = function (a, b, c) {
  14330. goog.log.ENABLED && a && a.info(b, c)
  14331. }
  14332. ;
  14333. goog.log.fine = function (a, b, c) {
  14334. goog.log.ENABLED && a && a.fine(b, c)
  14335. }
  14336. ;
  14337. goog.string.StringBuffer = function (a, b) {
  14338. null != a && this.append.apply(this, arguments)
  14339. }
  14340. ;
  14341. goog.string.StringBuffer.prototype.buffer_ = "";
  14342. goog.string.StringBuffer.prototype.set = function (a) {
  14343. this.buffer_ = "" + a
  14344. }
  14345. ;
  14346. goog.string.StringBuffer.prototype.append = function (a, b, c) {
  14347. this.buffer_ += String(a);
  14348. if (null != b)
  14349. for (var d = 1; d < arguments.length; d++)
  14350. this.buffer_ += arguments[d];
  14351. return this
  14352. }
  14353. ;
  14354. goog.string.StringBuffer.prototype.clear = function () {
  14355. this.buffer_ = ""
  14356. }
  14357. ;
  14358. goog.string.StringBuffer.prototype.getLength = function () {
  14359. return this.buffer_.length
  14360. }
  14361. ;
  14362. goog.string.StringBuffer.prototype.toString = function () {
  14363. return this.buffer_
  14364. }
  14365. ;
  14366. goog.ui.tree = {};
  14367. goog.ui.tree.BaseNode = function (a, b, c) {
  14368. goog.ui.Component.call(this, c);
  14369. this.config_ = b || goog.ui.tree.BaseNode.defaultConfig;
  14370. this.html_ = goog.html.SafeHtml.htmlEscapePreservingNewlines(a);
  14371. this.expanded_ = this.selected_ = !1;
  14372. this.toolTip_ = null;
  14373. this.afterLabelHtml_ = goog.html.SafeHtml.EMPTY;
  14374. this.isUserCollapsible_ = !0;
  14375. this.depth_ = -1
  14376. }
  14377. ;
  14378. goog.inherits(goog.ui.tree.BaseNode, goog.ui.Component);
  14379. goog.ui.tree.BaseNode.EventType = {
  14380. BEFORE_EXPAND: "beforeexpand",
  14381. EXPAND: "expand",
  14382. BEFORE_COLLAPSE: "beforecollapse",
  14383. COLLAPSE: "collapse"
  14384. };
  14385. goog.ui.tree.BaseNode.allNodes = {};
  14386. goog.ui.tree.BaseNode.prototype.disposeInternal = function () {
  14387. goog.ui.tree.BaseNode.superClass_.disposeInternal.call(this);
  14388. this.tree && (this.tree.removeNode(this),
  14389. this.tree = null);
  14390. this.setElementInternal(null)
  14391. }
  14392. ;
  14393. goog.ui.tree.BaseNode.prototype.initAccessibility = function () {
  14394. var a = this.getElement();
  14395. if (a) {
  14396. var b = this.getLabelElement();
  14397. b && !b.id && (b.id = this.getId() + ".label");
  14398. goog.a11y.aria.setRole(a, "treeitem");
  14399. goog.a11y.aria.setState(a, "selected", !1);
  14400. goog.a11y.aria.setState(a, "level", this.getDepth());
  14401. b && goog.a11y.aria.setState(a, "labelledby", b.id);
  14402. (b = this.getIconElement()) && goog.a11y.aria.setRole(b, "presentation");
  14403. (b = this.getExpandIconElement()) && goog.a11y.aria.setRole(b, "presentation");
  14404. if (b = this.getChildrenElement())
  14405. if (goog.a11y.aria.setRole(b, "group"),
  14406. b.hasChildNodes())
  14407. for (goog.a11y.aria.setState(a, goog.a11y.aria.State.EXPANDED, !1),
  14408. a = this.getChildCount(),
  14409. b = 1; b <= a; b++) {
  14410. var c = this.getChildAt(b - 1).getElement();
  14411. goog.asserts.assert(c, "The child element cannot be null");
  14412. goog.a11y.aria.setState(c, "setsize", a);
  14413. goog.a11y.aria.setState(c, "posinset", b)
  14414. }
  14415. }
  14416. }
  14417. ;
  14418. goog.ui.tree.BaseNode.prototype.createDom = function () {
  14419. var a = this.getDomHelper().safeHtmlToNode(this.toSafeHtml());
  14420. this.setElementInternal(a)
  14421. }
  14422. ;
  14423. goog.ui.tree.BaseNode.prototype.enterDocument = function () {
  14424. goog.ui.tree.BaseNode.superClass_.enterDocument.call(this);
  14425. goog.ui.tree.BaseNode.allNodes[this.getId()] = this;
  14426. this.initAccessibility()
  14427. }
  14428. ;
  14429. goog.ui.tree.BaseNode.prototype.exitDocument = function () {
  14430. goog.ui.tree.BaseNode.superClass_.exitDocument.call(this);
  14431. delete goog.ui.tree.BaseNode.allNodes[this.getId()]
  14432. }
  14433. ;
  14434. goog.ui.tree.BaseNode.prototype.addChildAt = function (a, b, c) {
  14435. goog.asserts.assert(!a.getParent());
  14436. goog.asserts.assertInstanceof(a, goog.ui.tree.BaseNode);
  14437. c = this.getChildAt(b - 1);
  14438. var d = this.getChildAt(b);
  14439. goog.ui.tree.BaseNode.superClass_.addChildAt.call(this, a, b);
  14440. a.previousSibling_ = c;
  14441. a.nextSibling_ = d;
  14442. c ? c.nextSibling_ = a : this.firstChild_ = a;
  14443. d ? d.previousSibling_ = a : this.lastChild_ = a;
  14444. (b = this.getTree()) && a.setTreeInternal(b);
  14445. a.setDepth_(this.getDepth() + 1);
  14446. if (b = this.getElement())
  14447. if (this.updateExpandIcon(),
  14448. goog.a11y.aria.setState(b, goog.a11y.aria.State.EXPANDED, this.getExpanded()),
  14449. this.getExpanded()) {
  14450. b = this.getChildrenElement();
  14451. a.getElement() || a.createDom();
  14452. var e = a.getElement()
  14453. , f = d && d.getElement();
  14454. b.insertBefore(e, f);
  14455. this.isInDocument() && a.enterDocument();
  14456. d || (c ? c.updateExpandIcon() : (goog.style.setElementShown(b, !0),
  14457. this.setExpanded(this.getExpanded())))
  14458. }
  14459. }
  14460. ;
  14461. goog.ui.tree.BaseNode.prototype.add = function (a, b) {
  14462. goog.asserts.assert(!b || b.getParent() == this, "Can only add nodes before siblings");
  14463. a.getParent() && a.getParent().removeChild(a);
  14464. this.addChildAt(a, b ? this.indexOfChild(b) : this.getChildCount());
  14465. return a
  14466. }
  14467. ;
  14468. goog.ui.tree.BaseNode.prototype.removeChild = function (a, b) {
  14469. var c = this.getTree()
  14470. , d = c ? c.getSelectedItem() : null;
  14471. if (d == a || a.contains(d))
  14472. c.hasFocus() ? (this.select(),
  14473. goog.Timer.callOnce(this.onTimeoutSelect_, 10, this)) : this.select();
  14474. goog.ui.tree.BaseNode.superClass_.removeChild.call(this, a);
  14475. this.lastChild_ == a && (this.lastChild_ = a.previousSibling_);
  14476. this.firstChild_ == a && (this.firstChild_ = a.nextSibling_);
  14477. a.previousSibling_ && (a.previousSibling_.nextSibling_ = a.nextSibling_);
  14478. a.nextSibling_ && (a.nextSibling_.previousSibling_ = a.previousSibling_);
  14479. d = a.isLastSibling();
  14480. a.tree = null;
  14481. a.depth_ = -1;
  14482. if (c && (c.removeNode(a),
  14483. this.isInDocument())) {
  14484. c = this.getChildrenElement();
  14485. if (a.isInDocument()) {
  14486. var e = a.getElement();
  14487. c.removeChild(e);
  14488. a.exitDocument()
  14489. }
  14490. d && (d = this.getLastChild()) && d.updateExpandIcon();
  14491. this.hasChildren() || (c.style.display = "none",
  14492. this.updateExpandIcon(),
  14493. this.updateIcon_(),
  14494. (d = this.getElement()) && goog.a11y.aria.removeState(d, goog.a11y.aria.State.EXPANDED))
  14495. }
  14496. return a
  14497. }
  14498. ;
  14499. goog.ui.tree.BaseNode.prototype.remove = goog.ui.tree.BaseNode.prototype.removeChild;
  14500. goog.ui.tree.BaseNode.prototype.onTimeoutSelect_ = function () {
  14501. this.select()
  14502. }
  14503. ;
  14504. goog.ui.tree.BaseNode.prototype.getTree = goog.abstractMethod;
  14505. goog.ui.tree.BaseNode.prototype.getDepth = function () {
  14506. var a = this.depth_;
  14507. 0 > a && (a = this.computeDepth_(),
  14508. this.setDepth_(a));
  14509. return a
  14510. }
  14511. ;
  14512. goog.ui.tree.BaseNode.prototype.computeDepth_ = function () {
  14513. var a = this.getParent();
  14514. return a ? a.getDepth() + 1 : 0
  14515. }
  14516. ;
  14517. goog.ui.tree.BaseNode.prototype.setDepth_ = function (a) {
  14518. if (a != this.depth_) {
  14519. this.depth_ = a;
  14520. var b = this.getRowElement();
  14521. if (b) {
  14522. var c = this.getPixelIndent_() + "px";
  14523. this.isRightToLeft() ? b.style.paddingRight = c : b.style.paddingLeft = c
  14524. }
  14525. this.forEachChild(function (b) {
  14526. b.setDepth_(a + 1)
  14527. })
  14528. }
  14529. }
  14530. ;
  14531. goog.ui.tree.BaseNode.prototype.contains = function (a) {
  14532. for (; a;) {
  14533. if (a == this)
  14534. return !0;
  14535. a = a.getParent()
  14536. }
  14537. return !1
  14538. }
  14539. ;
  14540. goog.ui.tree.BaseNode.EMPTY_CHILDREN_ = [];
  14541. goog.ui.tree.BaseNode.prototype.getChildren = function () {
  14542. var a = [];
  14543. this.forEachChild(function (b) {
  14544. a.push(b)
  14545. });
  14546. return a
  14547. }
  14548. ;
  14549. goog.ui.tree.BaseNode.prototype.getFirstChild = function () {
  14550. return this.getChildAt(0)
  14551. }
  14552. ;
  14553. goog.ui.tree.BaseNode.prototype.getLastChild = function () {
  14554. return this.getChildAt(this.getChildCount() - 1)
  14555. }
  14556. ;
  14557. goog.ui.tree.BaseNode.prototype.getPreviousSibling = function () {
  14558. return this.previousSibling_
  14559. }
  14560. ;
  14561. goog.ui.tree.BaseNode.prototype.getNextSibling = function () {
  14562. return this.nextSibling_
  14563. }
  14564. ;
  14565. goog.ui.tree.BaseNode.prototype.isLastSibling = function () {
  14566. return !this.nextSibling_
  14567. }
  14568. ;
  14569. goog.ui.tree.BaseNode.prototype.isSelected = function () {
  14570. return this.selected_;
  14571. }
  14572. ;
  14573. goog.ui.tree.BaseNode.prototype.select = function () {
  14574. var a = this.getTree();
  14575. a && a.setSelectedItem(this)
  14576. }
  14577. ;
  14578. goog.ui.tree.BaseNode.prototype.deselect = goog.nullFunction;
  14579. goog.ui.tree.BaseNode.prototype.setSelectedInternal = function (a) {
  14580. if (this.selected_ != a) {
  14581. this.selected_ = a;
  14582. this.updateRow();
  14583. var b = this.getElement();
  14584. b && (goog.a11y.aria.setState(b, "selected", a),
  14585. a && (a = this.getTree().getElement(),
  14586. goog.asserts.assert(a, "The DOM element for the tree cannot be null"),
  14587. goog.a11y.aria.setState(a, "activedescendant", this.getId())))
  14588. }
  14589. }
  14590. ;
  14591. goog.ui.tree.BaseNode.prototype.getExpanded = function () {
  14592. return this.expanded_
  14593. }
  14594. ;
  14595. goog.ui.tree.BaseNode.prototype.setExpandedInternal = function (a) {
  14596. this.expanded_ = a
  14597. }
  14598. ;
  14599. goog.ui.tree.BaseNode.prototype.setExpanded = function (a) {
  14600. var b = a != this.expanded_;
  14601. if (!b || this.dispatchEvent(a ? goog.ui.tree.BaseNode.EventType.BEFORE_EXPAND : goog.ui.tree.BaseNode.EventType.BEFORE_COLLAPSE)) {
  14602. this.expanded_ = a;
  14603. var c = this.getTree();
  14604. var d = this.getElement();
  14605. if (this.hasChildren()) {
  14606. if (!a && c && this.contains(c.getSelectedItem()) && this.select(),
  14607. d) {
  14608. if (c = this.getChildrenElement())
  14609. if (goog.style.setElementShown(c, a),
  14610. goog.a11y.aria.setState(d, goog.a11y.aria.State.EXPANDED, a),
  14611. a && this.isInDocument() && !c.hasChildNodes()) {
  14612. var e = [];
  14613. this.forEachChild(function (a) {
  14614. e.push(a.toSafeHtml())
  14615. });
  14616. goog.dom.safe.setInnerHtml(c, goog.html.SafeHtml.concat(e));
  14617. this.forEachChild(function (a) {
  14618. a.enterDocument()
  14619. })
  14620. }
  14621. this.updateExpandIcon()
  14622. }
  14623. } else
  14624. (c = this.getChildrenElement()) && goog.style.setElementShown(c, !1);
  14625. d && this.updateIcon_();
  14626. b && this.dispatchEvent(a ? goog.ui.tree.BaseNode.EventType.EXPAND : goog.ui.tree.BaseNode.EventType.COLLAPSE)
  14627. }
  14628. }
  14629. ;
  14630. goog.ui.tree.BaseNode.prototype.toggle = function () {
  14631. this.setExpanded(!this.getExpanded())
  14632. }
  14633. ;
  14634. goog.ui.tree.BaseNode.prototype.expand = function () {
  14635. this.setExpanded(!0)
  14636. }
  14637. ;
  14638. goog.ui.tree.BaseNode.prototype.collapse = function () {
  14639. this.setExpanded(!1)
  14640. }
  14641. ;
  14642. goog.ui.tree.BaseNode.prototype.collapseChildren = function () {
  14643. this.forEachChild(function (a) {
  14644. a.collapseAll()
  14645. })
  14646. }
  14647. ;
  14648. goog.ui.tree.BaseNode.prototype.collapseAll = function () {
  14649. this.collapseChildren();
  14650. this.collapse()
  14651. }
  14652. ;
  14653. goog.ui.tree.BaseNode.prototype.expandChildren = function () {
  14654. this.forEachChild(function (a) {
  14655. a.expandAll()
  14656. })
  14657. }
  14658. ;
  14659. goog.ui.tree.BaseNode.prototype.expandAll = function () {
  14660. this.expandChildren();
  14661. this.expand()
  14662. }
  14663. ;
  14664. goog.ui.tree.BaseNode.prototype.reveal = function () {
  14665. var a = this.getParent();
  14666. a && (a.setExpanded(!0),
  14667. a.reveal())
  14668. }
  14669. ;
  14670. goog.ui.tree.BaseNode.prototype.setIsUserCollapsible = function (a) {
  14671. (this.isUserCollapsible_ = a) || this.expand();
  14672. this.getElement() && this.updateExpandIcon()
  14673. }
  14674. ;
  14675. goog.ui.tree.BaseNode.prototype.isUserCollapsible = function () {
  14676. return this.isUserCollapsible_
  14677. }
  14678. ;
  14679. goog.ui.tree.BaseNode.prototype.toSafeHtml = function () {
  14680. var a = this.getTree()
  14681. , b = !a.getShowLines() || a == this.getParent() && !a.getShowRootLines() ? this.config_.cssChildrenNoLines : this.config_.cssChildren;
  14682. a = this.getExpanded() && this.hasChildren();
  14683. b = {
  14684. "class": b,
  14685. style: this.getLineStyle()
  14686. };
  14687. var c = [];
  14688. a && this.forEachChild(function (a) {
  14689. c.push(a.toSafeHtml())
  14690. });
  14691. a = goog.html.SafeHtml.create("div", b, c);
  14692. return goog.html.SafeHtml.create("div", {
  14693. "class": this.config_.cssItem,
  14694. id: this.getId()
  14695. }, [this.getRowSafeHtml(), a])
  14696. }
  14697. ;
  14698. goog.ui.tree.BaseNode.prototype.getPixelIndent_ = function () {
  14699. return Math.max(0, (this.getDepth() - 1) * this.config_.indentWidth)
  14700. }
  14701. ;
  14702. goog.ui.tree.BaseNode.prototype.getRowSafeHtml = function () {
  14703. var a = {};
  14704. a["padding-" + (this.isRightToLeft() ? "right" : "left")] = this.getPixelIndent_() + "px";
  14705. if (this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.ExtendedFunction || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.catMainBoard || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.catAI || this.html_.privateDoNotAccessOrElseSafeHtmlWrappedValue_ == Ardublockly.LOCALISED_TEXT.Third_party_Sensor) { a["background"] = this.hexColour; }
  14706. a = {
  14707. "class": this.getRowClassName(),
  14708. style: a
  14709. };
  14710. var b = [this.getExpandIconSafeHtml(), this.getIconSafeHtml(), this.getLabelSafeHtml()];
  14711. return goog.html.SafeHtml.create("div", a, b)
  14712. }
  14713. ;
  14714. goog.ui.tree.BaseNode.prototype.getRowClassName = function () {
  14715. var a = this.isSelected() ? " " + this.config_.cssSelectedRow : "";
  14716. return this.config_.cssTreeRow + a
  14717. }
  14718. ;
  14719. goog.ui.tree.BaseNode.prototype.getLabelSafeHtml = function () {
  14720. var a = goog.html.SafeHtml.create("span", {
  14721. "class": this.config_.cssItemLabel,
  14722. title: this.getToolTip() || null
  14723. }, this.getSafeHtml());
  14724. return goog.html.SafeHtml.concat(a, goog.html.SafeHtml.create("span", {}, this.getAfterLabelSafeHtml()))
  14725. }
  14726. ;
  14727. goog.ui.tree.BaseNode.prototype.getAfterLabelHtml = function () {
  14728. return goog.html.SafeHtml.unwrap(this.getAfterLabelSafeHtml())
  14729. }
  14730. ;
  14731. goog.ui.tree.BaseNode.prototype.getAfterLabelSafeHtml = function () {
  14732. return this.afterLabelHtml_
  14733. }
  14734. ;
  14735. goog.ui.tree.BaseNode.prototype.setAfterLabelSafeHtml = function (a) {
  14736. this.afterLabelHtml_ = a;
  14737. var b = this.getAfterLabelElement();
  14738. b && goog.dom.safe.setInnerHtml(b, a)
  14739. }
  14740. ;
  14741. goog.ui.tree.BaseNode.prototype.getIconSafeHtml = function () {
  14742. return goog.html.SafeHtml.create("span", {
  14743. style: {
  14744. display: "inline-block"
  14745. },
  14746. "class": this.getCalculatedIconClass()
  14747. })
  14748. }
  14749. ;
  14750. goog.ui.tree.BaseNode.prototype.getCalculatedIconClass = goog.abstractMethod;
  14751. goog.ui.tree.BaseNode.prototype.getExpandIconSafeHtml = function () {
  14752. return goog.html.SafeHtml.create("span", {
  14753. type: "expand",
  14754. style: {
  14755. display: "inline-block"
  14756. },
  14757. "class": this.getExpandIconClass()
  14758. })
  14759. }
  14760. ;
  14761. goog.ui.tree.BaseNode.prototype.getExpandIconClass = function () {
  14762. var a = this.getTree()
  14763. , b = !a.getShowLines() || a == this.getParent() && !a.getShowRootLines()
  14764. , c = this.config_
  14765. , d = new goog.string.StringBuffer;
  14766. d.append(c.cssTreeIcon, " ", c.cssExpandTreeIcon, " ");
  14767. if (this.hasChildren()) {
  14768. var e = 0;
  14769. a.getShowExpandIcons() && this.isUserCollapsible_ && (e = this.getExpanded() ? 2 : 1);
  14770. b || (e = this.isLastSibling() ? e + 4 : e + 8);
  14771. switch (e) {
  14772. case 1:
  14773. d.append(c.cssExpandTreeIconPlus);
  14774. break;
  14775. case 2:
  14776. d.append(c.cssExpandTreeIconMinus);
  14777. break;
  14778. case 4:
  14779. d.append(c.cssExpandTreeIconL);
  14780. break;
  14781. case 5:
  14782. d.append(c.cssExpandTreeIconLPlus);
  14783. break;
  14784. case 6:
  14785. d.append(c.cssExpandTreeIconLMinus);
  14786. break;
  14787. case 8:
  14788. d.append(c.cssExpandTreeIconT);
  14789. break;
  14790. case 9:
  14791. d.append(c.cssExpandTreeIconTPlus);
  14792. break;
  14793. case 10:
  14794. d.append(c.cssExpandTreeIconTMinus);
  14795. break;
  14796. default:
  14797. d.append(c.cssExpandTreeIconBlank)
  14798. }
  14799. } else
  14800. b ? d.append(c.cssExpandTreeIconBlank) : this.isLastSibling() ? d.append(c.cssExpandTreeIconL) : d.append(c.cssExpandTreeIconT);
  14801. return d.toString()
  14802. }
  14803. ;
  14804. goog.ui.tree.BaseNode.prototype.getLineStyle = function () {
  14805. var a = this.getExpanded() && this.hasChildren();
  14806. return goog.html.SafeStyle.create({
  14807. "background-position": this.getBackgroundPosition(),
  14808. display: a ? null : "none"
  14809. })
  14810. }
  14811. ;
  14812. goog.ui.tree.BaseNode.prototype.getBackgroundPosition = function () {
  14813. return (this.isLastSibling() ? "-100" : (this.getDepth() - 1) * this.config_.indentWidth) + "px 0"
  14814. }
  14815. ;
  14816. goog.ui.tree.BaseNode.prototype.getElement = function () {
  14817. var a = goog.ui.tree.BaseNode.superClass_.getElement.call(this);
  14818. a || (a = this.getDomHelper().getElement(this.getId()),
  14819. this.setElementInternal(a));
  14820. return a
  14821. }
  14822. ;
  14823. goog.ui.tree.BaseNode.prototype.getRowElement = function () {
  14824. var a = this.getElement();
  14825. return a ? a.firstChild : null
  14826. }
  14827. ;
  14828. goog.ui.tree.BaseNode.prototype.getExpandIconElement = function () {
  14829. var a = this.getRowElement();
  14830. return a ? a.firstChild : null
  14831. }
  14832. ;
  14833. goog.ui.tree.BaseNode.prototype.getIconElement = function () {
  14834. var a = this.getRowElement();
  14835. return a ? a.childNodes[1] : null
  14836. }
  14837. ;
  14838. goog.ui.tree.BaseNode.prototype.getLabelElement = function () {
  14839. var a = this.getRowElement();
  14840. return a && a.lastChild ? a.lastChild.previousSibling : null
  14841. }
  14842. ;
  14843. goog.ui.tree.BaseNode.prototype.getAfterLabelElement = function () {
  14844. var a = this.getRowElement();
  14845. return a ? a.lastChild : null
  14846. }
  14847. ;
  14848. goog.ui.tree.BaseNode.prototype.getChildrenElement = function () {
  14849. var a = this.getElement();
  14850. return a ? a.lastChild : null
  14851. }
  14852. ;
  14853. goog.ui.tree.BaseNode.prototype.setIconClass = function (a) {
  14854. this.iconClass_ = a;
  14855. this.isInDocument() && this.updateIcon_()
  14856. }
  14857. ;
  14858. goog.ui.tree.BaseNode.prototype.getIconClass = function () {
  14859. return this.iconClass_
  14860. }
  14861. ;
  14862. goog.ui.tree.BaseNode.prototype.setExpandedIconClass = function (a) {
  14863. this.expandedIconClass_ = a;
  14864. this.isInDocument() && this.updateIcon_()
  14865. }
  14866. ;
  14867. goog.ui.tree.BaseNode.prototype.getExpandedIconClass = function () {
  14868. return this.expandedIconClass_
  14869. }
  14870. ;
  14871. goog.ui.tree.BaseNode.prototype.setText = function (a) {
  14872. this.setSafeHtml(goog.html.SafeHtml.htmlEscape(a))
  14873. }
  14874. ;
  14875. goog.ui.tree.BaseNode.prototype.getText = function () {
  14876. return goog.string.unescapeEntities(goog.html.SafeHtml.unwrap(this.html_))
  14877. }
  14878. ;
  14879. goog.ui.tree.BaseNode.prototype.setSafeHtml = function (a) {
  14880. this.html_ = a;
  14881. var b = this.getLabelElement();
  14882. b && goog.dom.safe.setInnerHtml(b, a);
  14883. (a = this.getTree()) && a.setNode(this)
  14884. }
  14885. ;
  14886. goog.ui.tree.BaseNode.prototype.getHtml = function () {
  14887. return goog.html.SafeHtml.unwrap(this.getSafeHtml())
  14888. }
  14889. ;
  14890. goog.ui.tree.BaseNode.prototype.getSafeHtml = function () {
  14891. return this.html_
  14892. }
  14893. ;
  14894. goog.ui.tree.BaseNode.prototype.setToolTip = function (a) {
  14895. this.toolTip_ = a;
  14896. var b = this.getLabelElement();
  14897. b && (b.title = a)
  14898. }
  14899. ;
  14900. goog.ui.tree.BaseNode.prototype.getToolTip = function () {
  14901. return this.toolTip_
  14902. }
  14903. ;
  14904. goog.ui.tree.BaseNode.prototype.updateRow = function () {
  14905. var a = this.getRowElement();
  14906. a && (a.className = this.getRowClassName())
  14907. }
  14908. ;
  14909. goog.ui.tree.BaseNode.prototype.updateExpandIcon = function () {
  14910. var a = this.getExpandIconElement();
  14911. a && (a.className = this.getExpandIconClass());
  14912. if (a = this.getChildrenElement())
  14913. a.style.backgroundPosition = this.getBackgroundPosition()
  14914. }
  14915. ;
  14916. goog.ui.tree.BaseNode.prototype.updateIcon_ = function () {
  14917. this.getIconElement().className = this.getCalculatedIconClass()
  14918. }
  14919. ;
  14920. goog.ui.tree.BaseNode.prototype.onMouseDown = function (a) {
  14921. "expand" == a.target.getAttribute("type") && this.hasChildren() ? this.isUserCollapsible_ && this.toggle() : (this.select(),
  14922. this.updateRow())
  14923. }
  14924. ;
  14925. goog.ui.tree.BaseNode.prototype.onClick_ = goog.events.Event.preventDefault;
  14926. goog.ui.tree.BaseNode.prototype.onDoubleClick_ = function (a) {
  14927. "expand" == a.target.getAttribute("type") && this.hasChildren() || this.isUserCollapsible_ && this.toggle()
  14928. }
  14929. ;
  14930. goog.ui.tree.BaseNode.prototype.onKeyDown = function (a) {
  14931. var b = !0;
  14932. switch (a.keyCode) {
  14933. case goog.events.KeyCodes.RIGHT:
  14934. if (a.altKey)
  14935. break;
  14936. this.hasChildren() && (this.getExpanded() ? this.getFirstChild().select() : this.setExpanded(!0));
  14937. break;
  14938. case goog.events.KeyCodes.LEFT:
  14939. if (a.altKey)
  14940. break;
  14941. if (this.hasChildren() && this.getExpanded() && this.isUserCollapsible_)
  14942. this.setExpanded(!1);
  14943. else {
  14944. var c = this.getParent()
  14945. , d = this.getTree();
  14946. c && (d.getShowRootNode() || c != d) && c.select()
  14947. }
  14948. break;
  14949. case goog.events.KeyCodes.DOWN:
  14950. (c = this.getNextShownNode()) && c.select();
  14951. break;
  14952. case goog.events.KeyCodes.UP:
  14953. (c = this.getPreviousShownNode()) && c.select();
  14954. break;
  14955. default:
  14956. b = !1
  14957. }
  14958. b && (a.preventDefault(),
  14959. (d = this.getTree()) && d.clearTypeAhead());
  14960. return b
  14961. }
  14962. ;
  14963. goog.ui.tree.BaseNode.prototype.getLastShownDescendant = function () {
  14964. return this.getExpanded() && this.hasChildren() ? this.getLastChild().getLastShownDescendant() : this
  14965. }
  14966. ;
  14967. goog.ui.tree.BaseNode.prototype.getNextShownNode = function () {
  14968. if (this.hasChildren() && this.getExpanded())
  14969. return this.getFirstChild();
  14970. for (var a = this, b; a != this.getTree();) {
  14971. b = a.getNextSibling();
  14972. if (null != b)
  14973. return b;
  14974. a = a.getParent()
  14975. }
  14976. return null
  14977. }
  14978. ;
  14979. goog.ui.tree.BaseNode.prototype.getPreviousShownNode = function () {
  14980. var a = this.getPreviousSibling();
  14981. if (null != a)
  14982. return a.getLastShownDescendant();
  14983. a = this.getParent();
  14984. var b = this.getTree();
  14985. return !b.getShowRootNode() && a == b || this == b ? null : a
  14986. }
  14987. ;
  14988. goog.ui.tree.BaseNode.prototype.getClientData = goog.ui.tree.BaseNode.prototype.getModel;
  14989. goog.ui.tree.BaseNode.prototype.setClientData = goog.ui.tree.BaseNode.prototype.setModel;
  14990. goog.ui.tree.BaseNode.prototype.getConfig = function () {
  14991. return this.config_
  14992. }
  14993. ;
  14994. goog.ui.tree.BaseNode.prototype.setTreeInternal = function (a) {
  14995. this.tree != a && (this.tree = a,
  14996. a.setNode(this),
  14997. this.forEachChild(function (b) {
  14998. b.setTreeInternal(a)
  14999. }))
  15000. }
  15001. ;
  15002. goog.ui.tree.BaseNode.defaultConfig = {
  15003. indentWidth: 19,
  15004. cssRoot: "goog-tree-root goog-tree-item",
  15005. cssHideRoot: "goog-tree-hide-root",
  15006. cssItem: "goog-tree-item",
  15007. cssChildren: "goog-tree-children",
  15008. cssChildrenNoLines: "goog-tree-children-nolines",
  15009. cssTreeRow: "goog-tree-row",
  15010. cssItemLabel: "goog-tree-item-label",
  15011. cssTreeIcon: "goog-tree-icon",
  15012. cssExpandTreeIcon: "goog-tree-expand-icon",
  15013. cssExpandTreeIconPlus: "goog-tree-expand-icon-plus",
  15014. cssExpandTreeIconMinus: "goog-tree-expand-icon-minus",
  15015. cssExpandTreeIconTPlus: "goog-tree-expand-icon-tplus",
  15016. cssExpandTreeIconTMinus: "goog-tree-expand-icon-tminus",
  15017. cssExpandTreeIconLPlus: "goog-tree-expand-icon-lplus",
  15018. cssExpandTreeIconLMinus: "goog-tree-expand-icon-lminus",
  15019. cssExpandTreeIconT: "goog-tree-expand-icon-t",
  15020. cssExpandTreeIconL: "goog-tree-expand-icon-l",
  15021. cssExpandTreeIconBlank: "goog-tree-expand-icon-blank",
  15022. cssExpandedFolderIcon: "goog-tree-expanded-folder-icon",
  15023. cssCollapsedFolderIcon: "goog-tree-collapsed-folder-icon",
  15024. cssFileIcon: "goog-tree-file-icon",
  15025. cssExpandedRootIcon: "goog-tree-expanded-folder-icon",
  15026. cssCollapsedRootIcon: "goog-tree-collapsed-folder-icon",
  15027. cssSelectedRow: "selected"
  15028. };
  15029. goog.ui.tree.TreeNode = function (a, b, c) {
  15030. goog.ui.tree.BaseNode.call(this, a, b, c)
  15031. }
  15032. ;
  15033. goog.inherits(goog.ui.tree.TreeNode, goog.ui.tree.BaseNode);
  15034. goog.ui.tree.TreeNode.prototype.getTree = function () {
  15035. if (this.tree)
  15036. return this.tree;
  15037. var a = this.getParent();
  15038. return a && (a = a.getTree()) ? (this.setTreeInternal(a),
  15039. a) : null
  15040. }
  15041. ;
  15042. goog.ui.tree.TreeNode.prototype.getCalculatedIconClass = function () {
  15043. var a = this.getExpanded()
  15044. , b = this.getExpandedIconClass();
  15045. if (a && b)
  15046. return b;
  15047. b = this.getIconClass();
  15048. if (!a && b)
  15049. return b;
  15050. b = this.getConfig();
  15051. if (this.hasChildren()) {
  15052. if (a && b.cssExpandedFolderIcon)
  15053. return b.cssTreeIcon + " " + b.cssExpandedFolderIcon;
  15054. if (!a && b.cssCollapsedFolderIcon)
  15055. return b.cssTreeIcon + " " + b.cssCollapsedFolderIcon
  15056. } else if (b.cssFileIcon)
  15057. return b.cssTreeIcon + " " + b.cssFileIcon;
  15058. return ""
  15059. }
  15060. ;
  15061. goog.structs = {};
  15062. goog.structs.getCount = function (a) {
  15063. return a.getCount && "function" == typeof a.getCount ? a.getCount() : goog.isArrayLike(a) || "string" === typeof a ? a.length : goog.object.getCount(a)
  15064. }
  15065. ;
  15066. goog.structs.getValues = function (a) {
  15067. if (a.getValues && "function" == typeof a.getValues)
  15068. return a.getValues();
  15069. if ("string" === typeof a)
  15070. return a.split("");
  15071. if (goog.isArrayLike(a)) {
  15072. for (var b = [], c = a.length, d = 0; d < c; d++)
  15073. b.push(a[d]);
  15074. return b
  15075. }
  15076. return goog.object.getValues(a)
  15077. }
  15078. ;
  15079. goog.structs.getKeys = function (a) {
  15080. if (a.getKeys && "function" == typeof a.getKeys)
  15081. return a.getKeys();
  15082. if (!a.getValues || "function" != typeof a.getValues) {
  15083. if (goog.isArrayLike(a) || "string" === typeof a) {
  15084. var b = [];
  15085. a = a.length;
  15086. for (var c = 0; c < a; c++)
  15087. b.push(c);
  15088. return b
  15089. }
  15090. return goog.object.getKeys(a)
  15091. }
  15092. }
  15093. ;
  15094. goog.structs.contains = function (a, b) {
  15095. return a.contains && "function" == typeof a.contains ? a.contains(b) : a.containsValue && "function" == typeof a.containsValue ? a.containsValue(b) : goog.isArrayLike(a) || "string" === typeof a ? goog.array.contains(a, b) : goog.object.containsValue(a, b)
  15096. }
  15097. ;
  15098. goog.structs.isEmpty = function (a) {
  15099. return a.isEmpty && "function" == typeof a.isEmpty ? a.isEmpty() : goog.isArrayLike(a) || "string" === typeof a ? goog.array.isEmpty(a) : goog.object.isEmpty(a)
  15100. }
  15101. ;
  15102. goog.structs.clear = function (a) {
  15103. a.clear && "function" == typeof a.clear ? a.clear() : goog.isArrayLike(a) ? goog.array.clear(a) : goog.object.clear(a)
  15104. }
  15105. ;
  15106. goog.structs.forEach = function (a, b, c) {
  15107. if (a.forEach && "function" == typeof a.forEach)
  15108. a.forEach(b, c);
  15109. else if (goog.isArrayLike(a) || "string" === typeof a)
  15110. goog.array.forEach(a, b, c);
  15111. else
  15112. for (var d = goog.structs.getKeys(a), e = goog.structs.getValues(a), f = e.length, g = 0; g < f; g++)
  15113. b.call(c, e[g], d && d[g], a)
  15114. }
  15115. ;
  15116. goog.structs.filter = function (a, b, c) {
  15117. if ("function" == typeof a.filter)
  15118. return a.filter(b, c);
  15119. if (goog.isArrayLike(a) || "string" === typeof a)
  15120. return goog.array.filter(a, b, c);
  15121. var d = goog.structs.getKeys(a)
  15122. , e = goog.structs.getValues(a)
  15123. , f = e.length;
  15124. if (d) {
  15125. var g = {};
  15126. for (var h = 0; h < f; h++)
  15127. b.call(c, e[h], d[h], a) && (g[d[h]] = e[h])
  15128. } else
  15129. for (g = [],
  15130. h = 0; h < f; h++)
  15131. b.call(c, e[h], void 0, a) && g.push(e[h]);
  15132. return g
  15133. }
  15134. ;
  15135. goog.structs.map = function (a, b, c) {
  15136. if ("function" == typeof a.map)
  15137. return a.map(b, c);
  15138. if (goog.isArrayLike(a) || "string" === typeof a)
  15139. return goog.array.map(a, b, c);
  15140. var d = goog.structs.getKeys(a)
  15141. , e = goog.structs.getValues(a)
  15142. , f = e.length;
  15143. if (d) {
  15144. var g = {};
  15145. for (var h = 0; h < f; h++)
  15146. g[d[h]] = b.call(c, e[h], d[h], a)
  15147. } else
  15148. for (g = [],
  15149. h = 0; h < f; h++)
  15150. g[h] = b.call(c, e[h], void 0, a);
  15151. return g
  15152. }
  15153. ;
  15154. goog.structs.some = function (a, b, c) {
  15155. if ("function" == typeof a.some)
  15156. return a.some(b, c);
  15157. if (goog.isArrayLike(a) || "string" === typeof a)
  15158. return goog.array.some(a, b, c);
  15159. for (var d = goog.structs.getKeys(a), e = goog.structs.getValues(a), f = e.length, g = 0; g < f; g++)
  15160. if (b.call(c, e[g], d && d[g], a))
  15161. return !0;
  15162. return !1
  15163. }
  15164. ;
  15165. goog.structs.every = function (a, b, c) {
  15166. if ("function" == typeof a.every)
  15167. return a.every(b, c);
  15168. if (goog.isArrayLike(a) || "string" === typeof a)
  15169. return goog.array.every(a, b, c);
  15170. for (var d = goog.structs.getKeys(a), e = goog.structs.getValues(a), f = e.length, g = 0; g < f; g++)
  15171. if (!b.call(c, e[g], d && d[g], a))
  15172. return !1;
  15173. return !0
  15174. }
  15175. ;
  15176. goog.structs.Trie = function (a) {
  15177. this.value_ = void 0;
  15178. this.childNodes_ = {};
  15179. a && this.setAll(a)
  15180. }
  15181. ;
  15182. goog.structs.Trie.prototype.set = function (a, b) {
  15183. this.setOrAdd_(a, b, !1)
  15184. }
  15185. ;
  15186. goog.structs.Trie.prototype.add = function (a, b) {
  15187. this.setOrAdd_(a, b, !0)
  15188. }
  15189. ;
  15190. goog.structs.Trie.prototype.setOrAdd_ = function (a, b, c) {
  15191. for (var d = this, e = 0; e < a.length; e++) {
  15192. var f = a.charAt(e);
  15193. d.childNodes_[f] || (d.childNodes_[f] = new goog.structs.Trie);
  15194. d = d.childNodes_[f]
  15195. }
  15196. if (c && void 0 !== d.value_)
  15197. throw Error('The collection already contains the key "' + a + '"');
  15198. d.value_ = b
  15199. }
  15200. ;
  15201. goog.structs.Trie.prototype.setAll = function (a) {
  15202. var b = goog.structs.getKeys(a);
  15203. a = goog.structs.getValues(a);
  15204. for (var c = 0; c < b.length; c++)
  15205. this.set(b[c], a[c])
  15206. }
  15207. ;
  15208. goog.structs.Trie.prototype.getChildNode_ = function (a) {
  15209. for (var b = this, c = 0; c < a.length; c++) {
  15210. var d = a.charAt(c);
  15211. b = b.childNodes_[d];
  15212. if (!b)
  15213. return
  15214. }
  15215. return b
  15216. }
  15217. ;
  15218. goog.structs.Trie.prototype.get = function (a) {
  15219. return (a = this.getChildNode_(a)) ? a.value_ : void 0
  15220. }
  15221. ;
  15222. goog.structs.Trie.prototype.getKeyAndPrefixes = function (a, b) {
  15223. var c = this
  15224. , d = {}
  15225. , e = b || 0;
  15226. void 0 !== c.value_ && (d[e] = c.value_);
  15227. for (; e < a.length; e++) {
  15228. var f = a.charAt(e);
  15229. if (!(f in c.childNodes_))
  15230. break;
  15231. c = c.childNodes_[f];
  15232. void 0 !== c.value_ && (d[e] = c.value_)
  15233. }
  15234. return d
  15235. }
  15236. ;
  15237. goog.structs.Trie.prototype.getValues = function () {
  15238. var a = [];
  15239. this.getValuesInternal_(a);
  15240. return a
  15241. }
  15242. ;
  15243. goog.structs.Trie.prototype.getValuesInternal_ = function (a) {
  15244. void 0 !== this.value_ && a.push(this.value_);
  15245. for (var b in this.childNodes_)
  15246. this.childNodes_[b].getValuesInternal_(a)
  15247. }
  15248. ;
  15249. goog.structs.Trie.prototype.getKeys = function (a) {
  15250. var b = [];
  15251. if (a) {
  15252. for (var c = this, d = 0; d < a.length; d++) {
  15253. var e = a.charAt(d);
  15254. if (!c.childNodes_[e])
  15255. return [];
  15256. c = c.childNodes_[e]
  15257. }
  15258. c.getKeysInternal_(a, b)
  15259. } else
  15260. this.getKeysInternal_("", b);
  15261. return b
  15262. }
  15263. ;
  15264. goog.structs.Trie.prototype.getKeysInternal_ = function (a, b) {
  15265. void 0 !== this.value_ && b.push(a);
  15266. for (var c in this.childNodes_)
  15267. this.childNodes_[c].getKeysInternal_(a + c, b)
  15268. }
  15269. ;
  15270. goog.structs.Trie.prototype.containsKey = function (a) {
  15271. return void 0 !== this.get(a)
  15272. }
  15273. ;
  15274. goog.structs.Trie.prototype.containsPrefix = function (a) {
  15275. return 0 == a.length ? !this.isEmpty() : !!this.getChildNode_(a)
  15276. }
  15277. ;
  15278. goog.structs.Trie.prototype.containsValue = function (a) {
  15279. if (this.value_ === a)
  15280. return !0;
  15281. for (var b in this.childNodes_)
  15282. if (this.childNodes_[b].containsValue(a))
  15283. return !0;
  15284. return !1
  15285. }
  15286. ;
  15287. goog.structs.Trie.prototype.clear = function () {
  15288. this.childNodes_ = {};
  15289. this.value_ = void 0
  15290. }
  15291. ;
  15292. goog.structs.Trie.prototype.remove = function (a) {
  15293. for (var b = this, c = [], d = 0; d < a.length; d++) {
  15294. var e = a.charAt(d);
  15295. if (!b.childNodes_[e])
  15296. throw Error('The collection does not have the key "' + a + '"');
  15297. c.push([b, e]);
  15298. b = b.childNodes_[e]
  15299. }
  15300. a = b.value_;
  15301. for (delete b.value_; 0 < c.length;)
  15302. if (e = c.pop(),
  15303. b = e[0],
  15304. e = e[1],
  15305. b.childNodes_[e].isEmpty())
  15306. delete b.childNodes_[e];
  15307. else
  15308. break;
  15309. return a
  15310. }
  15311. ;
  15312. goog.structs.Trie.prototype.clone = function () {
  15313. return new goog.structs.Trie(this)
  15314. }
  15315. ;
  15316. goog.structs.Trie.prototype.getCount = function () {
  15317. return goog.structs.getCount(this.getValues())
  15318. }
  15319. ;
  15320. goog.structs.Trie.prototype.isEmpty = function () {
  15321. return void 0 === this.value_ && goog.object.isEmpty(this.childNodes_)
  15322. }
  15323. ;
  15324. goog.ui.tree.TypeAhead = function () {
  15325. this.nodeMap_ = new goog.structs.Trie;
  15326. this.buffer_ = "";
  15327. this.matchingNodes_ = this.matchingLabels_ = null;
  15328. this.matchingNodeIndex_ = this.matchingLabelIndex_ = 0
  15329. }
  15330. ;
  15331. goog.ui.tree.TypeAhead.Offset = {
  15332. DOWN: 1,
  15333. UP: -1
  15334. };
  15335. goog.ui.tree.TypeAhead.prototype.handleNavigation = function (a) {
  15336. var b = !1;
  15337. switch (a.keyCode) {
  15338. case goog.events.KeyCodes.DOWN:
  15339. case goog.events.KeyCodes.UP:
  15340. a.ctrlKey && (this.jumpTo_(a.keyCode == goog.events.KeyCodes.DOWN ? goog.ui.tree.TypeAhead.Offset.DOWN : goog.ui.tree.TypeAhead.Offset.UP),
  15341. b = !0);
  15342. break;
  15343. case goog.events.KeyCodes.BACKSPACE:
  15344. a = this.buffer_.length - 1;
  15345. b = !0;
  15346. 0 < a ? (this.buffer_ = this.buffer_.substring(0, a),
  15347. this.jumpToLabel_(this.buffer_)) : 0 == a ? this.buffer_ = "" : b = !1;
  15348. break;
  15349. case goog.events.KeyCodes.ESC:
  15350. this.buffer_ = "",
  15351. b = !0
  15352. }
  15353. return b
  15354. }
  15355. ;
  15356. goog.ui.tree.TypeAhead.prototype.handleTypeAheadChar = function (a) {
  15357. var b = !1;
  15358. a.ctrlKey || a.altKey || (a = String.fromCharCode(a.charCode || a.keyCode).toLowerCase(),
  15359. goog.string.isUnicodeChar(a) && (" " != a || this.buffer_) && (this.buffer_ += a,
  15360. b = this.jumpToLabel_(this.buffer_)));
  15361. return b
  15362. }
  15363. ;
  15364. goog.ui.tree.TypeAhead.prototype.setNodeInMap = function (a) {
  15365. var b = a.getText();
  15366. if (b && !goog.string.isEmptyOrWhitespace(goog.string.makeSafe(b))) {
  15367. b = b.toLowerCase();
  15368. var c = this.nodeMap_.get(b);
  15369. c ? c.push(a) : this.nodeMap_.set(b, [a])
  15370. }
  15371. }
  15372. ;
  15373. goog.ui.tree.TypeAhead.prototype.removeNodeFromMap = function (a) {
  15374. var b = a.getText();
  15375. if (b && !goog.string.isEmptyOrWhitespace(goog.string.makeSafe(b))) {
  15376. b = b.toLowerCase();
  15377. var c = this.nodeMap_.get(b);
  15378. if (c) {
  15379. for (var d = a.getChildCount(), e = 0; e < d; e++)
  15380. this.removeNodeFromMap(a.getChildAt(e));
  15381. goog.array.remove(c, a);
  15382. c.length || this.nodeMap_.remove(b)
  15383. }
  15384. }
  15385. }
  15386. ;
  15387. goog.ui.tree.TypeAhead.prototype.jumpToLabel_ = function (a) {
  15388. var b = !1;
  15389. (a = this.nodeMap_.getKeys(a)) && a.length && (this.matchingLabelIndex_ = this.matchingNodeIndex_ = 0,
  15390. b = this.nodeMap_.get(a[0]),
  15391. b = this.selectMatchingNode_(b)) && (this.matchingLabels_ = a);
  15392. return b
  15393. }
  15394. ;
  15395. goog.ui.tree.TypeAhead.prototype.jumpTo_ = function (a) {
  15396. var b = !1
  15397. , c = this.matchingLabels_;
  15398. if (c) {
  15399. b = null;
  15400. var d = !1;
  15401. if (this.matchingNodes_) {
  15402. var e = this.matchingNodeIndex_ + a;
  15403. 0 <= e && e < this.matchingNodes_.length ? (this.matchingNodeIndex_ = e,
  15404. b = this.matchingNodes_) : d = !0
  15405. }
  15406. b || (e = this.matchingLabelIndex_ + a,
  15407. 0 <= e && e < c.length && (this.matchingLabelIndex_ = e),
  15408. c.length > this.matchingLabelIndex_ && (b = this.nodeMap_.get(c[this.matchingLabelIndex_])),
  15409. b && b.length && d && (this.matchingNodeIndex_ = a == goog.ui.tree.TypeAhead.Offset.UP ? b.length - 1 : 0));
  15410. if (b = this.selectMatchingNode_(b))
  15411. this.matchingLabels_ = c
  15412. }
  15413. return b
  15414. }
  15415. ;
  15416. goog.ui.tree.TypeAhead.prototype.selectMatchingNode_ = function (a) {
  15417. if (a) {
  15418. if (this.matchingNodeIndex_ < a.length) {
  15419. var b = a[this.matchingNodeIndex_];
  15420. this.matchingNodes_ = a
  15421. }
  15422. b && (b.reveal(),
  15423. b.select())
  15424. }
  15425. return !!b
  15426. }
  15427. ;
  15428. goog.ui.tree.TypeAhead.prototype.clear = function () {
  15429. this.buffer_ = ""
  15430. }
  15431. ;
  15432. goog.ui.tree.TreeControl = function (a, b, c) {
  15433. goog.ui.tree.BaseNode.call(this, a, b, c);
  15434. this.setExpandedInternal(!0);
  15435. this.setSelectedInternal(!0);
  15436. this.selectedItem_ = this;
  15437. this.typeAhead_ = new goog.ui.tree.TypeAhead;
  15438. this.focusHandler_ = this.keyHandler_ = null;
  15439. this.logger_ = goog.log.getLogger("this");
  15440. this.focused_ = !1;
  15441. this.focusedNode_ = null;
  15442. this.showRootLines_ = this.showRootNode_ = this.showExpandIcons_ = this.showLines_ = !0;
  15443. if (goog.userAgent.IE)
  15444. try {
  15445. document.execCommand("BackgroundImageCache", !1, !0)
  15446. } catch (d) {
  15447. goog.log.warning(this.logger_, "Failed to enable background image cache")
  15448. }
  15449. }
  15450. ;
  15451. goog.inherits(goog.ui.tree.TreeControl, goog.ui.tree.BaseNode);
  15452. goog.ui.tree.TreeControl.prototype.getTree = function () {
  15453. return this
  15454. }
  15455. ;
  15456. goog.ui.tree.TreeControl.prototype.getDepth = function () {
  15457. return 0
  15458. }
  15459. ;
  15460. goog.ui.tree.TreeControl.prototype.reveal = function () { }
  15461. ;
  15462. goog.ui.tree.TreeControl.prototype.handleFocus_ = function (a) {
  15463. this.focused_ = !0;
  15464. goog.dom.classlist.add(goog.asserts.assert(this.getElement()), "focused");
  15465. this.selectedItem_ && this.selectedItem_.select()
  15466. }
  15467. ;
  15468. goog.ui.tree.TreeControl.prototype.handleBlur_ = function (a) {
  15469. this.focused_ = !1;
  15470. goog.dom.classlist.remove(goog.asserts.assert(this.getElement()), "focused")
  15471. }
  15472. ;
  15473. goog.ui.tree.TreeControl.prototype.hasFocus = function () {
  15474. return this.focused_
  15475. }
  15476. ;
  15477. goog.ui.tree.TreeControl.prototype.getExpanded = function () {
  15478. return !this.showRootNode_ || goog.ui.tree.TreeControl.superClass_.getExpanded.call(this)
  15479. }
  15480. ;
  15481. goog.ui.tree.TreeControl.prototype.setExpanded = function (a) {
  15482. this.showRootNode_ ? goog.ui.tree.TreeControl.superClass_.setExpanded.call(this, a) : this.setExpandedInternal(a)
  15483. }
  15484. ;
  15485. goog.ui.tree.TreeControl.prototype.getExpandIconSafeHtml = function () {
  15486. return goog.html.SafeHtml.EMPTY
  15487. }
  15488. ;
  15489. goog.ui.tree.TreeControl.prototype.getIconElement = function () {
  15490. var a = this.getRowElement();
  15491. return a ? a.firstChild : null
  15492. }
  15493. ;
  15494. goog.ui.tree.TreeControl.prototype.getExpandIconElement = function () {
  15495. return null
  15496. }
  15497. ;
  15498. goog.ui.tree.TreeControl.prototype.updateExpandIcon = function () { }
  15499. ;
  15500. goog.ui.tree.TreeControl.prototype.getRowClassName = function () {
  15501. return goog.ui.tree.TreeControl.superClass_.getRowClassName.call(this) + (this.showRootNode_ ? "" : " " + this.getConfig().cssHideRoot)
  15502. }
  15503. ;
  15504. goog.ui.tree.TreeControl.prototype.getCalculatedIconClass = function () {
  15505. var a = this.getExpanded()
  15506. , b = this.getExpandedIconClass();
  15507. if (a && b)
  15508. return b;
  15509. b = this.getIconClass();
  15510. if (!a && b)
  15511. return b;
  15512. b = this.getConfig();
  15513. return a && b.cssExpandedRootIcon ? b.cssTreeIcon + " " + b.cssExpandedRootIcon : !a && b.cssCollapsedRootIcon ? b.cssTreeIcon + " " + b.cssCollapsedRootIcon : ""
  15514. }
  15515. ;
  15516. goog.ui.tree.TreeControl.prototype.setSelectedItem = function (a) {
  15517. if (this.selectedItem_ != a) {
  15518. var b = !1;
  15519. this.selectedItem_ && (b = this.selectedItem_ == this.focusedNode_,
  15520. this.selectedItem_.setSelectedInternal(!1));
  15521. if (this.selectedItem_ = a)
  15522. a.setSelectedInternal(!0),
  15523. b && a.select();
  15524. this.dispatchEvent(goog.events.EventType.CHANGE)
  15525. }
  15526. }
  15527. ;
  15528. goog.ui.tree.TreeControl.prototype.getSelectedItem = function () {
  15529. return this.selectedItem_
  15530. }
  15531. ;
  15532. goog.ui.tree.TreeControl.prototype.setShowLines = function (a) {
  15533. this.showLines_ != a && (this.showLines_ = a,
  15534. this.isInDocument() && this.updateLinesAndExpandIcons_())
  15535. }
  15536. ;
  15537. goog.ui.tree.TreeControl.prototype.getShowLines = function () {
  15538. return this.showLines_
  15539. }
  15540. ;
  15541. goog.ui.tree.TreeControl.prototype.updateLinesAndExpandIcons_ = function () {
  15542. function a(e) {
  15543. var f = e.getChildrenElement();
  15544. if (f) {
  15545. var g = !c || b == e.getParent() && !d ? e.getConfig().cssChildrenNoLines : e.getConfig().cssChildren;
  15546. f.className = g;
  15547. if (f = e.getExpandIconElement())
  15548. f.className = e.getExpandIconClass()
  15549. }
  15550. e.forEachChild(a)
  15551. }
  15552. var b = this
  15553. , c = b.getShowLines()
  15554. , d = b.getShowRootLines();
  15555. a(this)
  15556. }
  15557. ;
  15558. goog.ui.tree.TreeControl.prototype.setShowRootLines = function (a) {
  15559. this.showRootLines_ != a && (this.showRootLines_ = a,
  15560. this.isInDocument() && this.updateLinesAndExpandIcons_())
  15561. }
  15562. ;
  15563. goog.ui.tree.TreeControl.prototype.getShowRootLines = function () {
  15564. return this.showRootLines_
  15565. }
  15566. ;
  15567. goog.ui.tree.TreeControl.prototype.setShowExpandIcons = function (a) {
  15568. this.showExpandIcons_ != a && (this.showExpandIcons_ = a,
  15569. this.isInDocument() && this.updateLinesAndExpandIcons_())
  15570. }
  15571. ;
  15572. goog.ui.tree.TreeControl.prototype.getShowExpandIcons = function () {
  15573. return this.showExpandIcons_
  15574. }
  15575. ;
  15576. goog.ui.tree.TreeControl.prototype.setShowRootNode = function (a) {
  15577. if (this.showRootNode_ != a) {
  15578. this.showRootNode_ = a;
  15579. if (this.isInDocument()) {
  15580. var b = this.getRowElement();
  15581. b && (b.className = this.getRowClassName())
  15582. }
  15583. !a && this.getSelectedItem() == this && this.getFirstChild() && this.setSelectedItem(this.getFirstChild())
  15584. }
  15585. }
  15586. ;
  15587. goog.ui.tree.TreeControl.prototype.getShowRootNode = function () {
  15588. return this.showRootNode_
  15589. }
  15590. ;
  15591. goog.ui.tree.TreeControl.prototype.initAccessibility = function () {
  15592. goog.ui.tree.TreeControl.superClass_.initAccessibility.call(this);
  15593. var a = this.getElement();
  15594. goog.asserts.assert(a, "The DOM element for the tree cannot be null.");
  15595. goog.a11y.aria.setRole(a, "tree");
  15596. goog.a11y.aria.setState(a, "labelledby", this.getLabelElement().id)
  15597. }
  15598. ;
  15599. goog.ui.tree.TreeControl.prototype.enterDocument = function () {
  15600. goog.ui.tree.TreeControl.superClass_.enterDocument.call(this);
  15601. var a = this.getElement();
  15602. a.className = this.getConfig().cssRoot;
  15603. a.setAttribute("hideFocus", "true");
  15604. this.attachEvents_();
  15605. this.initAccessibility()
  15606. }
  15607. ;
  15608. goog.ui.tree.TreeControl.prototype.exitDocument = function () {
  15609. goog.ui.tree.TreeControl.superClass_.exitDocument.call(this);
  15610. this.detachEvents_()
  15611. }
  15612. ;
  15613. goog.ui.tree.TreeControl.prototype.attachEvents_ = function () {
  15614. var a = this.getElement();
  15615. a.tabIndex = 0;
  15616. var b = this.keyHandler_ = new goog.events.KeyHandler(a)
  15617. , c = this.focusHandler_ = new goog.events.FocusHandler(a);
  15618. this.getHandler().listen(c, goog.events.FocusHandler.EventType.FOCUSOUT, this.handleBlur_).listen(c, goog.events.FocusHandler.EventType.FOCUSIN, this.handleFocus_).listen(b, goog.events.KeyHandler.EventType.KEY, this.handleKeyEvent).listen(a, goog.events.EventType.MOUSEDOWN, this.handleMouseEvent_).listen(a, goog.events.EventType.CLICK, this.handleMouseEvent_).listen(a, goog.events.EventType.DBLCLICK, this.handleMouseEvent_)
  15619. }
  15620. ;
  15621. goog.ui.tree.TreeControl.prototype.detachEvents_ = function () {
  15622. this.keyHandler_.dispose();
  15623. this.keyHandler_ = null;
  15624. this.focusHandler_.dispose();
  15625. this.focusHandler_ = null
  15626. }
  15627. ;
  15628. goog.ui.tree.TreeControl.prototype.handleMouseEvent_ = function (a) {
  15629. goog.log.fine(this.logger_, "Received event " + a.type);
  15630. var b = this.getNodeFromEvent_(a);
  15631. if (b)
  15632. switch (a.type) {
  15633. case goog.events.EventType.MOUSEDOWN:
  15634. b.onMouseDown(a);
  15635. break;
  15636. case goog.events.EventType.CLICK:
  15637. b.onClick_(a);
  15638. break;
  15639. case goog.events.EventType.DBLCLICK:
  15640. b.onDoubleClick_(a)
  15641. }
  15642. }
  15643. ;
  15644. goog.ui.tree.TreeControl.prototype.handleKeyEvent = function (a) {
  15645. var b;
  15646. (b = this.typeAhead_.handleNavigation(a) || this.selectedItem_ && this.selectedItem_.onKeyDown(a) || this.typeAhead_.handleTypeAheadChar(a)) && a.preventDefault();
  15647. return b
  15648. }
  15649. ;
  15650. goog.ui.tree.TreeControl.prototype.getNodeFromEvent_ = function (a) {
  15651. for (var b = a.target; null != b;) {
  15652. if (a = goog.ui.tree.BaseNode.allNodes[b.id])
  15653. return a;
  15654. if (b == this.getElement())
  15655. break;
  15656. b = b.parentNode
  15657. }
  15658. return null
  15659. }
  15660. ;
  15661. goog.ui.tree.TreeControl.prototype.createNode = function (a) {
  15662. return new goog.ui.tree.TreeNode(a || goog.html.SafeHtml.EMPTY, this.getConfig(), this.getDomHelper())
  15663. }
  15664. ;
  15665. goog.ui.tree.TreeControl.prototype.setNode = function (a) {
  15666. this.typeAhead_.setNodeInMap(a)
  15667. }
  15668. ;
  15669. goog.ui.tree.TreeControl.prototype.removeNode = function (a) {
  15670. this.typeAhead_.removeNodeFromMap(a)
  15671. }
  15672. ;
  15673. goog.ui.tree.TreeControl.prototype.clearTypeAhead = function () {
  15674. this.typeAhead_.clear()
  15675. }
  15676. ;
  15677. goog.ui.tree.TreeControl.defaultConfig = goog.ui.tree.BaseNode.defaultConfig;
  15678. var Blockly = {
  15679. Blocks: {}
  15680. };
  15681. Blockly.Touch = {};
  15682. Blockly.Touch.touchIdentifier_ = null;
  15683. Blockly.Touch.onTouchUpWrapper_ = null;
  15684. Blockly.Touch.TOUCH_MAP = {};
  15685. goog.events.BrowserFeature.TOUCH_ENABLED && (Blockly.Touch.TOUCH_MAP = {
  15686. mousedown: ["touchstart"],
  15687. mousemove: ["touchmove"],
  15688. mouseup: ["touchend", "touchcancel"]
  15689. });
  15690. Blockly.longPid_ = 0;
  15691. Blockly.longStart_ = function (a, b) {
  15692. Blockly.longStop_();
  15693. Blockly.longPid_ = setTimeout(function () {
  15694. a.button = 2;
  15695. b.onMouseDown_(a)
  15696. }, Blockly.LONGPRESS)
  15697. }
  15698. ;
  15699. Blockly.longStop_ = function () {
  15700. Blockly.longPid_ && (clearTimeout(Blockly.longPid_),
  15701. Blockly.longPid_ = 0)
  15702. }
  15703. ;
  15704. Blockly.onMouseUp_ = function (a) {
  15705. a = Blockly.getMainWorkspace();
  15706. a.dragMode_ != Blockly.DRAG_NONE && (Blockly.Touch.clearTouchIdentifier(),
  15707. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN),
  15708. a.dragMode_ = Blockly.DRAG_NONE,
  15709. Blockly.Touch.onTouchUpWrapper_ && (Blockly.unbindEvent_(Blockly.Touch.onTouchUpWrapper_),
  15710. Blockly.Touch.onTouchUpWrapper_ = null),
  15711. Blockly.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.onMouseMoveWrapper_),
  15712. Blockly.onMouseMoveWrapper_ = null))
  15713. }
  15714. ;
  15715. Blockly.onMouseMove_ = function (a) {
  15716. var b = Blockly.getMainWorkspace();
  15717. if (b.dragMode_ != Blockly.DRAG_NONE) {
  15718. var c = a.clientX - b.startDragMouseX
  15719. , d = a.clientY - b.startDragMouseY
  15720. , e = b.startDragMetrics
  15721. , f = b.startScrollX + c
  15722. , g = b.startScrollY + d;
  15723. f = Math.min(f, -e.contentLeft);
  15724. g = Math.min(g, -e.contentTop);
  15725. f = Math.max(f, e.viewWidth - e.contentLeft - e.contentWidth);
  15726. g = Math.max(g, e.viewHeight - e.contentTop - e.contentHeight);
  15727. b.scrollbar.set(-f - e.contentLeft, -g - e.contentTop);
  15728. Math.sqrt(c * c + d * d) > Blockly.DRAG_RADIUS && (Blockly.longStop_(),
  15729. b.dragMode_ = Blockly.DRAG_FREE);
  15730. a.stopPropagation();
  15731. a.preventDefault()
  15732. }
  15733. }
  15734. ;
  15735. Blockly.Touch.clearTouchIdentifier = function () {
  15736. Blockly.Touch.touchIdentifier_ = null
  15737. }
  15738. ;
  15739. Blockly.Touch.shouldHandleEvent = function (a) {
  15740. return !Blockly.Touch.isMouseOrTouchEvent(a) || Blockly.Touch.checkTouchIdentifier(a)
  15741. }
  15742. ;
  15743. Blockly.Touch.checkTouchIdentifier = function (a) {
  15744. var b = a.changedTouches && a.changedTouches[0] && void 0 != a.changedTouches[0].identifier && null != a.changedTouches[0].identifier ? a.changedTouches[0].identifier : "mouse";
  15745. return void 0 != Blockly.Touch.touchIdentifier_ && null != Blockly.Touch.touchIdentifier_ ? Blockly.Touch.touchIdentifier_ == b : "mousedown" == a.type || "touchstart" == a.type ? (Blockly.Touch.touchIdentifier_ = b,
  15746. !0) : !1
  15747. }
  15748. ;
  15749. Blockly.Touch.setClientFromTouch = function (a) {
  15750. if (goog.string.startsWith(a.type, "touch")) {
  15751. var b = a.changedTouches[0];
  15752. a.clientX = b.clientX;
  15753. a.clientY = b.clientY
  15754. }
  15755. }
  15756. ;
  15757. Blockly.Touch.isMouseOrTouchEvent = function (a) {
  15758. return goog.string.startsWith(a.type, "touch") || goog.string.startsWith(a.type, "mouse")
  15759. }
  15760. ;
  15761. Blockly.Touch.splitEventByTouches = function (a) {
  15762. var b = [];
  15763. if (a.changedTouches)
  15764. for (var c = 0; c < a.changedTouches.length; c++)
  15765. b[c] = {
  15766. type: a.type,
  15767. changedTouches: [a.changedTouches[c]],
  15768. target: a.target,
  15769. stopPropagation: function () {
  15770. a.stopPropagation()
  15771. },
  15772. preventDefault: function () {
  15773. a.preventDefault()
  15774. }
  15775. };
  15776. else
  15777. b.push(a);
  15778. return b
  15779. }
  15780. ;
  15781. Blockly.Workspace = function (a) {
  15782. this.id = Blockly.genUid();
  15783. Blockly.Workspace.WorkspaceDB_[this.id] = this;
  15784. this.options = a || {};
  15785. this.RTL = !!this.options.RTL;
  15786. this.horizontalLayout = !!this.options.horizontalLayout;
  15787. this.toolboxPosition = this.options.toolboxPosition;
  15788. this.topBlocks_ = [];
  15789. this.listeners_ = [];
  15790. this.undoStack_ = [];
  15791. this.redoStack_ = [];
  15792. this.blockDB_ = Object.create(null);
  15793. this.variableList = []
  15794. }
  15795. ;
  15796. Blockly.Workspace.prototype.rendered = !1;
  15797. Blockly.Workspace.prototype.MAX_UNDO = 1024;
  15798. Blockly.Workspace.prototype.dispose = function () {
  15799. this.listeners_.length = 0;
  15800. this.clear();
  15801. delete Blockly.Workspace.WorkspaceDB_[this.id]
  15802. }
  15803. ;
  15804. Blockly.Workspace.SCAN_ANGLE = 3;
  15805. Blockly.Workspace.prototype.addTopBlock = function (a) {
  15806. this.topBlocks_.push(a);
  15807. if (this.isFlyout) {
  15808. a = Blockly.Variables.allUsedVariables(a);
  15809. for (var b = 0; b < a.length; b++)
  15810. -1 == this.variableList.indexOf(a[b]) && this.variableList.push(a[b])
  15811. }
  15812. }
  15813. ;
  15814. Blockly.Workspace.prototype.removeTopBlock = function (a) {
  15815. if (!goog.array.remove(this.topBlocks_, a))
  15816. throw "Block not present in workspace's list of top-most blocks.";
  15817. }
  15818. ;
  15819. Blockly.Workspace.prototype.getTopBlocks = function (a) {
  15820. var b = [].concat(this.topBlocks_);
  15821. if (a && 1 < b.length) {
  15822. var c = Math.sin(goog.math.toRadians(Blockly.Workspace.SCAN_ANGLE));
  15823. this.RTL && (c *= -1);
  15824. b.sort(function (a, b) {
  15825. var d = a.getRelativeToSurfaceXY()
  15826. , e = b.getRelativeToSurfaceXY();
  15827. return d.y + c * d.x - (e.y + c * e.x)
  15828. })
  15829. }
  15830. return b
  15831. }
  15832. ;
  15833. Blockly.Workspace.prototype.getAllBlocks = function () {
  15834. for (var a = this.getTopBlocks(!1), b = 0; b < a.length; b++)
  15835. a.push.apply(a, a[b].getChildren());
  15836. return a
  15837. }
  15838. ;
  15839. Blockly.Workspace.prototype.clear = function () {
  15840. var a = Blockly.Events.getGroup();
  15841. for (a || Blockly.Events.setGroup(!0); this.topBlocks_.length;)
  15842. this.topBlocks_[0].dispose();
  15843. a || Blockly.Events.setGroup(!1);
  15844. this.variableList.length = 0
  15845. }
  15846. ;
  15847. Blockly.Workspace.prototype.updateVariableList = function (a) {
  15848. if (!this.isFlyout) {
  15849. a && (this.variableList.length = 0);
  15850. a = Blockly.Variables.allUsedVariables(this);
  15851. for (var b = 0; b < a.length; b++)
  15852. this.createVariable(a[b])
  15853. }
  15854. }
  15855. ;
  15856. Blockly.Workspace.prototype.renameVariable = function (a, b) {
  15857. var c = this.variableIndexOf(a)
  15858. , d = this.variableIndexOf(b);
  15859. if (-1 != d && this.variableList[d] != b)
  15860. var e = this.variableList[d];
  15861. Blockly.Events.setGroup(!0);
  15862. for (var f = this.getAllBlocks(), g = 0; g < f.length; g++)
  15863. f[g].renameVar(a, b),
  15864. e && f[g].renameVar(e, b);
  15865. Blockly.Events.setGroup(!1);
  15866. c == d || -1 != c && -1 == d ? this.variableList[c] = b : -1 != c && -1 != d ? (this.variableList[d] = b,
  15867. this.variableList.splice(c, 1)) : (this.variableList.push(b),
  15868. console.log("Tried to rename an non-existent variable."))
  15869. }
  15870. ;
  15871. Blockly.Workspace.prototype.createVariable = function (a) {
  15872. -1 == this.variableIndexOf(a) && this.variableList.push(a)
  15873. }
  15874. ;
  15875. Blockly.Workspace.prototype.getVariableUses = function (a) {
  15876. for (var b = [], c = this.getAllBlocks(), d = 0; d < c.length; d++) {
  15877. var e = c[d].getVars();
  15878. if (e)
  15879. for (var f = 0; f < e.length; f++) {
  15880. var g = e[f];
  15881. g && Blockly.Names.equals(g, a) && b.push(c[d])
  15882. }
  15883. }
  15884. return b
  15885. }
  15886. ;
  15887. Blockly.Workspace.prototype.deleteVariable = function (a) {
  15888. var b = this
  15889. , c = this.variableIndexOf(a);
  15890. if (-1 != c) {
  15891. for (var d = function () {
  15892. Blockly.Events.setGroup(!0);
  15893. for (var a = 0; a < e.length; a++)
  15894. e[a].dispose(!0, !1);
  15895. Blockly.Events.setGroup(!1);
  15896. b.variableList.splice(c, 1)
  15897. }, e = this.getVariableUses(a), f = 0, g; g = e[f]; f++)
  15898. if ("procedures_defnoreturn" == g.type || "procedures_defreturn" == g.type) {
  15899. f = g.getFieldValue("NAME");
  15900. Blockly.alert(Blockly.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1", a).replace("%2", f));
  15901. return
  15902. }
  15903. 1 < e.length ? Blockly.confirm(Blockly.Msg.DELETE_VARIABLE_CONFIRMATION.replace("%1", e.length).replace("%2", a), function (a) {
  15904. a && d()
  15905. }) : d()
  15906. }
  15907. }
  15908. ;
  15909. Blockly.Workspace.prototype.variableIndexOf = function (a) {
  15910. for (var b = 0, c; c = this.variableList[b]; b++)
  15911. if (Blockly.Names.equals(c, a))
  15912. return b;
  15913. return -1
  15914. }
  15915. ;
  15916. Blockly.Workspace.prototype.getWidth = function () {
  15917. return 0
  15918. }
  15919. ;
  15920. Blockly.Workspace.prototype.newBlock = function (a, b) {
  15921. return new Blockly.Block(this, a, b)
  15922. }
  15923. ;
  15924. Blockly.Workspace.prototype.remainingCapacity = function () {
  15925. return isNaN(this.options.maxBlocks) ? Infinity : this.options.maxBlocks - this.getAllBlocks().length
  15926. }
  15927. ;
  15928. Blockly.Workspace.prototype.undo = function (a) {
  15929. var b = a ? this.redoStack_ : this.undoStack_
  15930. , c = a ? this.undoStack_ : this.redoStack_
  15931. , d = b.pop();
  15932. if (d) {
  15933. for (var e = [d]; b.length && d.group && d.group == b[b.length - 1].group;)
  15934. e.push(b.pop());
  15935. for (b = 0; d = e[b]; b++)
  15936. c.push(d);
  15937. e = Blockly.Events.filter(e, a);
  15938. Blockly.Events.recordUndo = !1;
  15939. for (b = 0; d = e[b]; b++)
  15940. d.run(a);
  15941. Blockly.Events.recordUndo = !0
  15942. }
  15943. }
  15944. ;
  15945. Blockly.Workspace.prototype.clearUndo = function () {
  15946. this.undoStack_.length = 0;
  15947. this.redoStack_.length = 0;
  15948. Blockly.Events.clearPendingUndo()
  15949. }
  15950. ;
  15951. Blockly.Workspace.prototype.addChangeListener = function (a) {
  15952. this.listeners_.push(a);
  15953. return a
  15954. }
  15955. ;
  15956. Blockly.Workspace.prototype.removeChangeListener = function (a) {
  15957. goog.array.remove(this.listeners_, a)
  15958. }
  15959. ;
  15960. Blockly.Workspace.prototype.fireChangeListener = function (a) {
  15961. a.recordUndo && (this.undoStack_.push(a),
  15962. this.redoStack_.length = 0,
  15963. this.undoStack_.length > this.MAX_UNDO && this.undoStack_.unshift());
  15964. for (var b = 0, c; c = this.listeners_[b]; b++)
  15965. c(a)
  15966. }
  15967. ;
  15968. Blockly.Workspace.prototype.getBlockById = function (a) {
  15969. return this.blockDB_[a] || null
  15970. }
  15971. ;
  15972. Blockly.Workspace.WorkspaceDB_ = Object.create(null);
  15973. Blockly.Workspace.getById = function (a) {
  15974. return Blockly.Workspace.WorkspaceDB_[a] || null
  15975. }
  15976. ;
  15977. Blockly.Workspace.prototype.clear = Blockly.Workspace.prototype.clear;
  15978. Blockly.Workspace.prototype.clearUndo = Blockly.Workspace.prototype.clearUndo;
  15979. Blockly.Workspace.prototype.addChangeListener = Blockly.Workspace.prototype.addChangeListener;
  15980. Blockly.Workspace.prototype.removeChangeListener = Blockly.Workspace.prototype.removeChangeListener;
  15981. Blockly.Bubble = function (a, b, c, d, e, f) {
  15982. this.workspace_ = a;
  15983. this.content_ = b;
  15984. this.shape_ = c;
  15985. c = Blockly.Bubble.ARROW_ANGLE;
  15986. this.workspace_.RTL && (c = -c);
  15987. this.arrow_radians_ = goog.math.toRadians(c);
  15988. a.getBubbleCanvas().appendChild(this.createDom_(b, !(!e || !f)));
  15989. this.setAnchorLocation(d);
  15990. e && f || (b = this.content_.getBBox(),
  15991. e = b.width + 2 * Blockly.Bubble.BORDER_WIDTH,
  15992. f = b.height + 2 * Blockly.Bubble.BORDER_WIDTH);
  15993. this.setBubbleSize(e, f);
  15994. this.positionBubble_();
  15995. this.renderArrow_();
  15996. this.rendered_ = !0;
  15997. a.options.readOnly || (Blockly.bindEventWithChecks_(this.bubbleBack_, "mousedown", this, this.bubbleMouseDown_),
  15998. this.resizeGroup_ && Blockly.bindEventWithChecks_(this.resizeGroup_, "mousedown", this, this.resizeMouseDown_))
  15999. }
  16000. ;
  16001. Blockly.Bubble.BORDER_WIDTH = 6;
  16002. Blockly.Bubble.ARROW_THICKNESS = 5;
  16003. Blockly.Bubble.ARROW_ANGLE = 20;
  16004. Blockly.Bubble.ARROW_BEND = 4;
  16005. Blockly.Bubble.ANCHOR_RADIUS = 8;
  16006. Blockly.Bubble.onMouseUpWrapper_ = null;
  16007. Blockly.Bubble.onMouseMoveWrapper_ = null;
  16008. Blockly.Bubble.prototype.resizeCallback_ = null;
  16009. Blockly.Bubble.unbindDragEvents_ = function () {
  16010. Blockly.Bubble.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.Bubble.onMouseUpWrapper_),
  16011. Blockly.Bubble.onMouseUpWrapper_ = null);
  16012. Blockly.Bubble.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.Bubble.onMouseMoveWrapper_),
  16013. Blockly.Bubble.onMouseMoveWrapper_ = null)
  16014. }
  16015. ;
  16016. Blockly.Bubble.bubbleMouseUp_ = function () {
  16017. Blockly.Touch.clearTouchIdentifier();
  16018. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN);
  16019. Blockly.Bubble.unbindDragEvents_()
  16020. }
  16021. ;
  16022. Blockly.Bubble.prototype.rendered_ = !1;
  16023. Blockly.Bubble.prototype.anchorXY_ = null;
  16024. Blockly.Bubble.prototype.relativeLeft_ = 0;
  16025. Blockly.Bubble.prototype.relativeTop_ = 0;
  16026. Blockly.Bubble.prototype.width_ = 0;
  16027. Blockly.Bubble.prototype.height_ = 0;
  16028. Blockly.Bubble.prototype.autoLayout_ = !0;
  16029. Blockly.Bubble.prototype.createDom_ = function (a, b) {
  16030. this.bubbleGroup_ = Blockly.createSvgElement("g", {}, null);
  16031. var c = {
  16032. filter: "url(#" + this.workspace_.options.embossFilterId + ")"
  16033. };
  16034. -1 != goog.userAgent.getUserAgentString().indexOf("JavaFX") && (c = {});
  16035. c = Blockly.createSvgElement("g", c, this.bubbleGroup_);
  16036. this.bubbleArrow_ = Blockly.createSvgElement("path", {}, c);
  16037. this.bubbleBack_ = Blockly.createSvgElement("rect", {
  16038. "class": "blocklyDraggable",
  16039. x: 0,
  16040. y: 0,
  16041. rx: Blockly.Bubble.BORDER_WIDTH,
  16042. ry: Blockly.Bubble.BORDER_WIDTH
  16043. }, c);
  16044. b ? (this.resizeGroup_ = Blockly.createSvgElement("g", {
  16045. "class": this.workspace_.RTL ? "blocklyResizeSW" : "blocklyResizeSE"
  16046. }, this.bubbleGroup_),
  16047. c = 2 * Blockly.Bubble.BORDER_WIDTH,
  16048. Blockly.createSvgElement("polygon", {
  16049. points: "0,x x,x x,0".replace(/x/g, c.toString())
  16050. }, this.resizeGroup_),
  16051. Blockly.createSvgElement("line", {
  16052. "class": "blocklyResizeLine",
  16053. x1: c / 3,
  16054. y1: c - 1,
  16055. x2: c - 1,
  16056. y2: c / 3
  16057. }, this.resizeGroup_),
  16058. Blockly.createSvgElement("line", {
  16059. "class": "blocklyResizeLine",
  16060. x1: 2 * c / 3,
  16061. y1: c - 1,
  16062. x2: c - 1,
  16063. y2: 2 * c / 3
  16064. }, this.resizeGroup_)) : this.resizeGroup_ = null;
  16065. this.bubbleGroup_.appendChild(a);
  16066. return this.bubbleGroup_
  16067. }
  16068. ;
  16069. Blockly.Bubble.prototype.bubbleMouseDown_ = function (a) {
  16070. this.promote_();
  16071. Blockly.Bubble.unbindDragEvents_();
  16072. Blockly.isRightButton(a) ? a.stopPropagation() : Blockly.isTargetInput_(a) || (Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),
  16073. this.workspace_.startDrag(a, new goog.math.Coordinate(this.workspace_.RTL ? -this.relativeLeft_ : this.relativeLeft_, this.relativeTop_)),
  16074. Blockly.Bubble.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, Blockly.Bubble.bubbleMouseUp_),
  16075. Blockly.Bubble.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.bubbleMouseMove_),
  16076. Blockly.hideChaff(),
  16077. a.stopPropagation())
  16078. }
  16079. ;
  16080. Blockly.Bubble.prototype.bubbleMouseMove_ = function (a) {
  16081. this.autoLayout_ = !1;
  16082. a = this.workspace_.moveDrag(a);
  16083. this.relativeLeft_ = this.workspace_.RTL ? -a.x : a.x;
  16084. this.relativeTop_ = a.y;
  16085. this.positionBubble_();
  16086. this.renderArrow_()
  16087. }
  16088. ;
  16089. Blockly.Bubble.prototype.resizeMouseDown_ = function (a) {
  16090. this.promote_();
  16091. Blockly.Bubble.unbindDragEvents_();
  16092. Blockly.isRightButton(a) || (Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),
  16093. this.workspace_.startDrag(a, new goog.math.Coordinate(this.workspace_.RTL ? -this.width_ : this.width_, this.height_)),
  16094. Blockly.Bubble.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, Blockly.Bubble.bubbleMouseUp_),
  16095. Blockly.Bubble.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.resizeMouseMove_),
  16096. Blockly.hideChaff());
  16097. a.stopPropagation()
  16098. }
  16099. ;
  16100. Blockly.Bubble.prototype.resizeMouseMove_ = function (a) {
  16101. this.autoLayout_ = !1;
  16102. a = this.workspace_.moveDrag(a);
  16103. this.setBubbleSize(this.workspace_.RTL ? -a.x : a.x, a.y);
  16104. this.workspace_.RTL && this.positionBubble_()
  16105. }
  16106. ;
  16107. Blockly.Bubble.prototype.registerResizeEvent = function (a) {
  16108. this.resizeCallback_ = a
  16109. }
  16110. ;
  16111. Blockly.Bubble.prototype.promote_ = function () {
  16112. this.bubbleGroup_.parentNode.appendChild(this.bubbleGroup_)
  16113. }
  16114. ;
  16115. Blockly.Bubble.prototype.setAnchorLocation = function (a) {
  16116. this.anchorXY_ = a;
  16117. this.rendered_ && this.positionBubble_()
  16118. }
  16119. ;
  16120. Blockly.Bubble.prototype.layoutBubble_ = function () {
  16121. var a = -this.width_ / 4
  16122. , b = -this.height_ - Blockly.BlockSvg.MIN_BLOCK_Y
  16123. , c = this.workspace_.getMetrics();
  16124. c.viewWidth /= this.workspace_.scale;
  16125. c.viewLeft /= this.workspace_.scale;
  16126. var d = this.anchorXY_.x;
  16127. this.workspace_.RTL ? d - c.viewLeft - a - this.width_ < Blockly.Scrollbar.scrollbarThickness ? a = d - c.viewLeft - this.width_ - Blockly.Scrollbar.scrollbarThickness : d - c.viewLeft - a > c.viewWidth && (a = d - c.viewLeft - c.viewWidth) : d + a < c.viewLeft ? a = c.viewLeft - d : c.viewLeft + c.viewWidth < d + a + this.width_ + Blockly.BlockSvg.SEP_SPACE_X + Blockly.Scrollbar.scrollbarThickness && (a = c.viewLeft + c.viewWidth - d - this.width_ - Blockly.Scrollbar.scrollbarThickness);
  16128. this.anchorXY_.y + b < c.viewTop && (b = this.shape_.getBBox().height);
  16129. this.relativeLeft_ = a;
  16130. this.relativeTop_ = b
  16131. }
  16132. ;
  16133. Blockly.Bubble.prototype.positionBubble_ = function () {
  16134. var a = this.anchorXY_.x;
  16135. a = this.workspace_.RTL ? a - (this.relativeLeft_ + this.width_) : a + this.relativeLeft_;
  16136. this.bubbleGroup_.setAttribute("transform", "translate(" + a + "," + (this.relativeTop_ + this.anchorXY_.y) + ")")
  16137. }
  16138. ;
  16139. Blockly.Bubble.prototype.getBubbleSize = function () {
  16140. return {
  16141. width: this.width_,
  16142. height: this.height_
  16143. }
  16144. }
  16145. ;
  16146. Blockly.Bubble.prototype.setBubbleSize = function (a, b) {
  16147. var c = 2 * Blockly.Bubble.BORDER_WIDTH;
  16148. a = Math.max(a, c + 45);
  16149. b = Math.max(b, c + 20);
  16150. this.width_ = a;
  16151. this.height_ = b;
  16152. this.bubbleBack_.setAttribute("width", a);
  16153. this.bubbleBack_.setAttribute("height", b);
  16154. this.resizeGroup_ && (this.workspace_.RTL ? this.resizeGroup_.setAttribute("transform", "translate(" + 2 * Blockly.Bubble.BORDER_WIDTH + "," + (b - c) + ") scale(-1 1)") : this.resizeGroup_.setAttribute("transform", "translate(" + (a - c) + "," + (b - c) + ")"));
  16155. this.rendered_ && (this.autoLayout_ && this.layoutBubble_(),
  16156. this.positionBubble_(),
  16157. this.renderArrow_());
  16158. this.resizeCallback_ && this.resizeCallback_()
  16159. }
  16160. ;
  16161. Blockly.Bubble.prototype.renderArrow_ = function () {
  16162. var a = []
  16163. , b = this.width_ / 2
  16164. , c = this.height_ / 2
  16165. , d = -this.relativeLeft_
  16166. , e = -this.relativeTop_;
  16167. if (b == d && c == e)
  16168. a.push("M " + b + "," + c);
  16169. else {
  16170. e -= c;
  16171. d -= b;
  16172. this.workspace_.RTL && (d *= -1);
  16173. var f = Math.sqrt(e * e + d * d)
  16174. , g = Math.acos(d / f);
  16175. 0 > e && (g = 2 * Math.PI - g);
  16176. var h = g + Math.PI / 2;
  16177. h > 2 * Math.PI && (h -= 2 * Math.PI);
  16178. var k = Math.sin(h)
  16179. , m = Math.cos(h)
  16180. , p = this.getBubbleSize();
  16181. h = (p.width + p.height) / Blockly.Bubble.ARROW_THICKNESS;
  16182. h = Math.min(h, p.width, p.height) / 4;
  16183. p = 1 - Blockly.Bubble.ANCHOR_RADIUS / f;
  16184. d = b + p * d;
  16185. e = c + p * e;
  16186. p = b + h * m;
  16187. var l = c + h * k;
  16188. b -= h * m;
  16189. c -= h * k;
  16190. k = g + this.arrow_radians_;
  16191. k > 2 * Math.PI && (k -= 2 * Math.PI);
  16192. g = Math.sin(k) * f / Blockly.Bubble.ARROW_BEND;
  16193. f = Math.cos(k) * f / Blockly.Bubble.ARROW_BEND;
  16194. a.push("M" + p + "," + l);
  16195. a.push("C" + (p + f) + "," + (l + g) + " " + d + "," + e + " " + d + "," + e);
  16196. a.push("C" + d + "," + e + " " + (b + f) + "," + (c + g) + " " + b + "," + c)
  16197. }
  16198. a.push("z");
  16199. this.bubbleArrow_.setAttribute("d", a.join(" "))
  16200. }
  16201. ;
  16202. Blockly.Bubble.prototype.setColour = function (a) {
  16203. this.bubbleBack_.setAttribute("fill", a);
  16204. this.bubbleArrow_.setAttribute("fill", a)
  16205. }
  16206. ;
  16207. Blockly.Bubble.prototype.dispose = function () {
  16208. Blockly.Bubble.unbindDragEvents_();
  16209. goog.dom.removeNode(this.bubbleGroup_);
  16210. this.shape_ = this.content_ = this.workspace_ = this.resizeGroup_ = this.bubbleBack_ = this.bubbleArrow_ = this.bubbleGroup_ = null
  16211. }
  16212. ;
  16213. Blockly.Icon = function (a) {
  16214. this.block_ = a
  16215. }
  16216. ;
  16217. Blockly.Icon.prototype.collapseHidden = !0;
  16218. Blockly.Icon.prototype.SIZE = 17;
  16219. Blockly.Icon.prototype.bubble_ = null;
  16220. Blockly.Icon.prototype.iconXY_ = null;
  16221. Blockly.Icon.prototype.createIcon = function () {
  16222. this.iconGroup_ || (this.iconGroup_ = Blockly.createSvgElement("g", {
  16223. "class": "blocklyIconGroup"
  16224. }, null),
  16225. this.block_.isInFlyout && Blockly.addClass_(this.iconGroup_, "blocklyIconGroupReadonly"),
  16226. this.drawIcon_(this.iconGroup_),
  16227. this.block_.getSvgRoot().appendChild(this.iconGroup_),
  16228. Blockly.bindEventWithChecks_(this.iconGroup_, "mouseup", this, this.iconClick_),
  16229. this.updateEditable())
  16230. }
  16231. ;
  16232. Blockly.Icon.prototype.dispose = function () {
  16233. goog.dom.removeNode(this.iconGroup_);
  16234. this.iconGroup_ = null;
  16235. this.setVisible(!1);
  16236. this.block_ = null
  16237. }
  16238. ;
  16239. Blockly.Icon.prototype.updateEditable = function () { }
  16240. ;
  16241. Blockly.Icon.prototype.isVisible = function () {
  16242. return !!this.bubble_
  16243. }
  16244. ;
  16245. Blockly.Icon.prototype.iconClick_ = function (a) {
  16246. this.block_.workspace.isDragging() || this.block_.isInFlyout || Blockly.isRightButton(a) || this.setVisible(!this.isVisible())
  16247. }
  16248. ;
  16249. Blockly.Icon.prototype.updateColour = function () {
  16250. this.isVisible() && this.bubble_.setColour(this.block_.getColour())
  16251. }
  16252. ;
  16253. Blockly.Icon.prototype.renderIcon = function (a) {
  16254. if (this.collapseHidden && this.block_.isCollapsed())
  16255. return this.iconGroup_.setAttribute("display", "none"),
  16256. a;
  16257. this.iconGroup_.setAttribute("display", "block");
  16258. var b = this.SIZE;
  16259. this.block_.RTL && (a -= b);
  16260. this.iconGroup_.setAttribute("transform", "translate(" + a + ",5)");
  16261. this.computeIconLocation();
  16262. return a = this.block_.RTL ? a - Blockly.BlockSvg.SEP_SPACE_X : a + (b + Blockly.BlockSvg.SEP_SPACE_X)
  16263. }
  16264. ;
  16265. Blockly.Icon.prototype.setIconLocation = function (a) {
  16266. this.iconXY_ = a;
  16267. this.isVisible() && this.bubble_.setAnchorLocation(a)
  16268. }
  16269. ;
  16270. Blockly.Icon.prototype.computeIconLocation = function () {
  16271. var a = this.block_.getRelativeToSurfaceXY()
  16272. , b = Blockly.getRelativeXY_(this.iconGroup_);
  16273. a = new goog.math.Coordinate(a.x + b.x + this.SIZE / 2, a.y + b.y + this.SIZE / 2);
  16274. goog.math.Coordinate.equals(this.getIconLocation(), a) || this.setIconLocation(a)
  16275. }
  16276. ;
  16277. Blockly.Icon.prototype.getIconLocation = function () {
  16278. return this.iconXY_
  16279. }
  16280. ;
  16281. Blockly.Comment = function (a) {
  16282. Blockly.Comment.superClass_.constructor.call(this, a);
  16283. this.createIcon()
  16284. }
  16285. ;
  16286. goog.inherits(Blockly.Comment, Blockly.Icon);
  16287. Blockly.Comment.prototype.text_ = "";
  16288. Blockly.Comment.prototype.width_ = 160;
  16289. Blockly.Comment.prototype.height_ = 80;
  16290. Blockly.Comment.prototype.drawIcon_ = function (a) {
  16291. Blockly.createSvgElement("circle", {
  16292. "class": "blocklyIconShape",
  16293. r: "8",
  16294. cx: "8",
  16295. cy: "8"
  16296. }, a);
  16297. Blockly.createSvgElement("path", {
  16298. "class": "blocklyIconSymbol",
  16299. d: "m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.405 0.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25 -1.201,0.998 -1.201,1.528 -1.204,2.19z"
  16300. }, a);
  16301. Blockly.createSvgElement("rect", {
  16302. "class": "blocklyIconSymbol",
  16303. x: "6.8",
  16304. y: "10.78",
  16305. height: "2",
  16306. width: "2"
  16307. }, a)
  16308. }
  16309. ;
  16310. Blockly.Comment.prototype.createEditor_ = function () {
  16311. this.foreignObject_ = Blockly.createSvgElement("foreignObject", {
  16312. x: Blockly.Bubble.BORDER_WIDTH,
  16313. y: Blockly.Bubble.BORDER_WIDTH
  16314. }, null);
  16315. var a = document.createElementNS(Blockly.HTML_NS, "body");
  16316. a.setAttribute("xmlns", Blockly.HTML_NS);
  16317. a.className = "blocklyMinimalBody";
  16318. var b = document.createElementNS(Blockly.HTML_NS, "textarea");
  16319. b.className = "blocklyCommentTextarea";
  16320. b.setAttribute("dir", this.block_.RTL ? "RTL" : "LTR");
  16321. a.appendChild(b);
  16322. this.textarea_ = b;
  16323. this.foreignObject_.appendChild(a);
  16324. Blockly.bindEventWithChecks_(b, "mouseup", this, this.textareaFocus_);
  16325. Blockly.bindEventWithChecks_(b, "wheel", this, function (a) {
  16326. a.stopPropagation()
  16327. });
  16328. Blockly.bindEventWithChecks_(b, "change", this, function (a) {
  16329. this.text_ != b.value && (Blockly.Events.fire(new Blockly.Events.Change(this.block_, "comment", null, this.text_, b.value)),
  16330. this.text_ = b.value)
  16331. });
  16332. setTimeout(function () {
  16333. b.focus()
  16334. }, 0);
  16335. return this.foreignObject_
  16336. }
  16337. ;
  16338. Blockly.Comment.prototype.updateEditable = function () {
  16339. this.isVisible() && (this.setVisible(!1),
  16340. this.setVisible(!0));
  16341. Blockly.Icon.prototype.updateEditable.call(this)
  16342. }
  16343. ;
  16344. Blockly.Comment.prototype.resizeBubble_ = function () {
  16345. if (this.isVisible()) {
  16346. var a = this.bubble_.getBubbleSize()
  16347. , b = 2 * Blockly.Bubble.BORDER_WIDTH;
  16348. this.foreignObject_.setAttribute("width", a.width - b);
  16349. this.foreignObject_.setAttribute("height", a.height - b);
  16350. this.textarea_.style.width = a.width - b - 4 + "px";
  16351. this.textarea_.style.height = a.height - b - 4 + "px"
  16352. }
  16353. }
  16354. ;
  16355. Blockly.Comment.prototype.setVisible = function (a) {
  16356. if (a != this.isVisible())
  16357. if (Blockly.Events.fire(new Blockly.Events.Ui(this.block_, "commentOpen", !a, a)),
  16358. !this.block_.isEditable() && !this.textarea_ || goog.userAgent.IE)
  16359. Blockly.Warning.prototype.setVisible.call(this, a);
  16360. else {
  16361. var b = this.getText()
  16362. , c = this.getBubbleSize();
  16363. a ? (this.bubble_ = new Blockly.Bubble(this.block_.workspace, this.createEditor_(), this.block_.svgPath_, this.iconXY_, this.width_, this.height_),
  16364. this.bubble_.registerResizeEvent(this.resizeBubble_.bind(this)),
  16365. this.updateColour()) : (this.bubble_.dispose(),
  16366. this.foreignObject_ = this.textarea_ = this.bubble_ = null);
  16367. this.setText(b);
  16368. this.setBubbleSize(c.width, c.height)
  16369. }
  16370. }
  16371. ;
  16372. Blockly.Comment.prototype.textareaFocus_ = function (a) {
  16373. this.bubble_.promote_();
  16374. this.textarea_.focus()
  16375. }
  16376. ;
  16377. Blockly.Comment.prototype.getBubbleSize = function () {
  16378. return this.isVisible() ? this.bubble_.getBubbleSize() : {
  16379. width: this.width_,
  16380. height: this.height_
  16381. }
  16382. }
  16383. ;
  16384. Blockly.Comment.prototype.setBubbleSize = function (a, b) {
  16385. this.textarea_ ? this.bubble_.setBubbleSize(a, b) : (this.width_ = a,
  16386. this.height_ = b)
  16387. }
  16388. ;
  16389. Blockly.Comment.prototype.getText = function () {
  16390. return this.textarea_ ? this.textarea_.value : this.text_
  16391. }
  16392. ;
  16393. Blockly.Comment.prototype.setText = function (a) {
  16394. this.text_ != a && (Blockly.Events.fire(new Blockly.Events.Change(this.block_, "comment", null, this.text_, a)),
  16395. this.text_ = a);
  16396. this.textarea_ && (this.textarea_.value = a)
  16397. }
  16398. ;
  16399. Blockly.Comment.prototype.dispose = function () {
  16400. Blockly.Events.isEnabled() && this.setText("");
  16401. this.block_.comment = null;
  16402. Blockly.Icon.prototype.dispose.call(this)
  16403. }
  16404. ;
  16405. Blockly.Connection = function (a, b) {
  16406. this.sourceBlock_ = a;
  16407. this.type = b;
  16408. a.workspace.connectionDBList && (this.db_ = a.workspace.connectionDBList[b],
  16409. this.dbOpposite_ = a.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[b]],
  16410. this.hidden_ = !this.db_)
  16411. }
  16412. ;
  16413. Blockly.Connection.CAN_CONNECT = 0;
  16414. Blockly.Connection.REASON_SELF_CONNECTION = 1;
  16415. Blockly.Connection.REASON_WRONG_TYPE = 2;
  16416. Blockly.Connection.REASON_TARGET_NULL = 3;
  16417. Blockly.Connection.REASON_CHECKS_FAILED = 4;
  16418. Blockly.Connection.REASON_DIFFERENT_WORKSPACES = 5;
  16419. Blockly.Connection.REASON_SHADOW_PARENT = 6;
  16420. Blockly.Connection.prototype.targetConnection = null;
  16421. Blockly.Connection.prototype.check_ = null;
  16422. Blockly.Connection.prototype.shadowDom_ = null;
  16423. Blockly.Connection.prototype.x_ = 0;
  16424. Blockly.Connection.prototype.y_ = 0;
  16425. Blockly.Connection.prototype.inDB_ = !1;
  16426. Blockly.Connection.prototype.db_ = null;
  16427. Blockly.Connection.prototype.dbOpposite_ = null;
  16428. Blockly.Connection.prototype.hidden_ = null;
  16429. Blockly.Connection.prototype.connect_ = function (a) {
  16430. var b = this
  16431. , c = b.getSourceBlock()
  16432. , d = a.getSourceBlock();
  16433. a.isConnected() && a.disconnect();
  16434. if (b.isConnected()) {
  16435. var e = b.targetBlock()
  16436. , f = b.getShadowDom();
  16437. b.setShadowDom(null);
  16438. if (e.isShadow())
  16439. f = Blockly.Xml.blockToDom(e),
  16440. e.dispose(),
  16441. e = null;
  16442. else if (b.type == Blockly.INPUT_VALUE) {
  16443. if (!e.outputConnection)
  16444. throw "Orphan block does not have an output connection.";
  16445. var g = Blockly.Connection.lastConnectionInRow_(d, e);
  16446. g && (e.outputConnection.connect(g),
  16447. e = null)
  16448. } else if (b.type == Blockly.NEXT_STATEMENT) {
  16449. if (!e.previousConnection)
  16450. throw "Orphan block does not have a previous connection.";
  16451. for (g = d; g.nextConnection;) {
  16452. var h = g.getNextBlock();
  16453. if (h && !h.isShadow())
  16454. g = h;
  16455. else {
  16456. e.previousConnection.checkType_(g.nextConnection) && (g.nextConnection.connect(e.previousConnection),
  16457. e = null);
  16458. break
  16459. }
  16460. }
  16461. }
  16462. if (e && (b.disconnect(),
  16463. Blockly.Events.recordUndo)) {
  16464. var k = Blockly.Events.getGroup();
  16465. setTimeout(function () {
  16466. e.workspace && !e.getParent() && (Blockly.Events.setGroup(k),
  16467. e.outputConnection ? e.outputConnection.bumpAwayFrom_(b) : e.previousConnection && e.previousConnection.bumpAwayFrom_(b),
  16468. Blockly.Events.setGroup(!1))
  16469. }, Blockly.BUMP_DELAY)
  16470. }
  16471. b.setShadowDom(f)
  16472. }
  16473. var m;
  16474. Blockly.Events.isEnabled() && (m = new Blockly.Events.Move(d));
  16475. Blockly.Connection.connectReciprocally_(b, a);
  16476. d.setParent(c);
  16477. m && (m.recordNew(),
  16478. Blockly.Events.fire(m))
  16479. }
  16480. ;
  16481. Blockly.Connection.prototype.dispose = function () {
  16482. if (this.isConnected())
  16483. throw "Disconnect connection before disposing of it.";
  16484. this.inDB_ && this.db_.removeConnection_(this);
  16485. Blockly.highlightedConnection_ == this && (Blockly.highlightedConnection_ = null);
  16486. Blockly.localConnection_ == this && (Blockly.localConnection_ = null);
  16487. this.dbOpposite_ = this.db_ = null
  16488. }
  16489. ;
  16490. Blockly.Connection.prototype.getSourceBlock = function () {
  16491. return this.sourceBlock_
  16492. }
  16493. ;
  16494. Blockly.Connection.prototype.isSuperior = function () {
  16495. return this.type == Blockly.INPUT_VALUE || this.type == Blockly.NEXT_STATEMENT
  16496. }
  16497. ;
  16498. Blockly.Connection.prototype.isConnected = function () {
  16499. return !!this.targetConnection
  16500. }
  16501. ;
  16502. Blockly.Connection.prototype.canConnectWithReason_ = function (a) {
  16503. if (!a)
  16504. return Blockly.Connection.REASON_TARGET_NULL;
  16505. if (this.isSuperior())
  16506. var b = this.sourceBlock_
  16507. , c = a.getSourceBlock();
  16508. else
  16509. c = this.sourceBlock_,
  16510. b = a.getSourceBlock();
  16511. return b && b == c ? Blockly.Connection.REASON_SELF_CONNECTION : a.type != Blockly.OPPOSITE_TYPE[this.type] ? Blockly.Connection.REASON_WRONG_TYPE : b && c && b.workspace !== c.workspace ? Blockly.Connection.REASON_DIFFERENT_WORKSPACES : this.checkType_(a) ? b.isShadow() && !c.isShadow() ? Blockly.Connection.REASON_SHADOW_PARENT : Blockly.Connection.CAN_CONNECT : Blockly.Connection.REASON_CHECKS_FAILED
  16512. }
  16513. ;
  16514. Blockly.Connection.prototype.checkConnection_ = function (a) {
  16515. switch (this.canConnectWithReason_(a)) {
  16516. case Blockly.Connection.CAN_CONNECT:
  16517. break;
  16518. case Blockly.Connection.REASON_SELF_CONNECTION:
  16519. throw "Attempted to connect a block to itself.";
  16520. case Blockly.Connection.REASON_DIFFERENT_WORKSPACES:
  16521. throw "Blocks not on same workspace.";
  16522. case Blockly.Connection.REASON_WRONG_TYPE:
  16523. throw "Attempt to connect incompatible types.";
  16524. case Blockly.Connection.REASON_TARGET_NULL:
  16525. throw "Target connection is null.";
  16526. case Blockly.Connection.REASON_CHECKS_FAILED:
  16527. throw "Connection checks failed.";
  16528. case Blockly.Connection.REASON_SHADOW_PARENT:
  16529. throw "Connecting non-shadow to shadow block.";
  16530. default:
  16531. throw "Unknown connection failure: this should never happen!";
  16532. }
  16533. }
  16534. ;
  16535. Blockly.Connection.prototype.isConnectionAllowed = function (a) {
  16536. if (this.canConnectWithReason_(a) != Blockly.Connection.CAN_CONNECT)
  16537. return !1;
  16538. if (a.type == Blockly.OUTPUT_VALUE || a.type == Blockly.PREVIOUS_STATEMENT)
  16539. if (a.isConnected() || this.isConnected())
  16540. return !1;
  16541. return a.type == Blockly.INPUT_VALUE && a.isConnected() && !a.targetBlock().isMovable() && !a.targetBlock().isShadow() || this.type == Blockly.PREVIOUS_STATEMENT && a.isConnected() && !this.sourceBlock_.nextConnection && !a.targetBlock().isShadow() && a.targetBlock().nextConnection || -1 != Blockly.draggingConnections_.indexOf(a) ? !1 : !0
  16542. }
  16543. ;
  16544. Blockly.Connection.prototype.connect = function (a) {
  16545. this.targetConnection != a && (this.checkConnection_(a),
  16546. this.isSuperior() ? this.connect_(a) : a.connect_(this))
  16547. }
  16548. ;
  16549. Blockly.Connection.connectReciprocally_ = function (a, b) {
  16550. goog.asserts.assert(a && b, "Cannot connect null connections.");
  16551. a.targetConnection = b;
  16552. b.targetConnection = a
  16553. }
  16554. ;
  16555. Blockly.Connection.singleConnection_ = function (a, b) {
  16556. for (var c = !1, d = 0; d < a.inputList.length; d++) {
  16557. var e = a.inputList[d].connection;
  16558. if (e && e.type == Blockly.INPUT_VALUE && b.outputConnection.checkType_(e)) {
  16559. if (c)
  16560. return null;
  16561. c = e
  16562. }
  16563. }
  16564. return c
  16565. }
  16566. ;
  16567. Blockly.Connection.lastConnectionInRow_ = function (a, b) {
  16568. for (var c = a, d; d = Blockly.Connection.singleConnection_(c, b);)
  16569. if (c = d.targetBlock(),
  16570. !c || c.isShadow())
  16571. return d;
  16572. return null
  16573. }
  16574. ;
  16575. Blockly.Connection.prototype.disconnect = function () {
  16576. var a = this.targetConnection;
  16577. goog.asserts.assert(a, "Source connection not connected.");
  16578. goog.asserts.assert(a.targetConnection == this, "Target connection not connected to source connection.");
  16579. if (this.isSuperior()) {
  16580. var b = this.sourceBlock_;
  16581. var c = a.getSourceBlock();
  16582. a = this
  16583. } else
  16584. b = a.getSourceBlock(),
  16585. c = this.sourceBlock_;
  16586. this.disconnectInternal_(b, c);
  16587. a.respawnShadow_()
  16588. }
  16589. ;
  16590. Blockly.Connection.prototype.disconnectInternal_ = function (a, b) {
  16591. var c;
  16592. Blockly.Events.isEnabled() && (c = new Blockly.Events.Move(b));
  16593. this.targetConnection = this.targetConnection.targetConnection = null;
  16594. b.setParent(null);
  16595. c && (c.recordNew(),
  16596. Blockly.Events.fire(c))
  16597. }
  16598. ;
  16599. Blockly.Connection.prototype.respawnShadow_ = function () {
  16600. var a = this.getSourceBlock()
  16601. , b = this.getShadowDom();
  16602. if (a.workspace && b && Blockly.Events.recordUndo)
  16603. if (a = Blockly.Xml.domToBlock(b, a.workspace),
  16604. a.outputConnection)
  16605. this.connect(a.outputConnection);
  16606. else if (a.previousConnection)
  16607. this.connect(a.previousConnection);
  16608. else
  16609. throw "Child block does not have output or previous statement.";
  16610. }
  16611. ;
  16612. Blockly.Connection.prototype.targetBlock = function () {
  16613. return this.isConnected() ? this.targetConnection.getSourceBlock() : null
  16614. }
  16615. ;
  16616. Blockly.Connection.prototype.checkType_ = function (a) {
  16617. if (!this.check_ || !a.check_)
  16618. return !0;
  16619. for (var b = 0; b < this.check_.length; b++)
  16620. if (-1 != a.check_.indexOf(this.check_[b]))
  16621. return !0;
  16622. return !1
  16623. }
  16624. ;
  16625. Blockly.Connection.prototype.setCheck = function (a) {
  16626. a ? (goog.isArray(a) || (a = [a]),
  16627. this.check_ = a,
  16628. this.isConnected() && !this.checkType_(this.targetConnection) && ((this.isSuperior() ? this.targetBlock() : this.sourceBlock_).unplug(),
  16629. this.sourceBlock_.bumpNeighbours_())) : this.check_ = null;
  16630. return this
  16631. }
  16632. ;
  16633. Blockly.Connection.prototype.setShadowDom = function (a) {
  16634. this.shadowDom_ = a
  16635. }
  16636. ;
  16637. Blockly.Connection.prototype.getShadowDom = function () {
  16638. return this.shadowDom_
  16639. }
  16640. ;
  16641. Blockly.Field = function (a, b) {
  16642. this.size_ = new goog.math.Size(0, 25);
  16643. this.setValue(a);
  16644. this.setValidator(b)
  16645. }
  16646. ;
  16647. Blockly.Field.cacheWidths_ = null;
  16648. Blockly.Field.cacheReference_ = 0;
  16649. Blockly.Field.prototype.name = void 0;
  16650. Blockly.Field.prototype.maxDisplayLength = 50;
  16651. Blockly.Field.prototype.text_ = "";
  16652. Blockly.Field.prototype.sourceBlock_ = null;
  16653. Blockly.Field.prototype.visible_ = !0;
  16654. Blockly.Field.prototype.validator_ = null;
  16655. Blockly.Field.NBSP = "\u00a0";
  16656. Blockly.Field.prototype.EDITABLE = !0;
  16657. Blockly.Field.prototype.setSourceBlock = function (a) {
  16658. goog.asserts.assert(!this.sourceBlock_, "Field already bound to a block.");
  16659. this.sourceBlock_ = a
  16660. }
  16661. ;
  16662. Blockly.Field.prototype.init = function () {
  16663. this.fieldGroup_ || (this.fieldGroup_ = Blockly.createSvgElement("g", {}, null),
  16664. this.visible_ || (this.fieldGroup_.style.display = "none"),
  16665. this.borderRect_ = Blockly.createSvgElement("rect", {
  16666. rx: 4,
  16667. ry: 4,
  16668. x: -Blockly.BlockSvg.SEP_SPACE_X / 2,
  16669. y: 0,
  16670. height: 16
  16671. }, this.fieldGroup_, this.sourceBlock_.workspace),
  16672. this.textElement_ = Blockly.createSvgElement("text", {
  16673. "class": "blocklyText",
  16674. y: this.size_.height - 12.5
  16675. }, this.fieldGroup_),
  16676. this.updateEditable(),
  16677. this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),
  16678. this.mouseUpWrapper_ = Blockly.bindEventWithChecks_(this.fieldGroup_, "mouseup", this, this.onMouseUp_),
  16679. this.updateTextNode_())
  16680. }
  16681. ;
  16682. Blockly.Field.prototype.dispose = function () {
  16683. this.mouseUpWrapper_ && (Blockly.unbindEvent_(this.mouseUpWrapper_),
  16684. this.mouseUpWrapper_ = null);
  16685. this.sourceBlock_ = null;
  16686. goog.dom.removeNode(this.fieldGroup_);
  16687. this.validator_ = this.borderRect_ = this.textElement_ = this.fieldGroup_ = null
  16688. }
  16689. ;
  16690. Blockly.Field.prototype.updateEditable = function () {
  16691. var a = this.fieldGroup_;
  16692. this.EDITABLE && a && (this.sourceBlock_.isEditable() ? (Blockly.addClass_(a, "blocklyEditableText"),
  16693. Blockly.removeClass_(a, "blocklyNonEditableText"),
  16694. this.fieldGroup_.style.cursor = this.CURSOR) : (Blockly.addClass_(a, "blocklyNonEditableText"),
  16695. Blockly.removeClass_(a, "blocklyEditableText"),
  16696. this.fieldGroup_.style.cursor = ""))
  16697. }
  16698. ;
  16699. Blockly.Field.prototype.isVisible = function () {
  16700. return this.visible_
  16701. }
  16702. ;
  16703. Blockly.Field.prototype.setVisible = function (a) {
  16704. if (this.visible_ != a) {
  16705. this.visible_ = a;
  16706. var b = this.getSvgRoot();
  16707. b && (b.style.display = a ? "block" : "none",
  16708. this.render_())
  16709. }
  16710. }
  16711. ;
  16712. Blockly.Field.prototype.setValidator = function (a) {
  16713. this.validator_ = a
  16714. }
  16715. ;
  16716. Blockly.Field.prototype.getValidator = function () {
  16717. return this.validator_
  16718. }
  16719. ;
  16720. Blockly.Field.prototype.classValidator = function (a) {
  16721. return a
  16722. }
  16723. ;
  16724. Blockly.Field.prototype.callValidator = function (a) {
  16725. var b = this.classValidator(a);
  16726. if (null === b)
  16727. return null;
  16728. void 0 !== b && (a = b);
  16729. if (b = this.getValidator()) {
  16730. b = b.call(this, a);
  16731. if (null === b)
  16732. return null;
  16733. void 0 !== b && (a = b)
  16734. }
  16735. return a
  16736. }
  16737. ;
  16738. Blockly.Field.prototype.getSvgRoot = function () {
  16739. return this.fieldGroup_
  16740. }
  16741. ;
  16742. Blockly.Field.prototype.render_ = function () {
  16743. if (this.visible_ && this.textElement_) {
  16744. var a = this.textElement_.textContent + "\n" + this.textElement_.className.baseVal;
  16745. if (Blockly.Field.cacheWidths_ && Blockly.Field.cacheWidths_[a])
  16746. var b = Blockly.Field.cacheWidths_[a];
  16747. else {
  16748. try {
  16749. b = this.textElement_.getComputedTextLength()
  16750. } catch (c) {
  16751. b = 8 * this.textElement_.textContent.length
  16752. }
  16753. Blockly.Field.cacheWidths_ && (Blockly.Field.cacheWidths_[a] = b)
  16754. }
  16755. this.borderRect_ && this.borderRect_.setAttribute("width", b + Blockly.BlockSvg.SEP_SPACE_X)
  16756. } else
  16757. b = 0;
  16758. this.size_.width = b
  16759. }
  16760. ;
  16761. Blockly.Field.startCache = function () {
  16762. Blockly.Field.cacheReference_++;
  16763. Blockly.Field.cacheWidths_ || (Blockly.Field.cacheWidths_ = {})
  16764. }
  16765. ;
  16766. Blockly.Field.stopCache = function () {
  16767. Blockly.Field.cacheReference_--;
  16768. Blockly.Field.cacheReference_ || (Blockly.Field.cacheWidths_ = null)
  16769. }
  16770. ;
  16771. Blockly.Field.prototype.getSize = function () {
  16772. this.size_.width || this.render_();
  16773. return this.size_
  16774. }
  16775. ;
  16776. Blockly.Field.prototype.getScaledBBox_ = function () {
  16777. var a = this.borderRect_.getBBox();
  16778. return new goog.math.Size(a.width * this.sourceBlock_.workspace.scale, a.height * this.sourceBlock_.workspace.scale)
  16779. }
  16780. ;
  16781. Blockly.Field.prototype.getText = function () {
  16782. return this.text_
  16783. }
  16784. ;
  16785. Blockly.Field.prototype.setText = function (a) {
  16786. null !== a && (a = String(a),
  16787. a !== this.text_ && (this.text_ = a,
  16788. this.updateTextNode_(),
  16789. this.sourceBlock_ && this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  16790. this.sourceBlock_.bumpNeighbours_())))
  16791. }
  16792. ;
  16793. Blockly.Field.prototype.updateTextNode_ = function () {
  16794. if (this.textElement_) {
  16795. var a = this.text_;
  16796. a.length > this.maxDisplayLength && (a = a.substring(0, this.maxDisplayLength - 2) + "\u2026");
  16797. a = a.replace(/\s/g, Blockly.Field.NBSP);
  16798. this.sourceBlock_.RTL && a && (a += "\u200f");
  16799. a || (a = Blockly.Field.NBSP);
  16800. goog.dom.removeChildren(this.textElement_);
  16801. a = document.createTextNode(a);
  16802. this.textElement_.appendChild(a);
  16803. this.size_.width = 0
  16804. }
  16805. }
  16806. ;
  16807. Blockly.Field.prototype.getValue = function () {
  16808. return this.getText()
  16809. }
  16810. ;
  16811. Blockly.Field.prototype.setValue = function (a) {
  16812. if (null !== a) {
  16813. var b = this.getValue();
  16814. b != a && (this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, b, a)),
  16815. this.setText(a))
  16816. }
  16817. }
  16818. ;
  16819. Blockly.Field.prototype.onMouseUp_ = function (a) {
  16820. if (!goog.userAgent.IPHONE && !goog.userAgent.IPAD || goog.userAgent.isVersionOrHigher("537.51.2") || 0 === a.layerX || 0 === a.layerY)
  16821. Blockly.isRightButton(a) || this.sourceBlock_.workspace.isDragging() || this.sourceBlock_.isEditable() && this.showEditor_()
  16822. }
  16823. ;
  16824. Blockly.Field.prototype.setTooltip = function (a) { }
  16825. ;
  16826. Blockly.Field.prototype.getAbsoluteXY_ = function () {
  16827. return goog.style.getPageOffset(this.borderRect_)
  16828. }
  16829. ;
  16830. Blockly.Tooltip = {};
  16831. Blockly.Tooltip.visible = !1;
  16832. Blockly.Tooltip.LIMIT = 50;
  16833. Blockly.Tooltip.mouseOutPid_ = 0;
  16834. Blockly.Tooltip.showPid_ = 0;
  16835. Blockly.Tooltip.lastX_ = 0;
  16836. Blockly.Tooltip.lastY_ = 0;
  16837. Blockly.Tooltip.element_ = null;
  16838. Blockly.Tooltip.poisonedElement_ = null;
  16839. Blockly.Tooltip.OFFSET_X = 0;
  16840. Blockly.Tooltip.OFFSET_Y = 10;
  16841. Blockly.Tooltip.RADIUS_OK = 10;
  16842. Blockly.Tooltip.HOVER_MS = 750;
  16843. Blockly.Tooltip.MARGINS = 5;
  16844. Blockly.Tooltip.DIV = null;
  16845. Blockly.Tooltip.createDom = function () {
  16846. Blockly.Tooltip.DIV || (Blockly.Tooltip.DIV = goog.dom.createDom("DIV", "blocklyTooltipDiv"),
  16847. document.body.appendChild(Blockly.Tooltip.DIV))
  16848. }
  16849. ;
  16850. Blockly.Tooltip.bindMouseEvents = function (a) {
  16851. Blockly.bindEvent_(a, "mouseover", null, Blockly.Tooltip.onMouseOver_);
  16852. Blockly.bindEvent_(a, "mouseout", null, Blockly.Tooltip.onMouseOut_);
  16853. a.addEventListener("mousemove", Blockly.Tooltip.onMouseMove_, !1)
  16854. }
  16855. ;
  16856. Blockly.Tooltip.onMouseOver_ = function (a) {
  16857. for (a = a.target; !goog.isString(a.tooltip) && !goog.isFunction(a.tooltip);)
  16858. a = a.tooltip;
  16859. Blockly.Tooltip.element_ != a && (Blockly.Tooltip.hide(),
  16860. Blockly.Tooltip.poisonedElement_ = null,
  16861. Blockly.Tooltip.element_ = a);
  16862. clearTimeout(Blockly.Tooltip.mouseOutPid_)
  16863. }
  16864. ;
  16865. Blockly.Tooltip.onMouseOut_ = function (a) {
  16866. Blockly.Tooltip.mouseOutPid_ = setTimeout(function () {
  16867. Blockly.Tooltip.element_ = null;
  16868. Blockly.Tooltip.poisonedElement_ = null;
  16869. Blockly.Tooltip.hide()
  16870. }, 1);
  16871. clearTimeout(Blockly.Tooltip.showPid_)
  16872. }
  16873. ;
  16874. Blockly.Tooltip.onMouseMove_ = function (a) {
  16875. if (Blockly.Tooltip.element_ && Blockly.Tooltip.element_.tooltip && Blockly.dragMode_ == Blockly.DRAG_NONE && !Blockly.WidgetDiv.isVisible())
  16876. if (Blockly.Tooltip.visible) {
  16877. var b = Blockly.Tooltip.lastX_ - a.pageX;
  16878. a = Blockly.Tooltip.lastY_ - a.pageY;
  16879. Math.sqrt(b * b + a * a) > Blockly.Tooltip.RADIUS_OK && Blockly.Tooltip.hide()
  16880. } else
  16881. Blockly.Tooltip.poisonedElement_ != Blockly.Tooltip.element_ && (clearTimeout(Blockly.Tooltip.showPid_),
  16882. Blockly.Tooltip.lastX_ = a.pageX,
  16883. Blockly.Tooltip.lastY_ = a.pageY,
  16884. Blockly.Tooltip.showPid_ = setTimeout(Blockly.Tooltip.show_, Blockly.Tooltip.HOVER_MS))
  16885. }
  16886. ;
  16887. Blockly.Tooltip.hide = function () {
  16888. Blockly.Tooltip.visible && (Blockly.Tooltip.visible = !1,
  16889. Blockly.Tooltip.DIV && (Blockly.Tooltip.DIV.style.display = "none"));
  16890. clearTimeout(Blockly.Tooltip.showPid_)
  16891. }
  16892. ;
  16893. Blockly.Tooltip.show_ = function () {
  16894. Blockly.Tooltip.poisonedElement_ = Blockly.Tooltip.element_;
  16895. if (Blockly.Tooltip.DIV) {
  16896. goog.dom.removeChildren(Blockly.Tooltip.DIV);
  16897. for (var a = Blockly.Tooltip.element_.tooltip; goog.isFunction(a);)
  16898. a = a();
  16899. a = Blockly.utils.wrap(a, Blockly.Tooltip.LIMIT);
  16900. a = a.split("\n");
  16901. for (var b = 0; b < a.length; b++) {
  16902. var c = document.createElement("div");
  16903. c.appendChild(document.createTextNode(a[b]));
  16904. Blockly.Tooltip.DIV.appendChild(c)
  16905. }
  16906. a = Blockly.Tooltip.element_.RTL;
  16907. b = goog.dom.getViewportSize();
  16908. Blockly.Tooltip.DIV.style.direction = a ? "rtl" : "ltr";
  16909. Blockly.Tooltip.DIV.style.display = "block";
  16910. Blockly.Tooltip.visible = !0;
  16911. c = Blockly.Tooltip.lastX_;
  16912. c = a ? c - (Blockly.Tooltip.OFFSET_X + Blockly.Tooltip.DIV.offsetWidth) : c + Blockly.Tooltip.OFFSET_X;
  16913. var d = Blockly.Tooltip.lastY_ + Blockly.Tooltip.OFFSET_Y;
  16914. d + Blockly.Tooltip.DIV.offsetHeight > b.height + window.scrollY && (d -= Blockly.Tooltip.DIV.offsetHeight + 2 * Blockly.Tooltip.OFFSET_Y);
  16915. a ? c = Math.max(Blockly.Tooltip.MARGINS - window.scrollX, c) : c + Blockly.Tooltip.DIV.offsetWidth > b.width + window.scrollX - 2 * Blockly.Tooltip.MARGINS && (c = b.width - Blockly.Tooltip.DIV.offsetWidth - 2 * Blockly.Tooltip.MARGINS);
  16916. Blockly.Tooltip.DIV.style.top = d + "px";
  16917. Blockly.Tooltip.DIV.style.left = c + "px"
  16918. }
  16919. }
  16920. ;
  16921. Blockly.FieldLabel = function (a, b) {
  16922. this.size_ = new goog.math.Size(0, 17.5);
  16923. this.class_ = b;
  16924. this.setValue(a)
  16925. }
  16926. ;
  16927. goog.inherits(Blockly.FieldLabel, Blockly.Field);
  16928. Blockly.FieldLabel.prototype.EDITABLE = !1;
  16929. Blockly.FieldLabel.prototype.init = function () {
  16930. this.textElement_ || (this.textElement_ = Blockly.createSvgElement("text", {
  16931. "class": "blocklyText",
  16932. y: this.size_.height - 5
  16933. }, null),
  16934. this.class_ && Blockly.addClass_(this.textElement_, this.class_),
  16935. this.visible_ || (this.textElement_.style.display = "none"),
  16936. this.sourceBlock_.getSvgRoot().appendChild(this.textElement_),
  16937. this.textElement_.tooltip = this.sourceBlock_,
  16938. Blockly.Tooltip.bindMouseEvents(this.textElement_),
  16939. this.updateTextNode_())
  16940. }
  16941. ;
  16942. Blockly.FieldLabel.prototype.dispose = function () {
  16943. goog.dom.removeNode(this.textElement_);
  16944. this.textElement_ = null
  16945. }
  16946. ;
  16947. Blockly.FieldLabel.prototype.getSvgRoot = function () {
  16948. return this.textElement_
  16949. }
  16950. ;
  16951. Blockly.FieldLabel.prototype.setTooltip = function (a) {
  16952. this.textElement_.tooltip = a
  16953. }
  16954. ;
  16955. Blockly.Input = function (a, b, c, d) {
  16956. this.type = a;
  16957. this.name = b;
  16958. this.sourceBlock_ = c;
  16959. this.connection = d;
  16960. this.fieldRow = []
  16961. }
  16962. ;
  16963. Blockly.Input.prototype.align = Blockly.ALIGN_LEFT;
  16964. Blockly.Input.prototype.visible_ = !0;
  16965. Blockly.Input.prototype.appendField = function (a, b) {
  16966. if (!a && !b)
  16967. return this;
  16968. goog.isString(a) && (a = new Blockly.FieldLabel(a));
  16969. a.setSourceBlock(this.sourceBlock_);
  16970. this.sourceBlock_.rendered && a.init();
  16971. a.name = b;
  16972. a.prefixField && this.appendField(a.prefixField);
  16973. this.fieldRow.push(a);
  16974. a.suffixField && this.appendField(a.suffixField);
  16975. this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  16976. this.sourceBlock_.bumpNeighbours_());
  16977. return this
  16978. }
  16979. ;
  16980. Blockly.Input.prototype.appendTitle = function (a, b) {
  16981. console.warn("Deprecated call to appendTitle, use appendField instead.");
  16982. return this.appendField(a, b)
  16983. }
  16984. ;
  16985. Blockly.Input.prototype.removeField = function (a) {
  16986. for (var b = 0, c; c = this.fieldRow[b]; b++)
  16987. if (c.name === a) {
  16988. c.dispose();
  16989. this.fieldRow.splice(b, 1);
  16990. this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  16991. this.sourceBlock_.bumpNeighbours_());
  16992. return
  16993. }
  16994. goog.asserts.fail('Field "%s" not found.', a)
  16995. }
  16996. ;
  16997. Blockly.Input.prototype.isVisible = function () {
  16998. return this.visible_
  16999. }
  17000. ;
  17001. Blockly.Input.prototype.setVisible = function (a) {
  17002. var b = [];
  17003. if (this.visible_ == a)
  17004. return b;
  17005. for (var c = (this.visible_ = a) ? "block" : "none", d = 0, e; e = this.fieldRow[d]; d++)
  17006. e.setVisible(a);
  17007. this.connection && (a ? b = this.connection.unhideAll() : this.connection.hideAll(),
  17008. d = this.connection.targetBlock()) && (d.getSvgRoot().style.display = c,
  17009. a || (d.rendered = !1));
  17010. return b
  17011. }
  17012. ;
  17013. Blockly.Input.prototype.setCheck = function (a) {
  17014. if (!this.connection)
  17015. throw "This input does not have a connection.";
  17016. this.connection.setCheck(a);
  17017. return this
  17018. }
  17019. ;
  17020. Blockly.Input.prototype.setAlign = function (a) {
  17021. this.align = a;
  17022. this.sourceBlock_.rendered && this.sourceBlock_.render();
  17023. return this
  17024. }
  17025. ;
  17026. Blockly.Input.prototype.init = function () {
  17027. if (this.sourceBlock_.workspace.rendered)
  17028. for (var a = 0; a < this.fieldRow.length; a++)
  17029. this.fieldRow[a].init()
  17030. }
  17031. ;
  17032. Blockly.Input.prototype.dispose = function () {
  17033. for (var a = 0, b; b = this.fieldRow[a]; a++)
  17034. b.dispose();
  17035. this.connection && this.connection.dispose();
  17036. this.sourceBlock_ = null
  17037. }
  17038. ;
  17039. Blockly.ConnectionDB = function () { }
  17040. ;
  17041. Blockly.ConnectionDB.prototype = [];
  17042. Blockly.ConnectionDB.constructor = Blockly.ConnectionDB;
  17043. Blockly.ConnectionDB.prototype.addConnection = function (a) {
  17044. if (a.inDB_)
  17045. throw "Connection already in database.";
  17046. if (!a.getSourceBlock().isInFlyout) {
  17047. var b = this.findPositionForConnection_(a);
  17048. this.splice(b, 0, a);
  17049. a.inDB_ = !0
  17050. }
  17051. }
  17052. ;
  17053. Blockly.ConnectionDB.prototype.findConnection = function (a) {
  17054. if (!this.length)
  17055. return -1;
  17056. var b = this.findPositionForConnection_(a);
  17057. if (b >= this.length)
  17058. return -1;
  17059. for (var c = a.y_, d = b; 0 <= d && this[d].y_ == c;) {
  17060. if (this[d] == a)
  17061. return d;
  17062. d--
  17063. }
  17064. for (; b < this.length && this[b].y_ == c;) {
  17065. if (this[b] == a)
  17066. return b;
  17067. b++
  17068. }
  17069. return -1
  17070. }
  17071. ;
  17072. Blockly.ConnectionDB.prototype.findPositionForConnection_ = function (a) {
  17073. if (!this.length)
  17074. return 0;
  17075. for (var b = 0, c = this.length; b < c;) {
  17076. var d = Math.floor((b + c) / 2);
  17077. if (this[d].y_ < a.y_)
  17078. b = d + 1;
  17079. else if (this[d].y_ > a.y_)
  17080. c = d;
  17081. else {
  17082. b = d;
  17083. break
  17084. }
  17085. }
  17086. return b
  17087. }
  17088. ;
  17089. Blockly.ConnectionDB.prototype.removeConnection_ = function (a) {
  17090. if (!a.inDB_)
  17091. throw "Connection not in database.";
  17092. var b = this.findConnection(a);
  17093. if (-1 == b)
  17094. throw "Unable to find connection in connectionDB.";
  17095. a.inDB_ = !1;
  17096. this.splice(b, 1)
  17097. }
  17098. ;
  17099. Blockly.ConnectionDB.prototype.getNeighbours = function (a, b) {
  17100. function c(a) {
  17101. var c = e - d[a].x_
  17102. , g = f - d[a].y_;
  17103. Math.sqrt(c * c + g * g) <= b && m.push(d[a]);
  17104. return g < b
  17105. }
  17106. for (var d = this, e = a.x_, f = a.y_, g = 0, h = d.length - 2, k = h; g < k;)
  17107. d[k].y_ < f ? g = k : h = k,
  17108. k = Math.floor((g + h) / 2);
  17109. var m = [];
  17110. h = g = k;
  17111. if (d.length) {
  17112. for (; 0 <= g && c(g);)
  17113. g--;
  17114. do
  17115. h++;
  17116. while (h < d.length && c(h))
  17117. }
  17118. return m
  17119. }
  17120. ;
  17121. Blockly.ConnectionDB.prototype.isInYRange_ = function (a, b, c) {
  17122. return Math.abs(this[a].y_ - b) <= c
  17123. }
  17124. ;
  17125. Blockly.ConnectionDB.prototype.searchForClosest = function (a, b, c) {
  17126. if (!this.length)
  17127. return {
  17128. connection: null,
  17129. radius: b
  17130. };
  17131. var d = a.y_
  17132. , e = a.x_;
  17133. a.x_ = e + c.x;
  17134. a.y_ = d + c.y;
  17135. var f = this.findPositionForConnection_(a);
  17136. c = null;
  17137. for (var g = b, h, k = f - 1; 0 <= k && this.isInYRange_(k, a.y_, b);)
  17138. h = this[k],
  17139. a.isConnectionAllowed(h, g) && (c = h,
  17140. g = h.distanceFrom(a)),
  17141. k--;
  17142. for (; f < this.length && this.isInYRange_(f, a.y_, b);)
  17143. h = this[f],
  17144. a.isConnectionAllowed(h, g) && (c = h,
  17145. g = h.distanceFrom(a)),
  17146. f++;
  17147. a.x_ = e;
  17148. a.y_ = d;
  17149. return {
  17150. connection: c,
  17151. radius: g
  17152. }
  17153. }
  17154. ;
  17155. Blockly.ConnectionDB.init = function (a) {
  17156. var b = [];
  17157. b[Blockly.INPUT_VALUE] = new Blockly.ConnectionDB;
  17158. b[Blockly.OUTPUT_VALUE] = new Blockly.ConnectionDB;
  17159. b[Blockly.NEXT_STATEMENT] = new Blockly.ConnectionDB;
  17160. b[Blockly.PREVIOUS_STATEMENT] = new Blockly.ConnectionDB;
  17161. a.connectionDBList = b
  17162. }
  17163. ;
  17164. Blockly.constants = {};
  17165. Blockly.DRAG_RADIUS = 5;
  17166. Blockly.SNAP_RADIUS = 20;
  17167. Blockly.BUMP_DELAY = 250;
  17168. Blockly.COLLAPSE_CHARS = 30;
  17169. Blockly.LONGPRESS = 750;
  17170. Blockly.SOUND_LIMIT = 100;
  17171. Blockly.HSV_SATURATION = .45;
  17172. Blockly.HSV_VALUE = .65;
  17173. Blockly.SPRITE = {
  17174. width: 96,
  17175. height: 124,
  17176. url: "sprites.png"
  17177. };
  17178. Blockly.SVG_NS = "http://www.w3.org/2000/svg";
  17179. Blockly.HTML_NS = "http://www.w3.org/1999/xhtml";
  17180. Blockly.INPUT_VALUE = 1;
  17181. Blockly.OUTPUT_VALUE = 2;
  17182. Blockly.NEXT_STATEMENT = 3;
  17183. Blockly.PREVIOUS_STATEMENT = 4;
  17184. Blockly.DUMMY_INPUT = 5;
  17185. Blockly.ALIGN_LEFT = -1;
  17186. Blockly.ALIGN_CENTRE = 0;
  17187. Blockly.ALIGN_RIGHT = 1;
  17188. Blockly.DRAG_NONE = 0;
  17189. Blockly.DRAG_STICKY = 1;
  17190. Blockly.DRAG_BEGIN = 1;
  17191. Blockly.DRAG_FREE = 2;
  17192. Blockly.OPPOSITE_TYPE = [];
  17193. Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE] = Blockly.OUTPUT_VALUE;
  17194. Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE] = Blockly.INPUT_VALUE;
  17195. Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT] = Blockly.PREVIOUS_STATEMENT;
  17196. Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT] = Blockly.NEXT_STATEMENT;
  17197. Blockly.TOOLBOX_AT_TOP = 0;
  17198. Blockly.TOOLBOX_AT_BOTTOM = 1;
  17199. Blockly.TOOLBOX_AT_LEFT = 2;
  17200. Blockly.TOOLBOX_AT_RIGHT = 3;
  17201. Blockly.Options = function (a) {
  17202. var b = !!a.readOnly;
  17203. if (b)
  17204. var c = null
  17205. , d = !1
  17206. , e = !1
  17207. , f = !1
  17208. , g = !1
  17209. , h = !1
  17210. , k = !1;
  17211. else
  17212. c = Blockly.Options.parseToolboxTree(a.toolbox),
  17213. d = !(!c || !c.getElementsByTagName("category").length),
  17214. e = a.trashcan,
  17215. void 0 === e && (e = d),
  17216. f = a.collapse,
  17217. void 0 === f && (f = d),
  17218. g = a.comments,
  17219. void 0 === g && (g = d),
  17220. h = a.disable,
  17221. void 0 === h && (h = d),
  17222. k = a.sounds,
  17223. void 0 === k && (k = !0);
  17224. var m = !!a.rtl
  17225. , p = a.horizontalLayout;
  17226. void 0 === p && (p = !1);
  17227. var l = a.toolboxPosition;
  17228. l = "end" === l ? !1 : !0;
  17229. l = p ? l ? Blockly.TOOLBOX_AT_TOP : Blockly.TOOLBOX_AT_BOTTOM : l == m ? Blockly.TOOLBOX_AT_RIGHT : Blockly.TOOLBOX_AT_LEFT;
  17230. var n = a.scrollbars;
  17231. void 0 === n && (n = d);
  17232. var q = a.css;
  17233. void 0 === q && (q = !0);
  17234. var t = "blockly/media/";
  17235. a.media ? t = a.media : a.path && (t = a.path + "media/");
  17236. var r = void 0 === a.oneBasedIndex ? !0 : !!a.oneBasedIndex;
  17237. this.RTL = m;
  17238. this.oneBasedIndex = r;
  17239. this.collapse = f;
  17240. this.comments = g;
  17241. this.disable = h;
  17242. this.readOnly = b;
  17243. this.maxBlocks = a.maxBlocks || Infinity;
  17244. this.pathToMedia = t;
  17245. this.hasCategories = d;
  17246. this.hasScrollbars = n;
  17247. this.hasTrashcan = e;
  17248. this.hasSounds = k;
  17249. this.hasCss = q;
  17250. this.horizontalLayout = p;
  17251. this.languageTree = c;
  17252. this.gridOptions = Blockly.Options.parseGridOptions_(a);
  17253. this.zoomOptions = Blockly.Options.parseZoomOptions_(a);
  17254. this.toolboxPosition = l
  17255. }
  17256. ;
  17257. Blockly.Options.prototype.parentWorkspace = null;
  17258. Blockly.Options.prototype.setMetrics = null;
  17259. Blockly.Options.prototype.getMetrics = null;
  17260. Blockly.Options.parseZoomOptions_ = function (a) {
  17261. a = a.zoom || {};
  17262. var b = {};
  17263. b.controls = void 0 === a.controls ? !1 : !!a.controls;
  17264. b.wheel = void 0 === a.wheel ? !1 : !!a.wheel;
  17265. b.startScale = void 0 === a.startScale ? 1 : parseFloat(a.startScale);
  17266. b.maxScale = void 0 === a.maxScale ? 3 : parseFloat(a.maxScale);
  17267. b.minScale = void 0 === a.minScale ? .3 : parseFloat(a.minScale);
  17268. b.scaleSpeed = void 0 === a.scaleSpeed ? 1.2 : parseFloat(a.scaleSpeed);
  17269. return b
  17270. }
  17271. ;
  17272. Blockly.Options.parseGridOptions_ = function (a) {
  17273. a = a.grid || {};
  17274. var b = {};
  17275. b.spacing = parseFloat(a.spacing) || 0;
  17276. b.colour = a.colour || "#888";
  17277. b.length = parseFloat(a.length) || 1;
  17278. b.snap = 0 < b.spacing && !!a.snap;
  17279. return b
  17280. }
  17281. ;
  17282. Blockly.Options.parseToolboxTree = function (a) {
  17283. a ? ("string" != typeof a && ("undefined" == typeof XSLTProcessor && a.outerHTML ? a = a.outerHTML : a instanceof Element || (a = null)),
  17284. "string" == typeof a && (a = Blockly.Xml.textToDom(a))) : a = null;
  17285. return a
  17286. }
  17287. ;
  17288. Blockly.ScrollbarPair = function (a) {
  17289. this.workspace_ = a;
  17290. this.hScroll = new Blockly.Scrollbar(a, !0, !0);
  17291. this.vScroll = new Blockly.Scrollbar(a, !1, !0);
  17292. this.corner_ = Blockly.createSvgElement("rect", {
  17293. height: Blockly.Scrollbar.scrollbarThickness,
  17294. width: Blockly.Scrollbar.scrollbarThickness,
  17295. "class": "blocklyScrollbarBackground"
  17296. }, null);
  17297. Blockly.Scrollbar.insertAfter_(this.corner_, a.getBubbleCanvas())
  17298. }
  17299. ;
  17300. Blockly.ScrollbarPair.prototype.oldHostMetrics_ = null;
  17301. Blockly.ScrollbarPair.prototype.dispose = function () {
  17302. goog.dom.removeNode(this.corner_);
  17303. this.oldHostMetrics_ = this.workspace_ = this.corner_ = null;
  17304. this.hScroll.dispose();
  17305. this.hScroll = null;
  17306. this.vScroll.dispose();
  17307. this.vScroll = null
  17308. }
  17309. ;
  17310. Blockly.ScrollbarPair.prototype.resize = function () {
  17311. var a = this.workspace_.getMetrics();
  17312. if (a) {
  17313. var b = !1
  17314. , c = !1;
  17315. this.oldHostMetrics_ && this.oldHostMetrics_.viewWidth == a.viewWidth && this.oldHostMetrics_.viewHeight == a.viewHeight && this.oldHostMetrics_.absoluteTop == a.absoluteTop && this.oldHostMetrics_.absoluteLeft == a.absoluteLeft ? (this.oldHostMetrics_ && this.oldHostMetrics_.contentWidth == a.contentWidth && this.oldHostMetrics_.viewLeft == a.viewLeft && this.oldHostMetrics_.contentLeft == a.contentLeft || (b = !0),
  17316. this.oldHostMetrics_ && this.oldHostMetrics_.contentHeight == a.contentHeight && this.oldHostMetrics_.viewTop == a.viewTop && this.oldHostMetrics_.contentTop == a.contentTop || (c = !0)) : c = b = !0;
  17317. b && this.hScroll.resize(a);
  17318. c && this.vScroll.resize(a);
  17319. this.oldHostMetrics_ && this.oldHostMetrics_.viewWidth == a.viewWidth && this.oldHostMetrics_.absoluteLeft == a.absoluteLeft || this.corner_.setAttribute("x", this.vScroll.position_.x);
  17320. this.oldHostMetrics_ && this.oldHostMetrics_.viewHeight == a.viewHeight && this.oldHostMetrics_.absoluteTop == a.absoluteTop || this.corner_.setAttribute("y", this.hScroll.position_.y);
  17321. this.oldHostMetrics_ = a
  17322. }
  17323. }
  17324. ;
  17325. Blockly.ScrollbarPair.prototype.set = function (a, b) {
  17326. var c = {}
  17327. , d = a * this.hScroll.ratio_
  17328. , e = b * this.vScroll.ratio_
  17329. , f = this.vScroll.scrollViewSize_;
  17330. c.x = this.getRatio_(d, this.hScroll.scrollViewSize_);
  17331. c.y = this.getRatio_(e, f);
  17332. this.workspace_.setMetrics(c);
  17333. this.hScroll.setHandlePosition(d);
  17334. this.vScroll.setHandlePosition(e)
  17335. }
  17336. ;
  17337. Blockly.ScrollbarPair.prototype.getRatio_ = function (a, b) {
  17338. var c = a / b;
  17339. return isNaN(c) ? 0 : c
  17340. }
  17341. ;
  17342. Blockly.Scrollbar = function (a, b, c) {
  17343. this.workspace_ = a;
  17344. this.pair_ = c || !1;
  17345. this.horizontal_ = b;
  17346. this.oldHostMetrics_ = null;
  17347. this.createDom_();
  17348. this.position_ = new goog.math.Coordinate(0, 0);
  17349. b ? (this.svgBackground_.setAttribute("height", Blockly.Scrollbar.scrollbarThickness),
  17350. this.svgHandle_.setAttribute("height", Blockly.Scrollbar.scrollbarThickness - 5),
  17351. this.svgHandle_.setAttribute("y", 2.5),
  17352. this.lengthAttribute_ = "width",
  17353. this.positionAttribute_ = "x") : (this.svgBackground_.setAttribute("width", Blockly.Scrollbar.scrollbarThickness),
  17354. this.svgHandle_.setAttribute("width", Blockly.Scrollbar.scrollbarThickness - 5),
  17355. this.svgHandle_.setAttribute("x", 2.5),
  17356. this.lengthAttribute_ = "height",
  17357. this.positionAttribute_ = "y");
  17358. this.onMouseDownBarWrapper_ = Blockly.bindEventWithChecks_(this.svgBackground_, "mousedown", this, this.onMouseDownBar_);
  17359. this.onMouseDownHandleWrapper_ = Blockly.bindEventWithChecks_(this.svgHandle_, "mousedown", this, this.onMouseDownHandle_)
  17360. }
  17361. ;
  17362. Blockly.Scrollbar.prototype.scrollViewSize_ = 0;
  17363. Blockly.Scrollbar.prototype.handleLength_ = 0;
  17364. Blockly.Scrollbar.prototype.handlePosition_ = 0;
  17365. Blockly.Scrollbar.prototype.isVisible_ = !0;
  17366. Blockly.Scrollbar.scrollbarThickness = 15;
  17367. goog.events.BrowserFeature.TOUCH_ENABLED && (Blockly.Scrollbar.scrollbarThickness = 25);
  17368. Blockly.Scrollbar.metricsAreEquivalent_ = function (a, b) {
  17369. return a && b && a.viewWidth == b.viewWidth && a.viewHeight == b.viewHeight && a.viewLeft == b.viewLeft && a.viewTop == b.viewTop && a.absoluteTop == b.absoluteTop && a.absoluteLeft == b.absoluteLeft && a.contentWidth == b.contentWidth && a.contentHeight == b.contentHeight && a.contentLeft == b.contentLeft && a.contentTop == b.contentTop ? !0 : !1
  17370. }
  17371. ;
  17372. Blockly.Scrollbar.prototype.dispose = function () {
  17373. this.cleanUp_();
  17374. Blockly.unbindEvent_(this.onMouseDownBarWrapper_);
  17375. this.onMouseDownBarWrapper_ = null;
  17376. Blockly.unbindEvent_(this.onMouseDownHandleWrapper_);
  17377. this.onMouseDownHandleWrapper_ = null;
  17378. goog.dom.removeNode(this.svgGroup_);
  17379. this.workspace_ = this.svgHandle_ = this.svgBackground_ = this.svgGroup_ = null
  17380. }
  17381. ;
  17382. Blockly.Scrollbar.prototype.setHandleLength_ = function (a) {
  17383. this.handleLength_ = a;
  17384. this.svgHandle_.setAttribute(this.lengthAttribute_, this.handleLength_)
  17385. }
  17386. ;
  17387. Blockly.Scrollbar.prototype.setHandlePosition = function (a) {
  17388. this.handlePosition_ = a;
  17389. this.svgHandle_.setAttribute(this.positionAttribute_, this.handlePosition_)
  17390. }
  17391. ;
  17392. Blockly.Scrollbar.prototype.setScrollViewSize_ = function (a) {
  17393. this.scrollViewSize_ = a;
  17394. this.svgBackground_.setAttribute(this.lengthAttribute_, this.scrollViewSize_)
  17395. }
  17396. ;
  17397. Blockly.Scrollbar.prototype.setPosition = function (a, b) {
  17398. this.position_.x = a;
  17399. this.position_.y = b;
  17400. this.svgGroup_.setAttribute("transform", "translate(" + this.position_.x + "," + this.position_.y + ")")
  17401. }
  17402. ;
  17403. Blockly.Scrollbar.prototype.resize = function (a) {
  17404. if (!a && (a = this.workspace_.getMetrics(),
  17405. !a))
  17406. return;
  17407. Blockly.Scrollbar.metricsAreEquivalent_(a, this.oldHostMetrics_) || (this.oldHostMetrics_ = a,
  17408. this.horizontal_ ? this.resizeHorizontal_(a) : this.resizeVertical_(a),
  17409. this.onScroll_())
  17410. }
  17411. ;
  17412. Blockly.Scrollbar.prototype.resizeHorizontal_ = function (a) {
  17413. this.resizeViewHorizontal(a)
  17414. }
  17415. ;
  17416. Blockly.Scrollbar.prototype.resizeViewHorizontal = function (a) {
  17417. var b = a.viewWidth - 1;
  17418. this.pair_ && (b -= Blockly.Scrollbar.scrollbarThickness);
  17419. this.setScrollViewSize_(Math.max(0, b));
  17420. b = a.absoluteLeft + .5;
  17421. this.pair_ && this.workspace_.RTL && (b += Blockly.Scrollbar.scrollbarThickness);
  17422. this.setPosition(b, a.absoluteTop + a.viewHeight - Blockly.Scrollbar.scrollbarThickness - .5);
  17423. this.resizeContentHorizontal(a)
  17424. }
  17425. ;
  17426. Blockly.Scrollbar.prototype.resizeContentHorizontal = function (a) {
  17427. this.pair_ || this.setVisible(this.scrollViewSize_ < a.contentWidth);
  17428. this.ratio_ = this.scrollViewSize_ / a.contentWidth;
  17429. if (-Infinity == this.ratio_ || Infinity == this.ratio_ || isNaN(this.ratio_))
  17430. this.ratio_ = 0;
  17431. this.setHandleLength_(Math.max(0, a.viewWidth * this.ratio_));
  17432. this.setHandlePosition(this.constrainHandle_((a.viewLeft - a.contentLeft) * this.ratio_))
  17433. }
  17434. ;
  17435. Blockly.Scrollbar.prototype.resizeVertical_ = function (a) {
  17436. this.resizeViewVertical(a)
  17437. }
  17438. ;
  17439. Blockly.Scrollbar.prototype.resizeViewVertical = function (a) {
  17440. var b = a.viewHeight - 1;
  17441. this.pair_ && (b -= Blockly.Scrollbar.scrollbarThickness);
  17442. this.setScrollViewSize_(Math.max(0, b));
  17443. b = a.absoluteLeft + .5;
  17444. this.workspace_.RTL || (b += a.viewWidth - Blockly.Scrollbar.scrollbarThickness - 1);
  17445. this.setPosition(b, a.absoluteTop + .5);
  17446. this.resizeContentVertical(a)
  17447. }
  17448. ;
  17449. Blockly.Scrollbar.prototype.resizeContentVertical = function (a) {
  17450. this.pair_ || this.setVisible(this.scrollViewSize_ < a.contentHeight);
  17451. this.ratio_ = this.scrollViewSize_ / a.contentHeight;
  17452. if (-Infinity == this.ratio_ || Infinity == this.ratio_ || isNaN(this.ratio_))
  17453. this.ratio_ = 0;
  17454. this.setHandleLength_(Math.max(0, a.viewHeight * this.ratio_));
  17455. this.setHandlePosition(this.constrainHandle_((a.viewTop - a.contentTop) * this.ratio_))
  17456. }
  17457. ;
  17458. Blockly.Scrollbar.prototype.createDom_ = function () {
  17459. this.svgGroup_ = Blockly.createSvgElement("g", {
  17460. "class": "blocklyScrollbar" + (this.horizontal_ ? "Horizontal" : "Vertical")
  17461. }, null);
  17462. this.svgBackground_ = Blockly.createSvgElement("rect", {
  17463. "class": "blocklyScrollbarBackground"
  17464. }, this.svgGroup_);
  17465. var a = Math.floor((Blockly.Scrollbar.scrollbarThickness - 5) / 2);
  17466. this.svgHandle_ = Blockly.createSvgElement("rect", {
  17467. "class": "blocklyScrollbarHandle",
  17468. rx: a,
  17469. ry: a
  17470. }, this.svgGroup_);
  17471. Blockly.Scrollbar.insertAfter_(this.svgGroup_, this.workspace_.getBubbleCanvas())
  17472. }
  17473. ;
  17474. Blockly.Scrollbar.prototype.isVisible = function () {
  17475. return this.isVisible_
  17476. }
  17477. ;
  17478. Blockly.Scrollbar.prototype.setVisible = function (a) {
  17479. if (a != this.isVisible()) {
  17480. if (this.pair_)
  17481. throw "Unable to toggle visibility of paired scrollbars.";
  17482. (this.isVisible_ = a) ? this.svgGroup_.setAttribute("display", "block") : (this.workspace_.setMetrics({
  17483. x: 0,
  17484. y: 0
  17485. }),
  17486. this.svgGroup_.setAttribute("display", "none"))
  17487. }
  17488. }
  17489. ;
  17490. Blockly.Scrollbar.prototype.onMouseDownBar_ = function (a) {
  17491. this.workspace_.markFocused();
  17492. Blockly.Touch.clearTouchIdentifier();
  17493. this.cleanUp_();
  17494. if (Blockly.isRightButton(a))
  17495. a.stopPropagation();
  17496. else {
  17497. var b = Blockly.mouseToSvg(a, this.workspace_.getParentSvg(), this.workspace_.getInverseScreenCTM());
  17498. b = this.horizontal_ ? b.x : b.y;
  17499. var c = Blockly.getSvgXY_(this.svgHandle_, this.workspace_);
  17500. c = this.horizontal_ ? c.x : c.y;
  17501. var d = this.handlePosition_
  17502. , e = .95 * this.handleLength_;
  17503. b <= c ? d -= e : b >= c + this.handleLength_ && (d += e);
  17504. this.setHandlePosition(this.constrainHandle_(d));
  17505. this.onScroll_();
  17506. a.stopPropagation();
  17507. a.preventDefault()
  17508. }
  17509. }
  17510. ;
  17511. Blockly.Scrollbar.prototype.onMouseDownHandle_ = function (a) {
  17512. this.workspace_.markFocused();
  17513. this.cleanUp_();
  17514. Blockly.isRightButton(a) ? a.stopPropagation() : (this.startDragHandle = this.handlePosition_,
  17515. this.startDragMouse = this.horizontal_ ? a.clientX : a.clientY,
  17516. Blockly.Scrollbar.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, this.onMouseUpHandle_),
  17517. Blockly.Scrollbar.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.onMouseMoveHandle_),
  17518. a.stopPropagation(),
  17519. a.preventDefault())
  17520. }
  17521. ;
  17522. Blockly.Scrollbar.prototype.onMouseMoveHandle_ = function (a) {
  17523. this.setHandlePosition(this.constrainHandle_(this.startDragHandle + ((this.horizontal_ ? a.clientX : a.clientY) - this.startDragMouse)));
  17524. this.onScroll_()
  17525. }
  17526. ;
  17527. Blockly.Scrollbar.prototype.onMouseUpHandle_ = function () {
  17528. Blockly.Touch.clearTouchIdentifier();
  17529. this.cleanUp_()
  17530. }
  17531. ;
  17532. Blockly.Scrollbar.prototype.cleanUp_ = function () {
  17533. Blockly.hideChaff(!0);
  17534. Blockly.Scrollbar.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_),
  17535. Blockly.Scrollbar.onMouseUpWrapper_ = null);
  17536. Blockly.Scrollbar.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.Scrollbar.onMouseMoveWrapper_),
  17537. Blockly.Scrollbar.onMouseMoveWrapper_ = null)
  17538. }
  17539. ;
  17540. Blockly.Scrollbar.prototype.constrainHandle_ = function (a) {
  17541. return a = 0 >= a || isNaN(a) || this.scrollViewSize_ < this.handleLength_ ? 0 : Math.min(a, this.scrollViewSize_ - this.handleLength_)
  17542. }
  17543. ;
  17544. Blockly.Scrollbar.prototype.onScroll_ = function () {
  17545. var a = this.handlePosition_ / this.scrollViewSize_;
  17546. isNaN(a) && (a = 0);
  17547. var b = {};
  17548. this.horizontal_ ? b.x = a : b.y = a;
  17549. this.workspace_.setMetrics(b)
  17550. }
  17551. ;
  17552. Blockly.Scrollbar.prototype.set = function (a) {
  17553. this.setHandlePosition(this.constrainHandle_(a * this.ratio_));
  17554. this.onScroll_()
  17555. }
  17556. ;
  17557. Blockly.Scrollbar.insertAfter_ = function (a, b) {
  17558. var c = b.nextSibling
  17559. , d = b.parentNode;
  17560. if (!d)
  17561. throw "Reference node has no parent.";
  17562. c ? d.insertBefore(a, c) : d.appendChild(a)
  17563. }
  17564. ;
  17565. Blockly.Trashcan = function (a) {
  17566. this.workspace_ = a
  17567. }
  17568. ;
  17569. Blockly.Trashcan.prototype.WIDTH_ = 47;
  17570. Blockly.Trashcan.prototype.BODY_HEIGHT_ = 44;
  17571. Blockly.Trashcan.prototype.LID_HEIGHT_ = 16;
  17572. Blockly.Trashcan.prototype.MARGIN_BOTTOM_ = 20;
  17573. Blockly.Trashcan.prototype.MARGIN_SIDE_ = 20;
  17574. Blockly.Trashcan.prototype.MARGIN_HOTSPOT_ = 10;
  17575. Blockly.Trashcan.prototype.SPRITE_LEFT_ = 0;
  17576. Blockly.Trashcan.prototype.SPRITE_TOP_ = 32;
  17577. Blockly.Trashcan.prototype.isOpen = !1;
  17578. Blockly.Trashcan.prototype.svgGroup_ = null;
  17579. Blockly.Trashcan.prototype.svgLid_ = null;
  17580. Blockly.Trashcan.prototype.lidTask_ = 0;
  17581. Blockly.Trashcan.prototype.lidOpen_ = 0;
  17582. Blockly.Trashcan.prototype.left_ = 0;
  17583. Blockly.Trashcan.prototype.top_ = 0;
  17584. Blockly.Trashcan.prototype.createDom = function () {
  17585. this.svgGroup_ = Blockly.createSvgElement("g", {
  17586. "class": "blocklyTrash"
  17587. }, null);
  17588. var a = String(Math.random()).substring(2)
  17589. , b = Blockly.createSvgElement("clipPath", {
  17590. id: "blocklyTrashBodyClipPath" + a
  17591. }, this.svgGroup_);
  17592. Blockly.createSvgElement("rect", {
  17593. width: this.WIDTH_,
  17594. height: this.BODY_HEIGHT_,
  17595. y: this.LID_HEIGHT_
  17596. }, b);
  17597. Blockly.createSvgElement("image", {
  17598. width: Blockly.SPRITE.width,
  17599. x: -this.SPRITE_LEFT_,
  17600. height: Blockly.SPRITE.height,
  17601. y: -this.SPRITE_TOP_,
  17602. "clip-path": "url(#blocklyTrashBodyClipPath" + a + ")"
  17603. }, this.svgGroup_).setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", this.workspace_.options.pathToMedia + Blockly.SPRITE.url);
  17604. b = Blockly.createSvgElement("clipPath", {
  17605. id: "blocklyTrashLidClipPath" + a
  17606. }, this.svgGroup_);
  17607. Blockly.createSvgElement("rect", {
  17608. width: this.WIDTH_,
  17609. height: this.LID_HEIGHT_
  17610. }, b);
  17611. this.svgLid_ = Blockly.createSvgElement("image", {
  17612. width: Blockly.SPRITE.width,
  17613. x: -this.SPRITE_LEFT_,
  17614. height: Blockly.SPRITE.height,
  17615. y: -this.SPRITE_TOP_,
  17616. "clip-path": "url(#blocklyTrashLidClipPath" + a + ")"
  17617. }, this.svgGroup_);
  17618. this.svgLid_.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", this.workspace_.options.pathToMedia + Blockly.SPRITE.url);
  17619. Blockly.bindEventWithChecks_(this.svgGroup_, "mouseup", this, this.click);
  17620. this.animateLid_();
  17621. return this.svgGroup_
  17622. }
  17623. ;
  17624. Blockly.Trashcan.prototype.init = function (a) {
  17625. this.bottom_ = this.MARGIN_BOTTOM_ + a;
  17626. this.setOpen_(!1);
  17627. return this.bottom_ + this.BODY_HEIGHT_ + this.LID_HEIGHT_
  17628. }
  17629. ;
  17630. Blockly.Trashcan.prototype.dispose = function () {
  17631. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  17632. this.svgGroup_ = null);
  17633. this.workspace_ = this.svgLid_ = null;
  17634. goog.Timer.clear(this.lidTask_)
  17635. }
  17636. ;
  17637. Blockly.Trashcan.prototype.position = function () {
  17638. var a = this.workspace_.getMetrics();
  17639. a && (this.workspace_.RTL ? (this.left_ = this.MARGIN_SIDE_ + Blockly.Scrollbar.scrollbarThickness,
  17640. a.toolboxPosition == Blockly.TOOLBOX_AT_LEFT && (this.left_ += a.flyoutWidth,
  17641. this.workspace_.toolbox_ && (this.left_ += a.absoluteLeft))) : (this.left_ = a.viewWidth + a.absoluteLeft - this.WIDTH_ - this.MARGIN_SIDE_ - Blockly.Scrollbar.scrollbarThickness,
  17642. a.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT && (this.left_ -= a.flyoutWidth)),
  17643. this.top_ = a.viewHeight + a.absoluteTop - (this.BODY_HEIGHT_ + this.LID_HEIGHT_) - this.bottom_,
  17644. a.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM && (this.top_ -= a.flyoutHeight),
  17645. this.svgGroup_.setAttribute("transform", "translate(" + this.left_ + "," + this.top_ + ")"))
  17646. }
  17647. ;
  17648. Blockly.Trashcan.prototype.getClientRect = function () {
  17649. if (!this.svgGroup_)
  17650. return null;
  17651. var a = this.svgGroup_.getBoundingClientRect();
  17652. return new goog.math.Rect(a.left + this.SPRITE_LEFT_ - this.MARGIN_HOTSPOT_, a.top + this.SPRITE_TOP_ - this.MARGIN_HOTSPOT_, this.WIDTH_ + 2 * this.MARGIN_HOTSPOT_, this.LID_HEIGHT_ + this.BODY_HEIGHT_ + 2 * this.MARGIN_HOTSPOT_)
  17653. }
  17654. ;
  17655. Blockly.Trashcan.prototype.setOpen_ = function (a) {
  17656. this.isOpen != a && (goog.Timer.clear(this.lidTask_),
  17657. this.isOpen = a,
  17658. this.animateLid_())
  17659. }
  17660. ;
  17661. Blockly.Trashcan.prototype.animateLid_ = function () {
  17662. this.lidOpen_ += this.isOpen ? .2 : -.2;
  17663. this.lidOpen_ = goog.math.clamp(this.lidOpen_, 0, 1);
  17664. var a = 45 * this.lidOpen_;
  17665. this.svgLid_.setAttribute("transform", "rotate(" + (this.workspace_.RTL ? -a : a) + "," + (this.workspace_.RTL ? 4 : this.WIDTH_ - 4) + "," + (this.LID_HEIGHT_ - 2) + ")");
  17666. a = goog.math.lerp(.4, .8, this.lidOpen_);
  17667. this.svgGroup_.style.opacity = a;
  17668. 0 < this.lidOpen_ && 1 > this.lidOpen_ && (this.lidTask_ = goog.Timer.callOnce(this.animateLid_, 20, this))
  17669. }
  17670. ;
  17671. Blockly.Trashcan.prototype.close = function () {
  17672. this.setOpen_(!1)
  17673. }
  17674. ;
  17675. Blockly.Trashcan.prototype.click = function () {
  17676. var a = this.workspace_.startScrollX - this.workspace_.scrollX
  17677. , b = this.workspace_.startScrollY - this.workspace_.scrollY;
  17678. Math.sqrt(a * a + b * b) > Blockly.DRAG_RADIUS || console.log("TODO: Inspect trash.")
  17679. }
  17680. ;
  17681. Blockly.Xml = {};
  17682. Blockly.Xml.workspaceToDom = function (a, b) {
  17683. for (var c = goog.dom.createDom("xml"), d = a.getTopBlocks(!0), e = 0, f; f = d[e]; e++)
  17684. c.appendChild(Blockly.Xml.blockToDomWithXY(f, b));
  17685. return c
  17686. }
  17687. ;
  17688. Blockly.Xml.blockToDomWithXY = function (a, b) {
  17689. var c;
  17690. a.workspace.RTL && (c = a.workspace.getWidth());
  17691. var d = Blockly.Xml.blockToDom(a, b)
  17692. , e = a.getRelativeToSurfaceXY();
  17693. d.setAttribute("x", Math.round(a.workspace.RTL ? c - e.x : e.x));
  17694. d.setAttribute("y", Math.round(e.y));
  17695. return d
  17696. }
  17697. ;
  17698. Blockly.Xml.blockToDom = function (a, b) {
  17699. var c = goog.dom.createDom(a.isShadow() ? "shadow" : "block");
  17700. c.setAttribute("type", a.type);
  17701. b || c.setAttribute("id", a.id);
  17702. if (a.mutationToDom) {
  17703. var d = a.mutationToDom();
  17704. d && (d.hasChildNodes() || d.hasAttributes()) && c.appendChild(d)
  17705. }
  17706. d = 0;
  17707. for (var e; e = a.inputList[d]; d++)
  17708. for (var f = 0, g; g = e.fieldRow[f]; f++)
  17709. if (g.name && g.EDITABLE) {
  17710. var h = goog.dom.createDom("field", null, g.getValue());
  17711. h.setAttribute("name", g.name);
  17712. c.appendChild(h)
  17713. }
  17714. if (d = a.getCommentText())
  17715. d = goog.dom.createDom("comment", null, d),
  17716. "object" == typeof a.comment && (d.setAttribute("pinned", a.comment.isVisible()),
  17717. e = a.comment.getBubbleSize(),
  17718. d.setAttribute("h", e.height),
  17719. d.setAttribute("w", e.width)),
  17720. c.appendChild(d);
  17721. a.data && (d = goog.dom.createDom("data", null, a.data),
  17722. c.appendChild(d));
  17723. for (d = 0; e = a.inputList[d]; d++) {
  17724. var k;
  17725. g = !0;
  17726. e.type != Blockly.DUMMY_INPUT && (h = e.connection.targetBlock(),
  17727. e.type == Blockly.INPUT_VALUE ? k = goog.dom.createDom("value") : e.type == Blockly.NEXT_STATEMENT && (k = goog.dom.createDom("statement")),
  17728. f = e.connection.getShadowDom(),
  17729. !f || h && h.isShadow() || k.appendChild(Blockly.Xml.cloneShadow_(f)),
  17730. h && (k.appendChild(Blockly.Xml.blockToDom(h, b)),
  17731. g = !1),
  17732. k.setAttribute("name", e.name),
  17733. g || c.appendChild(k))
  17734. }
  17735. a.inputsInlineDefault != a.inputsInline && c.setAttribute("inline", a.inputsInline);
  17736. a.isCollapsed() && c.setAttribute("collapsed", !0);
  17737. a.disabled && c.setAttribute("disabled", !0);
  17738. a.isDeletable() || a.isShadow() || c.setAttribute("deletable", !1);
  17739. a.isMovable() || a.isShadow() || c.setAttribute("movable", !1);
  17740. a.isEditable() || c.setAttribute("editable", !1);
  17741. if (d = a.getNextBlock())
  17742. k = goog.dom.createDom("next", null, Blockly.Xml.blockToDom(d, b)),
  17743. c.appendChild(k);
  17744. f = a.nextConnection && a.nextConnection.getShadowDom();
  17745. !f || d && d.isShadow() || k.appendChild(Blockly.Xml.cloneShadow_(f));
  17746. return c
  17747. }
  17748. ;
  17749. Blockly.Xml.cloneShadow_ = function (a) {
  17750. for (var b = a = a.cloneNode(!0), c; b;)
  17751. if (b.firstChild)
  17752. b = b.firstChild;
  17753. else {
  17754. for (; b && !b.nextSibling;)
  17755. c = b,
  17756. b = b.parentNode,
  17757. 3 == c.nodeType && "" == c.data.trim() && b.firstChild != c && goog.dom.removeNode(c);
  17758. b && (c = b,
  17759. b = b.nextSibling,
  17760. 3 == c.nodeType && "" == c.data.trim() && goog.dom.removeNode(c))
  17761. }
  17762. return a
  17763. }
  17764. ;
  17765. Blockly.Xml.domToText = function (a) {
  17766. return (new XMLSerializer).serializeToString(a)
  17767. }
  17768. ;
  17769. Blockly.Xml.domToPrettyText = function (a) {
  17770. a = Blockly.Xml.domToText(a).split("<");
  17771. for (var b = "", c = 1; c < a.length; c++) {
  17772. var d = a[c];
  17773. "/" == d[0] && (b = b.substring(2));
  17774. a[c] = b + "<" + d;
  17775. "/" != d[0] && "/>" != d.slice(-2) && (b += " ")
  17776. }
  17777. a = a.join("\n");
  17778. a = a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g, "$1</$2>");
  17779. return a.replace(/^\n/, "")
  17780. }
  17781. ;
  17782. Blockly.Xml.textToDom = function (a) {
  17783. (a = (new DOMParser).parseFromString(a, "text/xml")) && a.firstChild && "xml" == a.firstChild.nodeName.toLowerCase() && a.firstChild === a.lastChild || goog.asserts.fail("Blockly.Xml.textToDom did not obtain a valid XML tree.");
  17784. return a.firstChild
  17785. }
  17786. ;
  17787. Blockly.Xml.domToWorkspace = function (a, b) {
  17788. if (a instanceof Blockly.Workspace) {
  17789. var c = a;
  17790. a = b;
  17791. b = c;
  17792. console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")
  17793. }
  17794. var d;
  17795. b.RTL && (d = b.getWidth());
  17796. Blockly.Field.startCache();
  17797. c = a.childNodes.length;
  17798. var e = Blockly.Events.getGroup();
  17799. e || Blockly.Events.setGroup(!0);
  17800. b.setResizesEnabled && b.setResizesEnabled(!1);
  17801. for (var f = 0; f < c; f++) {
  17802. var g = a.childNodes[f]
  17803. , h = g.nodeName.toLowerCase();
  17804. if ("block" == h || "shadow" == h && !Blockly.Events.recordUndo) {
  17805. h = Blockly.Xml.domToBlock(g, b);
  17806. var k = parseInt(g.getAttribute("x"), 10);
  17807. g = parseInt(g.getAttribute("y"), 10);
  17808. isNaN(k) || isNaN(g) || h.moveBy(b.RTL ? d - k : k, g)
  17809. } else
  17810. "shadow" == h && goog.asserts.fail("Shadow block cannot be a top-level block.")
  17811. }
  17812. e || Blockly.Events.setGroup(!1);
  17813. Blockly.Field.stopCache();
  17814. b.updateVariableList(!1);
  17815. b.setResizesEnabled && b.setResizesEnabled(!0)
  17816. }
  17817. ;
  17818. Blockly.Xml.domToBlock = function (a, b) {
  17819. if (a instanceof Blockly.Workspace) {
  17820. var c = a;
  17821. a = b;
  17822. b = c;
  17823. console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")
  17824. }
  17825. Blockly.Events.disable();
  17826. try {
  17827. var d = Blockly.Xml.domToBlockHeadless_(a, b);
  17828. if (b.rendered) {
  17829. d.setConnectionsHidden(!0);
  17830. for (var e = d.getDescendants(), f = e.length - 1; 0 <= f; f--)
  17831. e[f].initSvg();
  17832. for (f = e.length - 1; 0 <= f; f--)
  17833. e[f].render(!1);
  17834. setTimeout(function () {
  17835. d.workspace && d.setConnectionsHidden(!1)
  17836. }, 1);
  17837. d.updateDisabled();
  17838. b.resizeContents()
  17839. }
  17840. } finally {
  17841. Blockly.Events.enable()
  17842. }
  17843. Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Create(d));
  17844. return d
  17845. }
  17846. ;
  17847. Blockly.Xml.domToBlockHeadless_ = function (a, b) {
  17848. var c = null
  17849. , d = a.getAttribute("type");
  17850. goog.asserts.assert(d, "Block type unspecified: %s", a.outerHTML);
  17851. var e = a.getAttribute("id");
  17852. c = b.newBlock(d, e);
  17853. var f = null;
  17854. e = 0;
  17855. for (var g; g = a.childNodes[e]; e++)
  17856. if (3 != g.nodeType) {
  17857. for (var h = f = null, k = 0, m; m = g.childNodes[k]; k++)
  17858. 1 == m.nodeType && ("block" == m.nodeName.toLowerCase() ? f = m : "shadow" == m.nodeName.toLowerCase() && (h = m));
  17859. !f && h && (f = h);
  17860. k = g.getAttribute("name");
  17861. switch (g.nodeName.toLowerCase()) {
  17862. case "mutation":
  17863. c.domToMutation && (c.domToMutation(g),
  17864. c.initSvg && c.initSvg());
  17865. break;
  17866. case "comment":
  17867. c.setCommentText(g.textContent);
  17868. var p = g.getAttribute("pinned");
  17869. p && !c.isInFlyout && setTimeout(function () {
  17870. c.comment && c.comment.setVisible && c.comment.setVisible("true" == p)
  17871. }, 1);
  17872. f = parseInt(g.getAttribute("w"), 10);
  17873. g = parseInt(g.getAttribute("h"), 10);
  17874. !isNaN(f) && !isNaN(g) && c.comment && c.comment.setVisible && c.comment.setBubbleSize(f, g);
  17875. break;
  17876. case "data":
  17877. c.data = g.textContent;
  17878. break;
  17879. case "title":
  17880. case "field":
  17881. f = c.getField(k);
  17882. if (!f) {
  17883. console.warn("Ignoring non-existent field " + k + " in block " + d);
  17884. break
  17885. }
  17886. f.setValue(g.textContent);
  17887. break;
  17888. case "value":
  17889. case "statement":
  17890. g = c.getInput(k);
  17891. if (!g) {
  17892. console.warn("Ignoring non-existent input " + k + " in block " + d);
  17893. break
  17894. }
  17895. h && g.connection.setShadowDom(h);
  17896. f && (f = Blockly.Xml.domToBlockHeadless_(f, b),
  17897. f.outputConnection ? g.connection.connect(f.outputConnection) : f.previousConnection ? g.connection.connect(f.previousConnection) : goog.asserts.fail("Child block does not have output or previous statement."));
  17898. break;
  17899. case "next":
  17900. h && c.nextConnection && c.nextConnection.setShadowDom(h);
  17901. f && (goog.asserts.assert(c.nextConnection, "Next statement does not exist."),
  17902. goog.asserts.assert(!c.nextConnection.isConnected(), "Next statement is already connected."),
  17903. f = Blockly.Xml.domToBlockHeadless_(f, b),
  17904. goog.asserts.assert(f.previousConnection, "Next block does not have previous statement."),
  17905. c.nextConnection.connect(f.previousConnection));
  17906. break;
  17907. default:
  17908. console.warn("Ignoring unknown tag: " + g.nodeName)
  17909. }
  17910. }
  17911. (e = a.getAttribute("inline")) && c.setInputsInline("true" == e);
  17912. (e = a.getAttribute("disabled")) && c.setDisabled("true" == e);
  17913. (e = a.getAttribute("deletable")) && c.setDeletable("true" == e);
  17914. (e = a.getAttribute("movable")) && c.setMovable("true" == e);
  17915. (e = a.getAttribute("editable")) && c.setEditable("true" == e);
  17916. (e = a.getAttribute("collapsed")) && c.setCollapsed("true" == e);
  17917. if ("shadow" == a.nodeName.toLowerCase()) {
  17918. d = c.getChildren();
  17919. for (e = 0; g = d[e]; e++)
  17920. goog.asserts.assert(g.isShadow(), "Shadow block not allowed non-shadow child.");
  17921. goog.asserts.assert(0 == c.getVars().length, "Shadow blocks cannot have variable fields.");
  17922. c.setShadow(!0)
  17923. }
  17924. return c
  17925. }
  17926. ;
  17927. Blockly.Xml.deleteNext = function (a) {
  17928. for (var b = 0, c; c = a.childNodes[b]; b++)
  17929. if ("next" == c.nodeName.toLowerCase()) {
  17930. a.removeChild(c);
  17931. break
  17932. }
  17933. }
  17934. ;
  17935. goog.global.Blockly || (goog.global.Blockly = {});
  17936. goog.global.Blockly.Xml || (goog.global.Blockly.Xml = {});
  17937. goog.global.Blockly.Xml.domToText = Blockly.Xml.domToText;
  17938. goog.global.Blockly.Xml.domToWorkspace = Blockly.Xml.domToWorkspace;
  17939. goog.global.Blockly.Xml.textToDom = Blockly.Xml.textToDom;
  17940. goog.global.Blockly.Xml.workspaceToDom = Blockly.Xml.workspaceToDom;
  17941. Blockly.ZoomControls = function (a) {
  17942. this.workspace_ = a
  17943. }
  17944. ;
  17945. Blockly.ZoomControls.prototype.WIDTH_ = 32;
  17946. Blockly.ZoomControls.prototype.HEIGHT_ = 110;
  17947. Blockly.ZoomControls.prototype.MARGIN_BOTTOM_ = 20;
  17948. Blockly.ZoomControls.prototype.MARGIN_SIDE_ = 20;
  17949. Blockly.ZoomControls.prototype.svgGroup_ = null;
  17950. Blockly.ZoomControls.prototype.left_ = 0;
  17951. Blockly.ZoomControls.prototype.top_ = 0;
  17952. Blockly.ZoomControls.prototype.createDom = function () {
  17953. var a = this.workspace_;
  17954. this.svgGroup_ = Blockly.createSvgElement("g", {
  17955. "class": "blocklyZoom"
  17956. }, null);
  17957. var b = String(Math.random()).substring(2)
  17958. , c = Blockly.createSvgElement("clipPath", {
  17959. id: "blocklyZoomoutClipPath" + b
  17960. }, this.svgGroup_);
  17961. Blockly.createSvgElement("rect", {
  17962. width: 32,
  17963. height: 32,
  17964. y: 77
  17965. }, c);
  17966. var d = Blockly.createSvgElement("image", {
  17967. width: Blockly.SPRITE.width,
  17968. height: Blockly.SPRITE.height,
  17969. x: -64,
  17970. y: -15,
  17971. "clip-path": "url(#blocklyZoomoutClipPath" + b + ")"
  17972. }, this.svgGroup_);
  17973. d.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", a.options.pathToMedia + Blockly.SPRITE.url);
  17974. c = Blockly.createSvgElement("clipPath", {
  17975. id: "blocklyZoominClipPath" + b
  17976. }, this.svgGroup_);
  17977. Blockly.createSvgElement("rect", {
  17978. width: 32,
  17979. height: 32,
  17980. y: 43
  17981. }, c);
  17982. var e = Blockly.createSvgElement("image", {
  17983. width: Blockly.SPRITE.width,
  17984. height: Blockly.SPRITE.height,
  17985. x: -32,
  17986. y: -49,
  17987. "clip-path": "url(#blocklyZoominClipPath" + b + ")"
  17988. }, this.svgGroup_);
  17989. e.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", a.options.pathToMedia + Blockly.SPRITE.url);
  17990. c = Blockly.createSvgElement("clipPath", {
  17991. id: "blocklyZoomresetClipPath" + b
  17992. }, this.svgGroup_);
  17993. Blockly.createSvgElement("rect", {
  17994. width: 32,
  17995. height: 32
  17996. }, c);
  17997. b = Blockly.createSvgElement("image", {
  17998. width: Blockly.SPRITE.width,
  17999. height: Blockly.SPRITE.height,
  18000. y: -92,
  18001. "clip-path": "url(#blocklyZoomresetClipPath" + b + ")"
  18002. }, this.svgGroup_);
  18003. b.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", a.options.pathToMedia + Blockly.SPRITE.url);
  18004. Blockly.bindEventWithChecks_(b, "mousedown", null, function (b) {
  18005. a.markFocused();
  18006. a.setScale(a.options.zoomOptions.startScale);
  18007. a.scrollCenter();
  18008. Blockly.Touch.clearTouchIdentifier();
  18009. b.stopPropagation();
  18010. b.preventDefault()
  18011. });
  18012. Blockly.bindEventWithChecks_(e, "mousedown", null, function (b) {
  18013. a.markFocused();
  18014. a.zoomCenter(1);
  18015. Blockly.Touch.clearTouchIdentifier();
  18016. b.stopPropagation();
  18017. b.preventDefault()
  18018. });
  18019. Blockly.bindEventWithChecks_(d, "mousedown", null, function (b) {
  18020. a.markFocused();
  18021. a.zoomCenter(-1);
  18022. Blockly.Touch.clearTouchIdentifier();
  18023. b.stopPropagation();
  18024. b.preventDefault()
  18025. });
  18026. return this.svgGroup_
  18027. }
  18028. ;
  18029. Blockly.ZoomControls.prototype.init = function (a) {
  18030. this.bottom_ = this.MARGIN_BOTTOM_ + a;
  18031. return this.bottom_ + this.HEIGHT_
  18032. }
  18033. ;
  18034. Blockly.ZoomControls.prototype.dispose = function () {
  18035. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  18036. this.svgGroup_ = null);
  18037. this.workspace_ = null
  18038. }
  18039. ;
  18040. Blockly.ZoomControls.prototype.position = function () {
  18041. var a = this.workspace_.getMetrics();
  18042. a && (this.workspace_.RTL ? (this.left_ = this.MARGIN_SIDE_ + Blockly.Scrollbar.scrollbarThickness,
  18043. a.toolboxPosition == Blockly.TOOLBOX_AT_LEFT && (this.left_ += a.flyoutWidth,
  18044. this.workspace_.toolbox_ && (this.left_ += a.absoluteLeft))) : (this.left_ = a.viewWidth + a.absoluteLeft - this.WIDTH_ - this.MARGIN_SIDE_ - Blockly.Scrollbar.scrollbarThickness,
  18045. a.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT && (this.left_ -= a.flyoutWidth)),
  18046. this.top_ = a.viewHeight + a.absoluteTop - this.HEIGHT_ - this.bottom_,
  18047. a.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM && (this.top_ -= a.flyoutHeight),
  18048. this.svgGroup_.setAttribute("transform", "translate(" + this.left_ + "," + this.top_ + ")"))
  18049. }
  18050. ;
  18051. Blockly.WorkspaceSvg = function (a) {
  18052. Blockly.WorkspaceSvg.superClass_.constructor.call(this, a);
  18053. this.getMetrics = a.getMetrics || Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_;
  18054. this.setMetrics = a.setMetrics || Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_;
  18055. Blockly.ConnectionDB.init(this);
  18056. this.SOUNDS_ = Object.create(null);
  18057. this.highlightedBlocks_ = []
  18058. }
  18059. ;
  18060. goog.inherits(Blockly.WorkspaceSvg, Blockly.Workspace);
  18061. Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null;
  18062. Blockly.WorkspaceSvg.prototype.rendered = !0;
  18063. Blockly.WorkspaceSvg.prototype.isFlyout = !1;
  18064. Blockly.WorkspaceSvg.prototype.isMutator = !1;
  18065. Blockly.WorkspaceSvg.prototype.dragMode_ = Blockly.DRAG_NONE;
  18066. Blockly.WorkspaceSvg.prototype.resizesEnabled_ = !0;
  18067. Blockly.WorkspaceSvg.prototype.scrollX = 0;
  18068. Blockly.WorkspaceSvg.prototype.scrollY = 0;
  18069. Blockly.WorkspaceSvg.prototype.startScrollX = 0;
  18070. Blockly.WorkspaceSvg.prototype.startScrollY = 0;
  18071. Blockly.WorkspaceSvg.prototype.dragDeltaXY_ = null;
  18072. Blockly.WorkspaceSvg.prototype.scale = 1;
  18073. Blockly.WorkspaceSvg.prototype.trashcan = null;
  18074. Blockly.WorkspaceSvg.prototype.scrollbar = null;
  18075. Blockly.WorkspaceSvg.prototype.lastSound_ = null;
  18076. Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_ = null;
  18077. Blockly.WorkspaceSvg.prototype.inverseScreenCTM_ = null;
  18078. Blockly.WorkspaceSvg.prototype.getInverseScreenCTM = function () {
  18079. return this.inverseScreenCTM_
  18080. }
  18081. ;
  18082. Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM = function () {
  18083. var a = this.getParentSvg().getScreenCTM();
  18084. a && (this.inverseScreenCTM_ = a.inverse())
  18085. }
  18086. ;
  18087. Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper = function (a) {
  18088. this.resizeHandlerWrapper_ = a
  18089. }
  18090. ;
  18091. Blockly.WorkspaceSvg.prototype.createDom = function (a) {
  18092. this.svgGroup_ = Blockly.createSvgElement("g", {
  18093. "class": "blocklyWorkspace"
  18094. }, null);
  18095. a && (this.svgBackground_ = Blockly.createSvgElement("rect", {
  18096. height: "100%",
  18097. width: "100%",
  18098. "class": a
  18099. }, this.svgGroup_),
  18100. "blocklyMainBackground" == a && (this.svgBackground_.style.fill = "url(#" + this.options.gridPattern.id + ")"));
  18101. this.svgBlockCanvas_ = Blockly.createSvgElement("g", {
  18102. "class": "blocklyBlockCanvas"
  18103. }, this.svgGroup_, this);
  18104. this.svgBubbleCanvas_ = Blockly.createSvgElement("g", {
  18105. "class": "blocklyBubbleCanvas"
  18106. }, this.svgGroup_, this);
  18107. a = Blockly.Scrollbar.scrollbarThickness;
  18108. this.options.hasTrashcan && (a = this.addTrashcan_(a));
  18109. this.options.zoomOptions && this.options.zoomOptions.controls && (a = this.addZoomControls_(a));
  18110. if (!this.isFlyout) {
  18111. Blockly.bindEventWithChecks_(this.svgGroup_, "mousedown", this, this.onMouseDown_);
  18112. var b = this;
  18113. Blockly.bindEvent_(this.svgGroup_, "touchstart", null, function (a) {
  18114. Blockly.longStart_(a, b)
  18115. });
  18116. this.options.zoomOptions && this.options.zoomOptions.wheel && Blockly.bindEventWithChecks_(this.svgGroup_, "wheel", this, this.onMouseWheel_)
  18117. }
  18118. this.options.hasCategories ? this.toolbox_ = new Blockly.Toolbox(this) : this.options.languageTree && this.addFlyout_();
  18119. this.updateGridPattern_();
  18120. this.recordDeleteAreas();
  18121. return this.svgGroup_
  18122. }
  18123. ;
  18124. Blockly.WorkspaceSvg.prototype.dispose = function () {
  18125. this.rendered = !1;
  18126. Blockly.WorkspaceSvg.superClass_.dispose.call(this);
  18127. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  18128. this.svgGroup_ = null);
  18129. this.svgBubbleCanvas_ = this.svgBlockCanvas_ = null;
  18130. this.toolbox_ && (this.toolbox_.dispose(),
  18131. this.toolbox_ = null);
  18132. this.flyout_ && (this.flyout_.dispose(),
  18133. this.flyout_ = null);
  18134. this.trashcan && (this.trashcan.dispose(),
  18135. this.trashcan = null);
  18136. this.scrollbar && (this.scrollbar.dispose(),
  18137. this.scrollbar = null);
  18138. this.zoomControls_ && (this.zoomControls_.dispose(),
  18139. this.zoomControls_ = null);
  18140. this.options.parentWorkspace || goog.dom.removeNode(this.getParentSvg().parentNode);
  18141. this.resizeHandlerWrapper_ && (Blockly.unbindEvent_(this.resizeHandlerWrapper_),
  18142. this.resizeHandlerWrapper_ = null)
  18143. }
  18144. ;
  18145. Blockly.WorkspaceSvg.prototype.newBlock = function (a, b) {
  18146. return new Blockly.BlockSvg(this, a, b)
  18147. }
  18148. ;
  18149. Blockly.WorkspaceSvg.prototype.addTrashcan_ = function (a) {
  18150. this.trashcan = new Blockly.Trashcan(this);
  18151. var b = this.trashcan.createDom();
  18152. this.svgGroup_.insertBefore(b, this.svgBlockCanvas_);
  18153. return this.trashcan.init(a)
  18154. }
  18155. ;
  18156. Blockly.WorkspaceSvg.prototype.addZoomControls_ = function (a) {
  18157. this.zoomControls_ = new Blockly.ZoomControls(this);
  18158. var b = this.zoomControls_.createDom();
  18159. this.svgGroup_.appendChild(b);
  18160. return this.zoomControls_.init(a)
  18161. }
  18162. ;
  18163. Blockly.WorkspaceSvg.prototype.addFlyout_ = function () {
  18164. this.flyout_ = new Blockly.Flyout({
  18165. disabledPatternId: this.options.disabledPatternId,
  18166. parentWorkspace: this,
  18167. RTL: this.RTL,
  18168. oneBasedIndex: this.options.oneBasedIndex,
  18169. horizontalLayout: this.horizontalLayout,
  18170. toolboxPosition: this.options.toolboxPosition
  18171. });
  18172. this.flyout_.autoClose = !1;
  18173. var a = this.flyout_.createDom();
  18174. this.svgGroup_.insertBefore(a, this.svgBlockCanvas_)
  18175. }
  18176. ;
  18177. Blockly.WorkspaceSvg.prototype.updateScreenCalculations_ = function () {
  18178. this.updateInverseScreenCTM();
  18179. this.recordDeleteAreas()
  18180. }
  18181. ;
  18182. Blockly.WorkspaceSvg.prototype.resizeContents = function () {
  18183. this.resizesEnabled_ && this.rendered && (this.scrollbar && this.scrollbar.resize(),
  18184. this.updateInverseScreenCTM())
  18185. }
  18186. ;
  18187. Blockly.WorkspaceSvg.prototype.resize = function () {
  18188. this.toolbox_ && this.toolbox_.position();
  18189. this.flyout_ && this.flyout_.position();
  18190. this.trashcan && this.trashcan.position();
  18191. this.zoomControls_ && this.zoomControls_.position();
  18192. this.scrollbar && this.scrollbar.resize();
  18193. this.updateScreenCalculations_()
  18194. }
  18195. ;
  18196. Blockly.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled = function () {
  18197. var a = goog.dom.getDocumentScroll();
  18198. goog.math.Coordinate.equals(this.lastRecordedPageScroll_, a) || (this.lastRecordedPageScroll_ = a,
  18199. this.updateScreenCalculations_())
  18200. }
  18201. ;
  18202. Blockly.WorkspaceSvg.prototype.getCanvas = function () {
  18203. return this.svgBlockCanvas_
  18204. }
  18205. ;
  18206. Blockly.WorkspaceSvg.prototype.getBubbleCanvas = function () {
  18207. return this.svgBubbleCanvas_
  18208. }
  18209. ;
  18210. Blockly.WorkspaceSvg.prototype.getParentSvg = function () {
  18211. if (this.cachedParentSvg_)
  18212. return this.cachedParentSvg_;
  18213. for (var a = this.svgGroup_; a;) {
  18214. if ("svg" == a.tagName)
  18215. return this.cachedParentSvg_ = a;
  18216. a = a.parentNode
  18217. }
  18218. return null
  18219. }
  18220. ;
  18221. Blockly.WorkspaceSvg.prototype.translate = function (a, b) {
  18222. var c = "translate(" + a + "," + b + ") scale(" + this.scale + ")";
  18223. this.svgBlockCanvas_.setAttribute("transform", c);
  18224. this.svgBubbleCanvas_.setAttribute("transform", c)
  18225. }
  18226. ;
  18227. Blockly.WorkspaceSvg.prototype.getWidth = function () {
  18228. var a = this.getMetrics();
  18229. return a ? a.viewWidth / this.scale : 0
  18230. }
  18231. ;
  18232. Blockly.WorkspaceSvg.prototype.setVisible = function (a) {
  18233. this.getParentSvg().style.display = a ? "block" : "none";
  18234. this.toolbox_ && (this.toolbox_.HtmlDiv.style.display = a ? "block" : "none");
  18235. a ? (this.render(),
  18236. this.toolbox_ && this.toolbox_.position()) : Blockly.hideChaff(!0)
  18237. }
  18238. ;
  18239. Blockly.WorkspaceSvg.prototype.render = function () {
  18240. for (var a = this.getAllBlocks(), b = a.length - 1; 0 <= b; b--)
  18241. a[b].render(!1)
  18242. }
  18243. ;
  18244. Blockly.WorkspaceSvg.prototype.traceOn = function () {
  18245. console.warn("Deprecated call to traceOn, delete this.")
  18246. }
  18247. ;
  18248. Blockly.WorkspaceSvg.prototype.highlightBlock = function (a, b) {
  18249. if (void 0 === b) {
  18250. for (var c = 0, d; d = this.highlightedBlocks_[c]; c++)
  18251. d.setHighlighted(!1);
  18252. this.highlightedBlocks_.length = 0
  18253. }
  18254. if (d = a ? this.getBlockById(a) : null)
  18255. (c = void 0 === b || b) ? -1 == this.highlightedBlocks_.indexOf(d) && this.highlightedBlocks_.push(d) : goog.array.remove(this.highlightedBlocks_, d),
  18256. d.setHighlighted(c)
  18257. }
  18258. ;
  18259. Blockly.WorkspaceSvg.prototype.paste = function (a) {
  18260. if (this.rendered && !(a.getElementsByTagName("block").length >= this.remainingCapacity())) {
  18261. Blockly.terminateDrag_();
  18262. Blockly.Events.disable();
  18263. try {
  18264. var b = Blockly.Xml.domToBlock(a, this)
  18265. , c = parseInt(a.getAttribute("x"), 10)
  18266. , d = parseInt(a.getAttribute("y"), 10);
  18267. if (!isNaN(c) && !isNaN(d)) {
  18268. this.RTL && (c = -c);
  18269. do {
  18270. a = !1;
  18271. for (var e = this.getAllBlocks(), f = 0, g; g = e[f]; f++) {
  18272. var h = g.getRelativeToSurfaceXY();
  18273. if (1 >= Math.abs(c - h.x) && 1 >= Math.abs(d - h.y)) {
  18274. a = !0;
  18275. break
  18276. }
  18277. }
  18278. if (!a) {
  18279. var k = b.getConnections_(!1);
  18280. f = 0;
  18281. for (var m; m = k[f]; f++)
  18282. if (m.closest(Blockly.SNAP_RADIUS, new goog.math.Coordinate(c, d)).connection) {
  18283. a = !0;
  18284. break
  18285. }
  18286. }
  18287. a && (c = this.RTL ? c - Blockly.SNAP_RADIUS : c + Blockly.SNAP_RADIUS,
  18288. d += 2 * Blockly.SNAP_RADIUS)
  18289. } while (a); b.moveBy(c, d)
  18290. }
  18291. } finally {
  18292. Blockly.Events.enable()
  18293. }
  18294. Blockly.Events.isEnabled() && !b.isShadow() && Blockly.Events.fire(new Blockly.Events.Create(b));
  18295. b.select()
  18296. }
  18297. }
  18298. ;
  18299. Blockly.WorkspaceSvg.prototype.createVariable = function (a) {
  18300. Blockly.WorkspaceSvg.superClass_.createVariable.call(this, a);
  18301. this.toolbox_ && this.toolbox_.flyout_ && !Blockly.Flyout.startFlyout_ && this.toolbox_.refreshSelection()
  18302. }
  18303. ;
  18304. Blockly.WorkspaceSvg.prototype.recordDeleteAreas = function () {
  18305. this.deleteAreaTrash_ = this.trashcan ? this.trashcan.getClientRect() : null;
  18306. this.deleteAreaToolbox_ = this.flyout_ ? this.flyout_.getClientRect() : this.toolbox_ ? this.toolbox_.getClientRect() : null
  18307. }
  18308. ;
  18309. Blockly.WorkspaceSvg.prototype.isDeleteArea = function (a) {
  18310. a = new goog.math.Coordinate(a.clientX, a.clientY);
  18311. if (this.deleteAreaTrash_) {
  18312. if (this.deleteAreaTrash_.contains(a))
  18313. return this.trashcan.setOpen_(!0),
  18314. Blockly.Css.setCursor(Blockly.Css.Cursor.DELETE),
  18315. !0;
  18316. this.trashcan.setOpen_(!1)
  18317. }
  18318. if (this.deleteAreaToolbox_ && this.deleteAreaToolbox_.contains(a))
  18319. return Blockly.Css.setCursor(Blockly.Css.Cursor.DELETE),
  18320. !0;
  18321. Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);
  18322. return !1
  18323. }
  18324. ;
  18325. Blockly.WorkspaceSvg.prototype.onMouseDown_ = function (a) {
  18326. this.markFocused();
  18327. Blockly.isTargetInput_(a) ? Blockly.Touch.clearTouchIdentifier() : (Blockly.terminateDrag_(),
  18328. Blockly.hideChaff(),
  18329. a.target && a.target.nodeName && ("svg" == a.target.nodeName.toLowerCase() || a.target == this.svgBackground_) && Blockly.selected && !this.options.readOnly && Blockly.selected.unselect(),
  18330. Blockly.isRightButton(a) ? (this.showContextMenu_(a),
  18331. Blockly.Touch.clearTouchIdentifier()) : this.scrollbar ? (this.dragMode_ = Blockly.DRAG_BEGIN,
  18332. this.startDragMouseX = a.clientX,
  18333. this.startDragMouseY = a.clientY,
  18334. this.startDragMetrics = this.getMetrics(),
  18335. this.startScrollX = this.scrollX,
  18336. this.startScrollY = this.scrollY,
  18337. "mouseup" in Blockly.Touch.TOUCH_MAP && (Blockly.Touch.onTouchUpWrapper_ = Blockly.Touch.onTouchUpWrapper_ || [],
  18338. Blockly.Touch.onTouchUpWrapper_ = Blockly.Touch.onTouchUpWrapper_.concat(Blockly.bindEventWithChecks_(document, "mouseup", null, Blockly.onMouseUp_))),
  18339. Blockly.onMouseMoveWrapper_ = Blockly.onMouseMoveWrapper_ || [],
  18340. Blockly.onMouseMoveWrapper_ = Blockly.onMouseMoveWrapper_.concat(Blockly.bindEventWithChecks_(document, "mousemove", null, Blockly.onMouseMove_))) : Blockly.Touch.clearTouchIdentifier(),
  18341. a.stopPropagation(),
  18342. a.preventDefault())
  18343. }
  18344. ;
  18345. Blockly.WorkspaceSvg.prototype.startDrag = function (a, b) {
  18346. var c = Blockly.mouseToSvg(a, this.getParentSvg(), this.getInverseScreenCTM());
  18347. c.x /= this.scale;
  18348. c.y /= this.scale;
  18349. this.dragDeltaXY_ = goog.math.Coordinate.difference(b, c)
  18350. }
  18351. ;
  18352. Blockly.WorkspaceSvg.prototype.moveDrag = function (a) {
  18353. a = Blockly.mouseToSvg(a, this.getParentSvg(), this.getInverseScreenCTM());
  18354. a.x /= this.scale;
  18355. a.y /= this.scale;
  18356. return goog.math.Coordinate.sum(this.dragDeltaXY_, a)
  18357. }
  18358. ;
  18359. Blockly.WorkspaceSvg.prototype.isDragging = function () {
  18360. return Blockly.dragMode_ == Blockly.DRAG_FREE || Blockly.Flyout.startFlyout_ && Blockly.Flyout.startFlyout_.dragMode_ == Blockly.DRAG_FREE || this.dragMode_ == Blockly.DRAG_FREE
  18361. }
  18362. ;
  18363. Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function (a) {
  18364. Blockly.terminateDrag_();
  18365. var b = 0 < a.deltaY ? -1 : 1
  18366. , c = Blockly.mouseToSvg(a, this.getParentSvg(), this.getInverseScreenCTM());
  18367. this.zoom(c.x, c.y, b);
  18368. a.preventDefault()
  18369. }
  18370. ;
  18371. Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox = function () {
  18372. var a = this.getTopBlocks(!1);
  18373. if (!a.length)
  18374. return {
  18375. x: 0,
  18376. y: 0,
  18377. width: 0,
  18378. height: 0
  18379. };
  18380. for (var b = a[0].getBoundingRectangle(), c = 1; c < a.length; c++) {
  18381. var d = a[c].getBoundingRectangle();
  18382. d.topLeft.x < b.topLeft.x && (b.topLeft.x = d.topLeft.x);
  18383. d.bottomRight.x > b.bottomRight.x && (b.bottomRight.x = d.bottomRight.x);
  18384. d.topLeft.y < b.topLeft.y && (b.topLeft.y = d.topLeft.y);
  18385. d.bottomRight.y > b.bottomRight.y && (b.bottomRight.y = d.bottomRight.y)
  18386. }
  18387. return {
  18388. x: b.topLeft.x,
  18389. y: b.topLeft.y,
  18390. width: b.bottomRight.x - b.topLeft.x,
  18391. height: b.bottomRight.y - b.topLeft.y
  18392. }
  18393. }
  18394. ;
  18395. Blockly.WorkspaceSvg.prototype.cleanUp = function () {
  18396. Blockly.Events.setGroup(!0);
  18397. for (var a = this.getTopBlocks(!0), b = 0, c = 0, d; d = a[c]; c++) {
  18398. var e = d.getRelativeToSurfaceXY();
  18399. d.moveBy(-e.x, b - e.y);
  18400. d.snapToGrid();
  18401. b = d.getRelativeToSurfaceXY().y + d.getHeightWidth().height + Blockly.BlockSvg.MIN_BLOCK_Y
  18402. }
  18403. Blockly.Events.setGroup(!1);
  18404. this.resizeContents()
  18405. }
  18406. ;
  18407. Blockly.WorkspaceSvg.prototype.showContextMenu_ = function (a) {
  18408. function b(a) {
  18409. if (a.isDeletable())
  18410. l = l.concat(a.getDescendants());
  18411. else {
  18412. a = a.getChildren();
  18413. for (var c = 0; c < a.length; c++)
  18414. b(a[c])
  18415. }
  18416. }
  18417. function c() {
  18418. Blockly.Events.setGroup(f);
  18419. var a = l.shift();
  18420. a && (a.workspace ? (a.dispose(!1, !0),
  18421. setTimeout(c, 10)) : c());
  18422. Blockly.Events.setGroup(!1)
  18423. }
  18424. if (!this.options.readOnly && !this.isFlyout) {
  18425. var d = []
  18426. , e = this.getTopBlocks(!0)
  18427. , f = Blockly.genUid()
  18428. , g = {};
  18429. g.text = Blockly.Msg.UNDO;
  18430. g.enabled = 0 < this.undoStack_.length;
  18431. g.callback = this.undo.bind(this, !1);
  18432. d.push(g);
  18433. g = {};
  18434. g.text = Blockly.Msg.REDO;
  18435. g.enabled = 0 < this.redoStack_.length;
  18436. g.callback = this.undo.bind(this, !0);
  18437. d.push(g);
  18438. this.scrollbar && (g = {},
  18439. g.text = Blockly.Msg.CLEAN_UP,
  18440. g.enabled = 1 < e.length,
  18441. g.callback = this.cleanUp.bind(this),
  18442. d.push(g));
  18443. if (this.options.collapse) {
  18444. for (var h = g = !1, k = 0; k < e.length; k++)
  18445. for (var m = e[k]; m;)
  18446. m.isCollapsed() ? g = !0 : h = !0,
  18447. m = m.getNextBlock();
  18448. var p = function (a) {
  18449. for (var b = 0, c = 0; c < e.length; c++)
  18450. for (var d = e[c]; d;)
  18451. setTimeout(d.setCollapsed.bind(d, a), b),
  18452. d = d.getNextBlock(),
  18453. b += 10
  18454. };
  18455. h = {
  18456. enabled: h
  18457. };
  18458. h.text = Blockly.Msg.COLLAPSE_ALL;
  18459. h.callback = function () {
  18460. p(!0)
  18461. }
  18462. ;
  18463. d.push(h);
  18464. g = {
  18465. enabled: g
  18466. };
  18467. g.text = Blockly.Msg.EXPAND_ALL;
  18468. g.callback = function () {
  18469. p(!1)
  18470. }
  18471. ;
  18472. d.push(g)
  18473. }
  18474. var l = [];
  18475. for (k = 0; k < e.length; k++)
  18476. b(e[k]);
  18477. g = {
  18478. text: 1 == l.length ? Blockly.Msg.DELETE_BLOCK : Blockly.Msg.DELETE_X_BLOCKS.replace("%1", String(l.length)),
  18479. enabled: 0 < l.length,
  18480. callback: function () {
  18481. 2 > l.length ? c() : Blockly.confirm(Blockly.Msg.DELETE_ALL_BLOCKS.replace("%1", l.length), function (a) {
  18482. a && c()
  18483. })
  18484. }
  18485. };
  18486. d.push(g);
  18487. Blockly.ContextMenu.show(a, d, this.RTL)
  18488. }
  18489. }
  18490. ;
  18491. Blockly.WorkspaceSvg.prototype.loadAudio_ = function (a, b) {
  18492. if (a.length) {
  18493. try {
  18494. var c = new window.Audio
  18495. } catch (h) {
  18496. return
  18497. }
  18498. for (var d, e = 0; e < a.length; e++) {
  18499. var f = a[e]
  18500. , g = f.match(/\.(\w+)$/);
  18501. if (g && c.canPlayType("audio/" + g[1])) {
  18502. d = new window.Audio(f);
  18503. break
  18504. }
  18505. }
  18506. d && d.play && (this.SOUNDS_[b] = d)
  18507. }
  18508. }
  18509. ;
  18510. Blockly.WorkspaceSvg.prototype.preloadAudio_ = function () {
  18511. for (var a in this.SOUNDS_) {
  18512. var b = this.SOUNDS_[a];
  18513. b.volume = .01;
  18514. b.play();
  18515. b.pause();
  18516. if (goog.userAgent.IPAD || goog.userAgent.IPHONE)
  18517. break
  18518. }
  18519. }
  18520. ;
  18521. Blockly.WorkspaceSvg.prototype.playAudio = function (a, b) {
  18522. var c = this.SOUNDS_[a];
  18523. if (c) {
  18524. var d = new Date;
  18525. d - this.lastSound_ < Blockly.SOUND_LIMIT || (this.lastSound_ = d,
  18526. c = goog.userAgent.DOCUMENT_MODE && 9 === goog.userAgent.DOCUMENT_MODE || goog.userAgent.IPAD || goog.userAgent.ANDROID ? c : c.cloneNode(),
  18527. c.volume = void 0 === b ? 1 : b,
  18528. c.play())
  18529. } else
  18530. this.options.parentWorkspace && this.options.parentWorkspace.playAudio(a, b)
  18531. }
  18532. ;
  18533. Blockly.WorkspaceSvg.prototype.updateToolbox = function (a) {
  18534. if (a = Blockly.Options.parseToolboxTree(a)) {
  18535. if (!this.options.languageTree)
  18536. throw "Existing toolbox is null. Can't create new toolbox.";
  18537. if (a.getElementsByTagName("category").length) {
  18538. if (!this.toolbox_)
  18539. throw "Existing toolbox has no categories. Can't change mode.";
  18540. this.options.languageTree = a;
  18541. this.toolbox_.populate_(a);
  18542. this.toolbox_.addColour_()
  18543. } else {
  18544. if (!this.flyout_)
  18545. throw "Existing toolbox has categories. Can't change mode.";
  18546. this.options.languageTree = a;
  18547. this.flyout_.show(a.childNodes)
  18548. }
  18549. } else if (this.options.languageTree)
  18550. throw "Can't nullify an existing toolbox.";
  18551. }
  18552. ;
  18553. Blockly.WorkspaceSvg.prototype.markFocused = function () {
  18554. this.options.parentWorkspace ? this.options.parentWorkspace.markFocused() : Blockly.mainWorkspace = this
  18555. }
  18556. ;
  18557. Blockly.WorkspaceSvg.prototype.zoom = function (a, b, c) {
  18558. var d = this.options.zoomOptions.scaleSpeed
  18559. , e = this.getMetrics()
  18560. , f = this.getParentSvg().createSVGPoint();
  18561. f.x = a;
  18562. f.y = b;
  18563. f = f.matrixTransform(this.getCanvas().getCTM().inverse());
  18564. a = f.x;
  18565. b = f.y;
  18566. f = this.getCanvas();
  18567. d = 1 == c ? d : 1 / d;
  18568. c = this.scale * d;
  18569. c > this.options.zoomOptions.maxScale ? d = this.options.zoomOptions.maxScale / this.scale : c < this.options.zoomOptions.minScale && (d = this.options.zoomOptions.minScale / this.scale);
  18570. this.scale != c && (this.scrollbar && (a = f.getCTM().translate(a * (1 - d), b * (1 - d)).scale(d),
  18571. this.scrollX = a.e - e.absoluteLeft,
  18572. this.scrollY = a.f - e.absoluteTop),
  18573. this.setScale(c))
  18574. }
  18575. ;
  18576. Blockly.WorkspaceSvg.prototype.zoomCenter = function (a) {
  18577. var b = this.getMetrics();
  18578. this.zoom(b.viewWidth / 2, b.viewHeight / 2, a)
  18579. }
  18580. ;
  18581. Blockly.WorkspaceSvg.prototype.zoomToFit = function () {
  18582. var a = this.getMetrics()
  18583. , b = this.getBlocksBoundingBox()
  18584. , c = b.width;
  18585. b = b.height;
  18586. if (c) {
  18587. var d = a.viewWidth
  18588. , e = a.viewHeight;
  18589. this.flyout_ && (d -= this.flyout_.width_);
  18590. this.scrollbar || (c += a.contentLeft,
  18591. b += a.contentTop);
  18592. this.setScale(Math.min(d / c, e / b));
  18593. this.scrollCenter()
  18594. }
  18595. }
  18596. ;
  18597. Blockly.WorkspaceSvg.prototype.scrollCenter = function () {
  18598. if (this.scrollbar) {
  18599. var a = this.getMetrics()
  18600. , b = (a.contentWidth - a.viewWidth) / 2;
  18601. this.flyout_ && (b -= this.flyout_.width_ / 2);
  18602. this.scrollbar.set(b, (a.contentHeight - a.viewHeight) / 2)
  18603. }
  18604. }
  18605. ;
  18606. Blockly.WorkspaceSvg.prototype.setScale = function (a) {
  18607. this.options.zoomOptions.maxScale && a > this.options.zoomOptions.maxScale ? a = this.options.zoomOptions.maxScale : this.options.zoomOptions.minScale && a < this.options.zoomOptions.minScale && (a = this.options.zoomOptions.minScale);
  18608. this.scale = a;
  18609. this.updateGridPattern_();
  18610. this.scrollbar ? this.scrollbar.resize() : this.translate(this.scrollX, this.scrollY);
  18611. Blockly.hideChaff(!1);
  18612. this.flyout_ && this.flyout_.reflow()
  18613. }
  18614. ;
  18615. Blockly.WorkspaceSvg.prototype.updateGridPattern_ = function () {
  18616. if (this.options.gridPattern) {
  18617. var a = this.options.gridOptions.spacing * this.scale || 100;
  18618. this.options.gridPattern.setAttribute("width", a);
  18619. this.options.gridPattern.setAttribute("height", a);
  18620. a = Math.floor(this.options.gridOptions.spacing / 2) + .5;
  18621. var b = a - this.options.gridOptions.length / 2
  18622. , c = a + this.options.gridOptions.length / 2
  18623. , d = this.options.gridPattern.firstChild
  18624. , e = d && d.nextSibling;
  18625. a *= this.scale;
  18626. b *= this.scale;
  18627. c *= this.scale;
  18628. d && (d.setAttribute("stroke-width", this.scale),
  18629. d.setAttribute("x1", b),
  18630. d.setAttribute("y1", a),
  18631. d.setAttribute("x2", c),
  18632. d.setAttribute("y2", a));
  18633. e && (e.setAttribute("stroke-width", this.scale),
  18634. e.setAttribute("x1", a),
  18635. e.setAttribute("y1", b),
  18636. e.setAttribute("x2", a),
  18637. e.setAttribute("y2", c))
  18638. }
  18639. }
  18640. ;
  18641. Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function () {
  18642. var a = Blockly.svgSize(this.getParentSvg());
  18643. if (this.toolbox_)
  18644. if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP || this.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM)
  18645. a.height -= this.toolbox_.getHeight();
  18646. else if (this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT || this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT)
  18647. a.width -= this.toolbox_.getWidth();
  18648. var b = Blockly.Flyout.prototype.CORNER_RADIUS - 1
  18649. , c = a.width - b
  18650. , d = a.height - b
  18651. , e = this.getBlocksBoundingBox()
  18652. , f = e.width * this.scale
  18653. , g = e.height * this.scale
  18654. , h = e.x * this.scale
  18655. , k = e.y * this.scale;
  18656. this.scrollbar ? (b = Math.min(h - c / 2, h + f - c),
  18657. c = Math.max(h + f + c / 2, h + c),
  18658. f = Math.min(k - d / 2, k + g - d),
  18659. d = Math.max(k + g + d / 2, k + d)) : (b = e.x,
  18660. c = b + e.width,
  18661. f = e.y,
  18662. d = f + e.height);
  18663. e = 0;
  18664. this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT && (e = this.toolbox_.getWidth());
  18665. g = 0;
  18666. this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_TOP && (g = this.toolbox_.getHeight());
  18667. return {
  18668. viewHeight: a.height,
  18669. viewWidth: a.width,
  18670. contentHeight: d - f,
  18671. contentWidth: c - b,
  18672. viewTop: -this.scrollY,
  18673. viewLeft: -this.scrollX,
  18674. contentTop: f,
  18675. contentLeft: b,
  18676. absoluteTop: g,
  18677. absoluteLeft: e,
  18678. toolboxWidth: this.toolbox_ ? this.toolbox_.getWidth() : 0,
  18679. toolboxHeight: this.toolbox_ ? this.toolbox_.getHeight() : 0,
  18680. flyoutWidth: this.flyout_ ? this.flyout_.getWidth() : 0,
  18681. flyoutHeight: this.flyout_ ? this.flyout_.getHeight() : 0,
  18682. toolboxPosition: this.toolboxPosition
  18683. }
  18684. }
  18685. ;
  18686. Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_ = function (a) {
  18687. if (!this.scrollbar)
  18688. throw "Attempt to set top level workspace scroll without scrollbars.";
  18689. var b = this.getMetrics();
  18690. goog.isNumber(a.x) && (this.scrollX = -b.contentWidth * a.x - b.contentLeft);
  18691. goog.isNumber(a.y) && (this.scrollY = -b.contentHeight * a.y - b.contentTop);
  18692. a = this.scrollX + b.absoluteLeft;
  18693. b = this.scrollY + b.absoluteTop;
  18694. this.translate(a, b);
  18695. this.options.gridPattern && (this.options.gridPattern.setAttribute("x", a),
  18696. this.options.gridPattern.setAttribute("y", b),
  18697. goog.userAgent.IE && this.updateGridPattern_())
  18698. }
  18699. ;
  18700. Blockly.WorkspaceSvg.prototype.setResizesEnabled = function (a) {
  18701. var b = !this.resizesEnabled_ && a;
  18702. this.resizesEnabled_ = a;
  18703. b && this.resizeContents()
  18704. }
  18705. ;
  18706. Blockly.WorkspaceSvg.prototype.clear = function () {
  18707. this.setResizesEnabled(!1);
  18708. Blockly.WorkspaceSvg.superClass_.clear.call(this);
  18709. this.setResizesEnabled(!0)
  18710. }
  18711. ;
  18712. Blockly.WorkspaceSvg.prototype.setVisible = Blockly.WorkspaceSvg.prototype.setVisible;
  18713. Blockly.Mutator = function (a) {
  18714. Blockly.Mutator.superClass_.constructor.call(this, null);
  18715. this.quarkNames_ = a
  18716. }
  18717. ;
  18718. goog.inherits(Blockly.Mutator, Blockly.Icon);
  18719. Blockly.Mutator.prototype.workspaceWidth_ = 0;
  18720. Blockly.Mutator.prototype.workspaceHeight_ = 0;
  18721. Blockly.Mutator.prototype.drawIcon_ = function (a) {
  18722. Blockly.createSvgElement("rect", {
  18723. "class": "blocklyIconShape",
  18724. rx: "4",
  18725. ry: "4",
  18726. height: "16",
  18727. width: "16"
  18728. }, a);
  18729. Blockly.createSvgElement("path", {
  18730. "class": "blocklyIconSymbol",
  18731. d: "m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"
  18732. }, a);
  18733. Blockly.createSvgElement("circle", {
  18734. "class": "blocklyIconShape",
  18735. r: "2.7",
  18736. cx: "8",
  18737. cy: "8"
  18738. }, a)
  18739. }
  18740. ;
  18741. Blockly.Mutator.prototype.iconClick_ = function (a) {
  18742. this.block_.isEditable() && Blockly.Icon.prototype.iconClick_.call(this, a)
  18743. }
  18744. ;
  18745. Blockly.Mutator.prototype.createEditor_ = function () {
  18746. this.svgDialog_ = Blockly.createSvgElement("svg", {
  18747. x: Blockly.Bubble.BORDER_WIDTH,
  18748. y: Blockly.Bubble.BORDER_WIDTH
  18749. }, null);
  18750. if (this.quarkNames_.length)
  18751. for (var a = goog.dom.createDom("xml"), b = 0, c; c = this.quarkNames_[b]; b++)
  18752. a.appendChild(goog.dom.createDom("block", {
  18753. type: c
  18754. }));
  18755. else
  18756. a = null;
  18757. a = {
  18758. languageTree: a,
  18759. parentWorkspace: this.block_.workspace,
  18760. pathToMedia: this.block_.workspace.options.pathToMedia,
  18761. RTL: this.block_.RTL,
  18762. toolboxPosition: this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT : Blockly.TOOLBOX_AT_LEFT,
  18763. horizontalLayout: !1,
  18764. getMetrics: this.getFlyoutMetrics_.bind(this),
  18765. setMetrics: null
  18766. };
  18767. this.workspace_ = new Blockly.WorkspaceSvg(a);
  18768. this.workspace_.isMutator = !0;
  18769. this.svgDialog_.appendChild(this.workspace_.createDom("blocklyMutatorBackground"));
  18770. return this.svgDialog_
  18771. }
  18772. ;
  18773. Blockly.Mutator.prototype.updateEditable = function () {
  18774. this.block_.isInFlyout || (this.block_.isEditable() ? this.iconGroup_ && Blockly.removeClass_(this.iconGroup_, "blocklyIconGroupReadonly") : (this.setVisible(!1),
  18775. this.iconGroup_ && Blockly.addClass_(this.iconGroup_, "blocklyIconGroupReadonly")));
  18776. Blockly.Icon.prototype.updateEditable.call(this)
  18777. }
  18778. ;
  18779. Blockly.Mutator.prototype.resizeBubble_ = function () {
  18780. var a = 2 * Blockly.Bubble.BORDER_WIDTH
  18781. , b = this.workspace_.getCanvas().getBBox();
  18782. var c = this.block_.RTL ? -b.x : b.width + b.x;
  18783. b = b.height + 3 * a;
  18784. if (this.workspace_.flyout_) {
  18785. var d = this.workspace_.flyout_.getMetrics_();
  18786. b = Math.max(b, d.contentHeight + 20)
  18787. }
  18788. c += 3 * a;
  18789. if (Math.abs(this.workspaceWidth_ - c) > a || Math.abs(this.workspaceHeight_ - b) > a)
  18790. this.workspaceWidth_ = c,
  18791. this.workspaceHeight_ = b,
  18792. this.bubble_.setBubbleSize(c + a, b + a),
  18793. this.svgDialog_.setAttribute("width", this.workspaceWidth_),
  18794. this.svgDialog_.setAttribute("height", this.workspaceHeight_);
  18795. this.block_.RTL && (a = "translate(" + this.workspaceWidth_ + ",0)",
  18796. this.workspace_.getCanvas().setAttribute("transform", a));
  18797. this.workspace_.resize()
  18798. }
  18799. ;
  18800. Blockly.Mutator.prototype.setVisible = function (a) {
  18801. if (a != this.isVisible())
  18802. if (Blockly.Events.fire(new Blockly.Events.Ui(this.block_, "mutatorOpen", !a, a)),
  18803. a) {
  18804. this.bubble_ = new Blockly.Bubble(this.block_.workspace, this.createEditor_(), this.block_.svgPath_, this.iconXY_, null, null);
  18805. if (a = this.workspace_.options.languageTree)
  18806. this.workspace_.flyout_.init(this.workspace_),
  18807. this.workspace_.flyout_.show(a.childNodes);
  18808. this.rootBlock_ = this.block_.decompose(this.workspace_);
  18809. a = this.rootBlock_.getDescendants();
  18810. for (var b = 0, c; c = a[b]; b++)
  18811. c.render();
  18812. this.rootBlock_.setMovable(!1);
  18813. this.rootBlock_.setDeletable(!1);
  18814. this.workspace_.flyout_ ? (a = 2 * this.workspace_.flyout_.CORNER_RADIUS,
  18815. b = this.workspace_.flyout_.width_ + a) : b = a = 16;
  18816. this.block_.RTL && (b = -b);
  18817. this.rootBlock_.moveBy(b, a);
  18818. if (this.block_.saveConnections) {
  18819. var d = this;
  18820. this.block_.saveConnections(this.rootBlock_);
  18821. this.sourceListener_ = function () {
  18822. d.block_.saveConnections(d.rootBlock_)
  18823. }
  18824. ;
  18825. this.block_.workspace.addChangeListener(this.sourceListener_)
  18826. }
  18827. this.resizeBubble_();
  18828. this.workspace_.addChangeListener(this.workspaceChanged_.bind(this));
  18829. this.updateColour()
  18830. } else
  18831. this.svgDialog_ = null,
  18832. this.workspace_.dispose(),
  18833. this.rootBlock_ = this.workspace_ = null,
  18834. this.bubble_.dispose(),
  18835. this.bubble_ = null,
  18836. this.workspaceHeight_ = this.workspaceWidth_ = 0,
  18837. this.sourceListener_ && (this.block_.workspace.removeChangeListener(this.sourceListener_),
  18838. this.sourceListener_ = null)
  18839. }
  18840. ;
  18841. Blockly.Mutator.prototype.workspaceChanged_ = function () {
  18842. if (Blockly.dragMode_ == Blockly.DRAG_NONE)
  18843. for (var a = this.workspace_.getTopBlocks(!1), b = 0, c; c = a[b]; b++) {
  18844. var d = c.getRelativeToSurfaceXY()
  18845. , e = c.getHeightWidth();
  18846. 20 > d.y + e.height && c.moveBy(0, 20 - e.height - d.y)
  18847. }
  18848. if (this.rootBlock_.workspace == this.workspace_) {
  18849. Blockly.Events.setGroup(!0);
  18850. c = this.block_;
  18851. a = (a = c.mutationToDom()) && Blockly.Xml.domToText(a);
  18852. b = c.rendered;
  18853. c.rendered = !1;
  18854. c.compose(this.rootBlock_);
  18855. c.rendered = b;
  18856. c.initSvg();
  18857. b = (b = c.mutationToDom()) && Blockly.Xml.domToText(b);
  18858. if (a != b) {
  18859. Blockly.Events.fire(new Blockly.Events.Change(c, "mutation", null, a, b));
  18860. var f = Blockly.Events.getGroup();
  18861. setTimeout(function () {
  18862. Blockly.Events.setGroup(f);
  18863. c.bumpNeighbours_();
  18864. Blockly.Events.setGroup(!1)
  18865. }, Blockly.BUMP_DELAY)
  18866. }
  18867. c.rendered && c.render();
  18868. this.resizeBubble_();
  18869. Blockly.Events.setGroup(!1)
  18870. }
  18871. }
  18872. ;
  18873. Blockly.Mutator.prototype.getFlyoutMetrics_ = function () {
  18874. return {
  18875. viewHeight: this.workspaceHeight_,
  18876. viewWidth: this.workspaceWidth_,
  18877. absoluteTop: 0,
  18878. absoluteLeft: 0
  18879. }
  18880. }
  18881. ;
  18882. Blockly.Mutator.prototype.dispose = function () {
  18883. this.block_.mutator = null;
  18884. Blockly.Icon.prototype.dispose.call(this)
  18885. }
  18886. ;
  18887. Blockly.Mutator.reconnect = function (a, b, c) {
  18888. if (!a || !a.getSourceBlock().workspace)
  18889. return !1;
  18890. c = b.getInput(c).connection;
  18891. var d = a.targetBlock();
  18892. return d && d != b || c.targetConnection == a ? !1 : (c.isConnected() && c.disconnect(),
  18893. c.connect(a),
  18894. !0)
  18895. }
  18896. ;
  18897. goog.global.Blockly || (goog.global.Blockly = {});
  18898. goog.global.Blockly.Mutator || (goog.global.Blockly.Mutator = {});
  18899. goog.global.Blockly.Mutator.reconnect = Blockly.Mutator.reconnect;
  18900. Blockly.Warning = function (a) {
  18901. Blockly.Warning.superClass_.constructor.call(this, a);
  18902. this.createIcon();
  18903. this.text_ = {}
  18904. }
  18905. ;
  18906. goog.inherits(Blockly.Warning, Blockly.Icon);
  18907. Blockly.Warning.prototype.collapseHidden = !1;
  18908. Blockly.Warning.prototype.drawIcon_ = function (a) {
  18909. Blockly.createSvgElement("path", {
  18910. "class": "blocklyIconShape",
  18911. d: "M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"
  18912. }, a);
  18913. Blockly.createSvgElement("path", {
  18914. "class": "blocklyIconSymbol",
  18915. d: "m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"
  18916. }, a);
  18917. Blockly.createSvgElement("rect", {
  18918. "class": "blocklyIconSymbol",
  18919. x: "7",
  18920. y: "11",
  18921. height: "2",
  18922. width: "2"
  18923. }, a)
  18924. }
  18925. ;
  18926. Blockly.Warning.textToDom_ = function (a) {
  18927. var b = Blockly.createSvgElement("text", {
  18928. "class": "blocklyText blocklyBubbleText",
  18929. y: Blockly.Bubble.BORDER_WIDTH
  18930. }, null);
  18931. a = a.split("\n");
  18932. for (var c = 0; c < a.length; c++) {
  18933. var d = Blockly.createSvgElement("tspan", {
  18934. dy: "1em",
  18935. x: Blockly.Bubble.BORDER_WIDTH
  18936. }, b)
  18937. , e = document.createTextNode(a[c]);
  18938. d.appendChild(e)
  18939. }
  18940. return b
  18941. }
  18942. ;
  18943. Blockly.Warning.prototype.setVisible = function (a) {
  18944. if (a != this.isVisible())
  18945. if (Blockly.Events.fire(new Blockly.Events.Ui(this.block_, "warningOpen", !a, a)),
  18946. a) {
  18947. a = Blockly.Warning.textToDom_(this.getText());
  18948. this.bubble_ = new Blockly.Bubble(this.block_.workspace, a, this.block_.svgPath_, this.iconXY_, null, null);
  18949. if (this.block_.RTL)
  18950. for (var b = a.getBBox().width, c = 0, d; d = a.childNodes[c]; c++)
  18951. d.setAttribute("text-anchor", "end"),
  18952. d.setAttribute("x", b + Blockly.Bubble.BORDER_WIDTH);
  18953. this.updateColour();
  18954. a = this.bubble_.getBubbleSize();
  18955. this.bubble_.setBubbleSize(a.width, a.height)
  18956. } else
  18957. this.bubble_.dispose(),
  18958. this.body_ = this.bubble_ = null
  18959. }
  18960. ;
  18961. Blockly.Warning.prototype.bodyFocus_ = function (a) {
  18962. this.bubble_.promote_()
  18963. }
  18964. ;
  18965. Blockly.Warning.prototype.setText = function (a, b) {
  18966. this.text_[b] != a && (a ? this.text_[b] = a : delete this.text_[b],
  18967. this.isVisible() && (this.setVisible(!1),
  18968. this.setVisible(!0)))
  18969. }
  18970. ;
  18971. Blockly.Warning.prototype.getText = function () {
  18972. var a = [], b;
  18973. for (b in this.text_)
  18974. a.push(this.text_[b]);
  18975. return a.join("\n")
  18976. }
  18977. ;
  18978. Blockly.Warning.prototype.dispose = function () {
  18979. this.block_.warning = null;
  18980. Blockly.Icon.prototype.dispose.call(this)
  18981. }
  18982. ;
  18983. Blockly.Block = function (a, b, c) {
  18984. this.id = c && !a.getBlockById(c) ? c : Blockly.genUid();
  18985. a.blockDB_[this.id] = this;
  18986. this.previousConnection = this.nextConnection = this.outputConnection = null;
  18987. this.inputList = [];
  18988. this.inputsInline = void 0;
  18989. this.disabled = !1;
  18990. this.tooltip = "";
  18991. this.contextMenu = !0;
  18992. this.parentBlock_ = null;
  18993. this.childBlocks_ = [];
  18994. this.editable_ = this.movable_ = this.deletable_ = !0;
  18995. this.collapsed_ = this.isShadow_ = !1;
  18996. this.comment = null;
  18997. this.xy_ = new goog.math.Coordinate(0, 0);
  18998. this.workspace = a;
  18999. this.isInFlyout = a.isFlyout;
  19000. this.isInMutator = a.isMutator;
  19001. this.RTL = a.RTL;
  19002. b && (this.type = b,
  19003. c = Blockly.Blocks[b],
  19004. goog.asserts.assertObject(c, 'Error: "%s" is an unknown language block.', b),
  19005. goog.mixin(this, c));
  19006. a.addTopBlock(this);
  19007. goog.isFunction(this.init) && this.init();
  19008. this.inputsInlineDefault = this.inputsInline;
  19009. Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Create(this));
  19010. goog.isFunction(this.onchange) && (this.onchangeWrapper_ = this.onchange.bind(this),
  19011. this.workspace.addChangeListener(this.onchangeWrapper_))
  19012. }
  19013. ;
  19014. Blockly.Block.obtain = function (a, b) {
  19015. console.warn("Deprecated call to Blockly.Block.obtain, use workspace.newBlock instead.");
  19016. return a.newBlock(b)
  19017. }
  19018. ;
  19019. Blockly.Block.prototype.data = null;
  19020. Blockly.Block.prototype.colour_ = "#000000";
  19021. Blockly.Block.prototype.dispose = function (a) {
  19022. if (this.workspace) {
  19023. this.onchangeWrapper_ && this.workspace.removeChangeListener(this.onchangeWrapper_);
  19024. this.unplug(a);
  19025. Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Delete(this));
  19026. Blockly.Events.disable();
  19027. try {
  19028. this.workspace && (this.workspace.removeTopBlock(this),
  19029. delete this.workspace.blockDB_[this.id],
  19030. this.workspace = null);
  19031. for (var b = this.childBlocks_.length - 1; 0 <= b; b--)
  19032. this.childBlocks_[b].dispose(!1);
  19033. b = 0;
  19034. for (var c; c = this.inputList[b]; b++)
  19035. c.dispose();
  19036. this.inputList.length = 0;
  19037. var d = this.getConnections_(!0);
  19038. for (b = 0; b < d.length; b++) {
  19039. var e = d[b];
  19040. e.isConnected() && e.disconnect();
  19041. d[b].dispose()
  19042. }
  19043. } finally {
  19044. Blockly.Events.enable()
  19045. }
  19046. }
  19047. }
  19048. ;
  19049. Blockly.Block.prototype.unplug = function (a) {
  19050. if (this.outputConnection)
  19051. this.outputConnection.isConnected() && this.outputConnection.disconnect();
  19052. else if (this.previousConnection) {
  19053. var b = null;
  19054. this.previousConnection.isConnected() && (b = this.previousConnection.targetConnection,
  19055. this.previousConnection.disconnect());
  19056. var c = this.getNextBlock();
  19057. a && c && (a = this.nextConnection.targetConnection,
  19058. a.disconnect(),
  19059. b && b.checkType_(a) && b.connect(a))
  19060. }
  19061. }
  19062. ;
  19063. Blockly.Block.prototype.getConnections_ = function () {
  19064. var a = [];
  19065. this.outputConnection && a.push(this.outputConnection);
  19066. this.previousConnection && a.push(this.previousConnection);
  19067. this.nextConnection && a.push(this.nextConnection);
  19068. for (var b = 0, c; c = this.inputList[b]; b++)
  19069. c.connection && a.push(c.connection);
  19070. return a
  19071. }
  19072. ;
  19073. Blockly.Block.prototype.lastConnectionInStack_ = function () {
  19074. for (var a = this.nextConnection; a;) {
  19075. var b = a.targetBlock();
  19076. if (!b)
  19077. return a;
  19078. a = b.nextConnection
  19079. }
  19080. return null
  19081. }
  19082. ;
  19083. Blockly.Block.prototype.bumpNeighbours_ = function () {
  19084. if (this.workspace && Blockly.dragMode_ == Blockly.DRAG_NONE) {
  19085. var a = this.getRootBlock();
  19086. if (!a.isInFlyout)
  19087. for (var b = this.getConnections_(!1), c = 0, d; d = b[c]; c++) {
  19088. d.isConnected() && d.isSuperior() && d.targetBlock().bumpNeighbours_();
  19089. for (var e = d.neighbours_(Blockly.SNAP_RADIUS), f = 0, g; g = e[f]; f++)
  19090. d.isConnected() && g.isConnected() || g.getSourceBlock().getRootBlock() != a && (d.isSuperior() ? g.bumpAwayFrom_(d) : d.bumpAwayFrom_(g))
  19091. }
  19092. }
  19093. }
  19094. ;
  19095. Blockly.Block.prototype.getParent = function () {
  19096. return this.parentBlock_
  19097. }
  19098. ;
  19099. Blockly.Block.prototype.getInputWithBlock = function (a) {
  19100. for (var b = 0, c; c = this.inputList[b]; b++)
  19101. if (c.connection && c.connection.targetBlock() == a)
  19102. return c;
  19103. return null
  19104. }
  19105. ;
  19106. Blockly.Block.prototype.getSurroundParent = function () {
  19107. var a = this;
  19108. do {
  19109. var b = a;
  19110. a = a.getParent();
  19111. if (!a)
  19112. return null
  19113. } while (a.getNextBlock() == b); return a
  19114. }
  19115. ;
  19116. Blockly.Block.prototype.getNextBlock = function () {
  19117. return this.nextConnection && this.nextConnection.targetBlock()
  19118. }
  19119. ;
  19120. Blockly.Block.prototype.getRootBlock = function () {
  19121. var a = this;
  19122. do {
  19123. var b = a;
  19124. a = b.parentBlock_
  19125. } while (a); return b
  19126. }
  19127. ;
  19128. Blockly.Block.prototype.getChildren = function () {
  19129. return this.childBlocks_
  19130. }
  19131. ;
  19132. Blockly.Block.prototype.setParent = function (a) {
  19133. if (a != this.parentBlock_) {
  19134. if (this.parentBlock_) {
  19135. goog.array.remove(this.parentBlock_.childBlocks_, this);
  19136. if (this.previousConnection && this.previousConnection.isConnected())
  19137. throw "Still connected to previous block.";
  19138. if (this.outputConnection && this.outputConnection.isConnected())
  19139. throw "Still connected to parent block.";
  19140. this.parentBlock_ = null
  19141. } else
  19142. this.workspace.removeTopBlock(this);
  19143. (this.parentBlock_ = a) ? a.childBlocks_.push(this) : this.workspace.addTopBlock(this)
  19144. }
  19145. }
  19146. ;
  19147. Blockly.Block.prototype.getDescendants = function () {
  19148. for (var a = [this], b, c = 0; b = this.childBlocks_[c]; c++)
  19149. a.push.apply(a, b.getDescendants());
  19150. return a
  19151. }
  19152. ;
  19153. Blockly.Block.prototype.isDeletable = function () {
  19154. return this.deletable_ && !this.isShadow_ && !(this.workspace && this.workspace.options.readOnly)
  19155. }
  19156. ;
  19157. Blockly.Block.prototype.setDeletable = function (a) {
  19158. this.deletable_ = a
  19159. }
  19160. ;
  19161. Blockly.Block.prototype.isMovable = function () {
  19162. return this.movable_ && !this.isShadow_ && !(this.workspace && this.workspace.options.readOnly)
  19163. }
  19164. ;
  19165. Blockly.Block.prototype.setMovable = function (a) {
  19166. this.movable_ = a
  19167. }
  19168. ;
  19169. Blockly.Block.prototype.isShadow = function () {
  19170. return this.isShadow_
  19171. }
  19172. ;
  19173. Blockly.Block.prototype.setShadow = function (a) {
  19174. this.isShadow_ = a
  19175. }
  19176. ;
  19177. Blockly.Block.prototype.isEditable = function () {
  19178. return this.editable_ && !(this.workspace && this.workspace.options.readOnly)
  19179. }
  19180. ;
  19181. Blockly.Block.prototype.setEditable = function (a) {
  19182. this.editable_ = a;
  19183. a = 0;
  19184. for (var b; b = this.inputList[a]; a++)
  19185. for (var c = 0, d; d = b.fieldRow[c]; c++)
  19186. d.updateEditable()
  19187. }
  19188. ;
  19189. Blockly.Block.prototype.setConnectionsHidden = function (a) {
  19190. if (!a && this.isCollapsed()) {
  19191. if (this.outputConnection && this.outputConnection.setHidden(a),
  19192. this.previousConnection && this.previousConnection.setHidden(a),
  19193. this.nextConnection) {
  19194. this.nextConnection.setHidden(a);
  19195. var b = this.nextConnection.targetBlock();
  19196. b && b.setConnectionsHidden(a)
  19197. }
  19198. } else
  19199. for (var c = this.getConnections_(!0), d = 0; b = c[d]; d++)
  19200. b.setHidden(a),
  19201. b.isSuperior() && (b = b.targetBlock()) && b.setConnectionsHidden(a)
  19202. }
  19203. ;
  19204. Blockly.Block.prototype.setHelpUrl = function (a) {
  19205. this.helpUrl = a
  19206. }
  19207. ;
  19208. Blockly.Block.prototype.setTooltip = function (a) {
  19209. this.tooltip = a
  19210. }
  19211. ;
  19212. Blockly.Block.prototype.getColour = function () {
  19213. return this.colour_
  19214. }
  19215. ;
  19216. Blockly.Block.prototype.setColour = function (a) {
  19217. var b = parseFloat(a);
  19218. if (isNaN(b))
  19219. if (goog.isString(a) && a.match(/^#[0-9a-fA-F]{6}$/))
  19220. this.colour_ = a;
  19221. else
  19222. throw "Invalid colour: " + a;
  19223. else
  19224. this.colour_ = Blockly.hueToRgb(b)
  19225. }
  19226. ;
  19227. Blockly.Block.prototype.getField = function (a) {
  19228. for (var b = 0, c; c = this.inputList[b]; b++)
  19229. for (var d = 0, e; e = c.fieldRow[d]; d++)
  19230. if (e.name === a)
  19231. return e;
  19232. return null
  19233. }
  19234. ;
  19235. Blockly.Block.prototype.getVars = function () {
  19236. for (var a = [], b = 0, c; c = this.inputList[b]; b++)
  19237. for (var d = 0, e; e = c.fieldRow[d]; d++)
  19238. e instanceof Blockly.FieldVariable && a.push(e.getValue());
  19239. return a
  19240. }
  19241. ;
  19242. Blockly.Block.prototype.renameVar = function (a, b) {
  19243. for (var c = 0, d; d = this.inputList[c]; c++)
  19244. for (var e = 0, f; f = d.fieldRow[e]; e++)
  19245. f instanceof Blockly.FieldVariable && Blockly.Names.equals(a, f.getValue()) && f.setValue(b)
  19246. }
  19247. ;
  19248. Blockly.Block.prototype.getFieldValue = function (a) {
  19249. return (a = this.getField(a)) ? a.getValue() : null
  19250. }
  19251. ;
  19252. Blockly.Block.prototype.getTitleValue = function (a) {
  19253. console.warn("Deprecated call to getTitleValue, use getFieldValue instead.");
  19254. return this.getFieldValue(a)
  19255. }
  19256. ;
  19257. Blockly.Block.prototype.setFieldValue = function (a, b) {
  19258. var c = this.getField(b);
  19259. goog.asserts.assertObject(c, 'Field "%s" not found.', b);
  19260. c.setValue(a)
  19261. }
  19262. ;
  19263. Blockly.Block.prototype.setTitleValue = function (a, b) {
  19264. console.warn("Deprecated call to setTitleValue, use setFieldValue instead.");
  19265. this.setFieldValue(a, b)
  19266. }
  19267. ;
  19268. Blockly.Block.prototype.setPreviousStatement = function (a, b) {
  19269. a ? (void 0 === b && (b = null),
  19270. this.previousConnection || (goog.asserts.assert(!this.outputConnection, "Remove output connection prior to adding previous connection."),
  19271. this.previousConnection = this.makeConnection_(Blockly.PREVIOUS_STATEMENT)),
  19272. this.previousConnection.setCheck(b)) : this.previousConnection && (goog.asserts.assert(!this.previousConnection.isConnected(), "Must disconnect previous statement before removing connection."),
  19273. this.previousConnection.dispose(),
  19274. this.previousConnection = null)
  19275. }
  19276. ;
  19277. Blockly.Block.prototype.setNextStatement = function (a, b) {
  19278. a ? (void 0 === b && (b = null),
  19279. this.nextConnection || (this.nextConnection = this.makeConnection_(Blockly.NEXT_STATEMENT)),
  19280. this.nextConnection.setCheck(b)) : this.nextConnection && (goog.asserts.assert(!this.nextConnection.isConnected(), "Must disconnect next statement before removing connection."),
  19281. this.nextConnection.dispose(),
  19282. this.nextConnection = null)
  19283. }
  19284. ;
  19285. Blockly.Block.prototype.setOutput = function (a, b) {
  19286. a ? (void 0 === b && (b = null),
  19287. this.outputConnection || (goog.asserts.assert(!this.previousConnection, "Remove previous connection prior to adding output connection."),
  19288. this.outputConnection = this.makeConnection_(Blockly.OUTPUT_VALUE)),
  19289. this.outputConnection.setCheck(b)) : this.outputConnection && (goog.asserts.assert(!this.outputConnection.isConnected(), "Must disconnect output value before removing connection."),
  19290. this.outputConnection.dispose(),
  19291. this.outputConnection = null)
  19292. }
  19293. ;
  19294. Blockly.Block.prototype.setInputsInline = function (a) {
  19295. this.inputsInline != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "inline", null, this.inputsInline, a)),
  19296. this.inputsInline = a)
  19297. }
  19298. ;
  19299. Blockly.Block.prototype.getInputsInline = function () {
  19300. if (void 0 != this.inputsInline)
  19301. return this.inputsInline;
  19302. for (var a = 1; a < this.inputList.length; a++)
  19303. if (this.inputList[a - 1].type == Blockly.DUMMY_INPUT && this.inputList[a].type == Blockly.DUMMY_INPUT)
  19304. return !1;
  19305. for (a = 1; a < this.inputList.length; a++)
  19306. if (this.inputList[a - 1].type == Blockly.INPUT_VALUE && this.inputList[a].type == Blockly.DUMMY_INPUT)
  19307. return !0;
  19308. return !1
  19309. }
  19310. ;
  19311. Blockly.Block.prototype.setDisabled = function (a) {
  19312. this.disabled != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "disabled", null, this.disabled, a)),
  19313. this.disabled = a)
  19314. }
  19315. ;
  19316. Blockly.Block.prototype.getInheritedDisabled = function () {
  19317. for (var a = this; ;) {
  19318. a = a.getSurroundParent();
  19319. if (!a)
  19320. return !1;
  19321. if (a.disabled)
  19322. return !0
  19323. }
  19324. }
  19325. ;
  19326. Blockly.Block.prototype.isCollapsed = function () {
  19327. return this.collapsed_
  19328. }
  19329. ;
  19330. Blockly.Block.prototype.setCollapsed = function (a) {
  19331. this.collapsed_ != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "collapsed", null, this.collapsed_, a)),
  19332. this.collapsed_ = a)
  19333. }
  19334. ;
  19335. Blockly.Block.prototype.toString = function (a, b) {
  19336. var c = []
  19337. , d = b || "?";
  19338. if (this.collapsed_)
  19339. c.push(this.getInput("_TEMP_COLLAPSED_INPUT").fieldRow[0].text_);
  19340. else
  19341. for (var e = 0, f; f = this.inputList[e]; e++) {
  19342. for (var g = 0, h; h = f.fieldRow[g]; g++)
  19343. c.push(h.getText());
  19344. f.connection && ((f = f.connection.targetBlock()) ? c.push(f.toString(void 0, b)) : c.push(d))
  19345. }
  19346. c = goog.string.trim(c.join(" ")) || "???";
  19347. a && (c = goog.string.truncate(c, a));
  19348. return c
  19349. }
  19350. ;
  19351. Blockly.Block.prototype.appendValueInput = function (a) {
  19352. return this.appendInput_(Blockly.INPUT_VALUE, a)
  19353. }
  19354. ;
  19355. Blockly.Block.prototype.appendStatementInput = function (a) {
  19356. return this.appendInput_(Blockly.NEXT_STATEMENT, a)
  19357. }
  19358. ;
  19359. Blockly.Block.prototype.appendDummyInput = function (a) {
  19360. return this.appendInput_(Blockly.DUMMY_INPUT, a || "")
  19361. }
  19362. ;
  19363. Blockly.Block.prototype.jsonInit = function (a) {
  19364. goog.asserts.assert(void 0 == a.output || void 0 == a.previousStatement, "Must not have both an output and a previousStatement.");
  19365. void 0 !== a.colour && this.setColour(a.colour);
  19366. for (var b = 0; void 0 !== a["message" + b];)
  19367. this.interpolate_(a["message" + b], a["args" + b] || [], a["lastDummyAlign" + b]),
  19368. b++;
  19369. void 0 !== a.inputsInline && this.setInputsInline(a.inputsInline);
  19370. void 0 !== a.output && this.setOutput(!0, a.output);
  19371. void 0 !== a.previousStatement && this.setPreviousStatement(!0, a.previousStatement);
  19372. void 0 !== a.nextStatement && this.setNextStatement(!0, a.nextStatement);
  19373. void 0 !== a.tooltip && this.setTooltip(a.tooltip);
  19374. void 0 !== a.helpUrl && this.setHelpUrl(a.helpUrl)
  19375. }
  19376. ;
  19377. Blockly.Block.prototype.interpolate_ = function (a, b, c) {
  19378. var d = Blockly.utils.tokenizeInterpolation(a)
  19379. , e = []
  19380. , f = 0;
  19381. a = [];
  19382. for (var g = 0; g < d.length; g++) {
  19383. var h = d[g];
  19384. "number" == typeof h ? (goog.asserts.assert(0 < h && h <= b.length, 'Message index "%s" out of range.', h),
  19385. goog.asserts.assert(!e[h], 'Message index "%s" duplicated.', h),
  19386. e[h] = !0,
  19387. f++ ,
  19388. a.push(b[h - 1])) : (h = h.trim()) && a.push(h)
  19389. }
  19390. goog.asserts.assert(f == b.length, "Message does not reference all %s arg(s).", b.length);
  19391. a.length && ("string" == typeof a[a.length - 1] || goog.string.startsWith(a[a.length - 1].type, "field_")) && (g = {
  19392. type: "input_dummy"
  19393. },
  19394. c && (g.align = c),
  19395. a.push(g));
  19396. c = {
  19397. LEFT: Blockly.ALIGN_LEFT,
  19398. RIGHT: Blockly.ALIGN_RIGHT,
  19399. CENTRE: Blockly.ALIGN_CENTRE
  19400. };
  19401. b = [];
  19402. for (g = 0; g < a.length; g++)
  19403. if (e = a[g],
  19404. "string" == typeof e)
  19405. b.push([e, void 0]);
  19406. else {
  19407. d = f = null;
  19408. do
  19409. if (h = !1,
  19410. "string" == typeof e)
  19411. f = new Blockly.FieldLabel(e);
  19412. else
  19413. switch (e.type) {
  19414. case "input_value":
  19415. d = this.appendValueInput(e.name);
  19416. break;
  19417. case "input_statement":
  19418. d = this.appendStatementInput(e.name);
  19419. break;
  19420. case "input_dummy":
  19421. d = this.appendDummyInput(e.name);
  19422. break;
  19423. case "field_label":
  19424. f = new Blockly.FieldLabel(e.text, e["class"]);
  19425. break;
  19426. case "field_input":
  19427. f = new Blockly.FieldTextInput(e.text);
  19428. "boolean" == typeof e.spellcheck && f.setSpellcheck(e.spellcheck);
  19429. break;
  19430. case "field_textarea":
  19431. f = new Blockly.FieldTextArea(e.text);
  19432. break;
  19433. case "field_angle":
  19434. f = new Blockly.FieldAngle(e.angle);
  19435. break;
  19436. case "field_checkbox":
  19437. f = new Blockly.FieldCheckbox(e.checked ? "TRUE" : "FALSE");
  19438. break;
  19439. case "field_colour":
  19440. f = new Blockly.FieldColour(e.colour);
  19441. break;
  19442. case "field_variable":
  19443. f = new Blockly.FieldVariable(e.variable);
  19444. break;
  19445. case "field_dropdown":
  19446. f = new Blockly.FieldDropdown(e.options);
  19447. break;
  19448. case "field_image":
  19449. f = new Blockly.FieldImage(e.src, e.width, e.height, e.alt);
  19450. break;
  19451. case "field_number":
  19452. f = new Blockly.FieldNumber(e.value, e.min, e.max, e.precision);
  19453. break;
  19454. case "field_date":
  19455. if (Blockly.FieldDate) {
  19456. f = new Blockly.FieldDate(e.date);
  19457. break
  19458. }
  19459. default:
  19460. e.alt && (e = e.alt,
  19461. h = !0)
  19462. }
  19463. while (h); if (f)
  19464. b.push([f, e.name]);
  19465. else if (d) {
  19466. e.check && d.setCheck(e.check);
  19467. e.align && d.setAlign(c[e.align]);
  19468. for (e = 0; e < b.length; e++)
  19469. d.appendField(b[e][0], b[e][1]);
  19470. b.length = 0
  19471. }
  19472. }
  19473. }
  19474. ;
  19475. Blockly.Block.prototype.appendInput_ = function (a, b) {
  19476. var c = null;
  19477. if (a == Blockly.INPUT_VALUE || a == Blockly.NEXT_STATEMENT)
  19478. c = this.makeConnection_(a);
  19479. c = new Blockly.Input(a, b, this, c);
  19480. this.inputList.push(c);
  19481. return c
  19482. }
  19483. ;
  19484. Blockly.Block.prototype.moveInputBefore = function (a, b) {
  19485. if (a != b) {
  19486. for (var c = -1, d = b ? -1 : this.inputList.length, e = 0, f; f = this.inputList[e]; e++)
  19487. if (f.name == a) {
  19488. if (c = e,
  19489. -1 != d)
  19490. break
  19491. } else if (b && f.name == b && (d = e,
  19492. -1 != c))
  19493. break;
  19494. goog.asserts.assert(-1 != c, 'Named input "%s" not found.', a);
  19495. goog.asserts.assert(-1 != d, 'Reference input "%s" not found.', b);
  19496. this.moveNumberedInputBefore(c, d)
  19497. }
  19498. }
  19499. ;
  19500. Blockly.Block.prototype.moveNumberedInputBefore = function (a, b) {
  19501. goog.asserts.assert(a != b, "Can't move input to itself.");
  19502. goog.asserts.assert(a < this.inputList.length, "Input index " + a + " out of bounds.");
  19503. goog.asserts.assert(b <= this.inputList.length, "Reference input " + b + " out of bounds.");
  19504. var c = this.inputList[a];
  19505. this.inputList.splice(a, 1);
  19506. a < b && b--;
  19507. this.inputList.splice(b, 0, c)
  19508. }
  19509. ;
  19510. Blockly.Block.prototype.removeInput = function (a, b) {
  19511. for (var c = 0, d; d = this.inputList[c]; c++)
  19512. if (d.name == a) {
  19513. if (d.connection && d.connection.isConnected()) {
  19514. d.connection.setShadowDom(null);
  19515. var e = d.connection.targetBlock();
  19516. e.isShadow() ? e.dispose() : e.unplug()
  19517. }
  19518. d.dispose();
  19519. this.inputList.splice(c, 1);
  19520. return
  19521. }
  19522. b || goog.asserts.fail('Input "%s" not found.', a)
  19523. }
  19524. ;
  19525. Blockly.Block.prototype.getInput = function (a) {
  19526. for (var b = 0, c; c = this.inputList[b]; b++)
  19527. if (c.name == a)
  19528. return c;
  19529. return null
  19530. }
  19531. ;
  19532. Blockly.Block.prototype.getInputTargetBlock = function (a) {
  19533. return (a = this.getInput(a)) && a.connection && a.connection.targetBlock()
  19534. }
  19535. ;
  19536. Blockly.Block.prototype.getCommentText = function () {
  19537. return this.comment || ""
  19538. }
  19539. ;
  19540. Blockly.Block.prototype.setCommentText = function (a) {
  19541. this.comment != a && (Blockly.Events.fire(new Blockly.Events.Change(this, "comment", null, this.comment, a || "")),
  19542. this.comment = a)
  19543. }
  19544. ;
  19545. Blockly.Block.prototype.setWarningText = function (a) { }
  19546. ;
  19547. Blockly.Block.prototype.setMutator = function (a) { }
  19548. ;
  19549. Blockly.Block.prototype.getRelativeToSurfaceXY = function () {
  19550. return this.xy_
  19551. }
  19552. ;
  19553. Blockly.Block.prototype.moveBy = function (a, b) {
  19554. goog.asserts.assert(!this.parentBlock_, "Block has parent.");
  19555. var c = new Blockly.Events.Move(this);
  19556. this.xy_.translate(a, b);
  19557. c.recordNew();
  19558. Blockly.Events.fire(c)
  19559. }
  19560. ;
  19561. Blockly.Block.prototype.makeConnection_ = function (a) {
  19562. return new Blockly.Connection(this, a)
  19563. }
  19564. ;
  19565. Blockly.ContextMenu = {};
  19566. Blockly.ContextMenu.currentBlock = null;
  19567. Blockly.ContextMenu.show = function (a, b, c) {
  19568. Blockly.WidgetDiv.show(Blockly.ContextMenu, c, null);
  19569. if (b.length) {
  19570. var d = new goog.ui.Menu;
  19571. d.setRightToLeft(c);
  19572. for (var e = 0, f; f = b[e]; e++) {
  19573. var g = new goog.ui.MenuItem(f.text);
  19574. g.setRightToLeft(c);
  19575. d.addChild(g, !0);
  19576. g.setEnabled(f.enabled);
  19577. f.enabled && (goog.events.listen(g, goog.ui.Component.EventType.ACTION, f.callback),
  19578. g.handleContextMenu = function (a) {
  19579. goog.events.dispatchEvent(this, goog.ui.Component.EventType.ACTION)
  19580. }
  19581. )
  19582. }
  19583. goog.events.listen(d, goog.ui.Component.EventType.ACTION, Blockly.ContextMenu.hide);
  19584. b = goog.dom.getViewportSize();
  19585. e = goog.style.getViewportPageOffset(document);
  19586. d.render(Blockly.WidgetDiv.DIV);
  19587. var h = d.getElement();
  19588. Blockly.addClass_(h, "blocklyContextMenu");
  19589. Blockly.bindEventWithChecks_(h, "contextmenu", null, Blockly.noEvent);
  19590. f = goog.style.getSize(h);
  19591. g = a.clientX + e.x;
  19592. var k = a.clientY + e.y;
  19593. a.clientY + f.height >= b.height && (k -= f.height);
  19594. c ? f.width >= a.clientX && (g += f.width) : a.clientX + f.width >= b.width && (g -= f.width);
  19595. Blockly.WidgetDiv.position(g, k, b, e, c);
  19596. d.setAllowAutoFocus(!0);
  19597. setTimeout(function () {
  19598. h.focus()
  19599. }, 1);
  19600. Blockly.ContextMenu.currentBlock = null
  19601. } else
  19602. Blockly.ContextMenu.hide()
  19603. }
  19604. ;
  19605. Blockly.ContextMenu.hide = function () {
  19606. Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu);
  19607. Blockly.ContextMenu.currentBlock = null
  19608. }
  19609. ;
  19610. Blockly.ContextMenu.callbackFactory = function (a, b) {
  19611. return function () {
  19612. Blockly.Events.disable();
  19613. try {
  19614. var c = Blockly.Xml.domToBlock(b, a.workspace)
  19615. , d = a.getRelativeToSurfaceXY();
  19616. d.x = a.RTL ? d.x - Blockly.SNAP_RADIUS : d.x + Blockly.SNAP_RADIUS;
  19617. d.y += 2 * Blockly.SNAP_RADIUS;
  19618. c.moveBy(d.x, d.y)
  19619. } finally {
  19620. Blockly.Events.enable()
  19621. }
  19622. Blockly.Events.isEnabled() && !c.isShadow() && Blockly.Events.fire(new Blockly.Events.Create(c));
  19623. c.select()
  19624. }
  19625. }
  19626. ;
  19627. Blockly.RenderedConnection = function (a, b) {
  19628. Blockly.RenderedConnection.superClass_.constructor.call(this, a, b);
  19629. this.offsetInBlock_ = new goog.math.Coordinate(0, 0)
  19630. }
  19631. ;
  19632. goog.inherits(Blockly.RenderedConnection, Blockly.Connection);
  19633. Blockly.RenderedConnection.prototype.distanceFrom = function (a) {
  19634. var b = this.x_ - a.x_;
  19635. a = this.y_ - a.y_;
  19636. return Math.sqrt(b * b + a * a)
  19637. }
  19638. ;
  19639. Blockly.RenderedConnection.prototype.bumpAwayFrom_ = function (a) {
  19640. if (Blockly.dragMode_ == Blockly.DRAG_NONE) {
  19641. var b = this.sourceBlock_.getRootBlock();
  19642. if (!b.isInFlyout) {
  19643. var c = !1;
  19644. if (!b.isMovable()) {
  19645. b = a.getSourceBlock().getRootBlock();
  19646. if (!b.isMovable())
  19647. return;
  19648. a = this;
  19649. c = !0
  19650. }
  19651. var d = Blockly.selected == b;
  19652. d || b.addSelect();
  19653. var e = a.x_ + Blockly.SNAP_RADIUS - this.x_;
  19654. a = a.y_ + Blockly.SNAP_RADIUS - this.y_;
  19655. c && (a = -a);
  19656. b.RTL && (e = -e);
  19657. b.moveBy(e, a);
  19658. d || b.removeSelect()
  19659. }
  19660. }
  19661. }
  19662. ;
  19663. Blockly.RenderedConnection.prototype.moveTo = function (a, b) {
  19664. this.inDB_ && this.db_.removeConnection_(this);
  19665. this.x_ = a;
  19666. this.y_ = b;
  19667. this.hidden_ || this.db_.addConnection(this)
  19668. }
  19669. ;
  19670. Blockly.RenderedConnection.prototype.moveBy = function (a, b) {
  19671. this.moveTo(this.x_ + a, this.y_ + b)
  19672. }
  19673. ;
  19674. Blockly.RenderedConnection.prototype.moveToOffset = function (a) {
  19675. this.moveTo(a.x + this.offsetInBlock_.x, a.y + this.offsetInBlock_.y)
  19676. }
  19677. ;
  19678. Blockly.RenderedConnection.prototype.setOffsetInBlock = function (a, b) {
  19679. this.offsetInBlock_.x = a;
  19680. this.offsetInBlock_.y = b
  19681. }
  19682. ;
  19683. Blockly.RenderedConnection.prototype.tighten_ = function () {
  19684. var a = this.targetConnection.x_ - this.x_
  19685. , b = this.targetConnection.y_ - this.y_;
  19686. if (0 != a || 0 != b) {
  19687. var c = this.targetBlock()
  19688. , d = c.getSvgRoot();
  19689. if (!d)
  19690. throw "block is not rendered.";
  19691. d = Blockly.getRelativeXY_(d);
  19692. c.getSvgRoot().setAttribute("transform", "translate(" + (d.x - a) + "," + (d.y - b) + ")");
  19693. c.moveConnections_(-a, -b)
  19694. }
  19695. }
  19696. ;
  19697. Blockly.RenderedConnection.prototype.closest = function (a, b, c) {
  19698. return this.dbOpposite_.searchForClosest(this, a, b, c)
  19699. }
  19700. ;
  19701. Blockly.RenderedConnection.prototype.highlight = function () {
  19702. var a = this.type == Blockly.INPUT_VALUE || this.type == Blockly.OUTPUT_VALUE ? "m 0,0 " + Blockly.BlockSvg.TAB_PATH_DOWN + " v 5" : "m -20,0 h 5 " + Blockly.BlockSvg.NOTCH_PATH_LEFT + " h 5";
  19703. var b = this.sourceBlock_.getRelativeToSurfaceXY();
  19704. Blockly.Connection.highlightedPath_ = Blockly.createSvgElement("path", {
  19705. "class": "blocklyHighlightedConnectionPath",
  19706. d: a,
  19707. transform: "translate(" + (this.x_ - b.x) + "," + (this.y_ - b.y) + ")" + (this.sourceBlock_.RTL ? " scale(-1 1)" : "")
  19708. }, this.sourceBlock_.getSvgRoot())
  19709. }
  19710. ;
  19711. Blockly.RenderedConnection.prototype.unhideAll = function () {
  19712. this.setHidden(!1);
  19713. var a = [];
  19714. if (this.type != Blockly.INPUT_VALUE && this.type != Blockly.NEXT_STATEMENT)
  19715. return a;
  19716. var b = this.targetBlock();
  19717. if (b) {
  19718. if (b.isCollapsed()) {
  19719. var c = [];
  19720. b.outputConnection && c.push(b.outputConnection);
  19721. b.nextConnection && c.push(b.nextConnection);
  19722. b.previousConnection && c.push(b.previousConnection)
  19723. } else
  19724. c = b.getConnections_(!0);
  19725. for (var d = 0; d < c.length; d++)
  19726. a.push.apply(a, c[d].unhideAll());
  19727. a.length || (a[0] = b)
  19728. }
  19729. return a
  19730. }
  19731. ;
  19732. Blockly.RenderedConnection.prototype.unhighlight = function () {
  19733. goog.dom.removeNode(Blockly.Connection.highlightedPath_);
  19734. delete Blockly.Connection.highlightedPath_
  19735. }
  19736. ;
  19737. Blockly.RenderedConnection.prototype.setHidden = function (a) {
  19738. (this.hidden_ = a) && this.inDB_ ? this.db_.removeConnection_(this) : a || this.inDB_ || this.db_.addConnection(this)
  19739. }
  19740. ;
  19741. Blockly.RenderedConnection.prototype.hideAll = function () {
  19742. this.setHidden(!0);
  19743. if (this.targetConnection)
  19744. for (var a = this.targetBlock().getDescendants(), b = 0; b < a.length; b++) {
  19745. for (var c = a[b], d = c.getConnections_(!0), e = 0; e < d.length; e++)
  19746. d[e].setHidden(!0);
  19747. c = c.getIcons();
  19748. for (e = 0; e < c.length; e++)
  19749. c[e].setVisible(!1)
  19750. }
  19751. }
  19752. ;
  19753. Blockly.RenderedConnection.prototype.isConnectionAllowed = function (a, b) {
  19754. return this.distanceFrom(a) > b ? !1 : Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this, a)
  19755. }
  19756. ;
  19757. Blockly.RenderedConnection.prototype.disconnectInternal_ = function (a, b) {
  19758. Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this, a, b);
  19759. a.rendered && a.render();
  19760. b.rendered && (b.updateDisabled(),
  19761. b.render())
  19762. }
  19763. ;
  19764. Blockly.RenderedConnection.prototype.respawnShadow_ = function () {
  19765. var a = this.getSourceBlock()
  19766. , b = this.getShadowDom();
  19767. if (a.workspace && b && Blockly.Events.recordUndo) {
  19768. Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);
  19769. b = this.targetBlock();
  19770. if (!b)
  19771. throw "Couldn't respawn the shadow block that should exist here.";
  19772. b.initSvg();
  19773. b.render(!1);
  19774. a.rendered && a.render()
  19775. }
  19776. }
  19777. ;
  19778. Blockly.RenderedConnection.prototype.neighbours_ = function (a) {
  19779. return this.dbOpposite_.getNeighbours(this, a)
  19780. }
  19781. ;
  19782. Blockly.RenderedConnection.prototype.connect_ = function (a) {
  19783. Blockly.RenderedConnection.superClass_.connect_.call(this, a);
  19784. var b = this.getSourceBlock();
  19785. a = a.getSourceBlock();
  19786. b.rendered && b.updateDisabled();
  19787. a.rendered && a.updateDisabled();
  19788. b.rendered && a.rendered && (this.type == Blockly.NEXT_STATEMENT || this.type == Blockly.PREVIOUS_STATEMENT ? a.render() : b.render())
  19789. }
  19790. ;
  19791. Blockly.BlockSvg = function (a, b, c) {
  19792. this.svgGroup_ = Blockly.createSvgElement("g", {}, null);
  19793. this.svgPathDark_ = Blockly.createSvgElement("path", {
  19794. "class": "blocklyPathDark",
  19795. transform: "translate(1,1)"
  19796. }, this.svgGroup_);
  19797. this.svgPath_ = Blockly.createSvgElement("path", {
  19798. "class": "blocklyPath"
  19799. }, this.svgGroup_);
  19800. this.svgPathLight_ = Blockly.createSvgElement("path", {
  19801. "class": "blocklyPathLight"
  19802. }, this.svgGroup_);
  19803. this.svgPath_.tooltip = this;
  19804. this.rendered = !1;
  19805. Blockly.Tooltip.bindMouseEvents(this.svgPath_);
  19806. Blockly.BlockSvg.superClass_.constructor.call(this, a, b, c)
  19807. }
  19808. ;
  19809. goog.inherits(Blockly.BlockSvg, Blockly.Block);
  19810. Blockly.BlockSvg.prototype.height = 0;
  19811. Blockly.BlockSvg.prototype.width = 0;
  19812. Blockly.BlockSvg.prototype.dragStartXY_ = null;
  19813. Blockly.BlockSvg.INLINE = -1;
  19814. Blockly.BlockSvg.prototype.initSvg = function () {
  19815. goog.asserts.assert(this.workspace.rendered, "Workspace is headless.");
  19816. for (var a = 0, b; b = this.inputList[a]; a++)
  19817. b.init();
  19818. b = this.getIcons();
  19819. for (a = 0; a < b.length; a++)
  19820. b[a].createIcon();
  19821. this.updateColour();
  19822. this.updateMovable();
  19823. if (!this.workspace.options.readOnly && !this.eventsInit_) {
  19824. Blockly.bindEventWithChecks_(this.getSvgRoot(), "mousedown", this, this.onMouseDown_);
  19825. var c = this;
  19826. Blockly.bindEvent_(this.getSvgRoot(), "touchstart", null, function (a) {
  19827. Blockly.longStart_(a, c)
  19828. })
  19829. }
  19830. this.eventsInit_ = !0;
  19831. this.getSvgRoot().parentNode || this.workspace.getCanvas().appendChild(this.getSvgRoot())
  19832. }
  19833. ;
  19834. Blockly.BlockSvg.prototype.select = function () {
  19835. if (this.isShadow() && this.getParent())
  19836. this.getParent().select();
  19837. else if (Blockly.selected != this) {
  19838. var a = null;
  19839. if (Blockly.selected) {
  19840. a = Blockly.selected.id;
  19841. Blockly.Events.disable();
  19842. try {
  19843. Blockly.selected.unselect()
  19844. } finally {
  19845. Blockly.Events.enable()
  19846. }
  19847. }
  19848. a = new Blockly.Events.Ui(null, "selected", a, this.id);
  19849. a.workspaceId = this.workspace.id;
  19850. Blockly.Events.fire(a);
  19851. Blockly.selected = this;
  19852. this.addSelect()
  19853. }
  19854. }
  19855. ;
  19856. Blockly.BlockSvg.prototype.unselect = function () {
  19857. if (Blockly.selected == this) {
  19858. var a = new Blockly.Events.Ui(null, "selected", this.id, null);
  19859. a.workspaceId = this.workspace.id;
  19860. Blockly.Events.fire(a);
  19861. Blockly.selected = null;
  19862. this.removeSelect()
  19863. }
  19864. }
  19865. ;
  19866. Blockly.BlockSvg.prototype.mutator = null;
  19867. Blockly.BlockSvg.prototype.comment = null;
  19868. Blockly.BlockSvg.prototype.warning = null;
  19869. Blockly.BlockSvg.prototype.getIcons = function () {
  19870. var a = [];
  19871. this.mutator && a.push(this.mutator);
  19872. this.comment && a.push(this.comment);
  19873. this.warning && a.push(this.warning);
  19874. return a
  19875. }
  19876. ;
  19877. Blockly.BlockSvg.onMouseUpWrapper_ = null;
  19878. Blockly.BlockSvg.onMouseMoveWrapper_ = null;
  19879. Blockly.BlockSvg.terminateDrag = function () {
  19880. Blockly.BlockSvg.disconnectUiStop_();
  19881. Blockly.BlockSvg.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.BlockSvg.onMouseUpWrapper_),
  19882. Blockly.BlockSvg.onMouseUpWrapper_ = null);
  19883. Blockly.BlockSvg.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.BlockSvg.onMouseMoveWrapper_),
  19884. Blockly.BlockSvg.onMouseMoveWrapper_ = null);
  19885. var a = Blockly.selected;
  19886. if (Blockly.dragMode_ == Blockly.DRAG_FREE && a) {
  19887. var b = a.getRelativeToSurfaceXY();
  19888. b = goog.math.Coordinate.difference(b, a.dragStartXY_);
  19889. var c = new Blockly.Events.Move(a);
  19890. c.oldCoordinate = a.dragStartXY_;
  19891. c.recordNew();
  19892. Blockly.Events.fire(c);
  19893. a.moveConnections_(b.x, b.y);
  19894. delete a.draggedBubbles_;
  19895. a.setDragging_(!1);
  19896. a.render();
  19897. a.workspace.setResizesEnabled(!0);
  19898. var d = Blockly.Events.getGroup();
  19899. setTimeout(function () {
  19900. Blockly.Events.setGroup(d);
  19901. a.snapToGrid();
  19902. Blockly.Events.setGroup(!1)
  19903. }, Blockly.BUMP_DELAY / 2);
  19904. setTimeout(function () {
  19905. Blockly.Events.setGroup(d);
  19906. a.bumpNeighbours_();
  19907. Blockly.Events.setGroup(!1)
  19908. }, Blockly.BUMP_DELAY)
  19909. }
  19910. Blockly.dragMode_ = Blockly.DRAG_NONE;
  19911. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)
  19912. }
  19913. ;
  19914. Blockly.BlockSvg.prototype.setParent = function (a) {
  19915. if (a != this.parentBlock_) {
  19916. var b = this.getSvgRoot();
  19917. if (this.parentBlock_ && b) {
  19918. var c = this.getRelativeToSurfaceXY();
  19919. this.workspace.getCanvas().appendChild(b);
  19920. b.setAttribute("transform", "translate(" + c.x + "," + c.y + ")")
  19921. }
  19922. Blockly.Field.startCache();
  19923. Blockly.BlockSvg.superClass_.setParent.call(this, a);
  19924. Blockly.Field.stopCache();
  19925. a && (c = this.getRelativeToSurfaceXY(),
  19926. a.getSvgRoot().appendChild(b),
  19927. a = this.getRelativeToSurfaceXY(),
  19928. this.moveConnections_(a.x - c.x, a.y - c.y))
  19929. }
  19930. }
  19931. ;
  19932. Blockly.BlockSvg.prototype.getRelativeToSurfaceXY = function () {
  19933. var a = 0
  19934. , b = 0
  19935. , c = this.getSvgRoot();
  19936. if (c) {
  19937. do {
  19938. var d = Blockly.getRelativeXY_(c);
  19939. a += d.x;
  19940. b += d.y;
  19941. c = c.parentNode
  19942. } while (c && c != this.workspace.getCanvas())
  19943. }
  19944. return new goog.math.Coordinate(a, b)
  19945. }
  19946. ;
  19947. Blockly.BlockSvg.prototype.moveBy = function (a, b) {
  19948. goog.asserts.assert(!this.parentBlock_, "Block has parent.");
  19949. var c = new Blockly.Events.Move(this)
  19950. , d = this.getRelativeToSurfaceXY();
  19951. this.getSvgRoot().setAttribute("transform", "translate(" + (d.x + a) + "," + (d.y + b) + ")");
  19952. this.moveConnections_(a, b);
  19953. c.recordNew();
  19954. this.workspace.resizeContents();
  19955. Blockly.Events.fire(c)
  19956. }
  19957. ;
  19958. Blockly.BlockSvg.prototype.snapToGrid = function () {
  19959. if (this.workspace && Blockly.dragMode_ == Blockly.DRAG_NONE && !this.getParent() && !this.isInFlyout && this.workspace.options.gridOptions && this.workspace.options.gridOptions.snap) {
  19960. var a = this.workspace.options.gridOptions.spacing
  19961. , b = a / 2
  19962. , c = this.getRelativeToSurfaceXY()
  19963. , d = Math.round((c.x - b) / a) * a + b - c.x;
  19964. a = Math.round((c.y - b) / a) * a + b - c.y;
  19965. d = Math.round(d);
  19966. a = Math.round(a);
  19967. 0 == d && 0 == a || this.moveBy(d, a)
  19968. }
  19969. }
  19970. ;
  19971. Blockly.BlockSvg.prototype.getHeightWidth = function () {
  19972. var a = this.height
  19973. , b = this.width
  19974. , c = this.getNextBlock();
  19975. c ? (c = c.getHeightWidth(),
  19976. a += c.height - 4,
  19977. b = Math.max(b, c.width)) : this.nextConnection || this.outputConnection || (a += 2);
  19978. return {
  19979. height: a,
  19980. width: b
  19981. }
  19982. }
  19983. ;
  19984. Blockly.BlockSvg.prototype.getBoundingRectangle = function () {
  19985. var a = this.getRelativeToSurfaceXY(this)
  19986. , b = this.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0
  19987. , c = this.getHeightWidth();
  19988. if (this.RTL) {
  19989. var d = new goog.math.Coordinate(a.x - (c.width - b), a.y);
  19990. a = new goog.math.Coordinate(a.x + b, a.y + c.height)
  19991. } else
  19992. d = new goog.math.Coordinate(a.x - b, a.y),
  19993. a = new goog.math.Coordinate(a.x + c.width - b, a.y + c.height);
  19994. return {
  19995. topLeft: d,
  19996. bottomRight: a
  19997. }
  19998. }
  19999. ;
  20000. Blockly.BlockSvg.prototype.setCollapsed = function (a) {
  20001. if (this.collapsed_ != a) {
  20002. for (var b = [], c = 0, d; d = this.inputList[c]; c++)
  20003. b.push.apply(b, d.setVisible(!a));
  20004. if (a) {
  20005. d = this.getIcons();
  20006. for (c = 0; c < d.length; c++)
  20007. d[c].setVisible(!1);
  20008. c = this.toString(Blockly.COLLAPSE_CHARS);
  20009. this.appendDummyInput("_TEMP_COLLAPSED_INPUT").appendField(c).init()
  20010. } else
  20011. this.removeInput("_TEMP_COLLAPSED_INPUT"),
  20012. this.setWarningText(null);
  20013. Blockly.BlockSvg.superClass_.setCollapsed.call(this, a);
  20014. b.length || (b[0] = this);
  20015. if (this.rendered)
  20016. for (c = 0; a = b[c]; c++)
  20017. a.render()
  20018. }
  20019. }
  20020. ;
  20021. Blockly.BlockSvg.prototype.tab = function (a, b) {
  20022. for (var c = [], d = 0, e; e = this.inputList[d]; d++) {
  20023. for (var f = 0, g; g = e.fieldRow[f]; f++)
  20024. g instanceof Blockly.FieldTextInput && c.push(g);
  20025. e.connection && (e = e.connection.targetBlock()) && c.push(e)
  20026. }
  20027. d = c.indexOf(a);
  20028. -1 == d && (d = b ? -1 : c.length);
  20029. (c = c[b ? d + 1 : d - 1]) ? c instanceof Blockly.Field ? c.showEditor_() : c.tab(null, b) : (c = this.getParent()) && c.tab(this, b)
  20030. }
  20031. ;
  20032. Blockly.BlockSvg.prototype.onMouseDown_ = function (a) {
  20033. if (!this.workspace.options.readOnly)
  20034. if (this.isInFlyout)
  20035. "touchstart" == a.type && Blockly.isRightButton(a) && (Blockly.Flyout.blockRightClick_(a, this),
  20036. a.stopPropagation(),
  20037. a.preventDefault());
  20038. else {
  20039. this.isInMutator && this.workspace.resize();
  20040. this.workspace.updateScreenCalculationsIfScrolled();
  20041. this.workspace.markFocused();
  20042. Blockly.terminateDrag_();
  20043. this.select();
  20044. Blockly.hideChaff();
  20045. if (Blockly.isRightButton(a))
  20046. this.showContextMenu_(a),
  20047. Blockly.Touch.clearTouchIdentifier();
  20048. else if (this.isMovable()) {
  20049. Blockly.Events.getGroup() || Blockly.Events.setGroup(!0);
  20050. Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED);
  20051. this.dragStartXY_ = this.getRelativeToSurfaceXY();
  20052. this.workspace.startDrag(a, this.dragStartXY_);
  20053. Blockly.dragMode_ = Blockly.DRAG_STICKY;
  20054. Blockly.BlockSvg.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, this.onMouseUp_);
  20055. Blockly.BlockSvg.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.onMouseMove_);
  20056. this.draggedBubbles_ = [];
  20057. for (var b = this.getDescendants(), c = 0, d; d = b[c]; c++) {
  20058. d = d.getIcons();
  20059. for (var e = 0; e < d.length; e++) {
  20060. var f = d[e].getIconLocation();
  20061. f.bubble = d[e];
  20062. this.draggedBubbles_.push(f)
  20063. }
  20064. }
  20065. } else
  20066. return;
  20067. a.stopPropagation();
  20068. a.preventDefault()
  20069. }
  20070. }
  20071. ;
  20072. Blockly.BlockSvg.prototype.onMouseUp_ = function (a) {
  20073. Blockly.Touch.clearTouchIdentifier();
  20074. Blockly.dragMode_ == Blockly.DRAG_FREE || Blockly.WidgetDiv.isVisible() || Blockly.Events.fire(new Blockly.Events.Ui(this, "click", void 0, void 0));
  20075. Blockly.terminateDrag_();
  20076. Blockly.selected && Blockly.highlightedConnection_ ? (Blockly.localConnection_.connect(Blockly.highlightedConnection_),
  20077. this.rendered && (Blockly.localConnection_.isSuperior() ? Blockly.highlightedConnection_ : Blockly.localConnection_).getSourceBlock().connectionUiEffect(),
  20078. this.workspace.trashcan && this.workspace.trashcan.close()) : !this.getParent() && Blockly.selected.isDeletable() && this.workspace.isDeleteArea(a) && ((a = this.workspace.trashcan) && goog.Timer.callOnce(a.close, 100, a),
  20079. Blockly.selected.dispose(!1, !0));
  20080. Blockly.highlightedConnection_ && (Blockly.highlightedConnection_.unhighlight(),
  20081. Blockly.highlightedConnection_ = null);
  20082. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN);
  20083. Blockly.WidgetDiv.isVisible() || Blockly.Events.setGroup(!1)
  20084. }
  20085. ;
  20086. Blockly.BlockSvg.prototype.showHelp_ = function () {
  20087. var a = goog.isFunction(this.helpUrl) ? this.helpUrl() : this.helpUrl;
  20088. a && window.open(a)
  20089. }
  20090. ;
  20091. Blockly.BlockSvg.prototype.showContextMenu_ = function (a) {
  20092. if (!this.workspace.options.readOnly && this.contextMenu) {
  20093. var b = this
  20094. , c = [];
  20095. if (this.isDeletable() && this.isMovable() && !b.isInFlyout) {
  20096. var d = {
  20097. text: Blockly.Msg.DUPLICATE_BLOCK,
  20098. enabled: !0,
  20099. callback: function () {
  20100. Blockly.duplicate_(b)
  20101. }
  20102. };
  20103. this.getDescendants().length > this.workspace.remainingCapacity() && (d.enabled = !1);
  20104. c.push(d);
  20105. this.isEditable() && !this.collapsed_ && this.workspace.options.comments && (d = {
  20106. enabled: !goog.userAgent.IE
  20107. },
  20108. this.comment ? (d.text = Blockly.Msg.REMOVE_COMMENT,
  20109. d.callback = function () {
  20110. b.setCommentText(null)
  20111. }
  20112. ) : (d.text = Blockly.Msg.ADD_COMMENT,
  20113. d.callback = function () {
  20114. b.setCommentText("")
  20115. }
  20116. ),
  20117. c.push(d));
  20118. if (!this.collapsed_)
  20119. for (d = 1; d < this.inputList.length; d++)
  20120. if (this.inputList[d - 1].type != Blockly.NEXT_STATEMENT && this.inputList[d].type != Blockly.NEXT_STATEMENT) {
  20121. d = {
  20122. enabled: !0
  20123. };
  20124. var e = this.getInputsInline();
  20125. d.text = e ? Blockly.Msg.EXTERNAL_INPUTS : Blockly.Msg.INLINE_INPUTS;
  20126. d.callback = function () {
  20127. b.setInputsInline(!e)
  20128. }
  20129. ;
  20130. c.push(d);
  20131. break
  20132. }
  20133. this.workspace.options.collapse && (this.collapsed_ ? (d = {
  20134. enabled: !0
  20135. },
  20136. d.text = Blockly.Msg.EXPAND_BLOCK,
  20137. d.callback = function () {
  20138. b.setCollapsed(!1)
  20139. }
  20140. ,
  20141. c.push(d)) : (d = {
  20142. enabled: !0
  20143. },
  20144. d.text = Blockly.Msg.COLLAPSE_BLOCK,
  20145. d.callback = function () {
  20146. b.setCollapsed(!0)
  20147. }
  20148. ,
  20149. c.push(d)));
  20150. this.workspace.options.disable && (d = {
  20151. text: this.disabled ? Blockly.Msg.ENABLE_BLOCK : Blockly.Msg.DISABLE_BLOCK,
  20152. enabled: !this.getInheritedDisabled(),
  20153. callback: function () {
  20154. b.setDisabled(!b.disabled)
  20155. }
  20156. },
  20157. c.push(d));
  20158. d = this.getDescendants().length;
  20159. var f = this.getNextBlock();
  20160. f && (d -= f.getDescendants().length);
  20161. d = {
  20162. text: 1 == d ? Blockly.Msg.DELETE_BLOCK : Blockly.Msg.DELETE_X_BLOCKS.replace("%1", String(d)),
  20163. enabled: !0,
  20164. callback: function () {
  20165. Blockly.Events.setGroup(!0);
  20166. b.dispose(!0, !0);
  20167. Blockly.Events.setGroup(!1)
  20168. }
  20169. };
  20170. c.push(d)
  20171. }
  20172. d = {
  20173. enabled: !(goog.isFunction(this.helpUrl) ? !this.helpUrl() : !this.helpUrl)
  20174. };
  20175. d.text = Blockly.Msg.HELP;
  20176. d.callback = function () {
  20177. b.showHelp_()
  20178. }
  20179. ;
  20180. c.push(d);
  20181. this.customContextMenu && !b.isInFlyout && this.customContextMenu(c);
  20182. Blockly.ContextMenu.show(a, c, this.RTL);
  20183. Blockly.ContextMenu.currentBlock = this
  20184. }
  20185. }
  20186. ;
  20187. Blockly.BlockSvg.prototype.moveConnections_ = function (a, b) {
  20188. if (this.rendered) {
  20189. for (var c = this.getConnections_(!1), d = 0; d < c.length; d++)
  20190. c[d].moveBy(a, b);
  20191. c = this.getIcons();
  20192. for (d = 0; d < c.length; d++)
  20193. c[d].computeIconLocation();
  20194. for (d = 0; d < this.childBlocks_.length; d++)
  20195. this.childBlocks_[d].moveConnections_(a, b)
  20196. }
  20197. }
  20198. ;
  20199. Blockly.BlockSvg.prototype.setDragging_ = function (a) {
  20200. if (a) {
  20201. var b = this.getSvgRoot();
  20202. b.translate_ = "";
  20203. b.skew_ = "";
  20204. Blockly.draggingConnections_ = Blockly.draggingConnections_.concat(this.getConnections_(!0));
  20205. Blockly.addClass_(this.svgGroup_, "blocklyDragging")
  20206. } else
  20207. Blockly.draggingConnections_ = [],
  20208. Blockly.removeClass_(this.svgGroup_, "blocklyDragging");
  20209. for (b = 0; b < this.childBlocks_.length; b++)
  20210. this.childBlocks_[b].setDragging_(a)
  20211. }
  20212. ;
  20213. Blockly.BlockSvg.prototype.onMouseMove_ = function (a) {
  20214. if ("mousemove" == a.type && 1 >= a.clientX && 0 == a.clientY && 0 == a.button)
  20215. a.stopPropagation();
  20216. else {
  20217. var b = this.getRelativeToSurfaceXY()
  20218. , c = this.workspace.moveDrag(a);
  20219. if (Blockly.dragMode_ == Blockly.DRAG_STICKY && goog.math.Coordinate.distance(b, c) * this.workspace.scale > Blockly.DRAG_RADIUS) {
  20220. Blockly.dragMode_ = Blockly.DRAG_FREE;
  20221. Blockly.longStop_();
  20222. this.workspace.setResizesEnabled(!1);
  20223. if (this.parentBlock_) {
  20224. this.unplug();
  20225. var d = this.getSvgRoot();
  20226. d.translate_ = "translate(" + c.x + "," + c.y + ")";
  20227. this.disconnectUiEffect()
  20228. }
  20229. this.setDragging_(!0)
  20230. }
  20231. if (Blockly.dragMode_ == Blockly.DRAG_FREE) {
  20232. b = goog.math.Coordinate.difference(b, this.dragStartXY_);
  20233. d = this.getSvgRoot();
  20234. d.translate_ = "translate(" + c.x + "," + c.y + ")";
  20235. d.setAttribute("transform", d.translate_ + d.skew_);
  20236. for (c = 0; c < this.draggedBubbles_.length; c++)
  20237. d = this.draggedBubbles_[c],
  20238. d.bubble.setIconLocation(goog.math.Coordinate.sum(d, b));
  20239. d = this.getConnections_(!1);
  20240. (c = this.lastConnectionInStack_()) && c != this.nextConnection && d.push(c);
  20241. var e = null
  20242. , f = null
  20243. , g = Blockly.SNAP_RADIUS;
  20244. for (c = 0; c < d.length; c++) {
  20245. var h = d[c]
  20246. , k = h.closest(g, b);
  20247. k.connection && (e = k.connection,
  20248. f = h,
  20249. g = k.radius)
  20250. }
  20251. Blockly.highlightedConnection_ && Blockly.highlightedConnection_ != e && (Blockly.highlightedConnection_.unhighlight(),
  20252. Blockly.highlightedConnection_ = null,
  20253. Blockly.localConnection_ = null);
  20254. e && e != Blockly.highlightedConnection_ && (e.highlight(),
  20255. Blockly.highlightedConnection_ = e,
  20256. Blockly.localConnection_ = f);
  20257. this.isDeletable() && this.workspace.isDeleteArea(a)
  20258. }
  20259. a.stopPropagation();
  20260. a.preventDefault()
  20261. }
  20262. }
  20263. ;
  20264. Blockly.BlockSvg.prototype.updateMovable = function () {
  20265. this.isMovable() ? Blockly.addClass_(this.svgGroup_, "blocklyDraggable") : Blockly.removeClass_(this.svgGroup_, "blocklyDraggable")
  20266. }
  20267. ;
  20268. Blockly.BlockSvg.prototype.setMovable = function (a) {
  20269. Blockly.BlockSvg.superClass_.setMovable.call(this, a);
  20270. this.updateMovable()
  20271. }
  20272. ;
  20273. Blockly.BlockSvg.prototype.setEditable = function (a) {
  20274. Blockly.BlockSvg.superClass_.setEditable.call(this, a);
  20275. a = this.getIcons();
  20276. for (var b = 0; b < a.length; b++)
  20277. a[b].updateEditable()
  20278. }
  20279. ;
  20280. Blockly.BlockSvg.prototype.setShadow = function (a) {
  20281. Blockly.BlockSvg.superClass_.setShadow.call(this, a);
  20282. this.updateColour()
  20283. }
  20284. ;
  20285. Blockly.BlockSvg.prototype.getSvgRoot = function () {
  20286. return this.svgGroup_
  20287. }
  20288. ;
  20289. Blockly.BlockSvg.prototype.dispose = function (a, b) {
  20290. if (this.workspace) {
  20291. Blockly.Tooltip.hide();
  20292. Blockly.Field.startCache();
  20293. var c = this.workspace;
  20294. Blockly.selected == this && (this.unselect(),
  20295. Blockly.terminateDrag_());
  20296. Blockly.ContextMenu.currentBlock == this && Blockly.ContextMenu.hide();
  20297. b && this.rendered && (this.unplug(a),
  20298. this.disposeUiEffect());
  20299. this.rendered = !1;
  20300. Blockly.Events.disable();
  20301. try {
  20302. for (var d = this.getIcons(), e = 0; e < d.length; e++)
  20303. d[e].dispose()
  20304. } finally {
  20305. Blockly.Events.enable()
  20306. }
  20307. Blockly.BlockSvg.superClass_.dispose.call(this, a);
  20308. goog.dom.removeNode(this.svgGroup_);
  20309. c.resizeContents();
  20310. this.svgPathDark_ = this.svgPathLight_ = this.svgPath_ = this.svgGroup_ = null;
  20311. Blockly.Field.stopCache()
  20312. }
  20313. }
  20314. ;
  20315. Blockly.BlockSvg.prototype.disposeUiEffect = function () {
  20316. this.workspace.playAudio("delete");
  20317. var a = Blockly.getSvgXY_(this.svgGroup_, this.workspace)
  20318. , b = this.svgGroup_.cloneNode(!0);
  20319. b.translateX_ = a.x;
  20320. b.translateY_ = a.y;
  20321. b.setAttribute("transform", "translate(" + b.translateX_ + "," + b.translateY_ + ")");
  20322. this.workspace.getParentSvg().appendChild(b);
  20323. b.bBox_ = b.getBBox();
  20324. Blockly.BlockSvg.disposeUiStep_(b, this.RTL, new Date, this.workspace.scale)
  20325. }
  20326. ;
  20327. Blockly.BlockSvg.disposeUiStep_ = function (a, b, c, d) {
  20328. var e = (new Date - c) / 150;
  20329. 1 < e ? goog.dom.removeNode(a) : (a.setAttribute("transform", "translate(" + (a.translateX_ + (b ? -1 : 1) * a.bBox_.width * d / 2 * e) + "," + (a.translateY_ + a.bBox_.height * d * e) + ") scale(" + (1 - e) * d + ")"),
  20330. setTimeout(function () {
  20331. Blockly.BlockSvg.disposeUiStep_(a, b, c, d)
  20332. }, 10))
  20333. }
  20334. ;
  20335. Blockly.BlockSvg.prototype.connectionUiEffect = function () {
  20336. this.workspace.playAudio("click");
  20337. if (!(1 > this.workspace.scale)) {
  20338. var a = Blockly.getSvgXY_(this.svgGroup_, this.workspace);
  20339. this.outputConnection ? (a.x += (this.RTL ? 3 : -3) * this.workspace.scale,
  20340. a.y += 13 * this.workspace.scale) : this.previousConnection && (a.x += (this.RTL ? -23 : 23) * this.workspace.scale,
  20341. a.y += 3 * this.workspace.scale);
  20342. a = Blockly.createSvgElement("circle", {
  20343. cx: a.x,
  20344. cy: a.y,
  20345. r: 0,
  20346. fill: "none",
  20347. stroke: "#888",
  20348. "stroke-width": 10
  20349. }, this.workspace.getParentSvg());
  20350. Blockly.BlockSvg.connectionUiStep_(a, new Date, this.workspace.scale)
  20351. }
  20352. }
  20353. ;
  20354. Blockly.BlockSvg.connectionUiStep_ = function (a, b, c) {
  20355. var d = (new Date - b) / 150;
  20356. 1 < d ? goog.dom.removeNode(a) : (a.setAttribute("r", 25 * d * c),
  20357. a.style.opacity = 1 - d,
  20358. Blockly.BlockSvg.disconnectUiStop_.pid_ = setTimeout(function () {
  20359. Blockly.BlockSvg.connectionUiStep_(a, b, c)
  20360. }, 10))
  20361. }
  20362. ;
  20363. Blockly.BlockSvg.prototype.disconnectUiEffect = function () {
  20364. this.workspace.playAudio("disconnect");
  20365. if (!(1 > this.workspace.scale)) {
  20366. var a = this.getHeightWidth().height;
  20367. a = Math.atan(10 / a) / Math.PI * 180;
  20368. this.RTL || (a *= -1);
  20369. Blockly.BlockSvg.disconnectUiStep_(this.svgGroup_, a, new Date)
  20370. }
  20371. }
  20372. ;
  20373. Blockly.BlockSvg.disconnectUiStep_ = function (a, b, c) {
  20374. var d = (new Date - c) / 200;
  20375. 1 < d ? a.skew_ = "" : (a.skew_ = "skewX(" + Math.round(Math.sin(d * Math.PI * 3) * (1 - d) * b) + ")",
  20376. Blockly.BlockSvg.disconnectUiStop_.group = a,
  20377. Blockly.BlockSvg.disconnectUiStop_.pid = setTimeout(function () {
  20378. Blockly.BlockSvg.disconnectUiStep_(a, b, c)
  20379. }, 10));
  20380. a.setAttribute("transform", a.translate_ + a.skew_)
  20381. }
  20382. ;
  20383. Blockly.BlockSvg.disconnectUiStop_ = function () {
  20384. if (Blockly.BlockSvg.disconnectUiStop_.group) {
  20385. clearTimeout(Blockly.BlockSvg.disconnectUiStop_.pid);
  20386. var a = Blockly.BlockSvg.disconnectUiStop_.group;
  20387. a.skew_ = "";
  20388. a.setAttribute("transform", a.translate_);
  20389. Blockly.BlockSvg.disconnectUiStop_.group = null
  20390. }
  20391. }
  20392. ;
  20393. Blockly.BlockSvg.disconnectUiStop_.pid = 0;
  20394. Blockly.BlockSvg.disconnectUiStop_.group = null;
  20395. Blockly.BlockSvg.prototype.updateColour = function () {
  20396. if (!this.disabled) {
  20397. var a = this.getColour()
  20398. , b = goog.color.hexToRgb(a);
  20399. if (this.isShadow())
  20400. b = goog.color.lighten(b, .6),
  20401. a = goog.color.rgbArrayToHex(b),
  20402. this.svgPathLight_.style.display = "none",
  20403. this.svgPathDark_.setAttribute("fill", a);
  20404. else {
  20405. this.svgPathLight_.style.display = "";
  20406. var c = goog.color.rgbArrayToHex(goog.color.lighten(b, .3));
  20407. b = goog.color.rgbArrayToHex(goog.color.darken(b, .2));
  20408. this.svgPathLight_.setAttribute("stroke", c);
  20409. this.svgPathDark_.setAttribute("fill", b)
  20410. }
  20411. this.svgPath_.setAttribute("fill", a);
  20412. a = this.getIcons();
  20413. for (c = 0; c < a.length; c++)
  20414. a[c].updateColour();
  20415. for (a = 0; c = this.inputList[a]; a++) {
  20416. b = 0;
  20417. for (var d; d = c.fieldRow[b]; b++)
  20418. d.setText(null)
  20419. }
  20420. }
  20421. }
  20422. ;
  20423. Blockly.BlockSvg.prototype.updateDisabled = function () {
  20424. var a = Blockly.hasClass_(this.svgGroup_, "blocklyDisabled");
  20425. this.disabled || this.getInheritedDisabled() ? a || (Blockly.addClass_(this.svgGroup_, "blocklyDisabled"),
  20426. this.svgPath_.setAttribute("fill", "url(#" + this.workspace.options.disabledPatternId + ")")) : a && (Blockly.removeClass_(this.svgGroup_, "blocklyDisabled"),
  20427. this.updateColour());
  20428. a = this.getChildren();
  20429. for (var b = 0, c; c = a[b]; b++)
  20430. c.updateDisabled()
  20431. }
  20432. ;
  20433. Blockly.BlockSvg.prototype.getCommentText = function () {
  20434. return this.comment ? this.comment.getText().replace(/\s+$/, "").replace(/ +\n/g, "\n") : ""
  20435. }
  20436. ;
  20437. Blockly.BlockSvg.prototype.setCommentText = function (a) {
  20438. var b = !1;
  20439. goog.isString(a) ? (this.comment || (this.comment = new Blockly.Comment(this),
  20440. b = !0),
  20441. this.comment.setText(a)) : this.comment && (this.comment.dispose(),
  20442. b = !0);
  20443. b && this.rendered && (this.render(),
  20444. this.bumpNeighbours_())
  20445. }
  20446. ;
  20447. Blockly.BlockSvg.prototype.setWarningText = function (a, b) {
  20448. this.setWarningText.pid_ || (this.setWarningText.pid_ = Object.create(null));
  20449. var c = b || "";
  20450. if (c)
  20451. this.setWarningText.pid_[c] && (clearTimeout(this.setWarningText.pid_[c]),
  20452. delete this.setWarningText.pid_[c]);
  20453. else
  20454. for (var d in this.setWarningText.pid_)
  20455. clearTimeout(this.setWarningText.pid_[d]),
  20456. delete this.setWarningText.pid_[d];
  20457. if (Blockly.dragMode_ == Blockly.DRAG_FREE) {
  20458. var e = this;
  20459. this.setWarningText.pid_[c] = setTimeout(function () {
  20460. e.workspace && (delete e.setWarningText.pid_[c],
  20461. e.setWarningText(a, c))
  20462. }, 100)
  20463. } else {
  20464. this.isInFlyout && (a = null);
  20465. d = this.getSurroundParent();
  20466. for (var f = null; d;)
  20467. d.isCollapsed() && (f = d),
  20468. d = d.getSurroundParent();
  20469. f && f.setWarningText(a, "collapsed " + this.id + " " + c);
  20470. d = !1;
  20471. goog.isString(a) ? (this.warning || (this.warning = new Blockly.Warning(this),
  20472. d = !0),
  20473. this.warning.setText(a, c)) : this.warning && !c ? (this.warning.dispose(),
  20474. d = !0) : this.warning && (d = this.warning.getText(),
  20475. this.warning.setText("", c),
  20476. (f = this.warning.getText()) || this.warning.dispose(),
  20477. d = d == f);
  20478. d && this.rendered && (this.render(),
  20479. this.bumpNeighbours_())
  20480. }
  20481. }
  20482. ;
  20483. Blockly.BlockSvg.prototype.setMutator = function (a) {
  20484. this.mutator && this.mutator !== a && this.mutator.dispose();
  20485. a && (a.block_ = this,
  20486. this.mutator = a,
  20487. a.createIcon())
  20488. }
  20489. ;
  20490. Blockly.BlockSvg.prototype.setDisabled = function (a) {
  20491. this.disabled != a && (Blockly.BlockSvg.superClass_.setDisabled.call(this, a),
  20492. this.rendered && this.updateDisabled())
  20493. }
  20494. ;
  20495. Blockly.BlockSvg.prototype.setHighlighted = function (a) {
  20496. if (!this.rendered) {
  20497. return;
  20498. }
  20499. if (a) {
  20500. this.svgPath_.setAttribute('filter',
  20501. 'url(#' + this.workspace.options.embossFilterId + ')');
  20502. this.svgPathLight_.style.display = 'none';
  20503. } else {
  20504. this.svgPath_.removeAttribute('filter');
  20505. this.svgPathLight_.style.display = 'block';
  20506. }
  20507. }
  20508. ;
  20509. Blockly.BlockSvg.prototype.addSelect = function () {
  20510. Blockly.addClass_(this.svgGroup_, "blocklySelected");
  20511. var a = this;
  20512. do {
  20513. var b = a.getSvgRoot();
  20514. b.parentNode.appendChild(b);
  20515. a = a.getParent()
  20516. } while (a)
  20517. }
  20518. ;
  20519. Blockly.BlockSvg.prototype.removeSelect = function () {
  20520. Blockly.removeClass_(this.svgGroup_, "blocklySelected")
  20521. }
  20522. ;
  20523. Blockly.BlockSvg.prototype.setColour = function (a) {
  20524. Blockly.BlockSvg.superClass_.setColour.call(this, a);
  20525. this.rendered && this.updateColour()
  20526. }
  20527. ;
  20528. Blockly.BlockSvg.prototype.setPreviousStatement = function (a, b) {
  20529. Blockly.BlockSvg.superClass_.setPreviousStatement.call(this, a, b);
  20530. this.rendered && (this.render(),
  20531. this.bumpNeighbours_())
  20532. }
  20533. ;
  20534. Blockly.BlockSvg.prototype.setNextStatement = function (a, b) {
  20535. Blockly.BlockSvg.superClass_.setNextStatement.call(this, a, b);
  20536. this.rendered && (this.render(),
  20537. this.bumpNeighbours_())
  20538. }
  20539. ;
  20540. Blockly.BlockSvg.prototype.setOutput = function (a, b) {
  20541. Blockly.BlockSvg.superClass_.setOutput.call(this, a, b);
  20542. this.rendered && (this.render(),
  20543. this.bumpNeighbours_())
  20544. }
  20545. ;
  20546. Blockly.BlockSvg.prototype.setInputsInline = function (a) {
  20547. Blockly.BlockSvg.superClass_.setInputsInline.call(this, a);
  20548. this.rendered && (this.render(),
  20549. this.bumpNeighbours_())
  20550. }
  20551. ;
  20552. Blockly.BlockSvg.prototype.removeInput = function (a, b) {
  20553. Blockly.BlockSvg.superClass_.removeInput.call(this, a, b);
  20554. this.rendered && (this.render(),
  20555. this.bumpNeighbours_())
  20556. }
  20557. ;
  20558. Blockly.BlockSvg.prototype.moveNumberedInputBefore = function (a, b) {
  20559. Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this, a, b);
  20560. this.rendered && (this.render(),
  20561. this.bumpNeighbours_())
  20562. }
  20563. ;
  20564. Blockly.BlockSvg.prototype.appendInput_ = function (a, b) {
  20565. var c = Blockly.BlockSvg.superClass_.appendInput_.call(this, a, b);
  20566. this.rendered && (this.render(),
  20567. this.bumpNeighbours_());
  20568. return c
  20569. }
  20570. ;
  20571. Blockly.BlockSvg.prototype.getConnections_ = function (a) {
  20572. var b = [];
  20573. if (a || this.rendered)
  20574. if (this.outputConnection && b.push(this.outputConnection),
  20575. this.previousConnection && b.push(this.previousConnection),
  20576. this.nextConnection && b.push(this.nextConnection),
  20577. a || !this.collapsed_) {
  20578. a = 0;
  20579. for (var c; c = this.inputList[a]; a++)
  20580. c.connection && b.push(c.connection)
  20581. }
  20582. return b
  20583. }
  20584. ;
  20585. Blockly.BlockSvg.prototype.makeConnection_ = function (a) {
  20586. return new Blockly.RenderedConnection(this, a)
  20587. }
  20588. ;
  20589. Blockly.BlockSvg.render = {};
  20590. Blockly.BlockSvg.SEP_SPACE_X = 10;
  20591. Blockly.BlockSvg.SEP_SPACE_Y = 10;
  20592. Blockly.BlockSvg.INLINE_PADDING_Y = 5;
  20593. Blockly.BlockSvg.MIN_BLOCK_Y = 25;
  20594. Blockly.BlockSvg.TAB_HEIGHT = 20;
  20595. Blockly.BlockSvg.TAB_WIDTH = 8;
  20596. Blockly.BlockSvg.NOTCH_WIDTH = 30;
  20597. Blockly.BlockSvg.CORNER_RADIUS = 8;
  20598. Blockly.BlockSvg.START_HAT = !1;
  20599. Blockly.BlockSvg.START_HAT_HEIGHT = 15;
  20600. Blockly.BlockSvg.START_HAT_PATH = "c 30,-" + Blockly.BlockSvg.START_HAT_HEIGHT + " 70,-" + Blockly.BlockSvg.START_HAT_HEIGHT + " 100,0";
  20601. Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR = "c 17.8,-9.2 45.3,-14.9 75,-8.7 M 100.5,0.5";
  20602. Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL = "m 25,-8.7 c 29.7,-6.2 57.2,-0.5 75,8.7";
  20603. Blockly.BlockSvg.DISTANCE_45_INSIDE = (1 - Math.SQRT1_2) * (Blockly.BlockSvg.CORNER_RADIUS - .5) + .5;
  20604. Blockly.BlockSvg.DISTANCE_45_OUTSIDE = (1 - Math.SQRT1_2) * (Blockly.BlockSvg.CORNER_RADIUS + .5) - .5;
  20605. Blockly.BlockSvg.NOTCH_PATH_LEFT = "l 6,4 3,0 6,-4";
  20606. Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT = "l 6,4 3,0 6,-4";
  20607. Blockly.BlockSvg.NOTCH_PATH_RIGHT = "l -6,4 -3,0 -6,-4";
  20608. Blockly.BlockSvg.JAGGED_TEETH = "l 8,0 0,4 8,4 -16,8 8,4";
  20609. Blockly.BlockSvg.JAGGED_TEETH_HEIGHT = 20;
  20610. Blockly.BlockSvg.JAGGED_TEETH_WIDTH = 15;
  20611. Blockly.BlockSvg.TAB_PATH_DOWN = "v 5 c 0,10 -" + Blockly.BlockSvg.TAB_WIDTH + ",-8 -" + Blockly.BlockSvg.TAB_WIDTH + ",7.5 s " + Blockly.BlockSvg.TAB_WIDTH + ",-2.5 " + Blockly.BlockSvg.TAB_WIDTH + ",7.5";
  20612. Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL = "v 6.5 m -" + .97 * Blockly.BlockSvg.TAB_WIDTH + ",3 q -" + .05 * Blockly.BlockSvg.TAB_WIDTH + ",10 " + .3 * Blockly.BlockSvg.TAB_WIDTH + ",9.5 m " + .67 * Blockly.BlockSvg.TAB_WIDTH + ",-1.9 v 1.4";
  20613. Blockly.BlockSvg.TOP_LEFT_CORNER_START = "m 0," + Blockly.BlockSvg.CORNER_RADIUS;
  20614. Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL = "m " + Blockly.BlockSvg.DISTANCE_45_INSIDE + "," + Blockly.BlockSvg.DISTANCE_45_INSIDE;
  20615. Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR = "m 0.5," + (Blockly.BlockSvg.CORNER_RADIUS - .5);
  20616. Blockly.BlockSvg.TOP_LEFT_CORNER = "A " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,1 " + Blockly.BlockSvg.CORNER_RADIUS + ",0";
  20617. Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT = "A " + (Blockly.BlockSvg.CORNER_RADIUS - .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS - .5) + " 0 0,1 " + Blockly.BlockSvg.CORNER_RADIUS + ",0.5";
  20618. Blockly.BlockSvg.INNER_TOP_LEFT_CORNER = Blockly.BlockSvg.NOTCH_PATH_RIGHT + " h -" + (Blockly.BlockSvg.NOTCH_WIDTH - 15 - Blockly.BlockSvg.CORNER_RADIUS) + " a " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,0 -" + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS;
  20619. Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER = "a " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,0 " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS;
  20620. Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL = "a " + Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,0 " + (-Blockly.BlockSvg.DISTANCE_45_OUTSIDE - .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS - Blockly.BlockSvg.DISTANCE_45_OUTSIDE);
  20621. Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL = "a " + (Blockly.BlockSvg.CORNER_RADIUS + .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS + .5) + " 0 0,0 " + (Blockly.BlockSvg.CORNER_RADIUS + .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS + .5);
  20622. Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR = "a " + (Blockly.BlockSvg.CORNER_RADIUS + .5) + "," + (Blockly.BlockSvg.CORNER_RADIUS + .5) + " 0 0,0 " + (Blockly.BlockSvg.CORNER_RADIUS - Blockly.BlockSvg.DISTANCE_45_OUTSIDE) + "," + (Blockly.BlockSvg.DISTANCE_45_OUTSIDE + .5);
  20623. Blockly.BlockSvg.prototype.render = function (a) {
  20624. Blockly.Field.startCache();
  20625. this.rendered = !0;
  20626. var b = Blockly.BlockSvg.SEP_SPACE_X;
  20627. this.RTL && (b = -b);
  20628. for (var c = this.getIcons(), d = 0; d < c.length; d++)
  20629. b = c[d].renderIcon(b);
  20630. b += this.RTL ? Blockly.BlockSvg.SEP_SPACE_X : -Blockly.BlockSvg.SEP_SPACE_X;
  20631. c = this.renderCompute_(b);
  20632. this.renderDraw_(b, c);
  20633. this.renderMoveConnections_();
  20634. !1 !== a && ((a = this.getParent()) ? a.render(!0) : this.workspace.resizeContents());
  20635. Blockly.Field.stopCache()
  20636. }
  20637. ;
  20638. Blockly.BlockSvg.prototype.renderFields_ = function (a, b, c) {
  20639. c += Blockly.BlockSvg.INLINE_PADDING_Y;
  20640. this.RTL && (b = -b);
  20641. for (var d = 0, e; e = a[d]; d++) {
  20642. var f = e.getSvgRoot();
  20643. f && (this.RTL ? (b -= e.renderSep + e.renderWidth,
  20644. f.setAttribute("transform", "translate(" + b + "," + c + ")"),
  20645. e.renderWidth && (b -= Blockly.BlockSvg.SEP_SPACE_X)) : (f.setAttribute("transform", "translate(" + (b + e.renderSep) + "," + c + ")"),
  20646. e.renderWidth && (b += e.renderSep + e.renderWidth + Blockly.BlockSvg.SEP_SPACE_X)))
  20647. }
  20648. return this.RTL ? -b : b
  20649. }
  20650. ;
  20651. Blockly.BlockSvg.prototype.renderCompute_ = function (a) {
  20652. var b = this.inputList
  20653. , c = [];
  20654. c.rightEdge = a + 2 * Blockly.BlockSvg.SEP_SPACE_X;
  20655. if (this.previousConnection || this.nextConnection)
  20656. c.rightEdge = Math.max(c.rightEdge, Blockly.BlockSvg.NOTCH_WIDTH + Blockly.BlockSvg.SEP_SPACE_X);
  20657. for (var d = 0, e = 0, f = !1, g = !1, h = !1, k = void 0, m = this.getInputsInline() && !this.isCollapsed(), p = 0, l; l = b[p]; p++)
  20658. if (l.isVisible()) {
  20659. if (m && k && k != Blockly.NEXT_STATEMENT && l.type != Blockly.NEXT_STATEMENT)
  20660. var n = c[c.length - 1];
  20661. else
  20662. k = l.type,
  20663. n = [],
  20664. n.type = m && l.type != Blockly.NEXT_STATEMENT ? Blockly.BlockSvg.INLINE : l.type,
  20665. n.height = 0,
  20666. c.push(n);
  20667. n.push(l);
  20668. l.renderHeight = Blockly.BlockSvg.MIN_BLOCK_Y;
  20669. l.renderWidth = m && l.type == Blockly.INPUT_VALUE ? Blockly.BlockSvg.TAB_WIDTH + 1.25 * Blockly.BlockSvg.SEP_SPACE_X : 0;
  20670. if (l.connection && l.connection.isConnected()) {
  20671. var q = l.connection.targetBlock().getHeightWidth();
  20672. l.renderHeight = Math.max(l.renderHeight, q.height);
  20673. l.renderWidth = Math.max(l.renderWidth, q.width)
  20674. }
  20675. m || p != b.length - 1 ? !m && l.type == Blockly.INPUT_VALUE && b[p + 1] && b[p + 1].type == Blockly.NEXT_STATEMENT && l.renderHeight-- : l.renderHeight--;
  20676. n.height = Math.max(n.height, l.renderHeight);
  20677. l.fieldWidth = 0;
  20678. 1 == c.length && (l.fieldWidth += this.RTL ? -a : a);
  20679. q = !1;
  20680. for (var t = 0, r; r = l.fieldRow[t]; t++) {
  20681. 0 != t && (l.fieldWidth += Blockly.BlockSvg.SEP_SPACE_X);
  20682. var u = r.getSize();
  20683. r.renderWidth = u.width;
  20684. r.renderSep = q && r.EDITABLE ? Blockly.BlockSvg.SEP_SPACE_X : 0;
  20685. l.fieldWidth += r.renderWidth + r.renderSep;
  20686. n.height = Math.max(n.height, u.height);
  20687. q = r.EDITABLE
  20688. }
  20689. n.type != Blockly.BlockSvg.INLINE && (n.type == Blockly.NEXT_STATEMENT ? (g = !0,
  20690. e = Math.max(e, l.fieldWidth)) : (n.type == Blockly.INPUT_VALUE ? f = !0 : n.type == Blockly.DUMMY_INPUT && (h = !0),
  20691. d = Math.max(d, l.fieldWidth)))
  20692. }
  20693. for (a = 0; n = c[a]; a++)
  20694. if (n.thicker = !1,
  20695. n.type == Blockly.BlockSvg.INLINE)
  20696. for (b = 0; l = n[b]; b++)
  20697. if (l.type == Blockly.INPUT_VALUE) {
  20698. n.height += 2 * Blockly.BlockSvg.INLINE_PADDING_Y;
  20699. n.thicker = !0;
  20700. break
  20701. }
  20702. c.statementEdge = 2 * Blockly.BlockSvg.SEP_SPACE_X + e;
  20703. g && (c.rightEdge = Math.max(c.rightEdge, c.statementEdge + Blockly.BlockSvg.NOTCH_WIDTH));
  20704. f ? c.rightEdge = Math.max(c.rightEdge, d + 2 * Blockly.BlockSvg.SEP_SPACE_X + Blockly.BlockSvg.TAB_WIDTH) : h && (c.rightEdge = Math.max(c.rightEdge, d + 2 * Blockly.BlockSvg.SEP_SPACE_X));
  20705. c.hasValue = f;
  20706. c.hasStatement = g;
  20707. c.hasDummy = h;
  20708. return c
  20709. }
  20710. ;
  20711. Blockly.BlockSvg.prototype.renderDraw_ = function (a, b) {
  20712. this.startHat_ = !1;
  20713. this.height = 0;
  20714. if (this.outputConnection)
  20715. this.squareBottomLeftCorner_ = this.squareTopLeftCorner_ = !0;
  20716. else {
  20717. this.squareBottomLeftCorner_ = this.squareTopLeftCorner_ = !1;
  20718. if (this.previousConnection) {
  20719. var c = this.previousConnection.targetBlock();
  20720. c && c.getNextBlock() == this && (this.squareTopLeftCorner_ = !0)
  20721. } else
  20722. Blockly.BlockSvg.START_HAT && (this.startHat_ = this.squareTopLeftCorner_ = !0,
  20723. this.height += Blockly.BlockSvg.START_HAT_HEIGHT,
  20724. b.rightEdge = Math.max(b.rightEdge, 100));
  20725. this.getNextBlock() && (this.squareBottomLeftCorner_ = !0)
  20726. }
  20727. var d = []
  20728. , e = [];
  20729. c = [];
  20730. var f = [];
  20731. this.renderDrawTop_(d, c, b.rightEdge);
  20732. var g = this.renderDrawRight_(d, c, e, f, b, a);
  20733. this.renderDrawBottom_(d, c, g);
  20734. this.renderDrawLeft_(d, c);
  20735. d = d.join(" ") + "\n" + e.join(" ");
  20736. this.svgPath_.setAttribute("d", d);
  20737. this.svgPathDark_.setAttribute("d", d);
  20738. d = c.join(" ") + "\n" + f.join(" ");
  20739. this.svgPathLight_.setAttribute("d", d);
  20740. this.RTL && (this.svgPath_.setAttribute("transform", "scale(-1 1)"),
  20741. this.svgPathLight_.setAttribute("transform", "scale(-1 1)"),
  20742. this.svgPathDark_.setAttribute("transform", "translate(1,1) scale(-1 1)"))
  20743. }
  20744. ;
  20745. Blockly.BlockSvg.prototype.renderMoveConnections_ = function () {
  20746. var a = this.getRelativeToSurfaceXY();
  20747. this.previousConnection && this.previousConnection.moveToOffset(a);
  20748. this.outputConnection && this.outputConnection.moveToOffset(a);
  20749. for (var b = 0; b < this.inputList.length; b++) {
  20750. var c = this.inputList[b].connection;
  20751. c && (c.moveToOffset(a),
  20752. c.isConnected() && c.tighten_())
  20753. }
  20754. this.nextConnection && (this.nextConnection.moveToOffset(a),
  20755. this.nextConnection.isConnected() && this.nextConnection.tighten_())
  20756. }
  20757. ;
  20758. Blockly.BlockSvg.prototype.renderDrawTop_ = function (a, b, c) {
  20759. this.squareTopLeftCorner_ ? (a.push("m 0,0"),
  20760. b.push("m 0.5,0.5"),
  20761. this.startHat_ && (a.push(Blockly.BlockSvg.START_HAT_PATH),
  20762. b.push(this.RTL ? Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL : Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR))) : (a.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),
  20763. b.push(this.RTL ? Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL : Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR),
  20764. a.push(Blockly.BlockSvg.TOP_LEFT_CORNER),
  20765. b.push(Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT));
  20766. this.previousConnection && (a.push("H", Blockly.BlockSvg.NOTCH_WIDTH - 15),
  20767. b.push("H", Blockly.BlockSvg.NOTCH_WIDTH - 15),
  20768. a.push(Blockly.BlockSvg.NOTCH_PATH_LEFT),
  20769. b.push(Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT),
  20770. this.previousConnection.setOffsetInBlock(this.RTL ? -Blockly.BlockSvg.NOTCH_WIDTH : Blockly.BlockSvg.NOTCH_WIDTH, 0));
  20771. a.push("H", c);
  20772. b.push("H", c - .5);
  20773. this.width = c
  20774. }
  20775. ;
  20776. Blockly.BlockSvg.prototype.renderDrawRight_ = function (a, b, c, d, e, f) {
  20777. for (var g, h = 0, k, m, p = 0, l; l = e[p]; p++) {
  20778. g = Blockly.BlockSvg.SEP_SPACE_X;
  20779. 0 == p && (g += this.RTL ? -f : f);
  20780. b.push("M", e.rightEdge - .5 + "," + (h + .5));
  20781. if (this.isCollapsed()) {
  20782. var n = l[0];
  20783. k = h;
  20784. this.renderFields_(n.fieldRow, g, k);
  20785. a.push(Blockly.BlockSvg.JAGGED_TEETH);
  20786. b.push("h 8");
  20787. n = l.height - Blockly.BlockSvg.JAGGED_TEETH_HEIGHT;
  20788. a.push("v", n);
  20789. this.RTL && (b.push("v 3.9 l 7.2,3.4 m -14.5,8.9 l 7.3,3.5"),
  20790. b.push("v", n - .7));
  20791. this.width += Blockly.BlockSvg.JAGGED_TEETH_WIDTH
  20792. } else if (l.type == Blockly.BlockSvg.INLINE) {
  20793. for (var q = 0; n = l[q]; q++)
  20794. k = h,
  20795. l.thicker && (k += Blockly.BlockSvg.INLINE_PADDING_Y),
  20796. g = this.renderFields_(n.fieldRow, g, k),
  20797. n.type != Blockly.DUMMY_INPUT && (g += n.renderWidth + Blockly.BlockSvg.SEP_SPACE_X),
  20798. n.type == Blockly.INPUT_VALUE && (c.push("M", g - Blockly.BlockSvg.SEP_SPACE_X + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y)),
  20799. c.push("h", Blockly.BlockSvg.TAB_WIDTH - 2 - n.renderWidth),
  20800. c.push(Blockly.BlockSvg.TAB_PATH_DOWN),
  20801. c.push("v", n.renderHeight + 1 - Blockly.BlockSvg.TAB_HEIGHT),
  20802. c.push("h", n.renderWidth + 2 - Blockly.BlockSvg.TAB_WIDTH),
  20803. c.push("z"),
  20804. this.RTL ? (d.push("M", g - Blockly.BlockSvg.SEP_SPACE_X - 2.5 + Blockly.BlockSvg.TAB_WIDTH - n.renderWidth + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y + .5)),
  20805. d.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),
  20806. d.push("v", n.renderHeight - Blockly.BlockSvg.TAB_HEIGHT + 2.5),
  20807. d.push("h", n.renderWidth - Blockly.BlockSvg.TAB_WIDTH + 2)) : (d.push("M", g - Blockly.BlockSvg.SEP_SPACE_X + .5 + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y + .5)),
  20808. d.push("v", n.renderHeight + 1),
  20809. d.push("h", Blockly.BlockSvg.TAB_WIDTH - 2 - n.renderWidth),
  20810. d.push("M", g - n.renderWidth - Blockly.BlockSvg.SEP_SPACE_X + .9 + "," + (h + Blockly.BlockSvg.INLINE_PADDING_Y + Blockly.BlockSvg.TAB_HEIGHT - .7)),
  20811. d.push("l", .46 * Blockly.BlockSvg.TAB_WIDTH + ",-2.1")),
  20812. k = this.RTL ? -g - Blockly.BlockSvg.TAB_WIDTH + Blockly.BlockSvg.SEP_SPACE_X + n.renderWidth + 1 : g + Blockly.BlockSvg.TAB_WIDTH - Blockly.BlockSvg.SEP_SPACE_X - n.renderWidth - 1,
  20813. m = h + Blockly.BlockSvg.INLINE_PADDING_Y + 1,
  20814. n.connection.setOffsetInBlock(k, m));
  20815. g = Math.max(g, e.rightEdge);
  20816. this.width = Math.max(this.width, g);
  20817. a.push("H", g);
  20818. b.push("H", g - .5);
  20819. a.push("v", l.height);
  20820. this.RTL && b.push("v", l.height - 1)
  20821. } else
  20822. l.type == Blockly.INPUT_VALUE ? (n = l[0],
  20823. k = h,
  20824. n.align != Blockly.ALIGN_LEFT && (q = e.rightEdge - n.fieldWidth - Blockly.BlockSvg.TAB_WIDTH - 2 * Blockly.BlockSvg.SEP_SPACE_X,
  20825. n.align == Blockly.ALIGN_RIGHT ? g += q : n.align == Blockly.ALIGN_CENTRE && (g += q / 2)),
  20826. this.renderFields_(n.fieldRow, g, k),
  20827. a.push(Blockly.BlockSvg.TAB_PATH_DOWN),
  20828. q = l.height - Blockly.BlockSvg.TAB_HEIGHT,
  20829. a.push("v", q),
  20830. this.RTL ? (b.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),
  20831. b.push("v", q + .5)) : (b.push("M", e.rightEdge - 5 + "," + (h + Blockly.BlockSvg.TAB_HEIGHT - .7)),
  20832. b.push("l", .46 * Blockly.BlockSvg.TAB_WIDTH + ",-2.1")),
  20833. k = this.RTL ? -e.rightEdge - 1 : e.rightEdge + 1,
  20834. n.connection.setOffsetInBlock(k, h),
  20835. n.connection.isConnected() && (this.width = Math.max(this.width, e.rightEdge + n.connection.targetBlock().getHeightWidth().width - Blockly.BlockSvg.TAB_WIDTH + 1))) : l.type == Blockly.DUMMY_INPUT ? (n = l[0],
  20836. k = h,
  20837. n.align != Blockly.ALIGN_LEFT && (q = e.rightEdge - n.fieldWidth - 2 * Blockly.BlockSvg.SEP_SPACE_X,
  20838. e.hasValue && (q -= Blockly.BlockSvg.TAB_WIDTH),
  20839. n.align == Blockly.ALIGN_RIGHT ? g += q : n.align == Blockly.ALIGN_CENTRE && (g += q / 2)),
  20840. this.renderFields_(n.fieldRow, g, k),
  20841. a.push("v", l.height),
  20842. this.RTL && b.push("v", l.height - 1)) : l.type == Blockly.NEXT_STATEMENT && (n = l[0],
  20843. 0 == p && (a.push("v", Blockly.BlockSvg.SEP_SPACE_Y),
  20844. this.RTL && b.push("v", Blockly.BlockSvg.SEP_SPACE_Y - 1),
  20845. h += Blockly.BlockSvg.SEP_SPACE_Y),
  20846. k = h,
  20847. n.align != Blockly.ALIGN_LEFT && (q = e.statementEdge - n.fieldWidth - 2 * Blockly.BlockSvg.SEP_SPACE_X,
  20848. n.align == Blockly.ALIGN_RIGHT ? g += q : n.align == Blockly.ALIGN_CENTRE && (g += q / 2)),
  20849. this.renderFields_(n.fieldRow, g, k),
  20850. g = e.statementEdge + Blockly.BlockSvg.NOTCH_WIDTH,
  20851. a.push("H", g),
  20852. a.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER),
  20853. a.push("v", l.height - 2 * Blockly.BlockSvg.CORNER_RADIUS),
  20854. a.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER),
  20855. a.push("H", e.rightEdge),
  20856. this.RTL ? (b.push("M", g - Blockly.BlockSvg.NOTCH_WIDTH + Blockly.BlockSvg.DISTANCE_45_OUTSIDE + "," + (h + Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),
  20857. b.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL),
  20858. b.push("v", l.height - 2 * Blockly.BlockSvg.CORNER_RADIUS),
  20859. b.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL)) : (b.push("M", g - Blockly.BlockSvg.NOTCH_WIDTH + Blockly.BlockSvg.DISTANCE_45_OUTSIDE + "," + (h + l.height - Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),
  20860. b.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR)),
  20861. b.push("H", e.rightEdge - .5),
  20862. k = this.RTL ? -g : g + 1,
  20863. n.connection.setOffsetInBlock(k, h + 1),
  20864. n.connection.isConnected() && (this.width = Math.max(this.width, e.statementEdge + n.connection.targetBlock().getHeightWidth().width)),
  20865. p == e.length - 1 || e[p + 1].type == Blockly.NEXT_STATEMENT) && (a.push("v", Blockly.BlockSvg.SEP_SPACE_Y),
  20866. this.RTL && b.push("v", Blockly.BlockSvg.SEP_SPACE_Y - 1),
  20867. h += Blockly.BlockSvg.SEP_SPACE_Y);
  20868. h += l.height
  20869. }
  20870. e.length || (h = Blockly.BlockSvg.MIN_BLOCK_Y,
  20871. a.push("V", h),
  20872. this.RTL && b.push("V", h - 1));
  20873. return h
  20874. }
  20875. ;
  20876. Blockly.BlockSvg.prototype.renderDrawBottom_ = function (a, b, c) {
  20877. this.height += c + 1;
  20878. this.nextConnection && (a.push("H", Blockly.BlockSvg.NOTCH_WIDTH + (this.RTL ? .5 : -.5) + " " + Blockly.BlockSvg.NOTCH_PATH_RIGHT),
  20879. this.nextConnection.setOffsetInBlock(this.RTL ? -Blockly.BlockSvg.NOTCH_WIDTH : Blockly.BlockSvg.NOTCH_WIDTH, c + 1),
  20880. this.height += 4);
  20881. this.squareBottomLeftCorner_ ? (a.push("H 0"),
  20882. this.RTL || b.push("M", "0.5," + (c - .5))) : (a.push("H", Blockly.BlockSvg.CORNER_RADIUS),
  20883. a.push("a", Blockly.BlockSvg.CORNER_RADIUS + "," + Blockly.BlockSvg.CORNER_RADIUS + " 0 0,1 -" + Blockly.BlockSvg.CORNER_RADIUS + ",-" + Blockly.BlockSvg.CORNER_RADIUS),
  20884. this.RTL || (b.push("M", Blockly.BlockSvg.DISTANCE_45_INSIDE + "," + (c - Blockly.BlockSvg.DISTANCE_45_INSIDE)),
  20885. b.push("A", Blockly.BlockSvg.CORNER_RADIUS - .5 + "," + (Blockly.BlockSvg.CORNER_RADIUS - .5) + " 0 0,1 0.5," + (c - Blockly.BlockSvg.CORNER_RADIUS))))
  20886. }
  20887. ;
  20888. Blockly.BlockSvg.prototype.renderDrawLeft_ = function (a, b) {
  20889. this.outputConnection ? (this.outputConnection.setOffsetInBlock(0, 0),
  20890. a.push("V", Blockly.BlockSvg.TAB_HEIGHT),
  20891. a.push("c 0,-10 -" + Blockly.BlockSvg.TAB_WIDTH + ",8 -" + Blockly.BlockSvg.TAB_WIDTH + ",-7.5 s " + Blockly.BlockSvg.TAB_WIDTH + ",2.5 " + Blockly.BlockSvg.TAB_WIDTH + ",-7.5"),
  20892. this.RTL ? (b.push("M", -.25 * Blockly.BlockSvg.TAB_WIDTH + ",8.4"),
  20893. b.push("l", -.45 * Blockly.BlockSvg.TAB_WIDTH + ",-2.1")) : (b.push("V", Blockly.BlockSvg.TAB_HEIGHT - 1.5),
  20894. b.push("m", -.92 * Blockly.BlockSvg.TAB_WIDTH + ",-0.5 q " + -.19 * Blockly.BlockSvg.TAB_WIDTH + ",-5.5 0,-11"),
  20895. b.push("m", .92 * Blockly.BlockSvg.TAB_WIDTH + ",1 V 0.5 H 1")),
  20896. this.width += Blockly.BlockSvg.TAB_WIDTH) : this.RTL || (this.squareTopLeftCorner_ ? b.push("V", .5) : b.push("V", Blockly.BlockSvg.CORNER_RADIUS));
  20897. a.push("z")
  20898. }
  20899. ;
  20900. Blockly.Events = {};
  20901. Blockly.Events.group_ = "";
  20902. Blockly.Events.recordUndo = !0;
  20903. Blockly.Events.disabled_ = 0;
  20904. Blockly.Events.CREATE = "create";
  20905. Blockly.Events.DELETE = "delete";
  20906. Blockly.Events.CHANGE = "change";
  20907. Blockly.Events.MOVE = "move";
  20908. Blockly.Events.UI = "ui";
  20909. Blockly.Events.FIRE_QUEUE_ = [];
  20910. Blockly.Events.fire = function (a) {
  20911. Blockly.Events.isEnabled() && (Blockly.Events.FIRE_QUEUE_.length || setTimeout(Blockly.Events.fireNow_, 0),
  20912. Blockly.Events.FIRE_QUEUE_.push(a))
  20913. }
  20914. ;
  20915. Blockly.Events.fireNow_ = function () {
  20916. for (var a = Blockly.Events.filter(Blockly.Events.FIRE_QUEUE_, !0), b = Blockly.Events.FIRE_QUEUE_.length = 0, c; c = a[b]; b++) {
  20917. var d = Blockly.Workspace.getById(c.workspaceId);
  20918. d && d.fireChangeListener(c)
  20919. }
  20920. }
  20921. ;
  20922. Blockly.Events.filter = function (a, b) {
  20923. var c = goog.array.clone(a);
  20924. b || c.reverse();
  20925. for (var d = 0, e; e = c[d]; d++)
  20926. for (var f = d + 1, g; g = c[f]; f++)
  20927. e.type == g.type && e.blockId == g.blockId && e.workspaceId == g.workspaceId && (e.type == Blockly.Events.MOVE ? (e.newParentId = g.newParentId,
  20928. e.newInputName = g.newInputName,
  20929. e.newCoordinate = g.newCoordinate,
  20930. c.splice(f, 1),
  20931. f--) : e.type == Blockly.Events.CHANGE && e.element == g.element && e.name == g.name ? (e.newValue = g.newValue,
  20932. c.splice(f, 1),
  20933. f--) : e.type != Blockly.Events.UI || "click" != g.element || "commentOpen" != e.element && "mutatorOpen" != e.element && "warningOpen" != e.element || (e.newValue = g.newValue,
  20934. c.splice(f, 1),
  20935. f--));
  20936. for (d = c.length - 1; 0 <= d; d--)
  20937. c[d].isNull() && c.splice(d, 1);
  20938. b || c.reverse();
  20939. for (d = 1; e = c[d]; d++)
  20940. e.type == Blockly.Events.CHANGE && "mutation" == e.element && c.unshift(c.splice(d, 1)[0]);
  20941. return c
  20942. }
  20943. ;
  20944. Blockly.Events.clearPendingUndo = function () {
  20945. for (var a = 0, b; b = Blockly.Events.FIRE_QUEUE_[a]; a++)
  20946. b.recordUndo = !1
  20947. }
  20948. ;
  20949. Blockly.Events.disable = function () {
  20950. Blockly.Events.disabled_++
  20951. }
  20952. ;
  20953. Blockly.Events.enable = function () {
  20954. Blockly.Events.disabled_--
  20955. }
  20956. ;
  20957. Blockly.Events.isEnabled = function () {
  20958. return 0 == Blockly.Events.disabled_
  20959. }
  20960. ;
  20961. Blockly.Events.getGroup = function () {
  20962. return Blockly.Events.group_
  20963. }
  20964. ;
  20965. Blockly.Events.setGroup = function (a) {
  20966. Blockly.Events.group_ = "boolean" == typeof a ? a ? Blockly.genUid() : "" : a
  20967. }
  20968. ;
  20969. Blockly.Events.getDescendantIds_ = function (a) {
  20970. var b = [];
  20971. a = a.getDescendants();
  20972. for (var c = 0, d; d = a[c]; c++)
  20973. b[c] = d.id;
  20974. return b
  20975. }
  20976. ;
  20977. Blockly.Events.fromJson = function (a, b) {
  20978. switch (a.type) {
  20979. case Blockly.Events.CREATE:
  20980. var c = new Blockly.Events.Create(null);
  20981. break;
  20982. case Blockly.Events.DELETE:
  20983. c = new Blockly.Events.Delete(null);
  20984. break;
  20985. case Blockly.Events.CHANGE:
  20986. c = new Blockly.Events.Change(null);
  20987. break;
  20988. case Blockly.Events.MOVE:
  20989. c = new Blockly.Events.Move(null);
  20990. break;
  20991. case Blockly.Events.UI:
  20992. c = new Blockly.Events.Ui(null);
  20993. break;
  20994. default:
  20995. throw "Unknown event type.";
  20996. }
  20997. c.fromJson(a);
  20998. c.workspaceId = b.id;
  20999. return c
  21000. }
  21001. ;
  21002. Blockly.Events.Abstract = function (a) {
  21003. a && (this.blockId = a.id,
  21004. this.workspaceId = a.workspace.id);
  21005. this.group = Blockly.Events.group_;
  21006. this.recordUndo = Blockly.Events.recordUndo
  21007. }
  21008. ;
  21009. Blockly.Events.Abstract.prototype.toJson = function () {
  21010. var a = {
  21011. type: this.type
  21012. };
  21013. this.blockId && (a.blockId = this.blockId);
  21014. this.group && (a.group = this.group);
  21015. return a
  21016. }
  21017. ;
  21018. Blockly.Events.Abstract.prototype.fromJson = function (a) {
  21019. this.blockId = a.blockId;
  21020. this.group = a.group
  21021. }
  21022. ;
  21023. Blockly.Events.Abstract.prototype.isNull = function () {
  21024. return !1
  21025. }
  21026. ;
  21027. Blockly.Events.Abstract.prototype.run = function (a) { }
  21028. ;
  21029. Blockly.Events.Create = function (a) {
  21030. a && (Blockly.Events.Create.superClass_.constructor.call(this, a),
  21031. this.xml = Blockly.Xml.blockToDomWithXY(a),
  21032. this.ids = Blockly.Events.getDescendantIds_(a))
  21033. }
  21034. ;
  21035. goog.inherits(Blockly.Events.Create, Blockly.Events.Abstract);
  21036. Blockly.Events.Create.prototype.type = Blockly.Events.CREATE;
  21037. Blockly.Events.Create.prototype.toJson = function () {
  21038. var a = Blockly.Events.Create.superClass_.toJson.call(this);
  21039. a.xml = Blockly.Xml.domToText(this.xml);
  21040. a.ids = this.ids;
  21041. return a
  21042. }
  21043. ;
  21044. Blockly.Events.Create.prototype.fromJson = function (a) {
  21045. Blockly.Events.Create.superClass_.fromJson.call(this, a);
  21046. this.xml = Blockly.Xml.textToDom("<xml>" + a.xml + "</xml>").firstChild;
  21047. this.ids = a.ids
  21048. }
  21049. ;
  21050. Blockly.Events.Create.prototype.run = function (a) {
  21051. var b = Blockly.Workspace.getById(this.workspaceId);
  21052. if (a)
  21053. a = goog.dom.createDom("xml"),
  21054. a.appendChild(this.xml),
  21055. Blockly.Xml.domToWorkspace(a, b);
  21056. else {
  21057. a = 0;
  21058. for (var c; c = this.ids[a]; a++) {
  21059. var d = b.getBlockById(c);
  21060. d ? d.dispose(!1, !1) : c == this.blockId && console.warn("Can't uncreate non-existant block: " + c)
  21061. }
  21062. }
  21063. }
  21064. ;
  21065. Blockly.Events.Delete = function (a) {
  21066. if (a) {
  21067. if (a.getParent())
  21068. throw "Connected blocks cannot be deleted.";
  21069. Blockly.Events.Delete.superClass_.constructor.call(this, a);
  21070. this.oldXml = Blockly.Xml.blockToDomWithXY(a);
  21071. this.ids = Blockly.Events.getDescendantIds_(a)
  21072. }
  21073. }
  21074. ;
  21075. goog.inherits(Blockly.Events.Delete, Blockly.Events.Abstract);
  21076. Blockly.Events.Delete.prototype.type = Blockly.Events.DELETE;
  21077. Blockly.Events.Delete.prototype.toJson = function () {
  21078. var a = Blockly.Events.Delete.superClass_.toJson.call(this);
  21079. a.ids = this.ids;
  21080. return a
  21081. }
  21082. ;
  21083. Blockly.Events.Delete.prototype.fromJson = function (a) {
  21084. Blockly.Events.Delete.superClass_.fromJson.call(this, a);
  21085. this.ids = a.ids
  21086. }
  21087. ;
  21088. Blockly.Events.Delete.prototype.run = function (a) {
  21089. var b = Blockly.Workspace.getById(this.workspaceId);
  21090. if (a) {
  21091. a = 0;
  21092. for (var c; c = this.ids[a]; a++) {
  21093. var d = b.getBlockById(c);
  21094. d ? d.dispose(!1, !1) : c == this.blockId && console.warn("Can't delete non-existant block: " + c)
  21095. }
  21096. } else
  21097. a = goog.dom.createDom("xml"),
  21098. a.appendChild(this.oldXml),
  21099. Blockly.Xml.domToWorkspace(a, b)
  21100. }
  21101. ;
  21102. Blockly.Events.Change = function (a, b, c, d, e) {
  21103. a && (Blockly.Events.Change.superClass_.constructor.call(this, a),
  21104. this.element = b,
  21105. this.name = c,
  21106. this.oldValue = d,
  21107. this.newValue = e)
  21108. }
  21109. ;
  21110. goog.inherits(Blockly.Events.Change, Blockly.Events.Abstract);
  21111. Blockly.Events.Change.prototype.type = Blockly.Events.CHANGE;
  21112. Blockly.Events.Change.prototype.toJson = function () {
  21113. var a = Blockly.Events.Change.superClass_.toJson.call(this);
  21114. a.element = this.element;
  21115. this.name && (a.name = this.name);
  21116. a.newValue = this.newValue;
  21117. return a
  21118. }
  21119. ;
  21120. Blockly.Events.Change.prototype.fromJson = function (a) {
  21121. Blockly.Events.Change.superClass_.fromJson.call(this, a);
  21122. this.element = a.element;
  21123. this.name = a.name;
  21124. this.newValue = a.newValue
  21125. }
  21126. ;
  21127. Blockly.Events.Change.prototype.isNull = function () {
  21128. return this.oldValue == this.newValue
  21129. }
  21130. ;
  21131. Blockly.Events.Change.prototype.run = function (a) {
  21132. var b = Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId);
  21133. if (b)
  21134. switch (b.mutator && b.mutator.setVisible(!1),
  21135. a = a ? this.newValue : this.oldValue,
  21136. this.element) {
  21137. case "field":
  21138. (b = b.getField(this.name)) ? (b.callValidator(a),
  21139. b.setValue(a)) : console.warn("Can't set non-existant field: " + this.name);
  21140. break;
  21141. case "comment":
  21142. b.setCommentText(a || null);
  21143. break;
  21144. case "collapsed":
  21145. b.setCollapsed(a);
  21146. break;
  21147. case "disabled":
  21148. b.setDisabled(a);
  21149. break;
  21150. case "inline":
  21151. b.setInputsInline(a);
  21152. break;
  21153. case "mutation":
  21154. var c = "";
  21155. b.mutationToDom && (c = (c = b.mutationToDom()) && Blockly.Xml.domToText(c));
  21156. if (b.domToMutation) {
  21157. a = a || "<mutation></mutation>";
  21158. var d = Blockly.Xml.textToDom("<xml>" + a + "</xml>");
  21159. b.domToMutation(d.firstChild)
  21160. }
  21161. Blockly.Events.fire(new Blockly.Events.Change(b, "mutation", null, c, a));
  21162. break;
  21163. default:
  21164. console.warn("Unknown change type: " + this.element)
  21165. }
  21166. else
  21167. console.warn("Can't change non-existant block: " + this.blockId)
  21168. }
  21169. ;
  21170. Blockly.Events.Move = function (a) {
  21171. a && (Blockly.Events.Move.superClass_.constructor.call(this, a),
  21172. a = this.currentLocation_(),
  21173. this.oldParentId = a.parentId,
  21174. this.oldInputName = a.inputName,
  21175. this.oldCoordinate = a.coordinate)
  21176. }
  21177. ;
  21178. goog.inherits(Blockly.Events.Move, Blockly.Events.Abstract);
  21179. Blockly.Events.Move.prototype.type = Blockly.Events.MOVE;
  21180. Blockly.Events.Move.prototype.toJson = function () {
  21181. var a = Blockly.Events.Move.superClass_.toJson.call(this);
  21182. this.newParentId && (a.newParentId = this.newParentId);
  21183. this.newInputName && (a.newInputName = this.newInputName);
  21184. this.newCoordinate && (a.newCoordinate = Math.round(this.newCoordinate.x) + "," + Math.round(this.newCoordinate.y));
  21185. return a
  21186. }
  21187. ;
  21188. Blockly.Events.Move.prototype.fromJson = function (a) {
  21189. Blockly.Events.Move.superClass_.fromJson.call(this, a);
  21190. this.newParentId = a.newParentId;
  21191. this.newInputName = a.newInputName;
  21192. a.newCoordinate && (a = a.newCoordinate.split(","),
  21193. this.newCoordinate = new goog.math.Coordinate(parseFloat(a[0]), parseFloat(a[1])))
  21194. }
  21195. ;
  21196. Blockly.Events.Move.prototype.recordNew = function () {
  21197. var a = this.currentLocation_();
  21198. this.newParentId = a.parentId;
  21199. this.newInputName = a.inputName;
  21200. this.newCoordinate = a.coordinate
  21201. }
  21202. ;
  21203. Blockly.Events.Move.prototype.currentLocation_ = function () {
  21204. var a = Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId)
  21205. , b = {}
  21206. , c = a.getParent();
  21207. if (c) {
  21208. if (b.parentId = c.id,
  21209. a = c.getInputWithBlock(a))
  21210. b.inputName = a.name
  21211. } else
  21212. b.coordinate = a.getRelativeToSurfaceXY();
  21213. return b
  21214. }
  21215. ;
  21216. Blockly.Events.Move.prototype.isNull = function () {
  21217. return this.oldParentId == this.newParentId && this.oldInputName == this.newInputName && goog.math.Coordinate.equals(this.oldCoordinate, this.newCoordinate)
  21218. }
  21219. ;
  21220. Blockly.Events.Move.prototype.run = function (a) {
  21221. var b = Blockly.Workspace.getById(this.workspaceId)
  21222. , c = b.getBlockById(this.blockId);
  21223. if (c) {
  21224. var d = a ? this.newParentId : this.oldParentId
  21225. , e = a ? this.newInputName : this.oldInputName;
  21226. a = a ? this.newCoordinate : this.oldCoordinate;
  21227. var f = null;
  21228. if (d && (f = b.getBlockById(d),
  21229. !f)) {
  21230. console.warn("Can't connect to non-existant block: " + d);
  21231. return
  21232. }
  21233. c.getParent() && c.unplug();
  21234. if (a)
  21235. e = c.getRelativeToSurfaceXY(),
  21236. c.moveBy(a.x - e.x, a.y - e.y);
  21237. else {
  21238. c = c.outputConnection || c.previousConnection;
  21239. if (e) {
  21240. if (b = f.getInput(e))
  21241. var g = b.connection
  21242. } else
  21243. c.type == Blockly.PREVIOUS_STATEMENT && (g = f.nextConnection);
  21244. g ? c.connect(g) : console.warn("Can't connect to non-existant input: " + e)
  21245. }
  21246. } else
  21247. console.warn("Can't move non-existant block: " + this.blockId)
  21248. }
  21249. ;
  21250. Blockly.Events.Ui = function (a, b, c, d) {
  21251. Blockly.Events.Ui.superClass_.constructor.call(this, a);
  21252. this.element = b;
  21253. this.oldValue = c;
  21254. this.newValue = d;
  21255. this.recordUndo = !1
  21256. }
  21257. ;
  21258. goog.inherits(Blockly.Events.Ui, Blockly.Events.Abstract);
  21259. Blockly.Events.Ui.prototype.type = Blockly.Events.UI;
  21260. Blockly.Events.Ui.prototype.toJson = function () {
  21261. var a = Blockly.Events.Ui.superClass_.toJson.call(this);
  21262. a.element = this.element;
  21263. void 0 !== this.newValue && (a.newValue = this.newValue);
  21264. return a
  21265. }
  21266. ;
  21267. Blockly.Events.Ui.prototype.fromJson = function (a) {
  21268. Blockly.Events.Ui.superClass_.fromJson.call(this, a);
  21269. this.element = a.element;
  21270. this.newValue = a.newValue
  21271. }
  21272. ;
  21273. Blockly.Events.disableOrphans = function (a) {
  21274. if (a.type == Blockly.Events.MOVE || a.type == Blockly.Events.CREATE) {
  21275. Blockly.Events.disable();
  21276. if (a = Blockly.Workspace.getById(a.workspaceId).getBlockById(a.blockId))
  21277. if (a.getParent() && !a.getParent().disabled) {
  21278. a = a.getDescendants();
  21279. for (var b = 0, c; c = a[b]; b++)
  21280. c.setDisabled(!1)
  21281. } else if ((a.outputConnection || a.previousConnection) && Blockly.dragMode_ == Blockly.DRAG_NONE) {
  21282. do
  21283. a.setDisabled(!0),
  21284. a = a.getNextBlock();
  21285. while (a)
  21286. }
  21287. Blockly.Events.enable()
  21288. }
  21289. }
  21290. ;
  21291. Blockly.Msg = {};
  21292. goog.getMsgOrig = goog.getMsg;
  21293. goog.getMsg = function (a, b) {
  21294. var c = goog.getMsg.blocklyMsgMap[a];
  21295. c && (a = Blockly.Msg[c]);
  21296. return goog.getMsgOrig(a, b)
  21297. }
  21298. ;
  21299. goog.getMsg.blocklyMsgMap = {
  21300. Today: "TODAY"
  21301. };
  21302. Blockly.FieldTextInput = function (a, b) {
  21303. Blockly.FieldTextInput.superClass_.constructor.call(this, a, b)
  21304. }
  21305. ;
  21306. goog.inherits(Blockly.FieldTextInput, Blockly.Field);
  21307. Blockly.FieldTextInput.FONTSIZE = 11;
  21308. Blockly.FieldTextInput.prototype.CURSOR = "text";
  21309. Blockly.FieldTextInput.prototype.spellcheck_ = !0;
  21310. Blockly.FieldTextInput.prototype.dispose = function () {
  21311. Blockly.WidgetDiv.hideIfOwner(this);
  21312. Blockly.FieldTextInput.superClass_.dispose.call(this)
  21313. }
  21314. ;
  21315. Blockly.FieldTextInput.prototype.setValue = function (a) {
  21316. if (null !== a) {
  21317. if (this.sourceBlock_) {
  21318. var b = this.callValidator(a);
  21319. null !== b && (a = b)
  21320. }
  21321. Blockly.Field.prototype.setValue.call(this, a)
  21322. }
  21323. }
  21324. ;
  21325. Blockly.FieldTextInput.prototype.setSpellcheck = function (a) {
  21326. this.spellcheck_ = a
  21327. }
  21328. ;
  21329. Blockly.FieldTextInput.prototype.showEditor_ = function (a) {
  21330. this.workspace_ = this.sourceBlock_.workspace;
  21331. a = a || !1;
  21332. if (!a && (goog.userAgent.MOBILE || goog.userAgent.ANDROID || goog.userAgent.IPAD)) {
  21333. var b = this;
  21334. Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE, this.text_, function (a) {
  21335. b.sourceBlock_ && (a = b.callValidator(a));
  21336. b.setValue(a)
  21337. })
  21338. } else {
  21339. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
  21340. var c = Blockly.WidgetDiv.DIV
  21341. , d = goog.dom.createDom("INPUT", "blocklyHtmlInput");
  21342. d.setAttribute("spellcheck", this.spellcheck_);
  21343. var e = Blockly.FieldTextInput.FONTSIZE * this.workspace_.scale + "pt";
  21344. c.style.fontSize = e;
  21345. d.style.fontSize = e;
  21346. Blockly.FieldTextInput.htmlInput_ = d;
  21347. c.appendChild(d);
  21348. d.value = d.defaultValue = this.text_;
  21349. d.oldValue_ = null;
  21350. this.validate_();
  21351. this.resizeEditor_();
  21352. a || (d.focus(),
  21353. d.select());
  21354. d.onKeyDownWrapper_ = Blockly.bindEventWithChecks_(d, "keydown", this, this.onHtmlInputKeyDown_);
  21355. d.onKeyUpWrapper_ = Blockly.bindEventWithChecks_(d, "keyup", this, this.onHtmlInputChange_);
  21356. d.onKeyPressWrapper_ = Blockly.bindEventWithChecks_(d, "keypress", this, this.onHtmlInputChange_);
  21357. d.onWorkspaceChangeWrapper_ = this.resizeEditor_.bind(this);
  21358. this.workspace_.addChangeListener(d.onWorkspaceChangeWrapper_)
  21359. }
  21360. }
  21361. ;
  21362. Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_ = function (a) {
  21363. var b = Blockly.FieldTextInput.htmlInput_;
  21364. 13 == a.keyCode ? Blockly.WidgetDiv.hide() : 27 == a.keyCode ? (b.value = b.defaultValue,
  21365. Blockly.WidgetDiv.hide()) : 9 == a.keyCode && (Blockly.WidgetDiv.hide(),
  21366. this.sourceBlock_.tab(this, !a.shiftKey),
  21367. a.preventDefault())
  21368. }
  21369. ;
  21370. Blockly.FieldTextInput.prototype.onHtmlInputChange_ = function (a) {
  21371. a = Blockly.FieldTextInput.htmlInput_;
  21372. var b = a.value;
  21373. b !== a.oldValue_ ? (a.oldValue_ = b,
  21374. this.setValue(b),
  21375. this.validate_()) : goog.userAgent.WEBKIT && this.sourceBlock_.render();
  21376. this.resizeEditor_();
  21377. Blockly.svgResize(this.sourceBlock_.workspace)
  21378. }
  21379. ;
  21380. Blockly.FieldTextInput.prototype.validate_ = function () {
  21381. var a = !0;
  21382. goog.asserts.assertObject(Blockly.FieldTextInput.htmlInput_);
  21383. var b = Blockly.FieldTextInput.htmlInput_;
  21384. this.sourceBlock_ && (a = this.callValidator(b.value));
  21385. null === a ? Blockly.addClass_(b, "blocklyInvalidInput") : Blockly.removeClass_(b, "blocklyInvalidInput")
  21386. }
  21387. ;
  21388. Blockly.FieldTextInput.prototype.resizeEditor_ = function () {
  21389. var a = Blockly.WidgetDiv.DIV
  21390. , b = this.fieldGroup_.getBBox();
  21391. a.style.width = b.width * this.workspace_.scale + "px";
  21392. a.style.height = b.height * this.workspace_.scale + "px";
  21393. b = this.getAbsoluteXY_();
  21394. if (this.sourceBlock_.RTL) {
  21395. var c = this.getScaledBBox_();
  21396. b.x += c.width;
  21397. b.x -= a.offsetWidth
  21398. }
  21399. b.y += 1;
  21400. goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top && (--b.x,
  21401. --b.y);
  21402. goog.userAgent.WEBKIT && (b.y -= 3);
  21403. a.style.left = b.x + "px";
  21404. a.style.top = b.y + "px"
  21405. }
  21406. ;
  21407. Blockly.FieldTextInput.prototype.widgetDispose_ = function () {
  21408. var a = this;
  21409. return function () {
  21410. var b = Blockly.FieldTextInput.htmlInput_
  21411. , c = b.value;
  21412. if (a.sourceBlock_)
  21413. if (c = a.callValidator(c),
  21414. null === c)
  21415. c = b.defaultValue;
  21416. else if (a.onFinishEditing_)
  21417. a.onFinishEditing_(c);
  21418. a.setValue(c);
  21419. a.sourceBlock_.rendered && a.sourceBlock_.render();
  21420. Blockly.unbindEvent_(b.onKeyDownWrapper_);
  21421. Blockly.unbindEvent_(b.onKeyUpWrapper_);
  21422. Blockly.unbindEvent_(b.onKeyPressWrapper_);
  21423. a.workspace_.removeChangeListener(b.onWorkspaceChangeWrapper_);
  21424. Blockly.FieldTextInput.htmlInput_ = null;
  21425. b = Blockly.WidgetDiv.DIV.style;
  21426. b.width = "auto";
  21427. b.height = "auto";
  21428. b.fontSize = ""
  21429. }
  21430. }
  21431. ;
  21432. Blockly.FieldTextInput.numberValidator = function (a) {
  21433. console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");
  21434. if (null === a)
  21435. return null;
  21436. a = String(a);
  21437. a = a.replace(/O/ig, "0");
  21438. a = a.replace(/,/g, "");
  21439. a = parseFloat(a || 0);
  21440. return isNaN(a) ? null : String(a)
  21441. }
  21442. ;
  21443. Blockly.FieldTextInput.nonnegativeIntegerValidator = function (a) {
  21444. (a = Blockly.FieldTextInput.numberValidator(a)) && (a = String(Math.max(0, Math.floor(a))));
  21445. return a
  21446. }
  21447. ;
  21448. Blockly.FieldAngle = function (a, b) {
  21449. this.symbol_ = Blockly.createSvgElement("tspan", {}, null);
  21450. this.symbol_.appendChild(document.createTextNode("\u00b0"));
  21451. Blockly.FieldAngle.superClass_.constructor.call(this, a, b)
  21452. }
  21453. ;
  21454. goog.inherits(Blockly.FieldAngle, Blockly.FieldTextInput);
  21455. Blockly.FieldAngle.ROUND = 15;
  21456. Blockly.FieldAngle.HALF = 50;
  21457. Blockly.FieldAngle.CLOCKWISE = !1;
  21458. Blockly.FieldAngle.OFFSET = 0;
  21459. Blockly.FieldAngle.WRAP = 360;
  21460. Blockly.FieldAngle.RADIUS = Blockly.FieldAngle.HALF - 1;
  21461. Blockly.FieldAngle.prototype.dispose_ = function () {
  21462. var a = this;
  21463. return function () {
  21464. Blockly.FieldAngle.superClass_.dispose_.call(a)();
  21465. a.gauge_ = null;
  21466. a.clickWrapper_ && Blockly.unbindEvent_(a.clickWrapper_);
  21467. a.moveWrapper1_ && Blockly.unbindEvent_(a.moveWrapper1_);
  21468. a.moveWrapper2_ && Blockly.unbindEvent_(a.moveWrapper2_)
  21469. }
  21470. }
  21471. ;
  21472. Blockly.FieldAngle.prototype.showEditor_ = function () {
  21473. Blockly.FieldAngle.superClass_.showEditor_.call(this, goog.userAgent.MOBILE || goog.userAgent.ANDROID || goog.userAgent.IPAD);
  21474. var a = Blockly.WidgetDiv.DIV;
  21475. if (a.firstChild) {
  21476. a = Blockly.createSvgElement("svg", {
  21477. xmlns: "http://www.w3.org/2000/svg",
  21478. "xmlns:html": "http://www.w3.org/1999/xhtml",
  21479. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  21480. version: "1.1",
  21481. height: 2 * Blockly.FieldAngle.HALF + "px",
  21482. width: 2 * Blockly.FieldAngle.HALF + "px"
  21483. }, a);
  21484. var b = Blockly.createSvgElement("circle", {
  21485. cx: Blockly.FieldAngle.HALF,
  21486. cy: Blockly.FieldAngle.HALF,
  21487. r: Blockly.FieldAngle.RADIUS,
  21488. "class": "blocklyAngleCircle"
  21489. }, a);
  21490. this.gauge_ = Blockly.createSvgElement("path", {
  21491. "class": "blocklyAngleGauge"
  21492. }, a);
  21493. this.line_ = Blockly.createSvgElement("line", {
  21494. x1: Blockly.FieldAngle.HALF,
  21495. y1: Blockly.FieldAngle.HALF,
  21496. "class": "blocklyAngleLine"
  21497. }, a);
  21498. for (var c = 0; 360 > c; c += 15)
  21499. Blockly.createSvgElement("line", {
  21500. x1: Blockly.FieldAngle.HALF + Blockly.FieldAngle.RADIUS,
  21501. y1: Blockly.FieldAngle.HALF,
  21502. x2: Blockly.FieldAngle.HALF + Blockly.FieldAngle.RADIUS - (0 == c % 45 ? 10 : 5),
  21503. y2: Blockly.FieldAngle.HALF,
  21504. "class": "blocklyAngleMarks",
  21505. transform: "rotate(" + c + "," + Blockly.FieldAngle.HALF + "," + Blockly.FieldAngle.HALF + ")"
  21506. }, a);
  21507. a.style.marginLeft = 15 - Blockly.FieldAngle.RADIUS + "px";
  21508. this.clickWrapper_ = Blockly.bindEvent_(a, "click", this, Blockly.WidgetDiv.hide);
  21509. this.moveWrapper1_ = Blockly.bindEvent_(b, "mousemove", this, this.onMouseMove);
  21510. this.moveWrapper2_ = Blockly.bindEvent_(this.gauge_, "mousemove", this, this.onMouseMove);
  21511. this.updateGraph_()
  21512. }
  21513. }
  21514. ;
  21515. Blockly.FieldAngle.prototype.onMouseMove = function (a) {
  21516. var b = this.gauge_.ownerSVGElement.getBoundingClientRect()
  21517. , c = a.clientX - b.left - Blockly.FieldAngle.HALF;
  21518. a = a.clientY - b.top - Blockly.FieldAngle.HALF;
  21519. b = Math.atan(-a / c);
  21520. isNaN(b) || (b = goog.math.toDegrees(b),
  21521. 0 > c ? b += 180 : 0 < a && (b += 360),
  21522. b = Blockly.FieldAngle.CLOCKWISE ? Blockly.FieldAngle.OFFSET + 360 - b : b - Blockly.FieldAngle.OFFSET,
  21523. Blockly.FieldAngle.ROUND && (b = Math.round(b / Blockly.FieldAngle.ROUND) * Blockly.FieldAngle.ROUND),
  21524. b = this.callValidator(b),
  21525. Blockly.FieldTextInput.htmlInput_.value = b,
  21526. this.setValue(b),
  21527. this.validate_(),
  21528. this.resizeEditor_())
  21529. }
  21530. ;
  21531. Blockly.FieldAngle.prototype.setText = function (a) {
  21532. Blockly.FieldAngle.superClass_.setText.call(this, a);
  21533. this.textElement_ && (this.updateGraph_(),
  21534. this.sourceBlock_.RTL ? this.textElement_.insertBefore(this.symbol_, this.textElement_.firstChild) : this.textElement_.appendChild(this.symbol_),
  21535. this.size_.width = 0)
  21536. }
  21537. ;
  21538. Blockly.FieldAngle.prototype.updateGraph_ = function () {
  21539. if (this.gauge_) {
  21540. var a = Number(this.getText()) + Blockly.FieldAngle.OFFSET
  21541. , b = goog.math.toRadians(a);
  21542. a = ["M ", Blockly.FieldAngle.HALF, ",", Blockly.FieldAngle.HALF];
  21543. var c = Blockly.FieldAngle.HALF
  21544. , d = Blockly.FieldAngle.HALF;
  21545. if (!isNaN(b)) {
  21546. var e = goog.math.toRadians(Blockly.FieldAngle.OFFSET)
  21547. , f = Math.cos(e) * Blockly.FieldAngle.RADIUS
  21548. , g = Math.sin(e) * -Blockly.FieldAngle.RADIUS;
  21549. Blockly.FieldAngle.CLOCKWISE && (b = 2 * e - b);
  21550. c += Math.cos(b) * Blockly.FieldAngle.RADIUS;
  21551. d -= Math.sin(b) * Blockly.FieldAngle.RADIUS;
  21552. b = Math.abs(Math.floor((b - e) / Math.PI) % 2);
  21553. Blockly.FieldAngle.CLOCKWISE && (b = 1 - b);
  21554. a.push(" l ", f, ",", g, " A ", Blockly.FieldAngle.RADIUS, ",", Blockly.FieldAngle.RADIUS, " 0 ", b, " ", Number(Blockly.FieldAngle.CLOCKWISE), " ", c, ",", d, " z")
  21555. }
  21556. this.gauge_.setAttribute("d", a.join(""));
  21557. this.line_.setAttribute("x2", c);
  21558. this.line_.setAttribute("y2", d)
  21559. }
  21560. }
  21561. ;
  21562. Blockly.FieldAngle.prototype.classValidator = function (a) {
  21563. if (null === a)
  21564. return null;
  21565. a = parseFloat(a || 0);
  21566. if (isNaN(a))
  21567. return null;
  21568. a %= 360;
  21569. 0 > a && (a += 360);
  21570. a > Blockly.FieldAngle.WRAP && (a -= 360);
  21571. return String(a)
  21572. }
  21573. ;
  21574. Blockly.FieldCheckbox = function (a, b) {
  21575. Blockly.FieldCheckbox.superClass_.constructor.call(this, "", b);
  21576. this.setValue(a)
  21577. }
  21578. ;
  21579. goog.inherits(Blockly.FieldCheckbox, Blockly.Field);
  21580. Blockly.FieldCheckbox.CHECK_CHAR = "\u2713";
  21581. Blockly.FieldCheckbox.prototype.CURSOR = "default";
  21582. Blockly.FieldCheckbox.prototype.init = function () {
  21583. if (!this.fieldGroup_) {
  21584. Blockly.FieldCheckbox.superClass_.init.call(this);
  21585. this.checkElement_ = Blockly.createSvgElement("text", {
  21586. "class": "blocklyText blocklyCheckbox",
  21587. x: -3,
  21588. y: 14
  21589. }, this.fieldGroup_);
  21590. var a = document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);
  21591. this.checkElement_.appendChild(a);
  21592. this.checkElement_.style.display = this.state_ ? "block" : "none"
  21593. }
  21594. }
  21595. ;
  21596. Blockly.FieldCheckbox.prototype.getValue = function () {
  21597. return String(this.state_).toUpperCase()
  21598. }
  21599. ;
  21600. Blockly.FieldCheckbox.prototype.setValue = function (a) {
  21601. a = "TRUE" == a.toUpperCase();
  21602. this.state_ !== a && (this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.state_, a)),
  21603. this.state_ = a,
  21604. this.checkElement_ && (this.checkElement_.style.display = a ? "block" : "none"))
  21605. }
  21606. ;
  21607. Blockly.FieldCheckbox.prototype.showEditor_ = function () {
  21608. var a = !this.state_;
  21609. this.sourceBlock_ && (a = this.callValidator(a));
  21610. null !== a && this.setValue(String(a).toUpperCase())
  21611. }
  21612. ;
  21613. Blockly.FieldColour = function (a, b) {
  21614. Blockly.FieldColour.superClass_.constructor.call(this, a, b);
  21615. this.setText(Blockly.Field.NBSP + Blockly.Field.NBSP + Blockly.Field.NBSP)
  21616. }
  21617. ;
  21618. goog.inherits(Blockly.FieldColour, Blockly.Field);
  21619. Blockly.FieldColour.prototype.colours_ = null;
  21620. Blockly.FieldColour.prototype.columns_ = 0;
  21621. Blockly.FieldColour.prototype.init = function () {
  21622. Blockly.FieldColour.superClass_.init.call(this);
  21623. this.borderRect_.style.fillOpacity = 1;
  21624. this.setValue(this.getValue())
  21625. }
  21626. ;
  21627. Blockly.FieldColour.prototype.CURSOR = "default";
  21628. Blockly.FieldColour.prototype.dispose = function () {
  21629. Blockly.WidgetDiv.hideIfOwner(this);
  21630. Blockly.FieldColour.superClass_.dispose.call(this)
  21631. }
  21632. ;
  21633. Blockly.FieldColour.prototype.getValue = function () {
  21634. return this.colour_
  21635. }
  21636. ;
  21637. Blockly.FieldColour.prototype.setValue = function (a) {
  21638. this.sourceBlock_ && Blockly.Events.isEnabled() && this.colour_ != a && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.colour_, a));
  21639. this.colour_ = a;
  21640. this.borderRect_ && (this.borderRect_.style.fill = a)
  21641. }
  21642. ;
  21643. Blockly.FieldColour.prototype.getText = function () {
  21644. var a = this.colour_
  21645. , b = a.match(/^#(.)\1(.)\2(.)\3$/);
  21646. b && (a = "#" + b[1] + b[2] + b[3]);
  21647. return a
  21648. }
  21649. ;
  21650. Blockly.FieldColour.COLOURS = goog.ui.ColorPicker.SIMPLE_GRID_COLORS;
  21651. Blockly.FieldColour.COLUMNS = 7;
  21652. Blockly.FieldColour.prototype.setColours = function (a) {
  21653. this.colours_ = a;
  21654. return this
  21655. }
  21656. ;
  21657. Blockly.FieldColour.prototype.setColumns = function (a) {
  21658. this.columns_ = a;
  21659. return this
  21660. }
  21661. ;
  21662. Blockly.FieldColour.prototype.showEditor_ = function () {
  21663. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, Blockly.FieldColour.widgetDispose_);
  21664. var a = new goog.ui.ColorPicker;
  21665. a.setSize(this.columns_ || Blockly.FieldColour.COLUMNS);
  21666. a.setColors(this.colours_ || Blockly.FieldColour.COLOURS);
  21667. var b = goog.dom.getViewportSize()
  21668. , c = goog.style.getViewportPageOffset(document)
  21669. , d = this.getAbsoluteXY_()
  21670. , e = this.getScaledBBox_();
  21671. a.render(Blockly.WidgetDiv.DIV);
  21672. a.setSelectedColor(this.getValue());
  21673. var f = goog.style.getSize(a.getElement());
  21674. d.y = d.y + f.height + e.height >= b.height + c.y ? d.y - (f.height - 1) : d.y + (e.height - 1);
  21675. this.sourceBlock_.RTL ? (d.x += e.width,
  21676. d.x -= f.width,
  21677. d.x < c.x && (d.x = c.x)) : d.x > b.width + c.x - f.width && (d.x = b.width + c.x - f.width);
  21678. Blockly.WidgetDiv.position(d.x, d.y, b, c, this.sourceBlock_.RTL);
  21679. var g = this;
  21680. Blockly.FieldColour.changeEventKey_ = goog.events.listen(a, goog.ui.ColorPicker.EventType.CHANGE, function (a) {
  21681. a = a.target.getSelectedColor() || "#000000";
  21682. Blockly.WidgetDiv.hide();
  21683. g.sourceBlock_ && (a = g.callValidator(a));
  21684. null !== a && g.setValue(a)
  21685. })
  21686. }
  21687. ;
  21688. Blockly.FieldColour.widgetDispose_ = function () {
  21689. Blockly.FieldColour.changeEventKey_ && goog.events.unlistenByKey(Blockly.FieldColour.changeEventKey_)
  21690. }
  21691. ;
  21692. Blockly.FieldDropdown = function (a, b) {
  21693. this.menuGenerator_ = a;
  21694. this.trimOptions_();
  21695. var c = this.getOptions_()[0];
  21696. Blockly.FieldDropdown.superClass_.constructor.call(this, c[1], b)
  21697. }
  21698. ;
  21699. goog.inherits(Blockly.FieldDropdown, Blockly.Field);
  21700. Blockly.FieldDropdown.CHECKMARK_OVERHANG = 25;
  21701. Blockly.FieldDropdown.ARROW_CHAR = goog.userAgent.ANDROID ? "\u25bc" : "\u25be";
  21702. Blockly.FieldDropdown.prototype.CURSOR = "default";
  21703. Blockly.FieldDropdown.prototype.value_ = "";
  21704. Blockly.FieldDropdown.prototype.init = function () {
  21705. if (!this.fieldGroup_) {
  21706. this.arrow_ = Blockly.createSvgElement("tspan", {}, null);
  21707. this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL ? Blockly.FieldDropdown.ARROW_CHAR + " " : " " + Blockly.FieldDropdown.ARROW_CHAR));
  21708. Blockly.FieldDropdown.superClass_.init.call(this);
  21709. var a = this.text_;
  21710. this.text_ = null;
  21711. this.setText(a)
  21712. }
  21713. }
  21714. ;
  21715. Blockly.FieldDropdown.prototype.showEditor_ = function () {
  21716. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, null);
  21717. var a = this
  21718. , b = new goog.ui.Menu;
  21719. b.setRightToLeft(this.sourceBlock_.RTL);
  21720. for (var c = this.getOptions_(), d = 0; d < c.length; d++) {
  21721. var e = c[d][1]
  21722. , f = new goog.ui.MenuItem(c[d][0]);
  21723. f.setRightToLeft(this.sourceBlock_.RTL);
  21724. f.setValue(e);
  21725. f.setCheckable(!0);
  21726. b.addChild(f, !0);
  21727. f.setChecked(e == this.value_)
  21728. }
  21729. goog.events.listen(b, goog.ui.Component.EventType.ACTION, function (b) {
  21730. if (b = b.target)
  21731. a.onItemSelected(this, b);
  21732. Blockly.WidgetDiv.hideIfOwner(a)
  21733. });
  21734. b.getHandler().listen(b.getElement(), goog.events.EventType.TOUCHSTART, function (a) {
  21735. this.getOwnerControl(a.target).handleMouseDown(a)
  21736. });
  21737. b.getHandler().listen(b.getElement(), goog.events.EventType.TOUCHEND, function (a) {
  21738. this.getOwnerControl(a.target).performActionInternal(a)
  21739. });
  21740. c = goog.dom.getViewportSize();
  21741. d = goog.style.getViewportPageOffset(document);
  21742. e = this.getAbsoluteXY_();
  21743. f = this.getScaledBBox_();
  21744. b.render(Blockly.WidgetDiv.DIV);
  21745. var g = b.getElement();
  21746. Blockly.addClass_(g, "blocklyDropdownMenu");
  21747. var h = goog.style.getSize(g);
  21748. h.height = g.scrollHeight;
  21749. e.y = e.y + h.height + f.height >= c.height + d.y ? e.y - (h.height + 2) : e.y + f.height;
  21750. this.sourceBlock_.RTL ? (e.x += f.width,
  21751. e.x += Blockly.FieldDropdown.CHECKMARK_OVERHANG,
  21752. e.x < d.x + h.width && (e.x = d.x + h.width)) : (e.x -= Blockly.FieldDropdown.CHECKMARK_OVERHANG,
  21753. e.x > c.width + d.x - h.width && (e.x = c.width + d.x - h.width));
  21754. Blockly.WidgetDiv.position(e.x, e.y, c, d, this.sourceBlock_.RTL);
  21755. b.setAllowAutoFocus(!0);
  21756. g.focus()
  21757. }
  21758. ;
  21759. Blockly.FieldDropdown.prototype.onItemSelected = function (a, b) {
  21760. var c = b.getValue();
  21761. this.sourceBlock_ && (c = this.callValidator(c));
  21762. null !== c && this.setValue(c)
  21763. }
  21764. ;
  21765. Blockly.FieldDropdown.prototype.trimOptions_ = function () {
  21766. this.suffixField = this.prefixField = null;
  21767. var a = this.menuGenerator_;
  21768. if (goog.isArray(a) && !(2 > a.length)) {
  21769. var b = a.map(function (a) {
  21770. return a[0]
  21771. })
  21772. , c = Blockly.shortestStringLength(b)
  21773. , d = Blockly.commonWordPrefix(b, c)
  21774. , e = Blockly.commonWordSuffix(b, c);
  21775. if ((d || e) && !(c <= d + e)) {
  21776. d && (this.prefixField = b[0].substring(0, d - 1));
  21777. e && (this.suffixField = b[0].substr(1 - e));
  21778. b = [];
  21779. for (c = 0; c < a.length; c++) {
  21780. var f = a[c][0]
  21781. , g = a[c][1];
  21782. f = f.substring(d, f.length - e);
  21783. b[c] = [f, g]
  21784. }
  21785. this.menuGenerator_ = b
  21786. }
  21787. }
  21788. }
  21789. ;
  21790. Blockly.FieldDropdown.prototype.getOptions_ = function () {
  21791. return goog.isFunction(this.menuGenerator_) ? this.menuGenerator_.call(this) : this.menuGenerator_
  21792. }
  21793. ;
  21794. Blockly.FieldDropdown.prototype.getValue = function () {
  21795. return this.value_
  21796. }
  21797. ;
  21798. Blockly.FieldDropdown.prototype.setValue = function (a) {
  21799. if (null !== a && a !== this.value_) {
  21800. this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.value_, a));
  21801. this.value_ = a;
  21802. for (var b = this.getOptions_(), c = 0; c < b.length; c++)
  21803. if (b[c][1] == a) {
  21804. this.setText(b[c][0]);
  21805. return
  21806. }
  21807. this.setText(a)
  21808. }
  21809. }
  21810. ;
  21811. Blockly.FieldDropdown.prototype.setText = function (a) {
  21812. this.sourceBlock_ && this.arrow_ && (this.arrow_.style.fill = this.sourceBlock_.getColour());
  21813. null !== a && a !== this.text_ && (this.text_ = a,
  21814. this.updateTextNode_(),
  21815. this.textElement_ && (this.sourceBlock_.RTL ? this.textElement_.insertBefore(this.arrow_, this.textElement_.firstChild) : this.textElement_.appendChild(this.arrow_)),
  21816. this.sourceBlock_ && this.sourceBlock_.rendered && (this.sourceBlock_.render(),
  21817. this.sourceBlock_.bumpNeighbours_()))
  21818. }
  21819. ;
  21820. Blockly.FieldDropdown.prototype.dispose = function () {
  21821. Blockly.WidgetDiv.hideIfOwner(this);
  21822. Blockly.FieldDropdown.superClass_.dispose.call(this)
  21823. }
  21824. ;
  21825. Blockly.FieldImage = function (a, b, c, d) {
  21826. this.sourceBlock_ = null;
  21827. this.height_ = Number(c);
  21828. this.width_ = Number(b);
  21829. this.size_ = new goog.math.Size(this.width_, this.height_ + 2 * Blockly.BlockSvg.INLINE_PADDING_Y);
  21830. this.text_ = d || "";
  21831. this.setValue(a)
  21832. }
  21833. ;
  21834. goog.inherits(Blockly.FieldImage, Blockly.Field);
  21835. Blockly.FieldImage.prototype.rectElement_ = null;
  21836. Blockly.FieldImage.prototype.EDITABLE = !1;
  21837. Blockly.FieldImage.prototype.init = function () {
  21838. if (!this.fieldGroup_) {
  21839. this.fieldGroup_ = Blockly.createSvgElement("g", {}, null);
  21840. this.visible_ || (this.fieldGroup_.style.display = "none");
  21841. this.imageElement_ = Blockly.createSvgElement("image", {
  21842. height: this.height_ + "px",
  21843. width: this.width_ + "px"
  21844. }, this.fieldGroup_);
  21845. this.setValue(this.src_);
  21846. goog.userAgent.GECKO && (this.rectElement_ = Blockly.createSvgElement("rect", {
  21847. height: this.height_ + "px",
  21848. width: this.width_ + "px",
  21849. "fill-opacity": 0
  21850. }, this.fieldGroup_));
  21851. this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);
  21852. var a = this.rectElement_ || this.imageElement_;
  21853. a.tooltip = this.sourceBlock_;
  21854. Blockly.Tooltip.bindMouseEvents(a)
  21855. }
  21856. }
  21857. ;
  21858. Blockly.FieldImage.prototype.dispose = function () {
  21859. goog.dom.removeNode(this.fieldGroup_);
  21860. this.rectElement_ = this.imageElement_ = this.fieldGroup_ = null
  21861. }
  21862. ;
  21863. Blockly.FieldImage.prototype.setTooltip = function (a) {
  21864. (this.rectElement_ || this.imageElement_).tooltip = a
  21865. }
  21866. ;
  21867. Blockly.FieldImage.prototype.getValue = function () {
  21868. return this.src_
  21869. }
  21870. ;
  21871. Blockly.FieldImage.prototype.setValue = function (a) {
  21872. null !== a && (this.src_ = a,
  21873. this.imageElement_ && this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", goog.isString(a) ? a : ""))
  21874. }
  21875. ;
  21876. Blockly.FieldImage.prototype.setText = function (a) {
  21877. null !== a && (this.text_ = a)
  21878. }
  21879. ;
  21880. Blockly.FieldImage.prototype.render_ = function () { }
  21881. ;
  21882. Blockly.FieldTextArea = function (a, b) {
  21883. Blockly.FieldTextArea.superClass_.constructor.call(this, a, b)
  21884. }
  21885. ;
  21886. goog.inherits(Blockly.FieldTextArea, Blockly.FieldTextInput);
  21887. Blockly.FieldTextArea.prototype.updateTextNode_ = function () {
  21888. if (this.textElement_) {
  21889. var a = this.text_;
  21890. goog.dom.removeChildren(this.textElement_);
  21891. a = a.replace(/ /g, Blockly.Field.NBSP);
  21892. this.sourceBlock_.RTL && a && (a += "\u200f");
  21893. a || (a = Blockly.Field.NBSP);
  21894. a = a.split("\n");
  21895. for (var b = "0em", c = 0; c < a.length; c++) {
  21896. var d = Blockly.createSvgElement("tspan", {
  21897. dy: b,
  21898. x: 0
  21899. }, this.textElement_);
  21900. b = "1em";
  21901. "" == a[c] && (a[c] = "\u3000");
  21902. var e = document.createTextNode(a[c]);
  21903. d.appendChild(e)
  21904. }
  21905. this.size_.width = 0
  21906. }
  21907. }
  21908. ;
  21909. Blockly.FieldTextArea.prototype.render_ = function () {
  21910. this.text_ = this.text_.replace(/\s+$/, "");
  21911. this.size_.width = this.textElement_.getBBox().width + 5;
  21912. this.size_.height = 20 * (this.text_.split(/\n/).length || 1) + (Blockly.BlockSvg.SEP_SPACE_Y + 5);
  21913. this.minWidth_ && this.size_.width < this.minWidth_ && (this.size_.width = this.minWidth_);
  21914. this.borderRect_ && (this.borderRect_.setAttribute("width", this.size_.width + Blockly.BlockSvg.SEP_SPACE_X),
  21915. this.borderRect_.setAttribute("height", this.size_.height - (Blockly.BlockSvg.SEP_SPACE_Y + 5)))
  21916. }
  21917. ;
  21918. Blockly.FieldTextArea.prototype.showEditor_ = function (a) {
  21919. var b = a || !1;
  21920. if (!b && (goog.userAgent.MOBILE || goog.userAgent.ANDROID || goog.userAgent.IPAD))
  21921. a = window.prompt(Blockly.Msg.CHANGE_VALUE_TITLE, this.text_),
  21922. this.changeHandler_ && (b = this.changeHandler_(a),
  21923. void 0 !== b && (a = b)),
  21924. null !== a && this.setText(a);
  21925. else {
  21926. Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
  21927. var c = Blockly.WidgetDiv.DIV;
  21928. a = goog.dom.createDom("textarea", "blocklyHtmlInput");
  21929. Blockly.FieldTextInput.htmlInput_ = a;
  21930. a.style.resize = "none";
  21931. a.style["line-height"] = "20px";
  21932. a.style.height = "100%";
  21933. c.appendChild(a);
  21934. a.value = a.defaultValue = this.text_;
  21935. a.oldValue_ = null;
  21936. this.validate_();
  21937. this.resizeEditor_();
  21938. b || (a.focus(),
  21939. a.select());
  21940. a.onKeyDownWrapper_ = Blockly.bindEvent_(a, "keydown", this, this.onHtmlInputKeyDown_);
  21941. a.onKeyUpWrapper_ = Blockly.bindEvent_(a, "keyup", this, this.onHtmlInputChange_);
  21942. a.onKeyPressWrapper_ = Blockly.bindEvent_(a, "keypress", this, this.onHtmlInputChange_);
  21943. b = this.sourceBlock_.workspace.getCanvas();
  21944. a.onWorkspaceChangeWrapper_ = Blockly.bindEvent_(b, "blocklyWorkspaceChange", this, this.resizeEditor_)
  21945. }
  21946. }
  21947. ;
  21948. Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_ = function (a) {
  21949. var b = Blockly.FieldTextInput.htmlInput_;
  21950. a.keyCode == goog.events.KeyCodes.ESC && (this.setText(b.defaultValue),
  21951. Blockly.WidgetDiv.hide())
  21952. }
  21953. ;
  21954. Blockly.FieldTextArea.prototype.onHtmlInputChange_ = function (a) {
  21955. Blockly.FieldTextInput.prototype.onHtmlInputChange_.call(this, a);
  21956. var b = Blockly.FieldTextInput.htmlInput_;
  21957. a.keyCode == goog.events.KeyCodes.ESC ? (this.setText(b.defaultValue),
  21958. Blockly.WidgetDiv.hide()) : (Blockly.FieldTextInput.prototype.onHtmlInputChange_.call(this, a),
  21959. this.resizeEditor_())
  21960. }
  21961. ;
  21962. Blockly.FieldTextArea.prototype.resizeEditor_ = function () {
  21963. var a = Blockly.WidgetDiv.DIV
  21964. , b = this.fieldGroup_.getBBox();
  21965. a.style.width = b.width + "px";
  21966. a.style.height = b.height + "px";
  21967. b = this.getAbsoluteXY_();
  21968. if (this.RTL) {
  21969. var c = this.borderRect_.getBBox();
  21970. b.x += c.width;
  21971. b.x -= a.offsetWidth
  21972. }
  21973. b.y += 1;
  21974. goog.userAgent.WEBKIT && (b.y -= 3);
  21975. a.style.left = b.x + "px";
  21976. a.style.top = b.y + "px"
  21977. }
  21978. ;
  21979. Blockly.FieldTextArea.prototype.widgetDispose_ = function () {
  21980. var a = this;
  21981. return function () {
  21982. var b = Blockly.FieldTextInput.htmlInput_
  21983. , c = b.value;
  21984. a.changeHandler_ && (c = a.changeHandler_(c),
  21985. null === c && (c = b.defaultValue));
  21986. c = c.replace(/\s+$/, "");
  21987. a.setText(c);
  21988. a.sourceBlock_.rendered && a.sourceBlock_.render();
  21989. Blockly.unbindEvent_(b.onKeyUpWrapper_);
  21990. Blockly.unbindEvent_(b.onKeyPressWrapper_);
  21991. try {
  21992. a.sourceBlock_.workspace.removeChangeListener(b.onWorkspaceChangeWrapper_)
  21993. } catch (d) { }
  21994. Blockly.FieldTextInput.htmlInput_ = null;
  21995. b = Blockly.WidgetDiv.DIV.style;
  21996. b.width = "auto";
  21997. b.height = "auto";
  21998. b.fontSize = ""
  21999. }
  22000. }
  22001. ;
  22002. Blockly.FieldNumber = function (a, b, c, d, e) {
  22003. a = String(a);
  22004. Blockly.FieldNumber.superClass_.constructor.call(this, a, e);
  22005. this.setConstraints(b, c, d)
  22006. }
  22007. ;
  22008. goog.inherits(Blockly.FieldNumber, Blockly.FieldTextInput);
  22009. Blockly.FieldNumber.prototype.setConstraints = function (a, b, c) {
  22010. c = parseFloat(c);
  22011. this.precision_ = isNaN(c) ? 0 : c;
  22012. a = parseFloat(a);
  22013. this.min_ = isNaN(a) ? -Infinity : a;
  22014. b = parseFloat(b);
  22015. this.max_ = isNaN(b) ? Infinity : b;
  22016. this.setValue(this.callValidator(this.getValue()))
  22017. }
  22018. ;
  22019. Blockly.FieldNumber.prototype.classValidator = function (a) {
  22020. if (null === a)
  22021. return null;
  22022. a = String(a);
  22023. a = a.replace(/O/ig, "0");
  22024. a = a.replace(/,/g, "");
  22025. a = parseFloat(a || 0);
  22026. if (isNaN(a))
  22027. return null;
  22028. this.precision_ && isFinite(a) && (a = Math.round(a / this.precision_) * this.precision_);
  22029. a = goog.math.clamp(a, this.min_, this.max_);
  22030. return String(a)
  22031. }
  22032. ;
  22033. Blockly.Variables = {};
  22034. Blockly.Variables.NAME_TYPE = "VARIABLE";
  22035. Blockly.Variables.allUsedVariables = function (a) {
  22036. if (a instanceof Blockly.Block)
  22037. var b = a.getDescendants();
  22038. else if (a.getAllBlocks)
  22039. b = a.getAllBlocks();
  22040. else
  22041. throw "Not Block or Workspace: " + a;
  22042. a = Object.create(null);
  22043. for (var c = 0; c < b.length; c++) {
  22044. var d = b[c].getVars();
  22045. if (d)
  22046. for (var e = 0; e < d.length; e++) {
  22047. var f = d[e];
  22048. f && (a[f.toLowerCase()] = f)
  22049. }
  22050. }
  22051. b = [];
  22052. for (var g in a)
  22053. b.push(a[g]);
  22054. return b
  22055. }
  22056. ;
  22057. Blockly.Variables.allVariables = function (a) {
  22058. a instanceof Blockly.Block && console.warn("Deprecated call to Blockly.Variables.allVariables with a block instead of a workspace. You may want Blockly.Variables.allUsedVariables");
  22059. return a.variableList
  22060. }
  22061. ;
  22062. Blockly.Variables.flyoutCategory = function (a) {
  22063. a = a.variableList;
  22064. a.sort(goog.string.caseInsensitiveCompare);
  22065. var b = []
  22066. , c = goog.dom.createDom("button");
  22067. c.setAttribute("text", Blockly.Msg.NEW_VARIABLE);
  22068. c.setAttribute("callbackKey", "CREATE_VARIABLE");
  22069. Blockly.registerButtonCallback("CREATE_VARIABLE", function (a) {
  22070. Blockly.Variables.createVariable(a.getTargetWorkspace())
  22071. });
  22072. b.push(c);
  22073. if (0 < a.length) {
  22074. if (Blockly.Blocks.variables_set) {
  22075. c = goog.dom.createDom("block");
  22076. c.setAttribute("type", "variables_set");
  22077. Blockly.Blocks.math_change ? c.setAttribute("gap", 8) : c.setAttribute("gap", 24);
  22078. var d = goog.dom.createDom("field", null, a[0]);
  22079. d.setAttribute("name", "VAR");
  22080. c.appendChild(d);
  22081. var e = goog.dom.createDom("value");
  22082. e.setAttribute("name", "VALUE");
  22083. c.appendChild(e);
  22084. d = goog.dom.createDom("shadow");
  22085. d.setAttribute("type", "math_number");
  22086. e.appendChild(d);
  22087. e = goog.dom.createDom("field", null, "0");
  22088. e.setAttribute("name", "NUM");
  22089. d.appendChild(e);
  22090. b.push(c)
  22091. }
  22092. Blockly.Blocks.math_change && (c = goog.dom.createDom("block"),
  22093. c.setAttribute("type", "math_change"),
  22094. Blockly.Blocks.variables_get && c.setAttribute("gap", 20),
  22095. e = goog.dom.createDom("value"),
  22096. e.setAttribute("name", "DELTA"),
  22097. c.appendChild(e),
  22098. d = goog.dom.createDom("field", null, a[0]),
  22099. d.setAttribute("name", "VAR"),
  22100. c.appendChild(d),
  22101. d = goog.dom.createDom("shadow"),
  22102. d.setAttribute("type", "math_number"),
  22103. e.appendChild(d),
  22104. e = goog.dom.createDom("field", null, "1"),
  22105. e.setAttribute("name", "NUM"),
  22106. d.appendChild(e),
  22107. b.push(c));
  22108. for (e = 0; e < a.length; e++)
  22109. Blockly.Blocks.variables_get && (c = goog.dom.createDom("block"),
  22110. c.setAttribute("type", "variables_get"),
  22111. Blockly.Blocks.variables_set && c.setAttribute("gap", 8),
  22112. d = goog.dom.createDom("field", null, a[e]),
  22113. d.setAttribute("name", "VAR"),
  22114. c.appendChild(d),
  22115. b.push(c))
  22116. }
  22117. return b
  22118. }
  22119. ;
  22120. Blockly.Variables.generateUniqueName = function (a) {
  22121. a = a.variableList;
  22122. var b = "";
  22123. if (a.length)
  22124. for (var c = 1, d = 0, e = "ijkmnopqrstuvwxyzabcdefgh".charAt(d); !b;) {
  22125. for (var f = !1, g = 0; g < a.length; g++)
  22126. if (a[g].toLowerCase() == e) {
  22127. f = !0;
  22128. break
  22129. }
  22130. f ? (d++ ,
  22131. 25 == d && (d = 0,
  22132. c++),
  22133. e = "ijkmnopqrstuvwxyzabcdefgh".charAt(d),
  22134. 1 < c && (e += c)) : b = e
  22135. }
  22136. else
  22137. b = "i";
  22138. return b
  22139. }
  22140. ;
  22141. Blockly.Variables.createVariable = function (a, b) {
  22142. var c = function (d) {
  22143. Blockly.Variables.promptName(Blockly.Msg.NEW_VARIABLE_TITLE, d, function (d) {
  22144. d ? -1 != a.variableIndexOf(d) ? Blockly.alert(Blockly.Msg.VARIABLE_ALREADY_EXISTS.replace("%1", d.toLowerCase()), function () {
  22145. c(d)
  22146. }) : (a.createVariable(d),
  22147. b && b(d)) : b && b(null)
  22148. })
  22149. };
  22150. c("")
  22151. }
  22152. ;
  22153. Blockly.Variables.promptName = function (a, b, c) {
  22154. Blockly.prompt(a, b, function (a) {
  22155. a && (a = a.replace(/[\s\xa0]+/g, " ").replace(/^ | $/g, ""),
  22156. a == Blockly.Msg.RENAME_VARIABLE || a == Blockly.Msg.NEW_VARIABLE) && (a = null);
  22157. c(a)
  22158. })
  22159. }
  22160. ;
  22161. Blockly.FieldVariable = function (a, b) {
  22162. Blockly.FieldVariable.superClass_.constructor.call(this, Blockly.FieldVariable.dropdownCreate, b);
  22163. this.setValue(a || "")
  22164. }
  22165. ;
  22166. goog.inherits(Blockly.FieldVariable, Blockly.FieldDropdown);
  22167. Blockly.FieldVariable.prototype.renameVarItemIndex_ = -1;
  22168. Blockly.FieldVariable.prototype.deleteVarItemIndex_ = -1;
  22169. Blockly.FieldVariable.prototype.init = function () {
  22170. this.fieldGroup_ || (Blockly.FieldVariable.superClass_.init.call(this),
  22171. this.getValue() || this.setValue(Blockly.Variables.generateUniqueName(this.sourceBlock_.isInFlyout ? this.sourceBlock_.workspace.targetWorkspace : this.sourceBlock_.workspace)),
  22172. this.sourceBlock_.isInFlyout || this.sourceBlock_.workspace.createVariable(this.getValue()))
  22173. }
  22174. ;
  22175. Blockly.FieldVariable.prototype.setSourceBlock = function (a) {
  22176. goog.asserts.assert(!a.isShadow(), "Variable fields are not allowed to exist on shadow blocks.");
  22177. Blockly.FieldVariable.superClass_.setSourceBlock.call(this, a)
  22178. }
  22179. ;
  22180. Blockly.FieldVariable.prototype.getValue = function () {
  22181. return this.getText()
  22182. }
  22183. ;
  22184. Blockly.FieldVariable.prototype.setValue = function (a) {
  22185. this.sourceBlock_ && Blockly.Events.isEnabled() && Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, "field", this.name, this.value_, a));
  22186. this.value_ = a;
  22187. this.setText(a)
  22188. }
  22189. ;
  22190. Blockly.FieldVariable.dropdownCreate = function () {
  22191. var a = this.sourceBlock_ && this.sourceBlock_.workspace ? this.sourceBlock_.workspace.variableList.slice(0) : []
  22192. , b = this.getText();
  22193. b && -1 == a.indexOf(b) && a.push(b);
  22194. a.sort(goog.string.caseInsensitiveCompare);
  22195. this.renameVarItemIndex_ = a.length;
  22196. a.push(Blockly.Msg.RENAME_VARIABLE);
  22197. this.deleteVarItemIndex_ = a.length;
  22198. a.push(Blockly.Msg.DELETE_VARIABLE.replace("%1", b));
  22199. b = [];
  22200. for (var c = 0; c < a.length; c++)
  22201. b[c] = [a[c], a[c]];
  22202. return b
  22203. }
  22204. ;
  22205. Blockly.FieldVariable.prototype.onItemSelected = function (a, b) {
  22206. a.getChildCount();
  22207. var c = b.getValue();
  22208. if (this.sourceBlock_) {
  22209. var d = this.sourceBlock_.workspace;
  22210. if (0 <= this.renameVarItemIndex_ && a.getChildAt(this.renameVarItemIndex_) === b) {
  22211. var e = this.getText();
  22212. Blockly.hideChaff();
  22213. Blockly.Variables.promptName(Blockly.Msg.RENAME_VARIABLE_TITLE.replace("%1", e), e, function (a) {
  22214. a && d.renameVariable(e, a)
  22215. });
  22216. return
  22217. }
  22218. if (0 <= this.deleteVarItemIndex_ && a.getChildAt(this.deleteVarItemIndex_) === b) {
  22219. d.deleteVariable(this.getText());
  22220. return
  22221. }
  22222. c = this.callValidator(c)
  22223. }
  22224. null !== c && this.setValue(c)
  22225. }
  22226. ;
  22227. Blockly.Generator = function (a) {
  22228. this.name_ = a;
  22229. this.FUNCTION_NAME_PLACEHOLDER_REGEXP_ = new RegExp(this.FUNCTION_NAME_PLACEHOLDER_, "g")
  22230. }
  22231. ;
  22232. Blockly.Generator.NAME_TYPE = "generated_function";
  22233. Blockly.Generator.prototype.INFINITE_LOOP_TRAP = null;
  22234. Blockly.Generator.prototype.STATEMENT_PREFIX = null;
  22235. Blockly.Generator.prototype.INDENT = " ";
  22236. Blockly.Generator.prototype.COMMENT_WRAP = 60;
  22237. Blockly.Generator.prototype.ORDER_OVERRIDES = [];
  22238. Blockly.Generator.prototype.workspaceToCode = function (a) {
  22239. a || (console.warn("No workspace specified in workspaceToCode call. Guessing."),
  22240. a = Blockly.getMainWorkspace());
  22241. var b = [];
  22242. this.init(a);
  22243. a = a.getTopBlocks(!0);
  22244. for (var c = 0, d; d = a[c]; c++) {
  22245. var e = this.blockToCode(d);
  22246. goog.isArray(e) && (e = e[0]);
  22247. e && (d.outputConnection && this.scrubNakedValue && (e = this.scrubNakedValue(e)),
  22248. b.push(e))
  22249. }
  22250. b = b.join("\n");
  22251. b = this.finish(b);
  22252. b = b.replace(/^\s+\n/, "");
  22253. b = b.replace(/\n\s+$/, "\n");
  22254. return b = b.replace(/[ \t]+\n/g, "\n")
  22255. }
  22256. ;
  22257. Blockly.Generator.prototype.prefixLines = function (a, b) {
  22258. return b + a.replace(/(?!\n$)\n/g, "\n" + b)
  22259. }
  22260. ;
  22261. Blockly.Generator.prototype.allNestedComments = function (a) {
  22262. var b = [];
  22263. a = a.getDescendants();
  22264. for (var c = 0; c < a.length; c++) {
  22265. var d = a[c].getCommentText();
  22266. d && b.push(d)
  22267. }
  22268. b.length && b.push("");
  22269. return b.join("\n")
  22270. }
  22271. ;
  22272. Blockly.Generator.prototype.blockToCode = function (a) {
  22273. if (!a)
  22274. return "";
  22275. if (a.disabled)
  22276. return this.blockToCode(a.getNextBlock());
  22277. var b = this[a.type];
  22278. goog.asserts.assertFunction(b, 'Language "%s" does not know how to generate code for block type "%s".', this.name_, a.type);
  22279. b = b.call(a, a);
  22280. if (goog.isArray(b))
  22281. return goog.asserts.assert(a.outputConnection, 'Expecting string from statement block "%s".', a.type),
  22282. [this.scrub_(a, b[0]), b[1]];
  22283. if (goog.isString(b)) {
  22284. var c = a.id.replace(/\$/g, "$$$$");
  22285. this.STATEMENT_PREFIX && (b = this.STATEMENT_PREFIX.replace(/%1/g, "'" + c + "'") + b);
  22286. return this.scrub_(a, b)
  22287. }
  22288. if (null === b)
  22289. return "";
  22290. goog.asserts.fail("Invalid code generated: %s", b)
  22291. }
  22292. ;
  22293. Blockly.Generator.prototype.valueToCode = function (a, b, c) {
  22294. isNaN(c) && goog.asserts.fail('Expecting valid order from block "%s".', a.type);
  22295. var d = a.getInputTargetBlock(b);
  22296. if (!d)
  22297. return "";
  22298. b = this.blockToCode(d);
  22299. if ("" === b)
  22300. return "";
  22301. goog.asserts.assertArray(b, 'Expecting tuple from value block "%s".', d.type);
  22302. a = b[0];
  22303. b = b[1];
  22304. isNaN(b) && goog.asserts.fail('Expecting valid order from value block "%s".', d.type);
  22305. if (!a)
  22306. return "";
  22307. d = !1;
  22308. var e = Math.floor(c)
  22309. , f = Math.floor(b);
  22310. if (e <= f && (e != f || 0 != e && 99 != e))
  22311. for (d = !0,
  22312. e = 0; e < this.ORDER_OVERRIDES.length; e++)
  22313. if (this.ORDER_OVERRIDES[e][0] == c && this.ORDER_OVERRIDES[e][1] == b) {
  22314. d = !1;
  22315. break
  22316. }
  22317. d && (a = "(" + a + ")");
  22318. return a
  22319. }
  22320. ;
  22321. Blockly.Generator.prototype.statementToCode = function (a, b) {
  22322. var c = a.getInputTargetBlock(b)
  22323. , d = this.blockToCode(c);
  22324. goog.asserts.assertString(d, 'Expecting code from statement block "%s".', c && c.type);
  22325. d && (d = this.prefixLines(d, this.INDENT));
  22326. return d
  22327. }
  22328. ;
  22329. Blockly.Generator.prototype.addLoopTrap = function (a, b) {
  22330. b = b.replace(/\$/g, "$$$$");
  22331. this.INFINITE_LOOP_TRAP && (a = this.INFINITE_LOOP_TRAP.replace(/%1/g, "'" + b + "'") + a);
  22332. this.STATEMENT_PREFIX && (a += this.prefixLines(this.STATEMENT_PREFIX.replace(/%1/g, "'" + b + "'"), this.INDENT));
  22333. return a
  22334. }
  22335. ;
  22336. Blockly.Generator.prototype.RESERVED_WORDS_ = "";
  22337. Blockly.Generator.prototype.addReservedWords = function (a) {
  22338. this.RESERVED_WORDS_ += a + ","
  22339. }
  22340. ;
  22341. Blockly.Generator.prototype.FUNCTION_NAME_PLACEHOLDER_ = "{leCUI8hutHZI4480Dc}";
  22342. Blockly.Generator.prototype.provideFunction_ = function (a, b) {
  22343. if (!this.definitions_[a]) {
  22344. var c = this.variableDB_.getDistinctName(a, Blockly.Procedures.NAME_TYPE);
  22345. this.functionNames_[a] = c;
  22346. c = b.join("\n").replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_, c);
  22347. for (var d; d != c;)
  22348. d = c,
  22349. c = c.replace(/^(( )*) /gm, "$1\x00");
  22350. c = c.replace(/\0/g, this.INDENT);
  22351. this.definitions_[a] = c
  22352. }
  22353. return this.functionNames_[a]
  22354. }
  22355. ;
  22356. Blockly.Names = function (a, b) {
  22357. this.variablePrefix_ = b || "";
  22358. this.reservedDict_ = Object.create(null);
  22359. if (a)
  22360. for (var c = a.split(","), d = 0; d < c.length; d++)
  22361. this.reservedDict_[c[d]] = !0;
  22362. this.reset()
  22363. }
  22364. ;
  22365. Blockly.Names.prototype.reset = function () {
  22366. this.db_ = Object.create(null);
  22367. this.dbReverse_ = Object.create(null)
  22368. }
  22369. ;
  22370. Blockly.Names.prototype.getName = function (a, b) {
  22371. var c = a.toLowerCase() + "_" + b
  22372. , d = b == Blockly.Variables.NAME_TYPE ? this.variablePrefix_ : "";
  22373. if (c in this.db_)
  22374. return d + this.db_[c];
  22375. var e = this.getDistinctName(a, b);
  22376. this.db_[c] = e.substr(d.length);
  22377. return e
  22378. }
  22379. ;
  22380. Blockly.Names.prototype.getDistinctName = function (a, b) {
  22381. var c = this.safeName_(a);
  22382. this.dbReverse_[c] = !0;
  22383. return (b == Blockly.Variables.NAME_TYPE ? this.variablePrefix_ : "") + c
  22384. }
  22385. ;
  22386. Blockly.Names.prototype.safeName_ = function (a) {
  22387. a ? (a = encodeURI(a.replace(/ /g, "_")).replace(/[^\w]/g, "_"),
  22388. -1 != "0123456789".indexOf(a[0]) && (a = "my_" + a)) : a = "unnamed";
  22389. return a
  22390. }
  22391. ;
  22392. Blockly.Names.equals = function (a, b) {
  22393. return a.toLowerCase() == b.toLowerCase()
  22394. }
  22395. ;
  22396. Blockly.Procedures = {};
  22397. Blockly.Procedures.NAME_TYPE = "PROCEDURE";
  22398. Blockly.Procedures.allProcedures = function (a) {
  22399. a = a.getAllBlocks();
  22400. for (var b = [], c = [], d = 0; d < a.length; d++)
  22401. if (a[d].getProcedureDef) {
  22402. var e = a[d].getProcedureDef();
  22403. e && (e[2] ? b.push(e) : c.push(e))
  22404. }
  22405. c.sort(Blockly.Procedures.procTupleComparator_);
  22406. b.sort(Blockly.Procedures.procTupleComparator_);
  22407. return [c, b]
  22408. }
  22409. ;
  22410. Blockly.Procedures.procTupleComparator_ = function (a, b) {
  22411. return a[0].toLowerCase().localeCompare(b[0].toLowerCase())
  22412. }
  22413. ;
  22414. Blockly.Procedures.findLegalName = function (a, b) {
  22415. if (b.isInFlyout)
  22416. return a;
  22417. for (; !Blockly.Procedures.isLegalName_(a, b.workspace, b);) {
  22418. var c = a.match(/^(.*?)(\d+)$/);
  22419. a = c ? c[1] + (parseInt(c[2], 10) + 1) : a + "2"
  22420. }
  22421. return a
  22422. }
  22423. ;
  22424. Blockly.Procedures.isLegalName_ = function (a, b, c) {
  22425. b = b.getAllBlocks();
  22426. for (var d = 0; d < b.length; d++)
  22427. if (b[d] != c && b[d].getProcedureDef) {
  22428. var e = b[d].getProcedureDef();
  22429. if (Blockly.Names.equals(e[0], a))
  22430. return !1
  22431. }
  22432. return !0
  22433. }
  22434. ;
  22435. Blockly.Procedures.rename = function (a) {
  22436. a = a.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");
  22437. var b = Blockly.Procedures.findLegalName(a, this.sourceBlock_)
  22438. , c = this.text_;
  22439. if (c != a && c != b) {
  22440. a = this.sourceBlock_.workspace.getAllBlocks();
  22441. for (var d = 0; d < a.length; d++)
  22442. a[d].renameProcedure && a[d].renameProcedure(c, b)
  22443. }
  22444. return b
  22445. }
  22446. ;
  22447. Blockly.Procedures.flyoutCategory = function (a) {
  22448. function b(a, b) {
  22449. for (var d = 0; d < a.length; d++) {
  22450. var e = a[d][0]
  22451. , f = a[d][1]
  22452. , m = goog.dom.createDom("block");
  22453. m.setAttribute("type", b);
  22454. m.setAttribute("gap", 16);
  22455. var p = goog.dom.createDom("mutation");
  22456. p.setAttribute("name", e);
  22457. m.appendChild(p);
  22458. for (e = 0; e < f.length; e++) {
  22459. var l = goog.dom.createDom("arg");
  22460. l.setAttribute("name", f[e]);
  22461. p.appendChild(l)
  22462. }
  22463. c.push(m)
  22464. }
  22465. }
  22466. var c = [];
  22467. if (Blockly.Blocks.procedures_defnoreturn) {
  22468. var d = goog.dom.createDom("block");
  22469. d.setAttribute("type", "procedures_defnoreturn");
  22470. d.setAttribute("gap", 16);
  22471. c.push(d)
  22472. }
  22473. Blockly.Blocks.procedures_defreturn && (d = goog.dom.createDom("block"),
  22474. d.setAttribute("type", "procedures_defreturn"),
  22475. d.setAttribute("gap", 16),
  22476. c.push(d));
  22477. Blockly.Blocks.procedures_ifreturn && (d = goog.dom.createDom("block"),
  22478. d.setAttribute("type", "procedures_ifreturn"),
  22479. d.setAttribute("gap", 16),
  22480. c.push(d));
  22481. c.length && c[c.length - 1].setAttribute("gap", 24);
  22482. a = Blockly.Procedures.allProcedures(a);
  22483. b(a[0], "procedures_callnoreturn");
  22484. b(a[1], "procedures_callreturn");
  22485. return c
  22486. }
  22487. ;
  22488. Blockly.Procedures.getCallers = function (a, b) {
  22489. for (var c = [], d = b.getAllBlocks(), e = 0; e < d.length; e++)
  22490. if (d[e].getProcedureCall) {
  22491. var f = d[e].getProcedureCall();
  22492. f && Blockly.Names.equals(f, a) && c.push(d[e])
  22493. }
  22494. return c
  22495. }
  22496. ;
  22497. Blockly.Procedures.mutateCallers = function (a) {
  22498. var b = Blockly.Events.recordUndo
  22499. , c = a.getProcedureDef()[0]
  22500. , d = a.mutationToDom(!0);
  22501. a = Blockly.Procedures.getCallers(c, a.workspace);
  22502. c = 0;
  22503. for (var e; e = a[c]; c++) {
  22504. var f = e.mutationToDom();
  22505. f = f && Blockly.Xml.domToText(f);
  22506. e.domToMutation(d);
  22507. var g = e.mutationToDom();
  22508. g = g && Blockly.Xml.domToText(g);
  22509. f != g && (Blockly.Events.recordUndo = !1,
  22510. Blockly.Events.fire(new Blockly.Events.Change(e, "mutation", null, f, g)),
  22511. Blockly.Events.recordUndo = b)
  22512. }
  22513. }
  22514. ;
  22515. Blockly.Procedures.getDefinition = function (a, b) {
  22516. for (var c = b.getTopBlocks(!1), d = 0; d < c.length; d++)
  22517. if (c[d].getProcedureDef) {
  22518. var e = c[d].getProcedureDef();
  22519. if (e && Blockly.Names.equals(e[0], a))
  22520. return c[d]
  22521. }
  22522. return null
  22523. }
  22524. ;
  22525. Blockly.FlyoutButton = function (a, b, c, d, e) {
  22526. this.workspace_ = a;
  22527. this.targetWorkspace_ = b;
  22528. this.text_ = c;
  22529. this.position_ = new goog.math.Coordinate(0, 0);
  22530. this.callback_ = Blockly.flyoutButtonCallbacks_[d];
  22531. this.isLabel_ = e
  22532. }
  22533. ;
  22534. Blockly.FlyoutButton.MARGIN = 5;
  22535. Blockly.FlyoutButton.prototype.width = 0;
  22536. Blockly.FlyoutButton.prototype.height = 0;
  22537. Blockly.FlyoutButton.prototype.createDom = function () {
  22538. this.svgGroup_ = Blockly.createSvgElement("g", {
  22539. "class": this.isLabel_ ? "blocklyFlyoutLabel" : "blocklyFlyoutButton"
  22540. }, this.workspace_.getCanvas());
  22541. if (!this.isLabel_)
  22542. var a = Blockly.createSvgElement("rect", {
  22543. "class": "blocklyFlyoutButtonShadow",
  22544. rx: 4,
  22545. ry: 4,
  22546. x: 1,
  22547. y: 1
  22548. }, this.svgGroup_);
  22549. var b = Blockly.createSvgElement("rect", {
  22550. "class": this.isLabel_ ? "blocklyFlyoutLabelBackground" : "blocklyFlyoutButtonBackground",
  22551. rx: 4,
  22552. ry: 4
  22553. }, this.svgGroup_)
  22554. , c = Blockly.createSvgElement("text", {
  22555. "class": this.isLabel_ ? "blocklyFlyoutLabelText" : "blocklyText",
  22556. x: 0,
  22557. y: 0,
  22558. "text-anchor": "middle"
  22559. }, this.svgGroup_);
  22560. c.textContent = this.text_;
  22561. this.width = c.getComputedTextLength() + 2 * Blockly.FlyoutButton.MARGIN;
  22562. this.height = 20;
  22563. this.isLabel_ || (a.setAttribute("width", this.width),
  22564. a.setAttribute("height", this.height));
  22565. b.setAttribute("width", this.width);
  22566. b.setAttribute("height", this.height);
  22567. c.setAttribute("x", this.width / 2);
  22568. c.setAttribute("y", this.height - Blockly.FlyoutButton.MARGIN);
  22569. this.updateTransform_();
  22570. return this.svgGroup_
  22571. }
  22572. ;
  22573. Blockly.FlyoutButton.prototype.show = function () {
  22574. this.updateTransform_();
  22575. this.svgGroup_.setAttribute("display", "block")
  22576. }
  22577. ;
  22578. Blockly.FlyoutButton.prototype.updateTransform_ = function () {
  22579. this.svgGroup_.setAttribute("transform", "translate(" + this.position_.x + "," + this.position_.y + ")")
  22580. }
  22581. ;
  22582. Blockly.FlyoutButton.prototype.moveTo = function (a, b) {
  22583. this.position_.x = a;
  22584. this.position_.y = b;
  22585. this.updateTransform_()
  22586. }
  22587. ;
  22588. Blockly.FlyoutButton.prototype.getTargetWorkspace = function () {
  22589. return this.targetWorkspace_
  22590. }
  22591. ;
  22592. Blockly.FlyoutButton.prototype.dispose = function () {
  22593. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  22594. this.svgGroup_ = null);
  22595. this.targetWorkspace_ = this.workspace_ = null
  22596. }
  22597. ;
  22598. Blockly.FlyoutButton.prototype.onMouseUp = function (a) {
  22599. a.preventDefault();
  22600. a.stopPropagation();
  22601. Blockly.Flyout.terminateDrag_();
  22602. this.callback_ && this.callback_(this)
  22603. }
  22604. ;
  22605. Blockly.Flyout = function (a) {
  22606. a.getMetrics = this.getMetrics_.bind(this);
  22607. a.setMetrics = this.setMetrics_.bind(this);
  22608. this.workspace_ = new Blockly.WorkspaceSvg(a);
  22609. this.workspace_.isFlyout = !0;
  22610. this.RTL = !!a.RTL;
  22611. this.horizontalLayout_ = a.horizontalLayout;
  22612. this.toolboxPosition_ = a.toolboxPosition;
  22613. this.eventWrappers_ = [];
  22614. this.backgroundButtons_ = [];
  22615. this.buttons_ = [];
  22616. this.listeners_ = [];
  22617. this.permanentlyDisabled_ = [];
  22618. this.startDragMouseX_ = this.startDragMouseY_ = 0
  22619. }
  22620. ;
  22621. Blockly.Flyout.startFlyout_ = null;
  22622. Blockly.Flyout.startDownEvent_ = null;
  22623. Blockly.Flyout.startBlock_ = null;
  22624. Blockly.Flyout.onMouseUpWrapper_ = null;
  22625. Blockly.Flyout.onMouseMoveWrapper_ = null;
  22626. Blockly.Flyout.onMouseMoveBlockWrapper_ = null;
  22627. Blockly.Flyout.prototype.autoClose = !0;
  22628. Blockly.Flyout.prototype.CORNER_RADIUS = 8;
  22629. Blockly.Flyout.prototype.DRAG_RADIUS = 10;
  22630. Blockly.Flyout.prototype.MARGIN = Blockly.Flyout.prototype.CORNER_RADIUS;
  22631. Blockly.Flyout.prototype.GAP_X = 3 * Blockly.Flyout.prototype.MARGIN;
  22632. Blockly.Flyout.prototype.GAP_Y = 3 * Blockly.Flyout.prototype.MARGIN;
  22633. Blockly.Flyout.prototype.SCROLLBAR_PADDING = 2;
  22634. Blockly.Flyout.prototype.width_ = 0;
  22635. Blockly.Flyout.prototype.height_ = 0;
  22636. Blockly.Flyout.prototype.dragMode_ = Blockly.DRAG_NONE;
  22637. Blockly.Flyout.prototype.dragAngleRange_ = 70;
  22638. Blockly.Flyout.prototype.createDom = function () {
  22639. this.svgGroup_ = Blockly.createSvgElement("g", {
  22640. "class": "blocklyFlyout"
  22641. }, null);
  22642. this.svgBackground_ = Blockly.createSvgElement("path", {
  22643. "class": "blocklyFlyoutBackground"
  22644. }, this.svgGroup_);
  22645. this.svgGroup_.appendChild(this.workspace_.createDom());
  22646. return this.svgGroup_
  22647. }
  22648. ;
  22649. Blockly.Flyout.prototype.init = function (a) {
  22650. this.targetWorkspace_ = a;
  22651. this.workspace_.targetWorkspace = a;
  22652. this.scrollbar_ = new Blockly.Scrollbar(this.workspace_, this.horizontalLayout_, !1);
  22653. this.hide();
  22654. Array.prototype.push.apply(this.eventWrappers_, Blockly.bindEventWithChecks_(this.svgGroup_, "wheel", this, this.wheel_));
  22655. this.autoClose || (this.filterWrapper_ = this.filterForCapacity_.bind(this),
  22656. this.targetWorkspace_.addChangeListener(this.filterWrapper_));
  22657. Array.prototype.push.apply(this.eventWrappers_, Blockly.bindEventWithChecks_(this.svgGroup_, "mousedown", this, this.onMouseDown_))
  22658. }
  22659. ;
  22660. Blockly.Flyout.prototype.dispose = function () {
  22661. this.hide();
  22662. Blockly.unbindEvent_(this.eventWrappers_);
  22663. this.filterWrapper_ && (this.targetWorkspace_.removeChangeListener(this.filterWrapper_),
  22664. this.filterWrapper_ = null);
  22665. this.scrollbar_ && (this.scrollbar_.dispose(),
  22666. this.scrollbar_ = null);
  22667. this.workspace_ && (this.workspace_.targetWorkspace = null,
  22668. this.workspace_.dispose(),
  22669. this.workspace_ = null);
  22670. this.svgGroup_ && (goog.dom.removeNode(this.svgGroup_),
  22671. this.svgGroup_ = null);
  22672. this.targetWorkspace_ = this.svgBackground_ = null
  22673. }
  22674. ;
  22675. Blockly.Flyout.prototype.getWidth = function () {
  22676. return this.width_
  22677. }
  22678. ;
  22679. Blockly.Flyout.prototype.getHeight = function () {
  22680. return this.height_
  22681. }
  22682. ;
  22683. Blockly.Flyout.prototype.getMetrics_ = function () {
  22684. if (!this.isVisible())
  22685. return null;
  22686. try {
  22687. var a = this.workspace_.getCanvas().getBBox()
  22688. } catch (f) {
  22689. a = {
  22690. height: 0,
  22691. y: 0,
  22692. width: 0,
  22693. x: 0
  22694. }
  22695. }
  22696. var b = this.SCROLLBAR_PADDING
  22697. , c = this.SCROLLBAR_PADDING;
  22698. if (this.horizontalLayout_) {
  22699. this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM && (b = 0);
  22700. var d = this.height_;
  22701. this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP && (d -= this.SCROLLBAR_PADDING);
  22702. var e = this.width_ - 2 * this.SCROLLBAR_PADDING
  22703. } else
  22704. c = 0,
  22705. d = this.height_ - 2 * this.SCROLLBAR_PADDING,
  22706. e = this.width_,
  22707. this.RTL || (e -= this.SCROLLBAR_PADDING);
  22708. return {
  22709. viewHeight: d,
  22710. viewWidth: e,
  22711. contentHeight: (a.height + 2 * this.MARGIN) * this.workspace_.scale,
  22712. contentWidth: (a.width + 2 * this.MARGIN) * this.workspace_.scale,
  22713. viewTop: -this.workspace_.scrollY,
  22714. viewLeft: -this.workspace_.scrollX,
  22715. contentTop: a.y,
  22716. contentLeft: a.x,
  22717. absoluteTop: b,
  22718. absoluteLeft: c
  22719. }
  22720. }
  22721. ;
  22722. Blockly.Flyout.prototype.setMetrics_ = function (a) {
  22723. var b = this.getMetrics_();
  22724. b && (!this.horizontalLayout_ && goog.isNumber(a.y) ? this.workspace_.scrollY = -b.contentHeight * a.y : this.horizontalLayout_ && goog.isNumber(a.x) && (this.workspace_.scrollX = -b.contentWidth * a.x),
  22725. this.workspace_.translate(this.workspace_.scrollX + b.absoluteLeft, this.workspace_.scrollY + b.absoluteTop))
  22726. }
  22727. ;
  22728. Blockly.Flyout.prototype.position = function () {
  22729. if (this.isVisible()) {
  22730. var a = this.targetWorkspace_.getMetrics();
  22731. if (a) {
  22732. this.setBackgroundPath_(this.horizontalLayout_ ? a.viewWidth - 2 * this.CORNER_RADIUS : this.width_ - this.CORNER_RADIUS, this.horizontalLayout_ ? this.height_ - this.CORNER_RADIUS : a.viewHeight - 2 * this.CORNER_RADIUS);
  22733. var b = a.absoluteLeft;
  22734. this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT && (b += a.viewWidth,
  22735. b -= this.width_);
  22736. var c = a.absoluteTop;
  22737. this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM && (c += a.viewHeight,
  22738. c -= this.height_);
  22739. this.svgGroup_.setAttribute("transform", "translate(" + b + "," + c + ")");
  22740. this.horizontalLayout_ ? this.width_ = a.viewWidth : this.height_ = a.viewHeight;
  22741. this.scrollbar_ && this.scrollbar_.resize()
  22742. }
  22743. }
  22744. }
  22745. ;
  22746. Blockly.Flyout.prototype.setBackgroundPath_ = function (a, b) {
  22747. this.horizontalLayout_ ? this.setBackgroundPathHorizontal_(a, b) : this.setBackgroundPathVertical_(a, b)
  22748. }
  22749. ;
  22750. Blockly.Flyout.prototype.setBackgroundPathVertical_ = function (a, b) {
  22751. var c = this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT
  22752. , d = a + this.CORNER_RADIUS;
  22753. d = ["M " + (c ? d : 0) + ",0"];
  22754. d.push("h", c ? -a : a);
  22755. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, c ? 0 : 1, c ? -this.CORNER_RADIUS : this.CORNER_RADIUS, this.CORNER_RADIUS);
  22756. d.push("v", Math.max(0, b));
  22757. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, c ? 0 : 1, c ? this.CORNER_RADIUS : -this.CORNER_RADIUS, this.CORNER_RADIUS);
  22758. d.push("h", c ? a : -a);
  22759. d.push("z");
  22760. this.svgBackground_.setAttribute("d", d.join(" "))
  22761. }
  22762. ;
  22763. Blockly.Flyout.prototype.setBackgroundPathHorizontal_ = function (a, b) {
  22764. var c = this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP
  22765. , d = ["M 0," + (c ? 0 : this.CORNER_RADIUS)];
  22766. c ? (d.push("h", a + 2 * this.CORNER_RADIUS),
  22767. d.push("v", b),
  22768. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, -this.CORNER_RADIUS, this.CORNER_RADIUS),
  22769. d.push("h", -1 * a),
  22770. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, -this.CORNER_RADIUS, -this.CORNER_RADIUS)) : (d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, this.CORNER_RADIUS, -this.CORNER_RADIUS),
  22771. d.push("h", a),
  22772. d.push("a", this.CORNER_RADIUS, this.CORNER_RADIUS, 0, 0, 1, this.CORNER_RADIUS, this.CORNER_RADIUS),
  22773. d.push("v", b),
  22774. d.push("h", -a - 2 * this.CORNER_RADIUS));
  22775. d.push("z");
  22776. this.svgBackground_.setAttribute("d", d.join(" "))
  22777. }
  22778. ;
  22779. Blockly.Flyout.prototype.scrollToStart = function () {
  22780. this.scrollbar_.set(this.horizontalLayout_ && this.RTL ? Infinity : 0)
  22781. }
  22782. ;
  22783. Blockly.Flyout.prototype.wheel_ = function (a) {
  22784. var b = this.horizontalLayout_ ? a.deltaX : a.deltaY;
  22785. if (b) {
  22786. goog.userAgent.GECKO && (b *= 10);
  22787. var c = this.getMetrics_();
  22788. b = this.horizontalLayout_ ? c.viewLeft + b : c.viewTop + b;
  22789. b = Math.min(b, this.horizontalLayout_ ? c.contentWidth - c.viewWidth : c.contentHeight - c.viewHeight);
  22790. b = Math.max(b, 0);
  22791. this.scrollbar_.set(b)
  22792. }
  22793. a.preventDefault();
  22794. a.stopPropagation()
  22795. }
  22796. ;
  22797. Blockly.Flyout.prototype.isVisible = function () {
  22798. return this.svgGroup_ && "block" == this.svgGroup_.style.display
  22799. }
  22800. ;
  22801. Blockly.Flyout.prototype.hide = function () {
  22802. if (this.isVisible()) {
  22803. this.svgGroup_.style.display = "none";
  22804. for (var a = 0, b; b = this.listeners_[a]; a++)
  22805. Blockly.unbindEvent_(b);
  22806. this.listeners_.length = 0;
  22807. this.reflowWrapper_ && (this.workspace_.removeChangeListener(this.reflowWrapper_),
  22808. this.reflowWrapper_ = null)
  22809. }
  22810. }
  22811. ;
  22812. Blockly.Flyout.prototype.show = function (a) {
  22813. this.hide();
  22814. this.clearOldBlocks_();
  22815. a == Blockly.Variables.NAME_TYPE ? a = Blockly.Variables.flyoutCategory(this.workspace_.targetWorkspace) : a == Blockly.Procedures.NAME_TYPE && (a = Blockly.Procedures.flyoutCategory(this.workspace_.targetWorkspace));
  22816. this.svgGroup_.style.display = "block";
  22817. for (var b = [], c = [], d = this.permanentlyDisabled_.length = 0, e; e = a[d]; d++)
  22818. if (e.tagName) {
  22819. var f = e.tagName.toUpperCase()
  22820. , g = this.horizontalLayout_ ? this.GAP_X : this.GAP_Y;
  22821. if ("BLOCK" == f)
  22822. f = Blockly.Xml.domToBlock(e, this.workspace_),
  22823. f.disabled && this.permanentlyDisabled_.push(f),
  22824. b.push({
  22825. type: "block",
  22826. block: f
  22827. }),
  22828. e = parseInt(e.getAttribute("gap"), 10),
  22829. c.push(isNaN(e) ? g : e);
  22830. else if ("SEP" == e.tagName.toUpperCase())
  22831. e = parseInt(e.getAttribute("gap"), 10),
  22832. !isNaN(e) && 0 < c.length ? c[c.length - 1] = e : c.push(g);
  22833. else if ("BUTTON" == f || "LABEL" == f) {
  22834. f = "LABEL" == f;
  22835. var h = e.getAttribute("text");
  22836. e = e.getAttribute("callbackKey");
  22837. e = new Blockly.FlyoutButton(this.workspace_, this.targetWorkspace_, h, e, f);
  22838. b.push({
  22839. type: "button",
  22840. button: e
  22841. });
  22842. c.push(g)
  22843. }
  22844. }
  22845. this.layout_(b, c);
  22846. this.listeners_.push(Blockly.bindEventWithChecks_(this.svgBackground_, "mouseover", this, function () {
  22847. for (var a = this.workspace_.getTopBlocks(!1), b = 0, c; c = a[b]; b++)
  22848. c.removeSelect()
  22849. }));
  22850. this.horizontalLayout_ ? this.height_ = 0 : this.width_ = 0;
  22851. this.reflow();
  22852. this.filterForCapacity_();
  22853. this.position();
  22854. this.reflowWrapper_ = this.reflow.bind(this);
  22855. this.workspace_.addChangeListener(this.reflowWrapper_)
  22856. }
  22857. ;
  22858. Blockly.Flyout.prototype.layout_ = function (a, b) {
  22859. this.workspace_.scale = this.targetWorkspace_.scale;
  22860. var c = this.MARGIN
  22861. , d = this.RTL ? c : c + Blockly.BlockSvg.TAB_WIDTH;
  22862. this.horizontalLayout_ && this.RTL && (a = a.reverse());
  22863. for (var e = 0, f; f = a[e]; e++)
  22864. if ("block" == f.type) {
  22865. f = f.block;
  22866. for (var g = f.getDescendants(), h = 0, k; k = g[h]; h++)
  22867. k.isInFlyout = !0;
  22868. f.render();
  22869. g = f.getSvgRoot();
  22870. h = f.getHeightWidth();
  22871. k = f.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0;
  22872. this.horizontalLayout_ && (d += k);
  22873. f.moveBy(this.horizontalLayout_ && this.RTL ? d + h.width - k : d, c);
  22874. this.horizontalLayout_ ? d += h.width + b[e] - k : c += h.height + b[e];
  22875. h = Blockly.createSvgElement("rect", {
  22876. "fill-opacity": 0
  22877. }, null);
  22878. h.tooltip = f;
  22879. Blockly.Tooltip.bindMouseEvents(h);
  22880. this.workspace_.getCanvas().insertBefore(h, f.getSvgRoot());
  22881. f.flyoutRect_ = h;
  22882. this.backgroundButtons_[e] = h;
  22883. this.addBlockListeners_(g, f, h)
  22884. } else
  22885. "button" == f.type && (f = f.button,
  22886. g = f.createDom(),
  22887. f.moveTo(d, c),
  22888. f.show(),
  22889. Blockly.bindEventWithChecks_(g, "mouseup", f, f.onMouseUp),
  22890. this.buttons_.push(f),
  22891. this.horizontalLayout_ ? d += f.width + b[e] : c += f.height + b[e])
  22892. }
  22893. ;
  22894. Blockly.Flyout.prototype.clearOldBlocks_ = function () {
  22895. for (var a = this.workspace_.getTopBlocks(!1), b = 0, c; c = a[b]; b++)
  22896. c.workspace == this.workspace_ && c.dispose(!1, !1);
  22897. for (b = 0; b < this.backgroundButtons_.length; b++) {
  22898. if (a = this.backgroundButtons_[b]) {
  22899. goog.dom.removeNode(a);
  22900. }
  22901. }
  22902. for (b = this.backgroundButtons_.length = 0; b < this.buttons_.length; b++) {
  22903. if (a = this.buttons_[b]) {
  22904. a.dispose();
  22905. }
  22906. }
  22907. this.buttons_.length = 0
  22908. }
  22909. ;
  22910. Blockly.Flyout.prototype.addBlockListeners_ = function (a, b, c) {
  22911. this.listeners_.push(Blockly.bindEventWithChecks_(a, "mousedown", null, this.blockMouseDown_(b)));
  22912. this.listeners_.push(Blockly.bindEventWithChecks_(c, "mousedown", null, this.blockMouseDown_(b)));
  22913. this.listeners_.push(Blockly.bindEvent_(a, "mouseover", b, b.addSelect));
  22914. this.listeners_.push(Blockly.bindEvent_(a, "mouseout", b, b.removeSelect));
  22915. this.listeners_.push(Blockly.bindEvent_(c, "mouseover", b, b.addSelect));
  22916. this.listeners_.push(Blockly.bindEvent_(c, "mouseout", b, b.removeSelect))
  22917. }
  22918. ;
  22919. Blockly.Flyout.blockRightClick_ = function (a, b) {
  22920. Blockly.terminateDrag_();
  22921. Blockly.hideChaff(!0);
  22922. b.showContextMenu_(a);
  22923. Blockly.Touch.clearTouchIdentifier()
  22924. }
  22925. ;
  22926. Blockly.Flyout.prototype.blockMouseDown_ = function (a) {
  22927. var b = this;
  22928. return function (c) {
  22929. Blockly.isRightButton(c) ? Blockly.Flyout.blockRightClick_(c, a) : (Blockly.terminateDrag_(),
  22930. Blockly.hideChaff(!0),
  22931. Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),
  22932. b.startDragMouseY_ = c.clientY,
  22933. b.startDragMouseX_ = c.clientX,
  22934. Blockly.Flyout.startDownEvent_ = c,
  22935. Blockly.Flyout.startBlock_ = a,
  22936. Blockly.Flyout.startFlyout_ = b,
  22937. Blockly.Flyout.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", b, b.onMouseUp_),
  22938. Blockly.Flyout.onMouseMoveBlockWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", b, b.onMouseMoveBlock_));
  22939. c.stopPropagation();
  22940. c.preventDefault()
  22941. }
  22942. }
  22943. ;
  22944. Blockly.Flyout.prototype.onMouseDown_ = function (a) {
  22945. Blockly.isRightButton(a) ? Blockly.Touch.clearTouchIdentifier() : (Blockly.hideChaff(!0),
  22946. this.dragMode_ = Blockly.DRAG_FREE,
  22947. this.startDragMouseY_ = a.clientY,
  22948. this.startDragMouseX_ = a.clientX,
  22949. Blockly.Flyout.startFlyout_ = this,
  22950. Blockly.Flyout.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document, "mousemove", this, this.onMouseMove_),
  22951. Blockly.Flyout.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document, "mouseup", this, Blockly.Flyout.terminateDrag_),
  22952. a.preventDefault(),
  22953. a.stopPropagation())
  22954. }
  22955. ;
  22956. Blockly.Flyout.prototype.onMouseUp_ = function (a) {
  22957. this.workspace_.isDragging() || (Blockly.Touch.clearTouchIdentifier(),
  22958. this.autoClose ? this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_) : Blockly.WidgetDiv.isVisible() || Blockly.Events.fire(new Blockly.Events.Ui(Blockly.Flyout.startBlock_, "click", void 0, void 0)));
  22959. Blockly.terminateDrag_()
  22960. }
  22961. ;
  22962. Blockly.Flyout.prototype.onMouseMove_ = function (a) {
  22963. var b = this.getMetrics_();
  22964. if (this.horizontalLayout_) {
  22965. if (!(0 > b.contentWidth - b.viewWidth)) {
  22966. var c = a.clientX - this.startDragMouseX_;
  22967. this.startDragMouseX_ = a.clientX;
  22968. a = b.viewLeft - c;
  22969. a = goog.math.clamp(a, 0, b.contentWidth - b.viewWidth);
  22970. this.scrollbar_.set(a)
  22971. }
  22972. } else
  22973. 0 > b.contentHeight - b.viewHeight || (c = a.clientY - this.startDragMouseY_,
  22974. this.startDragMouseY_ = a.clientY,
  22975. a = b.viewTop - c,
  22976. a = goog.math.clamp(a, 0, b.contentHeight - b.viewHeight),
  22977. this.scrollbar_.set(a))
  22978. }
  22979. ;
  22980. Blockly.Flyout.prototype.onMouseMoveBlock_ = function (a) {
  22981. "mousemove" == a.type && 1 >= a.clientX && 0 == a.clientY && 0 == a.button || (this.determineDragIntention_(a.clientX - Blockly.Flyout.startDownEvent_.clientX, a.clientY - Blockly.Flyout.startDownEvent_.clientY) ? (Blockly.longStop_(),
  22982. this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_)) : this.dragMode_ == Blockly.DRAG_FREE && (Blockly.longStop_(),
  22983. this.onMouseMove_(a)));
  22984. a.stopPropagation()
  22985. }
  22986. ;
  22987. Blockly.Flyout.prototype.determineDragIntention_ = function (a, b) {
  22988. if (this.dragMode_ == Blockly.DRAG_FREE)
  22989. return !1;
  22990. if (Math.sqrt(a * a + b * b) < this.DRAG_RADIUS)
  22991. return this.dragMode_ = Blockly.DRAG_STICKY,
  22992. !1;
  22993. if (this.isDragTowardWorkspace_(a, b) || !this.scrollbar_.isVisible())
  22994. return !0;
  22995. this.dragMode_ = Blockly.DRAG_FREE;
  22996. return !1
  22997. }
  22998. ;
  22999. Blockly.Flyout.prototype.isDragTowardWorkspace_ = function (a, b) {
  23000. var c = Math.atan2(b, a) / Math.PI * 180
  23001. , d = this.dragAngleRange_;
  23002. if (this.horizontalLayout_) {
  23003. if (c < 90 + d && c > 90 - d || c > -90 - d && c < -90 + d)
  23004. return !0
  23005. } else if (c < d && c > -d || c < -180 + d || c > 180 - d)
  23006. return !0;
  23007. return !1
  23008. }
  23009. ;
  23010. Blockly.Flyout.prototype.createBlockFunc_ = function (a) {
  23011. var b = this;
  23012. return function (c) {
  23013. if (!Blockly.isRightButton(c) && !a.disabled) {
  23014. Blockly.Events.disable();
  23015. try {
  23016. var d = b.placeNewBlock_(a)
  23017. } finally {
  23018. Blockly.Events.enable()
  23019. }
  23020. Blockly.Events.isEnabled() && (Blockly.Events.setGroup(!0),
  23021. Blockly.Events.fire(new Blockly.Events.Create(d)));
  23022. b.autoClose ? b.hide() : b.filterForCapacity_();
  23023. d.onMouseDown_(c);
  23024. Blockly.dragMode_ = Blockly.DRAG_FREE;
  23025. d.setDragging_(!0);
  23026. b.targetWorkspace_.setResizesEnabled(!1)
  23027. }
  23028. }
  23029. }
  23030. ;
  23031. Blockly.Flyout.prototype.placeNewBlock_ = function (a) {
  23032. var b = this.targetWorkspace_
  23033. , c = a.getSvgRoot();
  23034. if (!c)
  23035. throw "originBlock is not rendered.";
  23036. c = Blockly.getSvgXY_(c, b);
  23037. var d = this.workspace_.scrollX
  23038. , e = this.workspace_.scale;
  23039. c.x += d / e - d;
  23040. this.toolboxPosition_ == Blockly.TOOLBOX_AT_RIGHT && (d = b.getMetrics().viewWidth - this.width_,
  23041. e = b.scale,
  23042. c.x += d / e - d);
  23043. d = this.workspace_.scrollY;
  23044. e = this.workspace_.scale;
  23045. c.y += d / e - d;
  23046. this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM && (d = b.getMetrics().viewHeight - this.height_,
  23047. e = b.scale,
  23048. c.y += d / e - d);
  23049. a = Blockly.Xml.blockToDom(a);
  23050. a = Blockly.Xml.domToBlock(a, b);
  23051. e = a.getSvgRoot();
  23052. if (!e)
  23053. throw "block is not rendered.";
  23054. e = Blockly.getSvgXY_(e, b);
  23055. e.x += b.scrollX / b.scale - b.scrollX;
  23056. e.y += b.scrollY / b.scale - b.scrollY;
  23057. b.toolbox_ && !b.scrollbar && (e.x += b.toolbox_.getWidth() / b.scale,
  23058. e.y += b.toolbox_.getHeight() / b.scale);
  23059. a.moveBy(c.x - e.x, c.y - e.y);
  23060. return a
  23061. }
  23062. ;
  23063. Blockly.Flyout.prototype.filterForCapacity_ = function () {
  23064. for (var a = this.targetWorkspace_.remainingCapacity(), b = this.workspace_.getTopBlocks(!1), c = 0, d; d = b[c]; c++)
  23065. if (-1 == this.permanentlyDisabled_.indexOf(d)) {
  23066. var e = d.getDescendants();
  23067. d.setDisabled(e.length > a)
  23068. }
  23069. }
  23070. ;
  23071. Blockly.Flyout.prototype.getClientRect = function () {
  23072. if (!this.svgGroup_)
  23073. return null;
  23074. var a = this.svgGroup_.getBoundingClientRect()
  23075. , b = a.left
  23076. , c = a.top
  23077. , d = a.width;
  23078. a = a.height;
  23079. return this.toolboxPosition_ == Blockly.TOOLBOX_AT_TOP ? new goog.math.Rect(-1E9, c - 1E9, 2E9, 1E9 + a) : this.toolboxPosition_ == Blockly.TOOLBOX_AT_BOTTOM ? new goog.math.Rect(-1E9, c, 2E9, 1E9 + a) : this.toolboxPosition_ == Blockly.TOOLBOX_AT_LEFT ? new goog.math.Rect(b - 1E9, -1E9, 1E9 + d, 2E9) : new goog.math.Rect(b, -1E9, 1E9 + d, 2E9)
  23080. }
  23081. ;
  23082. Blockly.Flyout.terminateDrag_ = function () {
  23083. Blockly.Flyout.startFlyout_ && (Blockly.Flyout.startFlyout_.dragMode_ == Blockly.DRAG_FREE && Blockly.Touch.clearTouchIdentifier(),
  23084. Blockly.Flyout.startFlyout_.dragMode_ = Blockly.DRAG_NONE,
  23085. Blockly.Flyout.startFlyout_ = null);
  23086. Blockly.Flyout.onMouseUpWrapper_ && (Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),
  23087. Blockly.Flyout.onMouseUpWrapper_ = null);
  23088. Blockly.Flyout.onMouseMoveBlockWrapper_ && (Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveBlockWrapper_),
  23089. Blockly.Flyout.onMouseMoveBlockWrapper_ = null);
  23090. Blockly.Flyout.onMouseMoveWrapper_ && (Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveWrapper_),
  23091. Blockly.Flyout.onMouseMoveWrapper_ = null);
  23092. Blockly.Flyout.startDownEvent_ = null;
  23093. Blockly.Flyout.startBlock_ = null
  23094. }
  23095. ;
  23096. Blockly.Flyout.prototype.reflowHorizontal = function (a) {
  23097. this.workspace_.scale = this.targetWorkspace_.scale;
  23098. for (var b = 0, c = 0, d; d = a[c]; c++)
  23099. b = Math.max(b, d.getHeightWidth().height);
  23100. b += 1.5 * this.MARGIN;
  23101. b *= this.workspace_.scale;
  23102. b += Blockly.Scrollbar.scrollbarThickness;
  23103. if (this.height_ != b) {
  23104. for (c = 0; d = a[c]; c++) {
  23105. var e = d.getHeightWidth();
  23106. if (d.flyoutRect_) {
  23107. d.flyoutRect_.setAttribute("width", e.width);
  23108. d.flyoutRect_.setAttribute("height", e.height);
  23109. var f = d.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0
  23110. , g = d.getRelativeToSurfaceXY();
  23111. d.flyoutRect_.setAttribute("y", g.y);
  23112. d.flyoutRect_.setAttribute("x", this.RTL ? g.x - e.width + f : g.x - f);
  23113. (e = d.startHat_ ? Blockly.BlockSvg.START_HAT_HEIGHT : 0) && d.moveBy(0, e);
  23114. d.flyoutRect_.setAttribute("y", g.y)
  23115. }
  23116. }
  23117. this.height_ = b;
  23118. this.targetWorkspace_.resize()
  23119. }
  23120. }
  23121. ;
  23122. Blockly.Flyout.prototype.reflowVertical = function (a) {
  23123. this.workspace_.scale = this.targetWorkspace_.scale;
  23124. for (var b = 0, c = 0, d; d = a[c]; c++) {
  23125. var e = d.getHeightWidth().width;
  23126. d.outputConnection && (e -= Blockly.BlockSvg.TAB_WIDTH);
  23127. b = Math.max(b, e)
  23128. }
  23129. for (c = 0; d = this.buttons_[c]; c++)
  23130. b = Math.max(b, d.width);
  23131. b += 1.5 * this.MARGIN + Blockly.BlockSvg.TAB_WIDTH;
  23132. b *= this.workspace_.scale;
  23133. b += Blockly.Scrollbar.scrollbarThickness;
  23134. if (this.width_ != b) {
  23135. for (c = 0; d = a[c]; c++) {
  23136. e = d.getHeightWidth();
  23137. if (this.RTL) {
  23138. var f = d.getRelativeToSurfaceXY().x
  23139. , g = b / this.workspace_.scale - this.MARGIN;
  23140. g -= Blockly.BlockSvg.TAB_WIDTH;
  23141. d.moveBy(g - f, 0)
  23142. }
  23143. d.flyoutRect_ && (d.flyoutRect_.setAttribute("width", e.width),
  23144. d.flyoutRect_.setAttribute("height", e.height),
  23145. g = d.outputConnection ? Blockly.BlockSvg.TAB_WIDTH : 0,
  23146. f = d.getRelativeToSurfaceXY(),
  23147. d.flyoutRect_.setAttribute("x", this.RTL ? f.x - e.width + g : f.x - g),
  23148. (e = d.startHat_ ? Blockly.BlockSvg.START_HAT_HEIGHT : 0) && d.moveBy(0, e),
  23149. d.flyoutRect_.setAttribute("y", f.y))
  23150. }
  23151. this.width_ = b;
  23152. this.targetWorkspace_.resize()
  23153. }
  23154. }
  23155. ;
  23156. Blockly.Flyout.prototype.reflow = function () {
  23157. this.reflowWrapper_ && this.workspace_.removeChangeListener(this.reflowWrapper_);
  23158. var a = this.workspace_.getTopBlocks(!1);
  23159. this.horizontalLayout_ ? this.reflowHorizontal(a) : this.reflowVertical(a);
  23160. this.reflowWrapper_ && this.workspace_.addChangeListener(this.reflowWrapper_)
  23161. }
  23162. ;
  23163. Blockly.Toolbox = function (a) {
  23164. this.workspace_ = a;
  23165. this.RTL = a.options.RTL;
  23166. this.horizontalLayout_ = a.options.horizontalLayout;
  23167. this.toolboxPosition = a.options.toolboxPosition;
  23168. this.config_ = {
  23169. indentWidth: 19,
  23170. cssRoot: "blocklyTreeRoot",
  23171. cssHideRoot: "blocklyHidden",
  23172. cssItem: "",
  23173. cssTreeRow: "blocklyTreeRow",
  23174. cssItemLabel: "blocklyTreeLabel",
  23175. cssTreeIcon: "blocklyTreeIcon",
  23176. cssExpandedFolderIcon: "blocklyTreeIconOpen",
  23177. cssFileIcon: "blocklyTreeIconNone",
  23178. cssSelectedRow: "blocklyTreeSelected"
  23179. };
  23180. this.treeSeparatorConfig_ = {
  23181. cssTreeRow: "blocklyTreeSeparator"
  23182. };
  23183. this.horizontalLayout_ && (this.config_.cssTreeRow += a.RTL ? " blocklyHorizontalTreeRtl" : " blocklyHorizontalTree",
  23184. this.treeSeparatorConfig_.cssTreeRow = "blocklyTreeSeparatorHorizontal " + (a.RTL ? "blocklyHorizontalTreeRtl" : "blocklyHorizontalTree"),
  23185. this.config_.cssTreeIcon = "")
  23186. }
  23187. ;
  23188. Blockly.Toolbox.prototype.width = 0;
  23189. Blockly.Toolbox.prototype.height = 0;
  23190. Blockly.Toolbox.prototype.selectedOption_ = null;
  23191. Blockly.Toolbox.prototype.lastCategory_ = null;
  23192. Blockly.Toolbox.prototype.init = function () {
  23193. var a = this.workspace_
  23194. , b = this.workspace_.getParentSvg();
  23195. this.HtmlDiv = goog.dom.createDom("DIV", "blocklyToolboxDiv");
  23196. this.HtmlDiv.setAttribute("dir", a.RTL ? "RTL" : "LTR");
  23197. b.parentNode.insertBefore(this.HtmlDiv, b);
  23198. Blockly.bindEventWithChecks_(this.HtmlDiv, "mousedown", this, function (a) {
  23199. Blockly.isRightButton(a) || a.target == this.HtmlDiv ? Blockly.hideChaff(!1) : Blockly.hideChaff(!0);
  23200. Blockly.Touch.clearTouchIdentifier()
  23201. });
  23202. this.flyout_ = new Blockly.Flyout({
  23203. disabledPatternId: a.options.disabledPatternId,
  23204. parentWorkspace: a,
  23205. RTL: a.RTL,
  23206. oneBasedIndex: a.options.oneBasedIndex,
  23207. horizontalLayout: a.horizontalLayout,
  23208. toolboxPosition: a.options.toolboxPosition
  23209. });
  23210. goog.dom.insertSiblingAfter(this.flyout_.createDom(), a.svgGroup_);
  23211. this.flyout_.init(a);
  23212. this.config_.cleardotPath = a.options.pathToMedia + "1x1.gif";
  23213. this.config_.cssCollapsedFolderIcon = "blocklyTreeIconClosed" + (a.RTL ? "Rtl" : "Ltr");
  23214. this.tree_ = b = new Blockly.Toolbox.TreeControl(this, this.config_);
  23215. b.setShowRootNode(!1);
  23216. b.setShowLines(!1);
  23217. b.setShowExpandIcons(!1);
  23218. b.setSelectedItem(null);
  23219. a = this.populate_(a.options.languageTree);
  23220. b.render(this.HtmlDiv);
  23221. a && b.setSelectedItem(a);
  23222. this.addColour_();
  23223. this.position()
  23224. }
  23225. ;
  23226. Blockly.Toolbox.prototype.dispose = function () {
  23227. this.flyout_.dispose();
  23228. this.tree_.dispose();
  23229. goog.dom.removeNode(this.HtmlDiv);
  23230. this.lastCategory_ = this.workspace_ = null
  23231. }
  23232. ;
  23233. Blockly.Toolbox.prototype.getWidth = function () {
  23234. return this.width
  23235. }
  23236. ;
  23237. Blockly.Toolbox.prototype.getHeight = function () {
  23238. return this.height
  23239. }
  23240. ;
  23241. Blockly.Toolbox.prototype.position = function () {
  23242. var a = this.HtmlDiv;
  23243. if (a) {
  23244. var b = this.workspace_.getParentSvg();
  23245. goog.style.getPageOffset(b);
  23246. b = Blockly.svgSize(b);
  23247. this.horizontalLayout_ ? (a.style.left = "0",
  23248. a.style.height = "auto",
  23249. a.style.width = b.width + "px",
  23250. this.height = a.offsetHeight,
  23251. this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ? a.style.top = "0" : a.style.bottom = "0") : (this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT ? a.style.right = "0" : a.style.left = "0",
  23252. a.style.height = b.height + "px",
  23253. this.width = a.offsetWidth);
  23254. this.flyout_.position()
  23255. }
  23256. }
  23257. ;
  23258. Blockly.Toolbox.prototype.populate_ = function (a) {
  23259. this.tree_.removeChildren();
  23260. this.tree_.blocks = [];
  23261. this.hasColours_ = !1;
  23262. a = this.syncTrees_(a, this.tree_, this.workspace_.options.pathToMedia);
  23263. if (this.tree_.blocks.length)
  23264. throw "Toolbox cannot have both blocks and categories in the root level.";
  23265. this.workspace_.resizeContents();
  23266. return a
  23267. }
  23268. ;
  23269. Blockly.Toolbox.prototype.syncTrees_ = function (a, b, c) {
  23270. for (var d = null, e = null, f = 0, g; g = a.childNodes[f]; f++)
  23271. if (g.tagName)
  23272. switch (g.tagName.toUpperCase()) {
  23273. case "CATEGORY":
  23274. e = this.tree_.createNode(g.getAttribute("name"));
  23275. e.blocks = [];
  23276. var h = g.getAttribute("custom");
  23277. h ? e.blocks = h : (h = this.syncTrees_(g, e, c)) && (d = h);
  23278. h = g.getAttribute("colour");
  23279. goog.isString(h) ? (h.match(/^#[0-9a-fA-F]{6}$/) ? e.hexColour = h : e.hexColour = Blockly.hueToRgb(h),
  23280. this.hasColours_ = !0) : e.hexColour = "";
  23281. "true" == g.getAttribute("expanded") ? (e.blocks.length && (d = e),
  23282. e.setExpanded(!0)) : e.setExpanded(!1);
  23283. b.add(e);
  23284. e = g;
  23285. break;
  23286. case "SEP":
  23287. e && ("CATEGORY" == e.tagName.toUpperCase() ? b.add(new Blockly.Toolbox.TreeSeparator(this.treeSeparatorConfig_)) : (g = parseFloat(g.getAttribute("gap")),
  23288. !isNaN(g) && e && e.setAttribute("gap", g)));
  23289. break;
  23290. case "BLOCK":
  23291. case "SHADOW":
  23292. case "LABEL":
  23293. case "BUTTON":
  23294. b.blocks.push(g),
  23295. e = g
  23296. }
  23297. return d
  23298. }
  23299. ;
  23300. Blockly.Toolbox.prototype.addColour_ = function (a) {
  23301. a = (a || this.tree_).getChildren();
  23302. for (var b = 0, c; c = a[b]; b++) {
  23303. var d = c.getRowElement();
  23304. if (d) {
  23305. var e = this.hasColours_ ? "8px solid " + (c.hexColour || "#ddd") : "none";
  23306. this.workspace_.RTL ? d.style.borderRight = e : d.style.borderLeft = e
  23307. }
  23308. this.addColour_(c)
  23309. }
  23310. }
  23311. ;
  23312. Blockly.Toolbox.prototype.clearSelection = function () {
  23313. this.tree_.setSelectedItem(null)
  23314. }
  23315. ;
  23316. Blockly.Toolbox.prototype.getClientRect = function () {
  23317. if (!this.HtmlDiv)
  23318. return null;
  23319. var a = this.HtmlDiv.getBoundingClientRect()
  23320. , b = a.left
  23321. , c = a.top
  23322. , d = a.width;
  23323. a = a.height;
  23324. return this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT ? new goog.math.Rect(-1E7, -1E7, 1E7 + b + d, 2E7) : this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT ? new goog.math.Rect(b, -1E7, 1E7 + d, 2E7) : this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ? new goog.math.Rect(-1E7, -1E7, 2E7, 1E7 + c + a) : new goog.math.Rect(0, c, 2E7, 1E7 + d)
  23325. }
  23326. ;
  23327. Blockly.Toolbox.prototype.refreshSelection = function () {
  23328. var a = this.tree_.getSelectedItem();
  23329. a && a.blocks && this.flyout_.show(a.blocks)
  23330. }
  23331. ;
  23332. Blockly.Toolbox.TreeControl = function (a, b) {
  23333. this.toolbox_ = a;
  23334. goog.ui.tree.TreeControl.call(this, goog.html.SafeHtml.EMPTY, b)
  23335. }
  23336. ;
  23337. goog.inherits(Blockly.Toolbox.TreeControl, goog.ui.tree.TreeControl);
  23338. Blockly.Toolbox.TreeControl.prototype.enterDocument = function () {
  23339. Blockly.Toolbox.TreeControl.superClass_.enterDocument.call(this);
  23340. var a = this.getElement();
  23341. goog.events.BrowserFeature.TOUCH_ENABLED && Blockly.bindEventWithChecks_(a, goog.events.EventType.TOUCHSTART, this, this.handleTouchEvent_)
  23342. }
  23343. ;
  23344. Blockly.Toolbox.TreeControl.prototype.handleTouchEvent_ = function (a) {
  23345. a.preventDefault();
  23346. var b = this.getNodeFromEvent_(a);
  23347. b && a.type === goog.events.EventType.TOUCHSTART && setTimeout(function () {
  23348. b.onMouseDown(a)
  23349. }, 1)
  23350. }
  23351. ;
  23352. Blockly.Toolbox.TreeControl.prototype.createNode = function (a) {
  23353. return new Blockly.Toolbox.TreeNode(this.toolbox_, a ? goog.html.SafeHtml.htmlEscape(a) : goog.html.SafeHtml.EMPTY, this.getConfig(), this.getDomHelper())
  23354. }
  23355. ;
  23356. Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function (a) {
  23357. var b = this.toolbox_;
  23358. if (a != this.selectedItem_ && a != b.tree_) {
  23359. b.lastCategory_ && (b.lastCategory_.children_ == null) && (b.lastCategory_.getRowElement().style.backgroundColor = "");
  23360. if (a) {
  23361. var c = a.hexColour || "#57e";
  23362. a.getRowElement().style.backgroundColor = c;
  23363. b.addColour_(a)
  23364. }
  23365. c = this.getSelectedItem();
  23366. goog.ui.tree.TreeControl.prototype.setSelectedItem.call(this, a);
  23367. a && a.blocks && a.blocks.length ? (b.flyout_.show(a.blocks),
  23368. b.lastCategory_ != a && b.flyout_.scrollToStart()) : b.flyout_.hide();
  23369. c != a && c != this && (c = new Blockly.Events.Ui(null, "category", c && c.getHtml(), a && a.getHtml()),
  23370. c.workspaceId = b.workspace_.id,
  23371. Blockly.Events.fire(c));
  23372. a && (b.lastCategory_ = a)
  23373. }
  23374. }
  23375. ;
  23376. Blockly.Toolbox.TreeNode = function (a, b, c, d) {
  23377. goog.ui.tree.TreeNode.call(this, b, c, d);
  23378. a && (b = function () {
  23379. Blockly.svgResize(a.workspace_)
  23380. }
  23381. ,
  23382. goog.events.listen(a.tree_, goog.ui.tree.BaseNode.EventType.EXPAND, b),
  23383. goog.events.listen(a.tree_, goog.ui.tree.BaseNode.EventType.COLLAPSE, b))
  23384. }
  23385. ;
  23386. goog.inherits(Blockly.Toolbox.TreeNode, goog.ui.tree.TreeNode);
  23387. Blockly.Toolbox.TreeNode.prototype.getExpandIconSafeHtml = function () {
  23388. return goog.html.SafeHtml.create("span")
  23389. }
  23390. ;
  23391. Blockly.Toolbox.TreeNode.prototype.onMouseDown = function (a) {
  23392. this.hasChildren() && this.isUserCollapsible_ ? (this.toggle(),
  23393. this.select()) : this.isSelected() ? this.getTree().setSelectedItem(null) : this.select();
  23394. this.updateRow()
  23395. }
  23396. ;
  23397. Blockly.Toolbox.TreeNode.prototype.onDoubleClick_ = function (a) { }
  23398. ;
  23399. Blockly.Toolbox.TreeNode.prototype.onKeyDown = function (a) {
  23400. if (this.tree.toolbox_.horizontalLayout_) {
  23401. var b = {}
  23402. , c = goog.events.KeyCodes.DOWN
  23403. , d = goog.events.KeyCodes.UP;
  23404. b[goog.events.KeyCodes.RIGHT] = this.rightToLeft_ ? d : c;
  23405. b[goog.events.KeyCodes.LEFT] = this.rightToLeft_ ? c : d;
  23406. b[goog.events.KeyCodes.UP] = goog.events.KeyCodes.LEFT;
  23407. b[goog.events.KeyCodes.DOWN] = goog.events.KeyCodes.RIGHT;
  23408. a.keyCode = b[a.keyCode] || a.keyCode
  23409. }
  23410. return Blockly.Toolbox.TreeNode.superClass_.onKeyDown.call(this, a)
  23411. }
  23412. ;
  23413. Blockly.Toolbox.TreeSeparator = function (a) {
  23414. Blockly.Toolbox.TreeNode.call(this, null, "", a)
  23415. }
  23416. ;
  23417. goog.inherits(Blockly.Toolbox.TreeSeparator, Blockly.Toolbox.TreeNode);
  23418. Blockly.Css = {};
  23419. Blockly.Css.Cursor = {
  23420. OPEN: "handopen",
  23421. CLOSED: "handclosed",
  23422. DELETE: "handdelete"
  23423. };
  23424. Blockly.Css.currentCursor_ = "";
  23425. Blockly.Css.styleSheet_ = null;
  23426. Blockly.Css.mediaPath_ = "";
  23427. Blockly.Css.inject = function (a, b) {
  23428. if (!Blockly.Css.styleSheet_) {
  23429. var c = ".blocklyDraggable {}\n";
  23430. a && (c += Blockly.Css.CONTENT.join("\n"),
  23431. Blockly.FieldDate && (c += Blockly.FieldDate.CSS.join("\n")));
  23432. Blockly.Css.mediaPath_ = b.replace(/[\\\/]$/, "");
  23433. c = c.replace(/<<<PATH>>>/g, Blockly.Css.mediaPath_);
  23434. var d = document.createElement("style");
  23435. document.head.insertBefore(d, document.head.firstChild);
  23436. c = document.createTextNode(c);
  23437. d.appendChild(c);
  23438. Blockly.Css.styleSheet_ = d.sheet;
  23439. Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)
  23440. }
  23441. }
  23442. ;
  23443. Blockly.Css.setCursor = function (a) {
  23444. if (Blockly.Css.currentCursor_ != a) {
  23445. Blockly.Css.currentCursor_ = a;
  23446. var b = "url(" + Blockly.Css.mediaPath_ + "/" + a + ".cur), auto"
  23447. , c = ".blocklyDraggable {\n cursor: " + b + ";\n}\n";
  23448. Blockly.Css.styleSheet_.deleteRule(0);
  23449. Blockly.Css.styleSheet_.insertRule(c, 0);
  23450. c = document.getElementsByClassName("blocklyToolboxDiv");
  23451. for (var d = 0, e; e = c[d]; d++)
  23452. e.style.cursor = a == Blockly.Css.Cursor.DELETE ? b : "";
  23453. document.body.parentNode.style.cursor = a == Blockly.Css.Cursor.OPEN ? "" : b
  23454. }
  23455. }
  23456. ;
  23457. Blockly.Css.CONTENT = [".blocklySvg {", "background-color: #fff;", "outline: none;", "overflow: hidden;", "display: block;", "}", ".blocklyWidgetDiv {", "display: none;", "position: absolute;", "z-index: 99999;", "}", ".injectionDiv {", "height: 100%;", "position: relative;", "}", ".blocklyNonSelectable {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "-ms-user-select: none;", "}", ".blocklyTooltipDiv {", "background-color: #ffffc7;", "border: 1px solid #ddc;", "box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);", "color: #000;", "display: none;", "font-family: sans-serif;", "font-size: 9pt;", "opacity: 0.9;", "padding: 2px;", "position: absolute;", "z-index: 100000;", "}", ".blocklyResizeSE {", "cursor: se-resize;", "fill: #aaa;", "}", ".blocklyResizeSW {", "cursor: sw-resize;", "fill: #aaa;", "}", ".blocklyResizeLine {", "stroke: #888;", "stroke-width: 1;", "}", ".blocklyHighlightedConnectionPath {", "fill: none;", "stroke: #fc3;", "stroke-width: 4px;", "}", ".blocklyPathLight {", "fill: none;", "stroke-linecap: round;", "stroke-width: 1;", "}", ".blocklySelected>.blocklyPath {", "stroke: #fc3;", "stroke-width: 3px;", "}", ".blocklySelected>.blocklyPathLight {", "display: none;", "}", ".blocklyDragging>.blocklyPath,", ".blocklyDragging>.blocklyPathLight {", "fill-opacity: .8;", "stroke-opacity: .8;", "}", ".blocklyDragging>.blocklyPathDark {", "display: none;", "}", ".blocklyDisabled>.blocklyPath {", "fill-opacity: .5;", "stroke-opacity: .5;", "}", ".blocklyDisabled>.blocklyPathLight,", ".blocklyDisabled>.blocklyPathDark {", "display: none;", "}", ".blocklyText {", "cursor: default;", "fill: #fff;", "font-family: sans-serif;", "font-size: 11pt;", "}", ".blocklyNonEditableText>text {", "pointer-events: none;", "}", ".blocklyNonEditableText>rect,", ".blocklyEditableText>rect {", "fill: #fff;", "fill-opacity: .6;", "}", ".blocklyNonEditableText>text,", ".blocklyEditableText>text {", "fill: #000;", "}", ".blocklyEditableText:hover>rect {", "stroke: #fff;", "stroke-width: 2;", "}", ".blocklyBubbleText {", "fill: #000;", "}", ".blocklyFlyoutButton {", "fill: #888;", "cursor: default;", "}", ".blocklyFlyoutButtonShadow {", "fill: #666;", "}", ".blocklyFlyoutButton:hover {", "fill: #aaa;", "}", ".blocklyFlyoutLabel {", "cursor: default;", "}", ".blocklyFlyoutLabelBackground {", "opacity: 0;", "}", ".blocklyFlyoutLabelText {", "fill: #000;", "}", ".blocklyFlyoutLabelText:hover {", "fill: #aaa;", "}", ".blocklySvg text {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "cursor: inherit;", "}", ".blocklyHidden {", "display: none;", "}", ".blocklyFieldDropdown:not(.blocklyHidden) {", "display: block;", "}", ".blocklyIconGroup {", "cursor: default;", "}", ".blocklyIconGroup:not(:hover),", ".blocklyIconGroupReadonly {", "opacity: .6;", "}", ".blocklyIconShape {", "fill: #00f;", "stroke: #fff;", "stroke-width: 1px;", "}", ".blocklyIconSymbol {", "fill: #fff;", "}", ".blocklyMinimalBody {", "margin: 0;", "padding: 0;", "}", ".blocklyCommentTextarea {", "background-color: #ffc;", "border: 0;", "margin: 0;", "padding: 2px;", "resize: none;", "}", ".blocklyHtmlInput {", "border: none;", "border-radius: 4px;", "font-family: sans-serif;", "height: 100%;", "margin: 0;", "outline: none;", "padding: 0 1px;", "width: 100%", "}", ".blocklyMainBackground {", "stroke-width: 1;", "stroke: #c6c6c6;", "}", ".blocklyMutatorBackground {", "fill: #fff;", "stroke: #ddd;", "stroke-width: 1;", "}", ".blocklyFlyoutBackground {", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyScrollbarBackground {", "opacity: 0;", "}", ".blocklyScrollbarHandle {", "fill: #ccc;", "}", ".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyScrollbarHandle:hover {", "fill: #bbb;", "}", ".blocklyZoom>image {", "opacity: .4;", "}", ".blocklyZoom>image:hover {", "opacity: .6;", "}", ".blocklyZoom>image:active {", "opacity: .8;", "}", ".blocklyFlyout .blocklyScrollbarHandle {", "fill: #bbb;", "}", ".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyFlyout .blocklyScrollbarHandle:hover {", "fill: #aaa;", "}", ".blocklyInvalidInput {", "background: #faa;", "}", ".blocklyAngleCircle {", "stroke: #444;", "stroke-width: 1;", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyAngleMarks {", "stroke: #444;", "stroke-width: 1;", "}", ".blocklyAngleGauge {", "fill: #f88;", "fill-opacity: .8;", "}", ".blocklyAngleLine {", "stroke: #f00;", "stroke-width: 2;", "stroke-linecap: round;", "}", ".blocklyContextMenu {", "border-radius: 4px;", "}", ".blocklyDropdownMenu {", "padding: 0 !important;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;", "}", ".blocklyToolboxDiv {", "background-color: #ddd;", "overflow-x: visible;", "overflow-y: auto;", "position: absolute;", "}", ".blocklyTreeRoot {", "padding: 4px 0;", "}", ".blocklyTreeRoot:focus {", "outline: none;", "}", ".blocklyTreeRow {", "height: 22px;", "line-height: 22px;", "margin-bottom: 3px;", "padding-right: 8px;", "white-space: nowrap;", "}", ".blocklyHorizontalTree {", "float: left;", "margin: 1px 5px 8px 0;", "}", ".blocklyHorizontalTreeRtl {", "float: right;", "margin: 1px 0 8px 5px;", "}", '.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {', "margin-left: 8px;", "}", ".blocklyTreeRow:not(.blocklyTreeSelected):hover {", "background-color: #e4e4e4;", "}", ".blocklyTreeSeparator {", "border-bottom: solid #e5e5e5 1px;", "height: 0;", "margin: 5px 0;", "}", ".blocklyTreeSeparatorHorizontal {", "border-right: solid #e5e5e5 1px;", "width: 0;", "padding: 5px 0;", "margin: 0 5px;", "}", ".blocklyTreeIcon {", "background-image: url(<<<PATH>>>/sprites.png);", "height: 16px;", "vertical-align: middle;", "width: 16px;", "}", ".blocklyTreeIconClosedLtr {", "background-position: -32px -1px;", "}", ".blocklyTreeIconClosedRtl {", "background-position: 0px -1px;", "}", ".blocklyTreeIconOpen {", "background-position: -16px -1px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", "background-position: -32px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedRtl {", "background-position: 0px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconOpen {", "background-position: -16px -17px;", "}", ".blocklyTreeIconNone,", ".blocklyTreeSelected>.blocklyTreeIconNone {", "background-position: -48px -1px;", "}", ".blocklyTreeLabel {", "cursor: default;", "font-family: sans-serif;", "font-size: 16px;", "padding: 0 3px;", "vertical-align: middle;", "}", ".blocklyTreeSelected .blocklyTreeLabel {", "color: #fff;", "}", ".blocklyWidgetDiv .goog-palette {", "outline: none;", "cursor: default;", "}", ".blocklyWidgetDiv .goog-palette-table {", "border: 1px solid #666;", "border-collapse: collapse;", "}", ".blocklyWidgetDiv .goog-palette-cell {", "height: 13px;", "width: 15px;", "margin: 0;", "border: 0;", "text-align: center;", "vertical-align: middle;", "border-right: 1px solid #666;", "font-size: 1px;", "}", ".blocklyWidgetDiv .goog-palette-colorswatch {", "position: relative;", "height: 13px;", "width: 15px;", "border: 1px solid #666;", "}", ".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {", "border: 1px solid #FFF;", "}", ".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {", "border: 1px solid #000;", "color: #fff;", "}", ".blocklyWidgetDiv .goog-menu {", "background: #fff;", "border-color: #ccc #666 #666 #ccc;", "border-style: solid;", "border-width: 1px;", "cursor: default;", "font: normal 13px Arial, sans-serif;", "margin: 0;", "outline: none;", "padding: 4px 0;", "position: absolute;", "overflow-y: auto;", "overflow-x: hidden;", "max-height: 100%;", "z-index: 20000;", "}", ".blocklyWidgetDiv .goog-menuitem {", "color: #000;", "font: normal 13px Arial, sans-serif;", "list-style: none;", "margin: 0;", "padding: 4px 7em 4px 28px;", "white-space: nowrap;", "}", ".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {", "padding-left: 7em;", "padding-right: 28px;", "}", ".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,", ".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {", "padding-left: 12px;", "}", ".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {", "padding-right: 20px;", "}", ".blocklyWidgetDiv .goog-menuitem-content {", "color: #000;", "font: normal 13px Arial, sans-serif;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {", "color: #ccc !important;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {", "opacity: 0.3;", "-moz-opacity: 0.3;", "filter: alpha(opacity=30);", "}", ".blocklyWidgetDiv .goog-menuitem-highlight,", ".blocklyWidgetDiv .goog-menuitem-hover {", "background-color: #d6e9f8;", "border-color: #d6e9f8;", "border-style: dotted;", "border-width: 1px 0;", "padding-bottom: 3px;", "padding-top: 3px;", "}", ".blocklyWidgetDiv .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-icon {", "background-repeat: no-repeat;", "height: 16px;", "left: 6px;", "position: absolute;", "right: auto;", "vertical-align: middle;", "width: 16px;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon {", "left: auto;", "right: 6px;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;", "}", ".blocklyWidgetDiv .goog-menuitem-accel {", "color: #999;", "direction: ltr;", "left: auto;", "padding: 0 6px;", "position: absolute;", "right: 0;", "text-align: right;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel {", "left: 0;", "right: auto;", "text-align: left;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {", "text-decoration: underline;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {", "color: #999;", "font-size: 12px;", "padding-left: 4px;", "}", ".blocklyWidgetDiv .goog-menuseparator {", "border-top: 1px solid #ccc;", "margin: 4px 0;", "padding: 0;", "}", ""];
  23458. Blockly.Css.CONTENT = [".blocklySvg {", "background-color: #fff;", "outline: none;", "overflow: hidden;", "display: block;", "}", ".blocklyWidgetDiv {", "display: none;", "position: absolute;", "z-index: 99999;", "}", ".injectionDiv {", "height: 100%;", "position: relative;", "}", ".blocklyNonSelectable {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "-ms-user-select: none;", "}", ".blocklyTooltipDiv {", "background-color: #ffffc7;", "border: 1px solid #ddc;", "box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);",
  23459. "color: #000;", "display: none;", "font-family: sans-serif;", "font-size: 9pt;", "opacity: 0.9;", "padding: 2px;", "position: absolute;", "z-index: 100000;", "}", ".blocklyResizeSE {", "cursor: se-resize;", "fill: #aaa;", "}", ".blocklyResizeSW {", "cursor: sw-resize;", "fill: #aaa;", "}", ".blocklyResizeLine {", "stroke: #888;", "stroke-width: 1;", "}", ".blocklyHighlightedConnectionPath {", "fill: none;", "stroke: #fc3;", "stroke-width: 4px;", "}", ".blocklyPathLight {", "fill: none;", "stroke-linecap: round;", "stroke-width: 1;",
  23460. "}", ".blocklySelected>.blocklyPath {", "stroke: #fc3;", "stroke-width: 3px;", "}", ".blocklySelected>.blocklyPathLight {", "display: none;", "}", ".blocklyDragging>.blocklyPath,", ".blocklyDragging>.blocklyPathLight {", "fill-opacity: .8;", "stroke-opacity: .8;", "}", ".blocklyDragging>.blocklyPathDark {", "display: none;", "}", ".blocklyDisabled>.blocklyPath {", "fill-opacity: .5;", "stroke-opacity: .5;", "}", ".blocklyDisabled>.blocklyPathLight,", ".blocklyDisabled>.blocklyPathDark {", "display: none;", "}", ".blocklyText {",
  23461. "cursor: default;", "fill: #fff;", "font-family: sans-serif;", "font-size: 11pt;", "}", ".blocklyTextCode {", " font-family: monospace;", "}", ".blocklyNonEditableText>text {", "pointer-events: none;", "}", ".blocklyNonEditableText>rect,", ".blocklyEditableText>rect {", "fill: #fff;", "fill-opacity: .6;", "}", ".blocklyNonEditableText>text,", ".blocklyEditableText>text {", "fill: #000;", "}", ".blocklyEditableText:hover>rect {", "stroke: #fff;", "stroke-width: 2;", "}", ".blocklyBubbleText {", "fill: #000;", "}", ".blocklyFlyoutButton {",
  23462. "fill: #888;", "cursor: default;", "}", ".blocklyFlyoutButtonShadow {", "fill: #666;", "}", ".blocklyFlyoutButton:hover {", "fill: #aaa;", "}", ".blocklyFlyoutLabel {", "cursor: default;", "}", ".blocklyFlyoutLabelBackground {", "opacity: 0;", "}", ".blocklyFlyoutLabelText {", "fill: #000;", "}", ".blocklyFlyoutLabelText:hover {", "fill: #aaa;", "}", ".blocklySvg text {", "user-select: none;", "-moz-user-select: none;", "-webkit-user-select: none;", "cursor: inherit;", "}", ".blocklyHidden {", "display: none;", "}", ".blocklyFieldDropdown:not(.blocklyHidden) {",
  23463. "display: block;", "}", ".blocklyIconGroup {", "cursor: default;", "}", ".blocklyIconGroup:not(:hover),", ".blocklyIconGroupReadonly {", "opacity: .6;", "}", ".blocklyIconShape {", "fill: #00f;", "stroke: #fff;", "stroke-width: 1px;", "}", ".blocklyIconSymbol {", "fill: #fff;", "}", ".blocklyMinimalBody {", "margin: 0;", "padding: 0;", "}", ".blocklyCommentTextarea {", "background-color: #ffc;", "border: 0;", "margin: 0;", "padding: 2px;", "resize: none;", "}", ".blocklyHtmlInput {", "border: none;", "border-radius: 4px;", "font-family: sans-serif;",
  23464. "height: 100%;", "margin: 0;", "outline: none;", "padding: 0 1px;", "width: 100%", "}", ".blocklyMainBackground {", "stroke-width: 1;", "stroke: #c6c6c6;", "}", ".blocklyMutatorBackground {", "fill: #fff;", "stroke: #ddd;", "stroke-width: 1;", "}", ".blocklyFlyoutBackground {", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyScrollbarBackground {", "opacity: 0;", "}", ".blocklyScrollbarHandle {", "fill: #ccc;", "}", ".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyScrollbarHandle:hover {", "fill: #bbb;",
  23465. "}", ".blocklyZoom>image {", "opacity: .4;", "}", ".blocklyZoom>image:hover {", "opacity: .6;", "}", ".blocklyZoom>image:active {", "opacity: .8;", "}", ".blocklyFlyout .blocklyScrollbarHandle {", "fill: #bbb;", "}", ".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyFlyout .blocklyScrollbarHandle:hover {", "fill: #aaa;", "}", ".blocklyInvalidInput {", "background: #faa;", "}", ".blocklyAngleCircle {", "stroke: #444;", "stroke-width: 1;", "fill: #ddd;", "fill-opacity: .8;", "}", ".blocklyAngleMarks {",
  23466. "stroke: #444;", "stroke-width: 1;", "}", ".blocklyAngleGauge {", "fill: #f88;", "fill-opacity: .8;", "}", ".blocklyAngleLine {", "stroke: #f00;", "stroke-width: 2;", "stroke-linecap: round;", "}", ".blocklyContextMenu {", "border-radius: 4px;", "}", ".blocklyDropdownMenu {", "padding: 0 !important;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;", "}",
  23467. ".blocklyToolboxDiv {", "background-color: #ddd;", "overflow-x: visible;", "overflow-y: auto;", "position: absolute;", "}", ".blocklyTreeRoot {", "padding: 4px 0;", "}", ".blocklyTreeRoot:focus {", "outline: none;", "}", ".blocklyTreeRow {", "height: 22px;", "line-height: 22px;", "margin-bottom: 3px;", "padding-right: 8px;", "white-space: nowrap;", "}", ".blocklyHorizontalTree {", "float: left;", "margin: 1px 5px 8px 0;", "}", ".blocklyHorizontalTreeRtl {", "float: right;", "margin: 1px 0 8px 5px;", "}", '.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',
  23468. "margin-left: 8px;", "}", ".blocklyTreeRow:not(.blocklyTreeSelected):hover {", "background-color: #e4e4e4;", "}", ".blocklyTreeSeparator {", "border-bottom: solid #e5e5e5 1px;", "height: 0;", "margin: 5px 0;", "}", ".blocklyTreeSeparatorHorizontal {", "border-right: solid #e5e5e5 1px;", "width: 0;", "padding: 5px 0;", "margin: 0 5px;", "}", ".blocklyTreeIcon {", "background-image: url(<<<PATH>>>/sprites.png);", "height: 16px;", "vertical-align: middle;", "width: 16px;", "}", ".blocklyTreeIconClosedLtr {", "background-position: -32px -1px;",
  23469. "}", ".blocklyTreeIconClosedRtl {", "background-position: 0px -1px;", "}", ".blocklyTreeIconOpen {", "background-position: -16px -1px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", "background-position: -32px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconClosedRtl {", "background-position: 0px -17px;", "}", ".blocklyTreeSelected>.blocklyTreeIconOpen {", "background-position: -16px -17px;", "}", ".blocklyTreeIconNone,", ".blocklyTreeSelected>.blocklyTreeIconNone {", "background-position: -48px -1px;",
  23470. "}", ".blocklyTreeLabel {", "cursor: default;", "font-family: sans-serif;", "font-size: 16px;", "padding: 0 3px;", "vertical-align: middle;", "}", ".blocklyTreeSelected .blocklyTreeLabel {", "color: #fff;", "}", ".blocklyWidgetDiv .goog-palette {", "outline: none;", "cursor: default;", "}", ".blocklyWidgetDiv .goog-palette-table {", "border: 1px solid #666;", "border-collapse: collapse;", "}", ".blocklyWidgetDiv .goog-palette-cell {", "height: 13px;", "width: 15px;", "margin: 0;", "border: 0;", "text-align: center;", "vertical-align: middle;",
  23471. "border-right: 1px solid #666;", "font-size: 1px;", "}", ".blocklyWidgetDiv .goog-palette-colorswatch {", "position: relative;", "height: 13px;", "width: 15px;", "border: 1px solid #666;", "}", ".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {", "border: 1px solid #FFF;", "}", ".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {", "border: 1px solid #000;", "color: #fff;", "}", ".blocklyWidgetDiv .goog-menu {", "background: #fff;", "border-color: #ccc #666 #666 #ccc;", "border-style: solid;",
  23472. "border-width: 1px;", "cursor: default;", "font: normal 13px Arial, sans-serif;", "margin: 0;", "outline: none;", "padding: 4px 0;", "position: absolute;", "overflow-y: auto;", "overflow-x: hidden;", "max-height: 100%;", "z-index: 20000;", "}", ".blocklyWidgetDiv .goog-menuitem {", "color: #000;", "font: normal 13px Arial, sans-serif;", "list-style: none;", "margin: 0;", "padding: 4px 7em 4px 28px;", "white-space: nowrap;", "}", ".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {", "padding-left: 7em;", "padding-right: 28px;",
  23473. "}", ".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,", ".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {", "padding-left: 12px;", "}", ".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {", "padding-right: 20px;", "}", ".blocklyWidgetDiv .goog-menuitem-content {", "color: #000;", "font: normal 13px Arial, sans-serif;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {", "color: #ccc !important;", "}", ".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {",
  23474. "opacity: 0.3;", "-moz-opacity: 0.3;", "filter: alpha(opacity=30);", "}", ".blocklyWidgetDiv .goog-menuitem-highlight,", ".blocklyWidgetDiv .goog-menuitem-hover {", "background-color: #d6e9f8;", "border-color: #d6e9f8;", "border-style: dotted;", "border-width: 1px 0;", "padding-bottom: 3px;", "padding-top: 3px;", "}", ".blocklyWidgetDiv .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-icon {", "background-repeat: no-repeat;", "height: 16px;", "left: 6px;", "position: absolute;", "right: auto;", "vertical-align: middle;",
  23475. "width: 16px;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon {", "left: auto;", "right: 6px;", "}", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,", ".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {", "background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;", "}", ".blocklyWidgetDiv .goog-menuitem-accel {", "color: #999;", "direction: ltr;", "left: auto;", "padding: 0 6px;",
  23476. "position: absolute;", "right: 0;", "text-align: right;", "}", ".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel {", "left: 0;", "right: auto;", "text-align: left;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {", "text-decoration: underline;", "}", ".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {", "color: #999;", "font-size: 12px;", "padding-left: 4px;", "}", ".blocklyWidgetDiv .goog-menuseparator {", "border-top: 1px solid #ccc;", "margin: 4px 0;", "padding: 0;", "}", ""];
  23477. Blockly.WidgetDiv = {};
  23478. Blockly.WidgetDiv.DIV = null;
  23479. Blockly.WidgetDiv.owner_ = null;
  23480. Blockly.WidgetDiv.dispose_ = null;
  23481. Blockly.WidgetDiv.createDom = function () {
  23482. Blockly.WidgetDiv.DIV || (Blockly.WidgetDiv.DIV = goog.dom.createDom("DIV", "blocklyWidgetDiv"),
  23483. document.body.appendChild(Blockly.WidgetDiv.DIV))
  23484. }
  23485. ;
  23486. Blockly.WidgetDiv.show = function (a, b, c) {
  23487. Blockly.WidgetDiv.hide();
  23488. Blockly.WidgetDiv.owner_ = a;
  23489. Blockly.WidgetDiv.dispose_ = c;
  23490. a = goog.style.getViewportPageOffset(document);
  23491. Blockly.WidgetDiv.DIV.style.top = a.y + "px";
  23492. Blockly.WidgetDiv.DIV.style.direction = b ? "rtl" : "ltr";
  23493. Blockly.WidgetDiv.DIV.style.display = "block"
  23494. }
  23495. ;
  23496. Blockly.WidgetDiv.hide = function () {
  23497. Blockly.WidgetDiv.owner_ && (Blockly.WidgetDiv.owner_ = null,
  23498. Blockly.WidgetDiv.DIV.style.display = "none",
  23499. Blockly.WidgetDiv.DIV.style.left = "",
  23500. Blockly.WidgetDiv.DIV.style.top = "",
  23501. Blockly.WidgetDiv.dispose_ && Blockly.WidgetDiv.dispose_(),
  23502. Blockly.WidgetDiv.dispose_ = null,
  23503. goog.dom.removeChildren(Blockly.WidgetDiv.DIV))
  23504. }
  23505. ;
  23506. Blockly.WidgetDiv.isVisible = function () {
  23507. return !!Blockly.WidgetDiv.owner_
  23508. }
  23509. ;
  23510. Blockly.WidgetDiv.hideIfOwner = function (a) {
  23511. Blockly.WidgetDiv.owner_ == a && Blockly.WidgetDiv.hide()
  23512. }
  23513. ;
  23514. Blockly.WidgetDiv.position = function (a, b, c, d, e) {
  23515. b < d.y && (b = d.y);
  23516. e ? a > c.width + d.x && (a = c.width + d.x) : a < d.x && (a = d.x);
  23517. Blockly.WidgetDiv.DIV.style.left = a + "px";
  23518. Blockly.WidgetDiv.DIV.style.top = b + "px";
  23519. Blockly.WidgetDiv.DIV.style.height = c.height + "px"
  23520. }
  23521. ;
  23522. Blockly.inject = function (a, b) {
  23523. goog.isString(a) && (a = document.getElementById(a) || document.querySelector(a));
  23524. if (!goog.dom.contains(document, a))
  23525. throw "Error: container is not in current document.";
  23526. var c = new Blockly.Options(b || {})
  23527. , d = goog.dom.createDom("div", "injectionDiv");
  23528. a.appendChild(d);
  23529. d = Blockly.createDom_(d, c);
  23530. c = Blockly.createMainWorkspace_(d, c);
  23531. Blockly.init_(c);
  23532. c.markFocused();
  23533. Blockly.bindEventWithChecks_(d, "focus", c, c.markFocused);
  23534. Blockly.svgResize(c);
  23535. return c
  23536. }
  23537. ;
  23538. Blockly.createDom_ = function (a, b) {
  23539. a.setAttribute("dir", "LTR");
  23540. goog.ui.Component.setDefaultRightToLeft(b.RTL);
  23541. Blockly.Css.inject(b.hasCss, b.pathToMedia);
  23542. var c = Blockly.createSvgElement("svg", {
  23543. xmlns: "http://www.w3.org/2000/svg",
  23544. "xmlns:html": "http://www.w3.org/1999/xhtml",
  23545. "xmlns:xlink": "http://www.w3.org/1999/xlink",
  23546. version: "1.1",
  23547. "class": "blocklySvg"
  23548. }, a)
  23549. , d = Blockly.createSvgElement("defs", {}, c)
  23550. , e = String(Math.random()).substring(2)
  23551. , f = Blockly.createSvgElement("filter", {
  23552. id: "blocklyEmbossFilter" + e
  23553. }, d);
  23554. Blockly.createSvgElement("feGaussianBlur", {
  23555. "in": "SourceAlpha",
  23556. stdDeviation: 1,
  23557. result: "blur"
  23558. }, f);
  23559. var g = Blockly.createSvgElement("feSpecularLighting", {
  23560. "in": "blur",
  23561. surfaceScale: 1,
  23562. specularConstant: .5,
  23563. specularExponent: 10,
  23564. "lighting-color": "white",
  23565. result: "specOut"
  23566. }, f);
  23567. Blockly.createSvgElement("fePointLight", {
  23568. x: -5E3,
  23569. y: -1E4,
  23570. z: 2E4
  23571. }, g);
  23572. Blockly.createSvgElement("feComposite", {
  23573. "in": "specOut",
  23574. in2: "SourceAlpha",
  23575. operator: "in",
  23576. result: "specOut"
  23577. }, f);
  23578. Blockly.createSvgElement("feComposite", {
  23579. "in": "SourceGraphic",
  23580. in2: "specOut",
  23581. operator: "arithmetic",
  23582. k1: 0,
  23583. k2: 1,
  23584. k3: 1,
  23585. k4: 0
  23586. }, f);
  23587. b.embossFilterId = f.id;
  23588. f = Blockly.createSvgElement("pattern", {
  23589. id: "blocklyDisabledPattern" + e,
  23590. patternUnits: "userSpaceOnUse",
  23591. width: 10,
  23592. height: 10
  23593. }, d);
  23594. Blockly.createSvgElement("rect", {
  23595. width: 10,
  23596. height: 10,
  23597. fill: "#aaa"
  23598. }, f);
  23599. Blockly.createSvgElement("path", {
  23600. d: "M 0 0 L 10 10 M 10 0 L 0 10",
  23601. stroke: "#cc0"
  23602. }, f);
  23603. b.disabledPatternId = f.id;
  23604. d = Blockly.createSvgElement("pattern", {
  23605. id: "blocklyGridPattern" + e,
  23606. patternUnits: "userSpaceOnUse"
  23607. }, d);
  23608. 0 < b.gridOptions.length && 0 < b.gridOptions.spacing && (Blockly.createSvgElement("line", {
  23609. stroke: b.gridOptions.colour
  23610. }, d),
  23611. 1 < b.gridOptions.length && Blockly.createSvgElement("line", {
  23612. stroke: b.gridOptions.colour
  23613. }, d));
  23614. b.gridPattern = d;
  23615. return c
  23616. }
  23617. ;
  23618. Blockly.createMainWorkspace_ = function (a, b) {
  23619. b.parentWorkspace = null;
  23620. var c = new Blockly.WorkspaceSvg(b);
  23621. c.scale = b.zoomOptions.startScale;
  23622. a.appendChild(c.createDom("blocklyMainBackground"));
  23623. c.translate(0, 0);
  23624. c.markFocused();
  23625. b.readOnly || b.hasScrollbars || c.addChangeListener(function () {
  23626. if (Blockly.dragMode_ == Blockly.DRAG_NONE) {
  23627. var a = c.getMetrics()
  23628. , e = a.viewLeft + a.absoluteLeft
  23629. , f = a.viewTop + a.absoluteTop;
  23630. if (a.contentTop < f || a.contentTop + a.contentHeight > a.viewHeight + f || a.contentLeft < (b.RTL ? a.viewLeft : e) || a.contentLeft + a.contentWidth > (b.RTL ? a.viewWidth : a.viewWidth + e))
  23631. for (var g = c.getTopBlocks(!1), h = 0, k; k = g[h]; h++) {
  23632. var m = k.getRelativeToSurfaceXY()
  23633. , p = k.getHeightWidth()
  23634. , l = f + 25 - p.height - m.y;
  23635. 0 < l && k.moveBy(0, l);
  23636. l = f + a.viewHeight - 25 - m.y;
  23637. 0 > l && k.moveBy(0, l);
  23638. l = 25 + e - m.x - (b.RTL ? 0 : p.width);
  23639. 0 < l && k.moveBy(l, 0);
  23640. m = e + a.viewWidth - 25 - m.x + (b.RTL ? p.width : 0);
  23641. 0 > m && k.moveBy(m, 0)
  23642. }
  23643. }
  23644. });
  23645. Blockly.svgResize(c);
  23646. Blockly.WidgetDiv.createDom();
  23647. Blockly.Tooltip.createDom();
  23648. return c
  23649. }
  23650. ;
  23651. Blockly.init_ = function (a) {
  23652. var b = a.options
  23653. , c = a.getParentSvg();
  23654. Blockly.bindEventWithChecks_(c, "contextmenu", null, function (a) {
  23655. Blockly.isTargetInput_(a) || a.preventDefault()
  23656. });
  23657. c = Blockly.bindEventWithChecks_(window, "resize", null, function () {
  23658. Blockly.hideChaff(!0);
  23659. Blockly.svgResize(a)
  23660. });
  23661. a.setResizeHandlerWrapper(c);
  23662. Blockly.inject.bindDocumentEvents_();
  23663. b.languageTree && (a.toolbox_ ? a.toolbox_.init(a) : a.flyout_ && (a.flyout_.init(a),
  23664. a.flyout_.show(b.languageTree.childNodes),
  23665. a.flyout_.scrollToStart(),
  23666. a.scrollX = a.flyout_.width_,
  23667. b.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT && (a.scrollX *= -1),
  23668. a.translate(a.scrollX, 0)));
  23669. b.hasScrollbars && (a.scrollbar = new Blockly.ScrollbarPair(a),
  23670. a.scrollbar.resize());
  23671. b.hasSounds && Blockly.inject.loadSounds_(b.pathToMedia, a)
  23672. }
  23673. ;
  23674. Blockly.inject.bindDocumentEvents_ = function () {
  23675. Blockly.documentEventsBound_ || (Blockly.bindEventWithChecks_(document, "keydown", null, Blockly.onKeyDown_),
  23676. Blockly.bindEventWithChecks_(document, "touchend", null, Blockly.longStop_),
  23677. Blockly.bindEventWithChecks_(document, "touchcancel", null, Blockly.longStop_),
  23678. document.addEventListener("mouseup", Blockly.onMouseUp_, !1),
  23679. goog.userAgent.IPAD && Blockly.bindEventWithChecks_(window, "orientationchange", document, function () {
  23680. Blockly.svgResize(Blockly.getMainWorkspace())
  23681. }));
  23682. Blockly.documentEventsBound_ = !0
  23683. }
  23684. ;
  23685. Blockly.inject.loadSounds_ = function (a, b) {
  23686. b.loadAudio_([a + "click.mp3", a + "click.wav", a + "click.ogg"], "click");
  23687. b.loadAudio_([a + "disconnect.wav", a + "disconnect.mp3", a + "disconnect.ogg"], "disconnect");
  23688. b.loadAudio_([a + "delete.mp3", a + "delete.ogg", a + "delete.wav"], "delete");
  23689. var c = []
  23690. , d = function () {
  23691. for (; c.length;)
  23692. Blockly.unbindEvent_(c.pop());
  23693. b.preloadAudio_()
  23694. };
  23695. c.push(Blockly.bindEventWithChecks_(document, "mousemove", null, d, !0));
  23696. c.push(Blockly.bindEventWithChecks_(document, "touchstart", null, d, !0))
  23697. }
  23698. ;
  23699. Blockly.updateToolbox = function (a) {
  23700. console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");
  23701. Blockly.getMainWorkspace().updateToolbox(a)
  23702. }
  23703. ;
  23704. Blockly.utils = {};
  23705. Blockly.addClass_ = function (a, b) {
  23706. var c = a.getAttribute("class") || "";
  23707. -1 == (" " + c + " ").indexOf(" " + b + " ") && (c && (c += " "),
  23708. a.setAttribute("class", c + b))
  23709. }
  23710. ;
  23711. Blockly.removeClass_ = function (a, b) {
  23712. var c = a.getAttribute("class");
  23713. if (-1 != (" " + c + " ").indexOf(" " + b + " ")) {
  23714. c = c.split(/\s+/);
  23715. for (var d = 0; d < c.length; d++)
  23716. c[d] && c[d] != b || (c.splice(d, 1),
  23717. d--);
  23718. c.length ? a.setAttribute("class", c.join(" ")) : a.removeAttribute("class")
  23719. }
  23720. }
  23721. ;
  23722. Blockly.hasClass_ = function (a, b) {
  23723. return -1 != (" " + a.getAttribute("class") + " ").indexOf(" " + b + " ")
  23724. }
  23725. ;
  23726. Blockly.bindEventWithChecks_ = function (a, b, c, d, e) {
  23727. var f = !1
  23728. , g = function (a) {
  23729. var b = !e;
  23730. a = Blockly.Touch.splitEventByTouches(a);
  23731. for (var g = 0, h; h = a[g]; g++)
  23732. if (!b || Blockly.Touch.shouldHandleEvent(h))
  23733. Blockly.Touch.setClientFromTouch(h),
  23734. c ? d.call(c, h) : d(h),
  23735. f = !0
  23736. };
  23737. a.addEventListener(b, g, !1);
  23738. var h = [[a, b, g]];
  23739. if (b in Blockly.Touch.TOUCH_MAP)
  23740. for (var k = function (a) {
  23741. g(a);
  23742. f && a.preventDefault()
  23743. }, m = 0, p; p = Blockly.Touch.TOUCH_MAP[b][m]; m++)
  23744. a.addEventListener(p, k, !1),
  23745. h.push([a, p, k]);
  23746. return h
  23747. }
  23748. ;
  23749. Blockly.bindEvent_ = function (a, b, c, d) {
  23750. var e = function (a) {
  23751. c ? d.call(c, a) : d(a)
  23752. };
  23753. a.addEventListener(b, e, !1);
  23754. var f = [[a, b, e]];
  23755. if (b in Blockly.Touch.TOUCH_MAP)
  23756. for (var g = function (a) {
  23757. if (1 == a.changedTouches.length) {
  23758. var b = a.changedTouches[0];
  23759. a.clientX = b.clientX;
  23760. a.clientY = b.clientY
  23761. }
  23762. e(a);
  23763. a.preventDefault()
  23764. }, h = 0, k; k = Blockly.Touch.TOUCH_MAP[b][h]; h++)
  23765. a.addEventListener(k, g, !1),
  23766. f.push([a, k, g]);
  23767. return f
  23768. }
  23769. ;
  23770. Blockly.unbindEvent_ = function (a) {
  23771. for (; a.length;) {
  23772. var b = a.pop()
  23773. , c = b[2];
  23774. b[0].removeEventListener(b[1], c, !1)
  23775. }
  23776. return c
  23777. }
  23778. ;
  23779. Blockly.noEvent = function (a) {
  23780. a.preventDefault();
  23781. a.stopPropagation()
  23782. }
  23783. ;
  23784. Blockly.isTargetInput_ = function (a) {
  23785. return "textarea" == a.target.type || "text" == a.target.type || "number" == a.target.type || "email" == a.target.type || "password" == a.target.type || "search" == a.target.type || "tel" == a.target.type || "url" == a.target.type || a.target.isContentEditable
  23786. }
  23787. ;
  23788. Blockly.getRelativeXY_ = function (a) {
  23789. var b = new goog.math.Coordinate(0, 0)
  23790. , c = a.getAttribute("x");
  23791. c && (b.x = parseInt(c, 10));
  23792. if (c = a.getAttribute("y"))
  23793. b.y = parseInt(c, 10);
  23794. if (a = (a = a.getAttribute("transform")) && a.match(Blockly.getRelativeXY_.XY_REGEXP_))
  23795. b.x += parseFloat(a[1]),
  23796. a[3] && (b.y += parseFloat(a[3]));
  23797. return b
  23798. }
  23799. ;
  23800. Blockly.getRelativeXY_.XY_REGEXP_ = /translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*\))?/;
  23801. Blockly.getSvgXY_ = function (a, b) {
  23802. var c = 0
  23803. , d = 0
  23804. , e = 1;
  23805. if (goog.dom.contains(b.getCanvas(), a) || goog.dom.contains(b.getBubbleCanvas(), a))
  23806. e = b.scale;
  23807. do {
  23808. var f = Blockly.getRelativeXY_(a);
  23809. if (a == b.getCanvas() || a == b.getBubbleCanvas())
  23810. e = 1;
  23811. c += f.x * e;
  23812. d += f.y * e;
  23813. a = a.parentNode
  23814. } while (a && a != b.getParentSvg()); return new goog.math.Coordinate(c, d)
  23815. }
  23816. ;
  23817. Blockly.createSvgElement = function (a, b, c, d) {
  23818. a = document.createElementNS(Blockly.SVG_NS, a);
  23819. for (var e in b)
  23820. a.setAttribute(e, b[e]);
  23821. document.body.runtimeStyle && (a.runtimeStyle = a.currentStyle = a.style);
  23822. c && c.appendChild(a);
  23823. return a
  23824. }
  23825. ;
  23826. Blockly.isRightButton = function (a) {
  23827. return a.ctrlKey && goog.userAgent.MAC ? !0 : 2 == a.button
  23828. }
  23829. ;
  23830. Blockly.mouseToSvg = function (a, b, c) {
  23831. var d = b.createSVGPoint();
  23832. d.x = a.clientX;
  23833. d.y = a.clientY;
  23834. c || (c = b.getScreenCTM().inverse());
  23835. return d.matrixTransform(c)
  23836. }
  23837. ;
  23838. Blockly.shortestStringLength = function (a) {
  23839. if (!a.length)
  23840. return 0;
  23841. for (var b = a[0].length, c = 1; c < a.length; c++)
  23842. b = Math.min(b, a[c].length);
  23843. return b
  23844. }
  23845. ;
  23846. Blockly.commonWordPrefix = function (a, b) {
  23847. if (!a.length)
  23848. return 0;
  23849. if (1 == a.length)
  23850. return a[0].length;
  23851. for (var c = 0, d = b || Blockly.shortestStringLength(a), e = 0; e < d; e++) {
  23852. for (var f = a[0][e], g = 1; g < a.length; g++)
  23853. if (f != a[g][e])
  23854. return c;
  23855. " " == f && (c = e + 1)
  23856. }
  23857. for (g = 1; g < a.length; g++)
  23858. if ((f = a[g][e]) && " " != f)
  23859. return c;
  23860. return d
  23861. }
  23862. ;
  23863. Blockly.commonWordSuffix = function (a, b) {
  23864. if (!a.length)
  23865. return 0;
  23866. if (1 == a.length)
  23867. return a[0].length;
  23868. for (var c = 0, d = b || Blockly.shortestStringLength(a), e = 0; e < d; e++) {
  23869. for (var f = a[0].substr(-e - 1, 1), g = 1; g < a.length; g++)
  23870. if (f != a[g].substr(-e - 1, 1))
  23871. return c;
  23872. " " == f && (c = e + 1)
  23873. }
  23874. for (g = 1; g < a.length; g++)
  23875. if ((f = a[g].charAt(a[g].length - e - 1)) && " " != f)
  23876. return c;
  23877. return d
  23878. }
  23879. ;
  23880. Blockly.isNumber = function (a) {
  23881. return !!a.match(/^\s*-?\d+(\.\d+)?\s*$/)
  23882. }
  23883. ;
  23884. Blockly.utils.tokenizeInterpolation = function (a) {
  23885. var b = [];
  23886. a = a.split("");
  23887. a.push("");
  23888. for (var c = 0, d = [], e = null, f = 0; f < a.length; f++) {
  23889. var g = a[f];
  23890. 0 == c ? "%" == g ? c = 1 : d.push(g) : 1 == c ? "%" == g ? (d.push(g),
  23891. c = 0) : "0" <= g && "9" >= g ? (c = 2,
  23892. e = g,
  23893. (g = d.join("")) && b.push(g),
  23894. d.length = 0) : (d.push("%", g),
  23895. c = 0) : 2 == c && ("0" <= g && "9" >= g ? e += g : (b.push(parseInt(e, 10)),
  23896. f-- ,
  23897. c = 0))
  23898. }
  23899. (g = d.join("")) && b.push(g);
  23900. return b
  23901. }
  23902. ;
  23903. Blockly.genUid = function () {
  23904. for (var a = Blockly.genUid.soup_.length, b = [], c = 0; 20 > c; c++)
  23905. b[c] = Blockly.genUid.soup_.charAt(Math.random() * a);
  23906. return b.join("")
  23907. }
  23908. ;
  23909. Blockly.genUid.soup_ = "!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  23910. Blockly.utils.wrap = function (a, b) {
  23911. for (var c = a.split("\n"), d = 0; d < c.length; d++)
  23912. c[d] = Blockly.utils.wrap_line_(c[d], b);
  23913. return c.join("\n")
  23914. }
  23915. ;
  23916. Blockly.utils.wrap_line_ = function (a, b) {
  23917. if (a.length <= b)
  23918. return a;
  23919. for (var c = a.trim().split(/\s+/), d = 0; d < c.length; d++)
  23920. c[d].length > b && (b = c[d].length);
  23921. d = -Infinity;
  23922. var e = 1;
  23923. do {
  23924. var f = d;
  23925. var g = a;
  23926. var h = []
  23927. , k = c.length / e
  23928. , m = 1;
  23929. for (d = 0; d < c.length - 1; d++)
  23930. m < (d + 1.5) / k ? (m++ ,
  23931. h[d] = !0) : h[d] = !1;
  23932. h = Blockly.utils.wrapMutate_(c, h, b);
  23933. d = Blockly.utils.wrapScore_(c, h, b);
  23934. a = Blockly.utils.wrapToText_(c, h);
  23935. e++
  23936. } while (d > f); return g
  23937. }
  23938. ;
  23939. Blockly.utils.wrapScore_ = function (a, b, c) {
  23940. for (var d = [0], e = [], f = 0; f < a.length; f++)
  23941. d[d.length - 1] += a[f].length,
  23942. !0 === b[f] ? (d.push(0),
  23943. e.push(a[f].charAt(a[f].length - 1))) : !1 === b[f] && d[d.length - 1]++;
  23944. a = Math.max.apply(Math, d);
  23945. for (f = b = 0; f < d.length; f++)
  23946. b -= 2 * Math.pow(Math.abs(c - d[f]), 1.5),
  23947. b -= Math.pow(a - d[f], 1.5),
  23948. -1 != ".?!".indexOf(e[f]) ? b += c / 3 : -1 != ",;)]}".indexOf(e[f]) && (b += c / 4);
  23949. 1 < d.length && d[d.length - 1] <= d[d.length - 2] && (b += .5);
  23950. return b
  23951. }
  23952. ;
  23953. Blockly.utils.wrapMutate_ = function (a, b, c) {
  23954. for (var d = Blockly.utils.wrapScore_(a, b, c), e, f = 0; f < b.length - 1; f++)
  23955. if (b[f] != b[f + 1]) {
  23956. var g = [].concat(b);
  23957. g[f] = !g[f];
  23958. g[f + 1] = !g[f + 1];
  23959. var h = Blockly.utils.wrapScore_(a, g, c);
  23960. h > d && (d = h,
  23961. e = g)
  23962. }
  23963. return e ? Blockly.utils.wrapMutate_(a, e, c) : b
  23964. }
  23965. ;
  23966. Blockly.utils.wrapToText_ = function (a, b) {
  23967. for (var c = [], d = 0; d < a.length; d++)
  23968. c.push(a[d]),
  23969. void 0 !== b[d] && c.push(b[d] ? "\n" : " ");
  23970. return c.join("")
  23971. }
  23972. ;
  23973. var CLOSURE_DEFINES = {
  23974. "goog.DEBUG": !1
  23975. };
  23976. Blockly.mainWorkspace = null;
  23977. Blockly.selected = null;
  23978. Blockly.highlightedConnection_ = null;
  23979. Blockly.localConnection_ = null;
  23980. Blockly.draggingConnections_ = [];
  23981. Blockly.clipboardXml_ = null;
  23982. Blockly.clipboardSource_ = null;
  23983. Blockly.dragMode_ = Blockly.DRAG_NONE;
  23984. Blockly.flyoutButtonCallbacks_ = {};
  23985. Blockly.registerButtonCallback = function (a, b) {
  23986. Blockly.flyoutButtonCallbacks_[a] = b
  23987. }
  23988. ;
  23989. Blockly.hueToRgb = function (a) {
  23990. return goog.color.hsvToHex(a, Blockly.HSV_SATURATION, 255 * Blockly.HSV_VALUE)
  23991. }
  23992. ;
  23993. Blockly.svgSize = function (a) {
  23994. return {
  23995. width: a.cachedWidth_,
  23996. height: a.cachedHeight_
  23997. }
  23998. }
  23999. ;
  24000. Blockly.resizeSvgContents = function (a) {
  24001. a.resizeContents()
  24002. }
  24003. ;
  24004. Blockly.svgResize = function (a) {
  24005. for (; a.options.parentWorkspace;)
  24006. a = a.options.parentWorkspace;
  24007. var b = a.getParentSvg()
  24008. , c = b.parentNode;
  24009. if (c) {
  24010. var d = c.offsetWidth;
  24011. c = c.offsetHeight;
  24012. b.cachedWidth_ != d && (b.setAttribute("width", d + "px"),
  24013. b.cachedWidth_ = d);
  24014. b.cachedHeight_ != c && (b.setAttribute("height", c + "px"),
  24015. b.cachedHeight_ = c);
  24016. a.resize()
  24017. }
  24018. }
  24019. ;
  24020. Blockly.onKeyDown_ = function (a) {
  24021. if (!Blockly.mainWorkspace.options.readOnly && !Blockly.isTargetInput_(a)) {
  24022. var b = !1;
  24023. if (27 == a.keyCode)
  24024. Blockly.hideChaff();
  24025. else if (8 == a.keyCode || 46 == a.keyCode)
  24026. a.preventDefault(),
  24027. Blockly.selected && Blockly.selected.isDeletable() && (b = !0);
  24028. else if (a.altKey || a.ctrlKey || a.metaKey)
  24029. Blockly.selected && Blockly.selected.isDeletable() && Blockly.selected.isMovable() && (67 == a.keyCode ? (Blockly.hideChaff(),
  24030. Blockly.copy_(Blockly.selected)) : 88 == a.keyCode && (Blockly.copy_(Blockly.selected),
  24031. b = !0)),
  24032. 86 == a.keyCode ? Blockly.clipboardXml_ && (Blockly.Events.setGroup(!0),
  24033. Blockly.clipboardSource_.paste(Blockly.clipboardXml_),
  24034. Blockly.Events.setGroup(!1)) : 90 == a.keyCode && (Blockly.hideChaff(),
  24035. Blockly.mainWorkspace.undo(a.shiftKey));
  24036. b && (Blockly.Events.setGroup(!0),
  24037. Blockly.hideChaff(),
  24038. Blockly.selected.dispose(Blockly.dragMode_ != Blockly.DRAG_FREE, !0),
  24039. Blockly.highlightedConnection_ && (Blockly.highlightedConnection_.unhighlight(),
  24040. Blockly.highlightedConnection_ = null),
  24041. Blockly.Events.setGroup(!1))
  24042. }
  24043. }
  24044. ;
  24045. Blockly.terminateDrag_ = function () {
  24046. Blockly.BlockSvg.terminateDrag();
  24047. Blockly.Flyout.terminateDrag_()
  24048. }
  24049. ;
  24050. Blockly.copy_ = function (a) {
  24051. var b = Blockly.Xml.blockToDom(a);
  24052. Blockly.dragMode_ != Blockly.DRAG_FREE && Blockly.Xml.deleteNext(b);
  24053. var c = a.getRelativeToSurfaceXY();
  24054. b.setAttribute("x", a.RTL ? -c.x : c.x);
  24055. b.setAttribute("y", c.y);
  24056. Blockly.clipboardXml_ = b;
  24057. Blockly.clipboardSource_ = a.workspace
  24058. }
  24059. ;
  24060. Blockly.duplicate_ = function (a) {
  24061. var b = Blockly.clipboardXml_
  24062. , c = Blockly.clipboardSource_;
  24063. Blockly.copy_(a);
  24064. a.workspace.paste(Blockly.clipboardXml_);
  24065. Blockly.clipboardXml_ = b;
  24066. Blockly.clipboardSource_ = c
  24067. }
  24068. ;
  24069. Blockly.onContextMenu_ = function (a) {
  24070. Blockly.isTargetInput_(a) || a.preventDefault()
  24071. }
  24072. ;
  24073. Blockly.hideChaff = function (a) {
  24074. Blockly.Tooltip.hide();
  24075. Blockly.WidgetDiv.hide();
  24076. a || (a = Blockly.getMainWorkspace(),
  24077. a.toolbox_ && a.toolbox_.flyout_ && a.toolbox_.flyout_.autoClose && a.toolbox_.clearSelection())
  24078. }
  24079. ;
  24080. Blockly.addChangeListener = function (a) {
  24081. console.warn("Deprecated call to Blockly.addChangeListener, use workspace.addChangeListener instead.");
  24082. return Blockly.getMainWorkspace().addChangeListener(a)
  24083. }
  24084. ;
  24085. Blockly.getMainWorkspace = function () {
  24086. return Blockly.mainWorkspace
  24087. }
  24088. ;
  24089. Blockly.alert = function (a, b) {
  24090. window.alert(a);
  24091. b && b()
  24092. }
  24093. ;
  24094. Blockly.confirm = function (a, b) {
  24095. b(window.confirm(a))
  24096. }
  24097. ;
  24098. Blockly.prompt = function (a, b, c) {
  24099. c(window.prompt(a, b))
  24100. }
  24101. ;
  24102. Blockly.jsonInitFactory_ = function (a) {
  24103. return function () {
  24104. this.jsonInit(a)
  24105. }
  24106. }
  24107. ;
  24108. Blockly.defineBlocksWithJsonArray = function (a) {
  24109. for (var b = 0, c; c = a[b]; b++)
  24110. Blockly.Blocks[c.type] = {
  24111. init: Blockly.jsonInitFactory_(c)
  24112. }
  24113. }
  24114. ;
  24115. goog.global.console || (goog.global.console = {
  24116. log: function () { },
  24117. warn: function () { }
  24118. });
  24119. goog.global.Blockly || (goog.global.Blockly = {});
  24120. goog.global.Blockly.getMainWorkspace = Blockly.getMainWorkspace;
  24121. goog.global.Blockly.addChangeListener = Blockly.addChangeListener;