mdc.textfield.js 363 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
  7. */
  8. (function webpackUniversalModuleDefinition(root, factory) {
  9. if(typeof exports === 'object' && typeof module === 'object')
  10. module.exports = factory();
  11. else if(typeof define === 'function' && define.amd)
  12. define("@material/textfield", [], factory);
  13. else if(typeof exports === 'object')
  14. exports["textfield"] = factory();
  15. else
  16. root["mdc"] = root["mdc"] || {}, root["mdc"]["textfield"] = factory();
  17. })(this, function() {
  18. return /******/ (function(modules) { // webpackBootstrap
  19. /******/ // The module cache
  20. /******/ var installedModules = {};
  21. /******/
  22. /******/ // The require function
  23. /******/ function __webpack_require__(moduleId) {
  24. /******/
  25. /******/ // Check if module is in cache
  26. /******/ if(installedModules[moduleId]) {
  27. /******/ return installedModules[moduleId].exports;
  28. /******/ }
  29. /******/ // Create a new module (and put it into the cache)
  30. /******/ var module = installedModules[moduleId] = {
  31. /******/ i: moduleId,
  32. /******/ l: false,
  33. /******/ exports: {}
  34. /******/ };
  35. /******/
  36. /******/ // Execute the module function
  37. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  38. /******/
  39. /******/ // Flag the module as loaded
  40. /******/ module.l = true;
  41. /******/
  42. /******/ // Return the exports of the module
  43. /******/ return module.exports;
  44. /******/ }
  45. /******/
  46. /******/
  47. /******/ // expose the modules object (__webpack_modules__)
  48. /******/ __webpack_require__.m = modules;
  49. /******/
  50. /******/ // expose the module cache
  51. /******/ __webpack_require__.c = installedModules;
  52. /******/
  53. /******/ // define getter function for harmony exports
  54. /******/ __webpack_require__.d = function(exports, name, getter) {
  55. /******/ if(!__webpack_require__.o(exports, name)) {
  56. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  57. /******/ }
  58. /******/ };
  59. /******/
  60. /******/ // define __esModule on exports
  61. /******/ __webpack_require__.r = function(exports) {
  62. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  63. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  64. /******/ }
  65. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  66. /******/ };
  67. /******/
  68. /******/ // create a fake namespace object
  69. /******/ // mode & 1: value is a module id, require it
  70. /******/ // mode & 2: merge all properties of value into the ns
  71. /******/ // mode & 4: return value when already ns object
  72. /******/ // mode & 8|1: behave like require
  73. /******/ __webpack_require__.t = function(value, mode) {
  74. /******/ if(mode & 1) value = __webpack_require__(value);
  75. /******/ if(mode & 8) return value;
  76. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  77. /******/ var ns = Object.create(null);
  78. /******/ __webpack_require__.r(ns);
  79. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  80. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  81. /******/ return ns;
  82. /******/ };
  83. /******/
  84. /******/ // getDefaultExport function for compatibility with non-harmony modules
  85. /******/ __webpack_require__.n = function(module) {
  86. /******/ var getter = module && module.__esModule ?
  87. /******/ function getDefault() { return module['default']; } :
  88. /******/ function getModuleExports() { return module; };
  89. /******/ __webpack_require__.d(getter, 'a', getter);
  90. /******/ return getter;
  91. /******/ };
  92. /******/
  93. /******/ // Object.prototype.hasOwnProperty.call
  94. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  95. /******/
  96. /******/ // __webpack_public_path__
  97. /******/ __webpack_require__.p = "";
  98. /******/
  99. /******/
  100. /******/ // Load entry module and return exports
  101. /******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-textfield/index.ts");
  102. /******/ })
  103. /************************************************************************/
  104. /******/ ({
  105. /***/ "./node_modules/process/browser.js":
  106. /*!*****************************************!*\
  107. !*** ./node_modules/process/browser.js ***!
  108. \*****************************************/
  109. /*! no static exports found */
  110. /***/ (function(module, exports) {
  111. // shim for using process in browser
  112. var process = module.exports = {};
  113. // cached from whatever global is present so that test runners that stub it
  114. // don't break things. But we need to wrap it in a try catch in case it is
  115. // wrapped in strict mode code which doesn't define any globals. It's inside a
  116. // function because try/catches deoptimize in certain engines.
  117. var cachedSetTimeout;
  118. var cachedClearTimeout;
  119. function defaultSetTimout() {
  120. throw new Error('setTimeout has not been defined');
  121. }
  122. function defaultClearTimeout () {
  123. throw new Error('clearTimeout has not been defined');
  124. }
  125. (function () {
  126. try {
  127. if (typeof setTimeout === 'function') {
  128. cachedSetTimeout = setTimeout;
  129. } else {
  130. cachedSetTimeout = defaultSetTimout;
  131. }
  132. } catch (e) {
  133. cachedSetTimeout = defaultSetTimout;
  134. }
  135. try {
  136. if (typeof clearTimeout === 'function') {
  137. cachedClearTimeout = clearTimeout;
  138. } else {
  139. cachedClearTimeout = defaultClearTimeout;
  140. }
  141. } catch (e) {
  142. cachedClearTimeout = defaultClearTimeout;
  143. }
  144. } ())
  145. function runTimeout(fun) {
  146. if (cachedSetTimeout === setTimeout) {
  147. //normal enviroments in sane situations
  148. return setTimeout(fun, 0);
  149. }
  150. // if setTimeout wasn't available but was latter defined
  151. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  152. cachedSetTimeout = setTimeout;
  153. return setTimeout(fun, 0);
  154. }
  155. try {
  156. // when when somebody has screwed with setTimeout but no I.E. maddness
  157. return cachedSetTimeout(fun, 0);
  158. } catch(e){
  159. try {
  160. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  161. return cachedSetTimeout.call(null, fun, 0);
  162. } catch(e){
  163. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  164. return cachedSetTimeout.call(this, fun, 0);
  165. }
  166. }
  167. }
  168. function runClearTimeout(marker) {
  169. if (cachedClearTimeout === clearTimeout) {
  170. //normal enviroments in sane situations
  171. return clearTimeout(marker);
  172. }
  173. // if clearTimeout wasn't available but was latter defined
  174. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  175. cachedClearTimeout = clearTimeout;
  176. return clearTimeout(marker);
  177. }
  178. try {
  179. // when when somebody has screwed with setTimeout but no I.E. maddness
  180. return cachedClearTimeout(marker);
  181. } catch (e){
  182. try {
  183. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  184. return cachedClearTimeout.call(null, marker);
  185. } catch (e){
  186. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  187. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  188. return cachedClearTimeout.call(this, marker);
  189. }
  190. }
  191. }
  192. var queue = [];
  193. var draining = false;
  194. var currentQueue;
  195. var queueIndex = -1;
  196. function cleanUpNextTick() {
  197. if (!draining || !currentQueue) {
  198. return;
  199. }
  200. draining = false;
  201. if (currentQueue.length) {
  202. queue = currentQueue.concat(queue);
  203. } else {
  204. queueIndex = -1;
  205. }
  206. if (queue.length) {
  207. drainQueue();
  208. }
  209. }
  210. function drainQueue() {
  211. if (draining) {
  212. return;
  213. }
  214. var timeout = runTimeout(cleanUpNextTick);
  215. draining = true;
  216. var len = queue.length;
  217. while(len) {
  218. currentQueue = queue;
  219. queue = [];
  220. while (++queueIndex < len) {
  221. if (currentQueue) {
  222. currentQueue[queueIndex].run();
  223. }
  224. }
  225. queueIndex = -1;
  226. len = queue.length;
  227. }
  228. currentQueue = null;
  229. draining = false;
  230. runClearTimeout(timeout);
  231. }
  232. process.nextTick = function (fun) {
  233. var args = new Array(arguments.length - 1);
  234. if (arguments.length > 1) {
  235. for (var i = 1; i < arguments.length; i++) {
  236. args[i - 1] = arguments[i];
  237. }
  238. }
  239. queue.push(new Item(fun, args));
  240. if (queue.length === 1 && !draining) {
  241. runTimeout(drainQueue);
  242. }
  243. };
  244. // v8 likes predictible objects
  245. function Item(fun, array) {
  246. this.fun = fun;
  247. this.array = array;
  248. }
  249. Item.prototype.run = function () {
  250. this.fun.apply(null, this.array);
  251. };
  252. process.title = 'browser';
  253. process.browser = true;
  254. process.env = {};
  255. process.argv = [];
  256. process.version = ''; // empty string to avoid regexp issues
  257. process.versions = {};
  258. function noop() {}
  259. process.on = noop;
  260. process.addListener = noop;
  261. process.once = noop;
  262. process.off = noop;
  263. process.removeListener = noop;
  264. process.removeAllListeners = noop;
  265. process.emit = noop;
  266. process.prependListener = noop;
  267. process.prependOnceListener = noop;
  268. process.listeners = function (name) { return [] }
  269. process.binding = function (name) {
  270. throw new Error('process.binding is not supported');
  271. };
  272. process.cwd = function () { return '/' };
  273. process.chdir = function (dir) {
  274. throw new Error('process.chdir is not supported');
  275. };
  276. process.umask = function() { return 0; };
  277. /***/ }),
  278. /***/ "./node_modules/safevalues/builders/attribute_builders.js":
  279. /*!****************************************************************!*\
  280. !*** ./node_modules/safevalues/builders/attribute_builders.js ***!
  281. \****************************************************************/
  282. /*! no static exports found */
  283. /***/ (function(module, exports, __webpack_require__) {
  284. "use strict";
  285. /**
  286. * @license
  287. * SPDX-License-Identifier: Apache-2.0
  288. */
  289. Object.defineProperty(exports, "__esModule", { value: true });
  290. exports.safeAttrPrefix = void 0;
  291. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  292. var attribute_impl_1 = __webpack_require__(/*! ../internals/attribute_impl */ "./node_modules/safevalues/internals/attribute_impl.js");
  293. var string_literal_1 = __webpack_require__(/*! ../internals/string_literal */ "./node_modules/safevalues/internals/string_literal.js");
  294. var sensitive_attributes_1 = __webpack_require__(/*! ./sensitive_attributes */ "./node_modules/safevalues/builders/sensitive_attributes.js");
  295. /**
  296. * Creates a SafeAttributePrefix object from a template literal with no
  297. * interpolations for attributes that share a common prefix guaranteed to be not
  298. * security sensitive.
  299. *
  300. * The template literal is a prefix that makes it obvious this attribute is not
  301. * security sensitive. If it doesn't, this function will throw.
  302. */
  303. function safeAttrPrefix(templ) {
  304. if (true) {
  305. (0, string_literal_1.assertIsTemplateObject)(templ, true, 'safeAttr is a template literal tag function ' +
  306. 'and should be called using the tagged template syntax. ' +
  307. 'For example, safeAttr`foo`;');
  308. }
  309. var attrPrefix = templ[0].toLowerCase();
  310. if (true) {
  311. if (attrPrefix.indexOf('on') === 0 || 'on'.indexOf(attrPrefix) === 0) {
  312. throw new Error("Prefix '".concat(templ[0], "' does not guarantee the attribute ") +
  313. "to be safe as it is also a prefix for event handler attributes" +
  314. "Please use 'addEventListener' to set event handlers.");
  315. }
  316. sensitive_attributes_1.SECURITY_SENSITIVE_ATTRIBUTES.forEach(function (sensitiveAttr) {
  317. if (sensitiveAttr.indexOf(attrPrefix) === 0) {
  318. throw new Error("Prefix '".concat(templ[0], "' does not guarantee the attribute ") +
  319. "to be safe as it is also a prefix for " +
  320. "the security sensitive attribute '".concat(sensitiveAttr, "'. ") +
  321. "Please use native or safe DOM APIs to set the attribute.");
  322. }
  323. });
  324. }
  325. return (0, attribute_impl_1.createAttributePrefix)(attrPrefix);
  326. }
  327. exports.safeAttrPrefix = safeAttrPrefix;
  328. /***/ }),
  329. /***/ "./node_modules/safevalues/builders/html_builders.js":
  330. /*!***********************************************************!*\
  331. !*** ./node_modules/safevalues/builders/html_builders.js ***!
  332. \***********************************************************/
  333. /*! no static exports found */
  334. /***/ (function(module, exports, __webpack_require__) {
  335. "use strict";
  336. /**
  337. * @license
  338. * SPDX-License-Identifier: Apache-2.0
  339. */
  340. Object.defineProperty(exports, "__esModule", { value: true });
  341. exports.concatHtmls = exports.createScriptSrc = exports.createScript = exports.htmlEscape = void 0;
  342. var html_impl_1 = __webpack_require__(/*! ../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  343. var resource_url_impl_1 = __webpack_require__(/*! ../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  344. var script_impl_1 = __webpack_require__(/*! ../internals/script_impl */ "./node_modules/safevalues/internals/script_impl.js");
  345. /**
  346. * Returns HTML-escaped text as a `SafeHtml` object.
  347. *
  348. * Available options:
  349. * - `preserveSpaces` turns every second consecutive space character into its
  350. * HTML entity representation (`&#160;`).
  351. * - `preserveNewlines` turns newline characters into breaks (`<br>`).
  352. * - `preserveTabs` wraps tab characters in a span with style=white-space:pre.
  353. */
  354. function htmlEscape(text, options) {
  355. if (options === void 0) { options = {}; }
  356. var htmlEscapedString = htmlEscapeToString(text);
  357. if (options.preserveSpaces) {
  358. // Do this first to ensure we preserve spaces after newlines and tabs.
  359. htmlEscapedString =
  360. htmlEscapedString.replace(/(^|[\r\n\t ]) /g, '$1&#160;');
  361. }
  362. if (options.preserveNewlines) {
  363. htmlEscapedString = htmlEscapedString.replace(/(\r\n|\n|\r)/g, '<br>');
  364. }
  365. if (options.preserveTabs) {
  366. htmlEscapedString = htmlEscapedString.replace(/(\t+)/g, '<span style="white-space:pre">$1</span>');
  367. }
  368. return (0, html_impl_1.createHtml)(htmlEscapedString);
  369. }
  370. exports.htmlEscape = htmlEscape;
  371. /**
  372. * Creates a `SafeHtml` representing a script tag with inline script content.
  373. */
  374. function createScript(script, options) {
  375. if (options === void 0) { options = {}; }
  376. var unwrappedScript = (0, script_impl_1.unwrapScript)(script).toString();
  377. var stringTag = "<script";
  378. if (options.id) {
  379. stringTag += " id=\"".concat(htmlEscapeToString(options.id), "\"");
  380. }
  381. if (options.nonce) {
  382. stringTag += " nonce=\"".concat(htmlEscapeToString(options.nonce), "\"");
  383. }
  384. if (options.type) {
  385. stringTag += " type=\"".concat(htmlEscapeToString(options.type), "\"");
  386. }
  387. stringTag += ">".concat(unwrappedScript, "</script>");
  388. return (0, html_impl_1.createHtml)(stringTag);
  389. }
  390. exports.createScript = createScript;
  391. /**
  392. * Creates a `SafeHtml` representing a script tag with the src attribute.
  393. * This also supports CSP nonces and async loading.
  394. */
  395. function createScriptSrc(src, async, nonce) {
  396. var unwrappedSrc = (0, resource_url_impl_1.unwrapResourceUrl)(src).toString();
  397. var stringTag = "<script src=\"".concat(htmlEscapeToString(unwrappedSrc), "\"");
  398. if (async) {
  399. stringTag += ' async';
  400. }
  401. if (nonce) {
  402. stringTag += " nonce=\"".concat(htmlEscapeToString(nonce), "\"");
  403. }
  404. stringTag += '>\x3c/script>';
  405. return (0, html_impl_1.createHtml)(stringTag);
  406. }
  407. exports.createScriptSrc = createScriptSrc;
  408. /**
  409. * HTML-escapes the given text (`&`, `<`, `>`, `"` and `'`).
  410. */
  411. function htmlEscapeToString(text) {
  412. var escaped = text.replace(/&/g, '&amp;')
  413. .replace(/</g, '&lt;')
  414. .replace(/>/g, '&gt;')
  415. .replace(/"/g, '&quot;')
  416. .replace(/'/g, '&apos;');
  417. return escaped;
  418. }
  419. /** Creates a `SafeHtml` value by concatenating multiple `SafeHtml`s. */
  420. function concatHtmls(htmls) {
  421. return (0, html_impl_1.createHtml)(htmls.map(html_impl_1.unwrapHtml).join(''));
  422. }
  423. exports.concatHtmls = concatHtmls;
  424. /***/ }),
  425. /***/ "./node_modules/safevalues/builders/html_sanitizer/html_sanitizer.js":
  426. /*!***************************************************************************!*\
  427. !*** ./node_modules/safevalues/builders/html_sanitizer/html_sanitizer.js ***!
  428. \***************************************************************************/
  429. /*! no static exports found */
  430. /***/ (function(module, exports, __webpack_require__) {
  431. "use strict";
  432. /**
  433. * @license
  434. * SPDX-License-Identifier: Apache-2.0
  435. */
  436. var __values = (this && this.__values) || function(o) {
  437. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  438. if (m) return m.call(o);
  439. if (o && typeof o.length === "number") return {
  440. next: function () {
  441. if (o && i >= o.length) o = void 0;
  442. return { value: o && o[i++], done: !o };
  443. }
  444. };
  445. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  446. };
  447. var __read = (this && this.__read) || function (o, n) {
  448. var m = typeof Symbol === "function" && o[Symbol.iterator];
  449. if (!m) return o;
  450. var i = m.call(o), r, ar = [], e;
  451. try {
  452. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  453. }
  454. catch (error) { e = { error: error }; }
  455. finally {
  456. try {
  457. if (r && !r.done && (m = i["return"])) m.call(i);
  458. }
  459. finally { if (e) throw e.error; }
  460. }
  461. return ar;
  462. };
  463. Object.defineProperty(exports, "__esModule", { value: true });
  464. exports.sanitizeHtmlToFragment = exports.sanitizeHtmlAssertUnchanged = exports.sanitizeHtml = exports.HtmlSanitizerImpl = void 0;
  465. __webpack_require__(/*! ../../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  466. var html_impl_1 = __webpack_require__(/*! ../../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  467. /* g3_import_pure from '../../internals/pure' */
  468. var secrets_1 = __webpack_require__(/*! ../../internals/secrets */ "./node_modules/safevalues/internals/secrets.js");
  469. var url_sanitizer_1 = __webpack_require__(/*! ../url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  470. var inert_fragment_1 = __webpack_require__(/*! ./inert_fragment */ "./node_modules/safevalues/builders/html_sanitizer/inert_fragment.js");
  471. var no_clobber_1 = __webpack_require__(/*! ./no_clobber */ "./node_modules/safevalues/builders/html_sanitizer/no_clobber.js");
  472. var default_sanitizer_table_1 = __webpack_require__(/*! ./sanitizer_table/default_sanitizer_table */ "./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/default_sanitizer_table.js");
  473. var sanitizer_table_1 = __webpack_require__(/*! ./sanitizer_table/sanitizer_table */ "./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/sanitizer_table.js");
  474. /** Implementation for `HtmlSanitizer` */
  475. var HtmlSanitizerImpl = /** @class */ (function () {
  476. function HtmlSanitizerImpl(sanitizerTable, token) {
  477. this.sanitizerTable = sanitizerTable;
  478. this.changes = [];
  479. (0, secrets_1.ensureTokenIsValid)(token);
  480. }
  481. HtmlSanitizerImpl.prototype.sanitizeAssertUnchanged = function (html) {
  482. this.changes = [];
  483. var sanitizedHtml = this.sanitize(html);
  484. if (this.changes.length !== 0) {
  485. var message = '';
  486. if (true) {
  487. message =
  488. "Unexpected change to HTML value as a result of sanitization. " +
  489. "Input: \"".concat(html, "\", sanitized output: \"").concat(sanitizedHtml, "\"\n") +
  490. "List of changes:".concat(this.changes.join('\n'));
  491. }
  492. throw new Error(message);
  493. }
  494. return sanitizedHtml;
  495. };
  496. HtmlSanitizerImpl.prototype.sanitize = function (html) {
  497. var fakeRoot = document.createElement('span');
  498. fakeRoot.appendChild(this.sanitizeToFragment(html));
  499. // XML serialization is preferred over HTML serialization as it is
  500. // stricter and makes sure all attributes are properly escaped, avoiding
  501. // cases where the tree might mutate when parsed again later due to the
  502. // complexities of the HTML parsing algorithm
  503. var serializedNewTree = new XMLSerializer().serializeToString(fakeRoot);
  504. // We remove the outer most element as this is the span node created as
  505. // the root for the sanitized tree and contains a spurious xmlns attribute
  506. // from the XML serialization step.
  507. serializedNewTree = serializedNewTree.slice(serializedNewTree.indexOf('>') + 1, serializedNewTree.lastIndexOf('</'));
  508. return (0, html_impl_1.createHtml)(serializedNewTree);
  509. };
  510. HtmlSanitizerImpl.prototype.sanitizeToFragment = function (html) {
  511. var _this = this;
  512. var dirtyFragment = (0, inert_fragment_1.createInertFragment)(html);
  513. var treeWalker = document.createTreeWalker(dirtyFragment, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,
  514. // IE10 and IE11 won't accept a proper `NodeFilter` interface, and
  515. // expect the filtering function to be passed directly. It seems that
  516. // other browsers also do not mind getting the function directly. see
  517. // https://stackoverflow.com/q/38245898
  518. (function (n) { return _this.nodeFilter(n); }),
  519. // @ts-ignore: error TS2554: Expected 1-3 arguments, but got 4.
  520. false);
  521. // `nextNode` is called so we skip the root `DocumentFragment`.
  522. var currentNode = treeWalker.nextNode();
  523. // We create a root element to attach all the children of the body to. We
  524. // use div as it as a semantic-free, generic container and does not
  525. // represent anything. This is removed when we serialize the tree back
  526. // into a string.
  527. var sanitizedFragment = document.createDocumentFragment();
  528. var sanitizedParent = sanitizedFragment;
  529. while (currentNode !== null) {
  530. var sanitizedNode = void 0;
  531. if ((0, no_clobber_1.isText)(currentNode)) {
  532. sanitizedNode = this.sanitizeTextNode(currentNode);
  533. }
  534. else if ((0, no_clobber_1.isElement)(currentNode)) {
  535. sanitizedNode = this.sanitizeElementNode(currentNode);
  536. }
  537. else {
  538. throw new Error('Node is not of type text or element');
  539. }
  540. sanitizedParent.appendChild(sanitizedNode);
  541. // Advance iterator while keeping track of the sanitized parent for the
  542. // current node
  543. currentNode = treeWalker.firstChild();
  544. if (currentNode) {
  545. sanitizedParent = sanitizedNode;
  546. }
  547. else {
  548. while (!(currentNode = treeWalker.nextSibling())) {
  549. if (!(currentNode = treeWalker.parentNode())) {
  550. break;
  551. }
  552. sanitizedParent = sanitizedParent.parentNode;
  553. }
  554. }
  555. }
  556. return sanitizedFragment;
  557. };
  558. HtmlSanitizerImpl.prototype.sanitizeTextNode = function (textNode) {
  559. return document.createTextNode(textNode.data);
  560. };
  561. HtmlSanitizerImpl.prototype.sanitizeElementNode = function (elementNode) {
  562. var e_1, _a;
  563. var elementName = (0, no_clobber_1.getNodeName)(elementNode);
  564. var newNode = document.createElement(elementName);
  565. var dirtyAttributes = elementNode.attributes;
  566. try {
  567. for (var dirtyAttributes_1 = __values(dirtyAttributes), dirtyAttributes_1_1 = dirtyAttributes_1.next(); !dirtyAttributes_1_1.done; dirtyAttributes_1_1 = dirtyAttributes_1.next()) {
  568. var _b = dirtyAttributes_1_1.value, name_1 = _b.name, value = _b.value;
  569. var policy = this.sanitizerTable.getAttributePolicy(name_1, elementName);
  570. if (!this.satisfiesAllConditions(policy.conditions, dirtyAttributes)) {
  571. this.recordChange("Not all conditions satisfied for attribute: ".concat(name_1, "."));
  572. continue;
  573. }
  574. switch (policy.policyAction) {
  575. case sanitizer_table_1.AttributePolicyAction.KEEP:
  576. newNode.setAttribute(name_1, value);
  577. break;
  578. case sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL:
  579. var sanitizedAttrUrl = (0, url_sanitizer_1.restrictivelySanitizeUrl)(value);
  580. if (sanitizedAttrUrl !== value) {
  581. this.recordChange("Url in attribute ".concat(name_1, " was modified during sanitization. Original url:\"").concat(value, "\" was sanitized to: \"").concat(sanitizedAttrUrl, "\""));
  582. }
  583. newNode.setAttribute(name_1, sanitizedAttrUrl);
  584. break;
  585. case sanitizer_table_1.AttributePolicyAction.KEEP_AND_NORMALIZE:
  586. // We don't consider changing the case of an attribute value to be a
  587. // semantic change
  588. newNode.setAttribute(name_1, value.toLowerCase());
  589. break;
  590. case sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_STYLE:
  591. newNode.setAttribute(name_1, value);
  592. break;
  593. case sanitizer_table_1.AttributePolicyAction.DROP:
  594. this.recordChange("Attribute: ".concat(name_1, " was dropped"));
  595. break;
  596. default:
  597. checkExhaustive(policy.policyAction, 'Unhandled AttributePolicyAction case');
  598. }
  599. }
  600. }
  601. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  602. finally {
  603. try {
  604. if (dirtyAttributes_1_1 && !dirtyAttributes_1_1.done && (_a = dirtyAttributes_1.return)) _a.call(dirtyAttributes_1);
  605. }
  606. finally { if (e_1) throw e_1.error; }
  607. }
  608. return newNode;
  609. };
  610. HtmlSanitizerImpl.prototype.nodeFilter = function (node) {
  611. if ((0, no_clobber_1.isText)(node)) {
  612. return NodeFilter.FILTER_ACCEPT;
  613. }
  614. else if (!(0, no_clobber_1.isElement)(node)) {
  615. // Getting a node that is neither an `Element` or a `Text` node. This is
  616. // likely due to something that is not supposed to be an element in user
  617. // code but recognized as such by the TreeWalker (e.g. a polyfill for
  618. // other kind of nodes). Since we can't recognize it as an element, we
  619. // drop the node, but we don't record it as a meaningful change.
  620. return NodeFilter.FILTER_REJECT;
  621. }
  622. var nodeName = (0, no_clobber_1.getNodeName)(node);
  623. if (nodeName === null) {
  624. this.recordChange("Node name was null for node: ".concat(node));
  625. return NodeFilter.FILTER_REJECT;
  626. }
  627. if (this.sanitizerTable.isAllowedElement(nodeName)) {
  628. return NodeFilter.FILTER_ACCEPT;
  629. }
  630. this.recordChange("Element: ".concat(nodeName, " was dropped"));
  631. return NodeFilter.FILTER_REJECT;
  632. };
  633. HtmlSanitizerImpl.prototype.recordChange = function (errorMessage) {
  634. if (true) {
  635. this.changes.push(errorMessage);
  636. }
  637. else {}
  638. };
  639. HtmlSanitizerImpl.prototype.satisfiesAllConditions = function (conditions, attrs) {
  640. var e_2, _a;
  641. var _b;
  642. if (!conditions) {
  643. return true;
  644. }
  645. try {
  646. for (var conditions_1 = __values(conditions), conditions_1_1 = conditions_1.next(); !conditions_1_1.done; conditions_1_1 = conditions_1.next()) {
  647. var _c = __read(conditions_1_1.value, 2), attrName = _c[0], expectedValues = _c[1];
  648. var value = (_b = attrs.getNamedItem(attrName)) === null || _b === void 0 ? void 0 : _b.value;
  649. if (value && !expectedValues.has(value)) {
  650. return false;
  651. }
  652. }
  653. }
  654. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  655. finally {
  656. try {
  657. if (conditions_1_1 && !conditions_1_1.done && (_a = conditions_1.return)) _a.call(conditions_1);
  658. }
  659. finally { if (e_2) throw e_2.error; }
  660. }
  661. return true;
  662. };
  663. return HtmlSanitizerImpl;
  664. }());
  665. exports.HtmlSanitizerImpl = HtmlSanitizerImpl;
  666. var defaultHtmlSanitizer =
  667. /* #__PURE__ */ (function () { return new HtmlSanitizerImpl(default_sanitizer_table_1.defaultSanitizerTable, secrets_1.secretToken); })();
  668. /** Sanitizes untrusted html using the default sanitizer configuration. */
  669. function sanitizeHtml(html) {
  670. return defaultHtmlSanitizer.sanitize(html);
  671. }
  672. exports.sanitizeHtml = sanitizeHtml;
  673. /**
  674. * Sanitizes untrusted html using the default sanitizer configuration. Throws
  675. * an error if the html was changed.
  676. */
  677. function sanitizeHtmlAssertUnchanged(html) {
  678. return defaultHtmlSanitizer.sanitizeAssertUnchanged(html);
  679. }
  680. exports.sanitizeHtmlAssertUnchanged = sanitizeHtmlAssertUnchanged;
  681. /**
  682. * Sanitizes untrusted html using the default sanitizer configuration. Throws
  683. * an error if the html was changed.
  684. */
  685. function sanitizeHtmlToFragment(html) {
  686. return defaultHtmlSanitizer.sanitizeToFragment(html);
  687. }
  688. exports.sanitizeHtmlToFragment = sanitizeHtmlToFragment;
  689. function checkExhaustive(value, msg) {
  690. if (msg === void 0) { msg = "unexpected value ".concat(value, "!"); }
  691. throw new Error(msg);
  692. }
  693. /***/ }),
  694. /***/ "./node_modules/safevalues/builders/html_sanitizer/html_sanitizer_builder.js":
  695. /*!***********************************************************************************!*\
  696. !*** ./node_modules/safevalues/builders/html_sanitizer/html_sanitizer_builder.js ***!
  697. \***********************************************************************************/
  698. /*! no static exports found */
  699. /***/ (function(module, exports, __webpack_require__) {
  700. "use strict";
  701. /**
  702. * @license
  703. * SPDX-License-Identifier: Apache-2.0
  704. */
  705. var __values = (this && this.__values) || function(o) {
  706. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  707. if (m) return m.call(o);
  708. if (o && typeof o.length === "number") return {
  709. next: function () {
  710. if (o && i >= o.length) o = void 0;
  711. return { value: o && o[i++], done: !o };
  712. }
  713. };
  714. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  715. };
  716. var __read = (this && this.__read) || function (o, n) {
  717. var m = typeof Symbol === "function" && o[Symbol.iterator];
  718. if (!m) return o;
  719. var i = m.call(o), r, ar = [], e;
  720. try {
  721. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  722. }
  723. catch (error) { e = { error: error }; }
  724. finally {
  725. try {
  726. if (r && !r.done && (m = i["return"])) m.call(i);
  727. }
  728. finally { if (e) throw e.error; }
  729. }
  730. return ar;
  731. };
  732. Object.defineProperty(exports, "__esModule", { value: true });
  733. exports.HtmlSanitizerBuilder = void 0;
  734. var secrets_1 = __webpack_require__(/*! ../../internals/secrets */ "./node_modules/safevalues/internals/secrets.js");
  735. var html_sanitizer_1 = __webpack_require__(/*! ./html_sanitizer */ "./node_modules/safevalues/builders/html_sanitizer/html_sanitizer.js");
  736. var default_sanitizer_table_1 = __webpack_require__(/*! ./sanitizer_table/default_sanitizer_table */ "./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/default_sanitizer_table.js");
  737. var sanitizer_table_1 = __webpack_require__(/*! ./sanitizer_table/sanitizer_table */ "./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/sanitizer_table.js");
  738. /** This class allows modifications to the default sanitizer configuration. */
  739. var HtmlSanitizerBuilder = /** @class */ (function () {
  740. function HtmlSanitizerBuilder() {
  741. // To denote if the builder has called build() and therefore should make no
  742. // further changes to the sanitizer table.
  743. this.calledBuild = false;
  744. this.sanitizerTable = default_sanitizer_table_1.defaultSanitizerTable;
  745. }
  746. /** Builder option to restrict allowed elements to a smaller subset. */
  747. HtmlSanitizerBuilder.prototype.onlyAllowElements = function (elementSet) {
  748. var e_1, _a;
  749. var allowedElements = new Set();
  750. var allowedElementPolicies = new Map();
  751. try {
  752. for (var elementSet_1 = __values(elementSet), elementSet_1_1 = elementSet_1.next(); !elementSet_1_1.done; elementSet_1_1 = elementSet_1.next()) {
  753. var element = elementSet_1_1.value;
  754. element = element.toUpperCase();
  755. if (!this.sanitizerTable.isAllowedElement(element)) {
  756. throw new Error("Element: ".concat(element, ", is not allowed by html5_contract.textpb"));
  757. }
  758. var elementPolicy = this.sanitizerTable.elementPolicies.get(element);
  759. if (elementPolicy !== undefined) {
  760. allowedElementPolicies.set(element, elementPolicy);
  761. }
  762. else {
  763. allowedElements.add(element);
  764. }
  765. }
  766. }
  767. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  768. finally {
  769. try {
  770. if (elementSet_1_1 && !elementSet_1_1.done && (_a = elementSet_1.return)) _a.call(elementSet_1);
  771. }
  772. finally { if (e_1) throw e_1.error; }
  773. }
  774. this.sanitizerTable = new sanitizer_table_1.SanitizerTable(allowedElements, allowedElementPolicies, this.sanitizerTable.allowedGlobalAttributes, this.sanitizerTable.globalAttributePolicies);
  775. return this;
  776. };
  777. /**
  778. * Builder option to restrict allowed attributes to a smaller subset.
  779. *
  780. * If the attribute isn't currently allowed then it won't be added.
  781. */
  782. HtmlSanitizerBuilder.prototype.onlyAllowAttributes = function (attributeSet) {
  783. var e_2, _a, e_3, _b, e_4, _c;
  784. var allowedGlobalAttributes = new Set();
  785. var globalAttributePolicies = new Map();
  786. var elementPolicies = new Map();
  787. try {
  788. for (var attributeSet_1 = __values(attributeSet), attributeSet_1_1 = attributeSet_1.next(); !attributeSet_1_1.done; attributeSet_1_1 = attributeSet_1.next()) {
  789. var attribute = attributeSet_1_1.value;
  790. if (this.sanitizerTable.allowedGlobalAttributes.has(attribute)) {
  791. allowedGlobalAttributes.add(attribute);
  792. }
  793. if (this.sanitizerTable.globalAttributePolicies.has(attribute)) {
  794. globalAttributePolicies.set(attribute, this.sanitizerTable.globalAttributePolicies.get(attribute));
  795. }
  796. }
  797. }
  798. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  799. finally {
  800. try {
  801. if (attributeSet_1_1 && !attributeSet_1_1.done && (_a = attributeSet_1.return)) _a.call(attributeSet_1);
  802. }
  803. finally { if (e_2) throw e_2.error; }
  804. }
  805. try {
  806. for (var _d = __values(this.sanitizerTable
  807. .elementPolicies.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
  808. var _f = __read(_e.value, 2), elementName = _f[0], originalElementPolicy = _f[1];
  809. var newElementPolicy = new Map();
  810. try {
  811. for (var _g = (e_4 = void 0, __values(originalElementPolicy
  812. .entries())), _h = _g.next(); !_h.done; _h = _g.next()) {
  813. var _j = __read(_h.value, 2), attribute = _j[0], attributePolicy = _j[1];
  814. if (attributeSet.has(attribute)) {
  815. newElementPolicy.set(attribute, attributePolicy);
  816. }
  817. }
  818. }
  819. catch (e_4_1) { e_4 = { error: e_4_1 }; }
  820. finally {
  821. try {
  822. if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
  823. }
  824. finally { if (e_4) throw e_4.error; }
  825. }
  826. elementPolicies.set(elementName, newElementPolicy);
  827. }
  828. }
  829. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  830. finally {
  831. try {
  832. if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
  833. }
  834. finally { if (e_3) throw e_3.error; }
  835. }
  836. this.sanitizerTable = new sanitizer_table_1.SanitizerTable(this.sanitizerTable.allowedElements, elementPolicies, allowedGlobalAttributes, globalAttributePolicies);
  837. return this;
  838. };
  839. /**
  840. * Allows the set of data attributes passed.
  841. *
  842. * These values must be prefixed with "data-"
  843. *
  844. * If called with onlyAllowElements or onlyAllowAttributes, those methods must
  845. * be called first.
  846. */
  847. HtmlSanitizerBuilder.prototype.allowDataAttributes = function (attributes) {
  848. var e_5, _a;
  849. var allowedGlobalAttributes = new Set(this.sanitizerTable.allowedGlobalAttributes);
  850. try {
  851. for (var attributes_1 = __values(attributes), attributes_1_1 = attributes_1.next(); !attributes_1_1.done; attributes_1_1 = attributes_1.next()) {
  852. var attribute = attributes_1_1.value;
  853. if (attribute.indexOf('data-') !== 0) {
  854. throw new Error("data attribute: ".concat(attribute, " does not begin with the prefix \"data-\""));
  855. }
  856. allowedGlobalAttributes.add(attribute);
  857. }
  858. }
  859. catch (e_5_1) { e_5 = { error: e_5_1 }; }
  860. finally {
  861. try {
  862. if (attributes_1_1 && !attributes_1_1.done && (_a = attributes_1.return)) _a.call(attributes_1);
  863. }
  864. finally { if (e_5) throw e_5.error; }
  865. }
  866. this.sanitizerTable = new sanitizer_table_1.SanitizerTable(this.sanitizerTable.allowedElements, this.sanitizerTable.elementPolicies, allowedGlobalAttributes, this.sanitizerTable.globalAttributePolicies);
  867. return this;
  868. };
  869. /**
  870. * Preserves style attributes. Note that the sanitizer won't parse and
  871. * sanitize the values but keep them as they are. In particular this means
  872. * that the code will be able to call functions that could do undesirable
  873. * things (e.g. `url` to trigger a network request), as well as any custom
  874. * properties or functions defined by the application.
  875. */
  876. HtmlSanitizerBuilder.prototype.allowStyleAttributes = function () {
  877. var globalAttributePolicies = new Map(this.sanitizerTable.globalAttributePolicies);
  878. globalAttributePolicies.set('style', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_STYLE });
  879. this.sanitizerTable = new sanitizer_table_1.SanitizerTable(this.sanitizerTable.allowedElements, this.sanitizerTable.elementPolicies, this.sanitizerTable.allowedGlobalAttributes, globalAttributePolicies);
  880. return this;
  881. };
  882. /**
  883. * Preserves the class attribute on all elements. This means contents can
  884. * adopt CSS styles from other page elements and possibly mask themselves as
  885. * legitimate UI elements, which can lead to phishing.
  886. */
  887. HtmlSanitizerBuilder.prototype.allowClassAttributes = function () {
  888. var globalAttributePolicies = new Map(this.sanitizerTable.globalAttributePolicies);
  889. globalAttributePolicies.set('class', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP });
  890. this.sanitizerTable = new sanitizer_table_1.SanitizerTable(this.sanitizerTable.allowedElements, this.sanitizerTable.elementPolicies, this.sanitizerTable.allowedGlobalAttributes, globalAttributePolicies);
  891. return this;
  892. };
  893. /**
  894. * Preserves id attributes. This carries moderate risk as it allows an
  895. * element to override other elements with the same ID.
  896. */
  897. HtmlSanitizerBuilder.prototype.allowIdAttributes = function () {
  898. var globalAttributePolicies = new Map(this.sanitizerTable.globalAttributePolicies);
  899. globalAttributePolicies.set('id', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP });
  900. this.sanitizerTable = new sanitizer_table_1.SanitizerTable(this.sanitizerTable.allowedElements, this.sanitizerTable.elementPolicies, this.sanitizerTable.allowedGlobalAttributes, globalAttributePolicies);
  901. return this;
  902. };
  903. HtmlSanitizerBuilder.prototype.build = function () {
  904. if (this.calledBuild) {
  905. throw new Error('this sanitizer has already called build');
  906. }
  907. this.calledBuild = true;
  908. return new html_sanitizer_1.HtmlSanitizerImpl(this.sanitizerTable, secrets_1.secretToken);
  909. };
  910. return HtmlSanitizerBuilder;
  911. }());
  912. exports.HtmlSanitizerBuilder = HtmlSanitizerBuilder;
  913. /***/ }),
  914. /***/ "./node_modules/safevalues/builders/html_sanitizer/inert_fragment.js":
  915. /*!***************************************************************************!*\
  916. !*** ./node_modules/safevalues/builders/html_sanitizer/inert_fragment.js ***!
  917. \***************************************************************************/
  918. /*! no static exports found */
  919. /***/ (function(module, exports, __webpack_require__) {
  920. "use strict";
  921. /**
  922. * @license
  923. * SPDX-License-Identifier: Apache-2.0
  924. */
  925. Object.defineProperty(exports, "__esModule", { value: true });
  926. exports.createInertFragment = void 0;
  927. var element_1 = __webpack_require__(/*! ../../dom/elements/element */ "./node_modules/safevalues/dom/elements/element.js");
  928. var html_impl_1 = __webpack_require__(/*! ../../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  929. /**
  930. * Returns a fragment that contains the parsed HTML for `dirtyHtml` without
  931. * executing any of the potential payload.
  932. */
  933. function createInertFragment(dirtyHtml) {
  934. var template = document.createElement('template');
  935. // This call is only used to create an inert tree for the sanitizer to
  936. // further process and is never returned directly to the caller. We can't use
  937. // a reviewed conversion in order to avoid an import loop.
  938. var temporarySafeHtml = (0, html_impl_1.createHtml)(dirtyHtml);
  939. (0, element_1.setInnerHtml)(template, temporarySafeHtml);
  940. return template.content;
  941. }
  942. exports.createInertFragment = createInertFragment;
  943. /***/ }),
  944. /***/ "./node_modules/safevalues/builders/html_sanitizer/no_clobber.js":
  945. /*!***********************************************************************!*\
  946. !*** ./node_modules/safevalues/builders/html_sanitizer/no_clobber.js ***!
  947. \***********************************************************************/
  948. /*! no static exports found */
  949. /***/ (function(module, exports, __webpack_require__) {
  950. "use strict";
  951. /**
  952. * @license
  953. * SPDX-License-Identifier: Apache-2.0
  954. */
  955. Object.defineProperty(exports, "__esModule", { value: true });
  956. exports.isElement = exports.isText = exports.getNodeName = void 0;
  957. /**
  958. * Library that provides safe getters for different node properties and
  959. * checks for clobbering.
  960. */
  961. /** Gets a reasonable nodeName, even for clobbered nodes. */
  962. function getNodeName(node) {
  963. var nodeName = node.nodeName;
  964. // If the property is clobbered, assume it is an `HTMLFormElement`.
  965. return (typeof nodeName === 'string') ? nodeName : 'FORM';
  966. }
  967. exports.getNodeName = getNodeName;
  968. /** Returns true if the object passed is a Text node. */
  969. function isText(node) {
  970. // The property cannot get clobbered on Text nodes.
  971. return node.nodeType === Node.TEXT_NODE;
  972. }
  973. exports.isText = isText;
  974. /** Returns true if the object passed is an Element node. */
  975. function isElement(node) {
  976. var nodeType = node.nodeType;
  977. // If the property is clobbered, we can assume it is an `HTMLFormElement`, and
  978. // thus an `Element`.
  979. return (nodeType === Node.ELEMENT_NODE) || (typeof nodeType !== 'number');
  980. }
  981. exports.isElement = isElement;
  982. /***/ }),
  983. /***/ "./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/default_sanitizer_table.js":
  984. /*!****************************************************************************************************!*\
  985. !*** ./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/default_sanitizer_table.js ***!
  986. \****************************************************************************************************/
  987. /*! no static exports found */
  988. /***/ (function(module, exports, __webpack_require__) {
  989. "use strict";
  990. /**
  991. * @license
  992. * SPDX-License-Identifier: Apache-2.0
  993. */
  994. Object.defineProperty(exports, "__esModule", { value: true });
  995. exports.defaultSanitizerTable = void 0;
  996. var sanitizer_table_1 = __webpack_require__(/*! ./sanitizer_table */ "./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/sanitizer_table.js");
  997. /**
  998. * GENERATED CODE, DO NOT MODIFY
  999. * This SanitizerTable was generated from the checked in html contract:
  1000. * webutil/html/types/codegen/html5_contract.textpb
  1001. *
  1002. * You can regenerate this file with:
  1003. * webutil/html/types/codegen/update_generated_source_files.sh
  1004. */
  1005. exports.defaultSanitizerTable = new sanitizer_table_1.SanitizerTable(new Set([
  1006. 'ARTICLE', 'SECTION', 'NAV', 'ASIDE', 'H1', 'H2',
  1007. 'H3', 'H4', 'H5', 'H6', 'HEADER', 'FOOTER',
  1008. 'ADDRESS', 'P', 'HR', 'PRE', 'BLOCKQUOTE', 'OL',
  1009. 'UL', 'LH', 'LI', 'DL', 'DT', 'DD',
  1010. 'FIGURE', 'FIGCAPTION', 'MAIN', 'DIV', 'EM', 'STRONG',
  1011. 'SMALL', 'S', 'CITE', 'Q', 'DFN', 'ABBR',
  1012. 'RUBY', 'RB', 'RT', 'RTC', 'RP', 'DATA',
  1013. 'TIME', 'CODE', 'VAR', 'SAMP', 'KBD', 'SUB',
  1014. 'SUP', 'I', 'B', 'U', 'MARK', 'BDI',
  1015. 'BDO', 'SPAN', 'BR', 'WBR', 'INS', 'DEL',
  1016. 'PICTURE', 'PARAM', 'TRACK', 'MAP', 'TABLE', 'CAPTION',
  1017. 'COLGROUP', 'COL', 'TBODY', 'THEAD', 'TFOOT', 'TR',
  1018. 'TD', 'TH', 'SELECT', 'DATALIST', 'OPTGROUP', 'OPTION',
  1019. 'OUTPUT', 'PROGRESS', 'METER', 'FIELDSET', 'LEGEND', 'DETAILS',
  1020. 'SUMMARY', 'MENU', 'DIALOG', 'SLOT', 'CANVAS', 'FONT',
  1021. 'CENTER',
  1022. ]), new Map([
  1023. [
  1024. 'A', new Map([
  1025. ['href', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1026. ])
  1027. ],
  1028. [
  1029. 'AREA', new Map([
  1030. ['href', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1031. ])
  1032. ],
  1033. [
  1034. 'LINK', new Map([
  1035. [
  1036. 'href', {
  1037. policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL,
  1038. conditions: new Map([[
  1039. 'rel', new Set([
  1040. 'alternate',
  1041. 'author',
  1042. 'bookmark',
  1043. 'canonical',
  1044. 'cite',
  1045. 'help',
  1046. 'icon',
  1047. 'license',
  1048. 'next',
  1049. 'prefetch',
  1050. 'dns-prefetch',
  1051. 'prerender',
  1052. 'preconnect',
  1053. 'preload',
  1054. 'prev',
  1055. 'search',
  1056. 'subresource',
  1057. ])
  1058. ]])
  1059. }
  1060. ],
  1061. ])
  1062. ],
  1063. [
  1064. 'SOURCE', new Map([
  1065. ['src', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1066. ])
  1067. ],
  1068. [
  1069. 'IMG', new Map([
  1070. ['src', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1071. ])
  1072. ],
  1073. [
  1074. 'VIDEO', new Map([
  1075. ['src', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1076. ])
  1077. ],
  1078. [
  1079. 'AUDIO', new Map([
  1080. ['src', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1081. ])
  1082. ],
  1083. ]), new Set([
  1084. 'title',
  1085. 'aria-atomic',
  1086. 'aria-autocomplete',
  1087. 'aria-busy',
  1088. 'aria-checked',
  1089. 'aria-current',
  1090. 'aria-disabled',
  1091. 'aria-dropeffect',
  1092. 'aria-expanded',
  1093. 'aria-haspopup',
  1094. 'aria-hidden',
  1095. 'aria-invalid',
  1096. 'aria-label',
  1097. 'aria-level',
  1098. 'aria-live',
  1099. 'aria-multiline',
  1100. 'aria-multiselectable',
  1101. 'aria-orientation',
  1102. 'aria-posinset',
  1103. 'aria-pressed',
  1104. 'aria-readonly',
  1105. 'aria-relevant',
  1106. 'aria-required',
  1107. 'aria-selected',
  1108. 'aria-setsize',
  1109. 'aria-sort',
  1110. 'aria-valuemax',
  1111. 'aria-valuemin',
  1112. 'aria-valuenow',
  1113. 'aria-valuetext',
  1114. 'alt',
  1115. 'align',
  1116. 'autocapitalize',
  1117. 'autocomplete',
  1118. 'autocorrect',
  1119. 'autofocus',
  1120. 'autoplay',
  1121. 'bgcolor',
  1122. 'border',
  1123. 'cellpadding',
  1124. 'cellspacing',
  1125. 'checked',
  1126. 'color',
  1127. 'cols',
  1128. 'colspan',
  1129. 'controls',
  1130. 'datetime',
  1131. 'disabled',
  1132. 'download',
  1133. 'draggable',
  1134. 'enctype',
  1135. 'face',
  1136. 'formenctype',
  1137. 'frameborder',
  1138. 'height',
  1139. 'hreflang',
  1140. 'hidden',
  1141. 'ismap',
  1142. 'label',
  1143. 'lang',
  1144. 'loop',
  1145. 'max',
  1146. 'maxlength',
  1147. 'media',
  1148. 'minlength',
  1149. 'min',
  1150. 'multiple',
  1151. 'muted',
  1152. 'nonce',
  1153. 'open',
  1154. 'placeholder',
  1155. 'preload',
  1156. 'rel',
  1157. 'required',
  1158. 'reversed',
  1159. 'role',
  1160. 'rows',
  1161. 'rowspan',
  1162. 'selected',
  1163. 'shape',
  1164. 'size',
  1165. 'sizes',
  1166. 'slot',
  1167. 'span',
  1168. 'spellcheck',
  1169. 'start',
  1170. 'step',
  1171. 'summary',
  1172. 'translate',
  1173. 'type',
  1174. 'valign',
  1175. 'value',
  1176. 'width',
  1177. 'wrap',
  1178. 'itemscope',
  1179. 'itemtype',
  1180. 'itemid',
  1181. 'itemprop',
  1182. 'itemref',
  1183. ]), new Map([
  1184. [
  1185. 'dir', {
  1186. policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_NORMALIZE,
  1187. conditions: new Map([[
  1188. 'dir', new Set([
  1189. 'auto',
  1190. 'ltr',
  1191. 'rtl',
  1192. ])
  1193. ]])
  1194. }
  1195. ],
  1196. [
  1197. 'async', {
  1198. policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_NORMALIZE,
  1199. conditions: new Map([[
  1200. 'async', new Set([
  1201. 'async',
  1202. ])
  1203. ]])
  1204. }
  1205. ],
  1206. ['cite', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1207. [
  1208. 'loading', {
  1209. policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_NORMALIZE,
  1210. conditions: new Map([[
  1211. 'loading', new Set([
  1212. 'eager',
  1213. 'lazy',
  1214. ])
  1215. ]])
  1216. }
  1217. ],
  1218. ['poster', { policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_SANITIZE_URL }],
  1219. [
  1220. 'target', {
  1221. policyAction: sanitizer_table_1.AttributePolicyAction.KEEP_AND_NORMALIZE,
  1222. conditions: new Map([[
  1223. 'target', new Set([
  1224. '_self',
  1225. '_blank',
  1226. ])
  1227. ]])
  1228. }
  1229. ],
  1230. ]));
  1231. /***/ }),
  1232. /***/ "./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/sanitizer_table.js":
  1233. /*!********************************************************************************************!*\
  1234. !*** ./node_modules/safevalues/builders/html_sanitizer/sanitizer_table/sanitizer_table.js ***!
  1235. \********************************************************************************************/
  1236. /*! no static exports found */
  1237. /***/ (function(module, exports, __webpack_require__) {
  1238. "use strict";
  1239. /**
  1240. * @license
  1241. * SPDX-License-Identifier: Apache-2.0
  1242. */
  1243. Object.defineProperty(exports, "__esModule", { value: true });
  1244. exports.AttributePolicyAction = exports.SanitizerTable = void 0;
  1245. /** Class for holding element and attribute policies used for sanitization. */
  1246. var SanitizerTable = /** @class */ (function () {
  1247. function SanitizerTable(allowedElements, elementPolicies, allowedGlobalAttributes, globalAttributePolicies) {
  1248. this.allowedElements = allowedElements;
  1249. this.elementPolicies = elementPolicies;
  1250. this.allowedGlobalAttributes = allowedGlobalAttributes;
  1251. this.globalAttributePolicies = globalAttributePolicies;
  1252. }
  1253. SanitizerTable.prototype.isAllowedElement = function (elementName) {
  1254. // Note: `HTMLFormElement`s are always dropped, supporting them is very
  1255. // costly because of the DOM clobberring they can cause. The additional code
  1256. // size required to properly work around DOM clobberring issues is large and
  1257. // shouldn't be put on every user of the sanitizer. Thoroughly review
  1258. // b/210975025 and the CLs linked there before you start allowing form
  1259. // elements.
  1260. return elementName.toLowerCase() !== 'form' &&
  1261. (this.allowedElements.has(elementName) ||
  1262. this.elementPolicies.has(elementName));
  1263. };
  1264. SanitizerTable.prototype.getAttributePolicy = function (attributeName, elementName) {
  1265. var elementPolicy = this.elementPolicies.get(elementName);
  1266. if (elementPolicy === null || elementPolicy === void 0 ? void 0 : elementPolicy.has(attributeName)) {
  1267. return elementPolicy.get(attributeName);
  1268. }
  1269. if (this.allowedGlobalAttributes.has(attributeName)) {
  1270. return { policyAction: AttributePolicyAction.KEEP };
  1271. }
  1272. var globalPolicy = this.globalAttributePolicies.get(attributeName);
  1273. return globalPolicy || { policyAction: AttributePolicyAction.DROP };
  1274. };
  1275. return SanitizerTable;
  1276. }());
  1277. exports.SanitizerTable = SanitizerTable;
  1278. /**
  1279. * Values derived from
  1280. * https://godoc.corp.google.com/pkg/google3/third_party/safehtml/sanitizer/policy#AttributePolicy
  1281. */
  1282. var AttributePolicyAction;
  1283. (function (AttributePolicyAction) {
  1284. AttributePolicyAction[AttributePolicyAction["DROP"] = 0] = "DROP";
  1285. AttributePolicyAction[AttributePolicyAction["KEEP"] = 1] = "KEEP";
  1286. AttributePolicyAction[AttributePolicyAction["KEEP_AND_SANITIZE_URL"] = 2] = "KEEP_AND_SANITIZE_URL";
  1287. AttributePolicyAction[AttributePolicyAction["KEEP_AND_NORMALIZE"] = 3] = "KEEP_AND_NORMALIZE";
  1288. AttributePolicyAction[AttributePolicyAction["KEEP_AND_SANITIZE_STYLE"] = 4] = "KEEP_AND_SANITIZE_STYLE";
  1289. })(AttributePolicyAction = exports.AttributePolicyAction || (exports.AttributePolicyAction = {}));
  1290. /***/ }),
  1291. /***/ "./node_modules/safevalues/builders/resource_url_builders.js":
  1292. /*!*******************************************************************!*\
  1293. !*** ./node_modules/safevalues/builders/resource_url_builders.js ***!
  1294. \*******************************************************************/
  1295. /*! no static exports found */
  1296. /***/ (function(module, exports, __webpack_require__) {
  1297. "use strict";
  1298. /**
  1299. * @license
  1300. * SPDX-License-Identifier: Apache-2.0
  1301. */
  1302. Object.defineProperty(exports, "__esModule", { value: true });
  1303. exports.blobUrlFromScript = exports.replaceFragment = exports.appendParams = exports.trustedResourceUrl = void 0;
  1304. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  1305. var resource_url_impl_1 = __webpack_require__(/*! ../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  1306. var script_impl_1 = __webpack_require__(/*! ../internals/script_impl */ "./node_modules/safevalues/internals/script_impl.js");
  1307. var string_literal_1 = __webpack_require__(/*! ../internals/string_literal */ "./node_modules/safevalues/internals/string_literal.js");
  1308. /**
  1309. * Check whether the base url contains a valid origin,
  1310. *
  1311. * A string for an origin must contain only alphanumeric or any of the
  1312. * following: `-.:`, and must not be an IP address. Remember that, as per the
  1313. * documentation for TrustedResourceUrl, the origin must be trustworthy.
  1314. *
  1315. * @param base The base url that contains an origin.
  1316. */
  1317. function hasValidOrigin(base) {
  1318. if (!(/^https:\/\//.test(base) || /^\/\//.test(base))) {
  1319. return false;
  1320. }
  1321. var originStart = base.indexOf('//') + 2;
  1322. var originEnd = base.indexOf('/', originStart);
  1323. // If the base url only contains the prefix (e.g. //), or the slash
  1324. // for the origin is right after the prefix (e.g. ///), the origin is
  1325. // missing.
  1326. if (originEnd <= originStart) {
  1327. throw new Error("Can't interpolate data in a url's origin, " +
  1328. "Please make sure to fully specify the origin, terminated with '/'.");
  1329. }
  1330. var origin = base.substring(originStart, originEnd);
  1331. if (!/^[0-9a-z.:-]+$/i.test(origin)) {
  1332. throw new Error('The origin contains unsupported characters.');
  1333. }
  1334. if (!/^[^:]*(:[0-9]+)?$/i.test(origin)) {
  1335. throw new Error('Invalid port number.');
  1336. }
  1337. if (!/(^|\.)[a-z][^.]*$/i.test(origin)) {
  1338. throw new Error('The top-level domain must start with a letter.');
  1339. }
  1340. return true;
  1341. }
  1342. /**
  1343. * Check whether the base url contains a valid about url at its beginning.
  1344. *
  1345. * An about url is either exactly 'about:blank' or 'about:blank#<str>' where
  1346. * <str> can be an arbitrary string.
  1347. *
  1348. * @param base The base url.
  1349. */
  1350. function isValidAboutUrl(base) {
  1351. if (!/^about:blank/.test(base)) {
  1352. return false;
  1353. }
  1354. if (base !== 'about:blank' && !/^about:blank#/.test(base)) {
  1355. throw new Error('The about url is invalid.');
  1356. }
  1357. return true;
  1358. }
  1359. /**
  1360. * Check whether the base url contains a valid path start at its beginning.
  1361. *
  1362. * A valid path start is either a '/' or a '/' followed by at least one
  1363. * character that is not '/' or '\'.
  1364. *
  1365. * @param base The base url.
  1366. */
  1367. function isValidPathStart(base) {
  1368. if (!/^\//.test(base)) {
  1369. return false;
  1370. }
  1371. if ((base === '/') ||
  1372. (base.length > 1 && base[1] !== '/' && base[1] !== '\\')) {
  1373. return true;
  1374. }
  1375. throw new Error('The path start in the url is invalid.');
  1376. }
  1377. /**
  1378. * Builds TrustedResourceUrl from a template literal.
  1379. *
  1380. * This factory is a template literal tag function. It should be called with
  1381. * a template literal, with or without embedded expressions. For example,
  1382. * trustedResourceUrl`//example.com/${bar}`;
  1383. * or
  1384. * trustedResourceUrl`//example.com`;
  1385. *
  1386. * When this function is called with a template literal without any embedded
  1387. * expressions, the template string may contain anything as the whole URL is
  1388. * a compile-time string constant.
  1389. *
  1390. * When this function is called with a template literal that contains embedded
  1391. * expressions, the template must start with one of the following:
  1392. * - `https://<origin>/`
  1393. * - `//<origin>/`
  1394. * - `/<pathStart>`
  1395. * - `about:blank`
  1396. * - `data:`
  1397. *
  1398. * `<origin>` must contain only alphanumeric or any of the following: `-.:`.
  1399. * Remember that, as per the documentation for TrustedResourceUrl, the origin
  1400. * must be trustworthy. An origin of "example.com" could be set with this
  1401. * method, but would tie the security of your site to the security of
  1402. * example.com. Similarly, formats that potentially cover redirects hosted
  1403. * on a trusted origin are problematic, since that could lead to untrusted
  1404. * origins.
  1405. *
  1406. * `<pathStart>` is either an empty string, or a non empty string that does not
  1407. * start with '/' or '\'.
  1408. * In other words, `/<pathStart>` is either a '/' or a
  1409. * '/' followed by at least one character that is not '/' or '\'.
  1410. *
  1411. * `data:` (data URL) does not allow embedded expressions in the template
  1412. * literal input.
  1413. *
  1414. * All embedded expressions are URL encoded when they are interpolated. Do not
  1415. * embed expressions that are already URL encoded as they will be double encoded
  1416. * by the builder.
  1417. *
  1418. * @param templateObj This contains the literal part of the template literal.
  1419. * @param rest This represents the template's embedded expressions.
  1420. */
  1421. function trustedResourceUrl(templateObj) {
  1422. var rest = [];
  1423. for (var _i = 1; _i < arguments.length; _i++) {
  1424. rest[_i - 1] = arguments[_i];
  1425. }
  1426. // Check if templateObj is actually from a template literal.
  1427. if (true) {
  1428. (0, string_literal_1.assertIsTemplateObject)(templateObj, true, 'trustedResourceUrl is a template literal tag function and ' +
  1429. 'can only be called as such (e.g. trustedResourceUrl`/somepath.js`)');
  1430. }
  1431. if (rest.length === 0) {
  1432. return (0, resource_url_impl_1.createResourceUrl)(templateObj[0]);
  1433. }
  1434. var base = templateObj[0].toLowerCase();
  1435. if (true) {
  1436. if (/^data:/.test(base)) {
  1437. throw new Error('Data URLs cannot have expressions in the template literal input.');
  1438. }
  1439. if (!hasValidOrigin(base) && !isValidPathStart(base) &&
  1440. !isValidAboutUrl(base)) {
  1441. throw new Error('Trying to interpolate expressions in an unsupported url format.');
  1442. }
  1443. }
  1444. var urlParts = [templateObj[0]];
  1445. for (var i = 0; i < rest.length; i++) {
  1446. urlParts.push(encodeURIComponent(rest[i]));
  1447. urlParts.push(templateObj[i + 1]);
  1448. }
  1449. return (0, resource_url_impl_1.createResourceUrl)(urlParts.join(''));
  1450. }
  1451. exports.trustedResourceUrl = trustedResourceUrl;
  1452. /**
  1453. * Creates a new TrustedResourceUrl with params added to the URL's search
  1454. * parameters.
  1455. *
  1456. * @param params What to add to the URL. Parameters with value `null` or
  1457. * `undefined` are skipped. Both keys and values will be encoded. Do not pass
  1458. * pre-encoded values as this will result them being double encoded. If the
  1459. * value is an array then the same parameter is added for every element in the
  1460. * array.
  1461. */
  1462. function appendParams(trustedUrl, params) {
  1463. var url = (0, resource_url_impl_1.unwrapResourceUrl)(trustedUrl).toString();
  1464. if (/#/.test(url)) {
  1465. var message = '';
  1466. if (true) {
  1467. message = "Found a hash in url (".concat(url, "), appending not supported");
  1468. }
  1469. throw new Error(message);
  1470. }
  1471. var separator = /\?/.test(url) ? '&' : '?';
  1472. // for-of has a big polyfill.
  1473. // tslint:disable-next-line:ban-iterable-foreach
  1474. params.forEach(function (value, key) {
  1475. var values = (value instanceof Array) ? value : [value];
  1476. for (var i = 0; i < values.length; i++) {
  1477. var v = values[i];
  1478. if (v === null || v === undefined) {
  1479. continue;
  1480. }
  1481. url += separator + encodeURIComponent(key) + '=' +
  1482. encodeURIComponent(String(v));
  1483. separator = '&';
  1484. }
  1485. });
  1486. return (0, resource_url_impl_1.createResourceUrl)(url);
  1487. }
  1488. exports.appendParams = appendParams;
  1489. var BEFORE_FRAGMENT_REGEXP = /[^#]*/;
  1490. /**
  1491. * Creates a new TrustedResourceUrl based on an existing one but with the
  1492. * addition of a fragment (the part after `#`). If the URL already has a
  1493. * fragment, it is replaced with the new one.
  1494. * @param fragment The fragment to add to the URL, verbatim, without the leading
  1495. * `#`. No additional escaping is applied.
  1496. */
  1497. function replaceFragment(trustedUrl, fragment) {
  1498. var urlString = (0, resource_url_impl_1.unwrapResourceUrl)(trustedUrl).toString();
  1499. return (0, resource_url_impl_1.createResourceUrl)(BEFORE_FRAGMENT_REGEXP.exec(urlString)[0] + '#' + fragment);
  1500. }
  1501. exports.replaceFragment = replaceFragment;
  1502. /**
  1503. * Creates a `TrustedResourceUrl` by generating a `Blob` from a
  1504. * `SafeScript` and then calling `URL.createObjectURL` with that `Blob`.
  1505. *
  1506. * Caller must call `URL.revokeObjectUrl()` on the stringified url to
  1507. * release the underlying `Blob`.
  1508. */
  1509. function blobUrlFromScript(safeScript) {
  1510. var scriptContent = (0, script_impl_1.unwrapScript)(safeScript).toString();
  1511. var blob = new Blob([scriptContent], { type: 'text/javascript' });
  1512. return (0, resource_url_impl_1.createResourceUrl)(URL.createObjectURL(blob));
  1513. }
  1514. exports.blobUrlFromScript = blobUrlFromScript;
  1515. /***/ }),
  1516. /***/ "./node_modules/safevalues/builders/script_builders.js":
  1517. /*!*************************************************************!*\
  1518. !*** ./node_modules/safevalues/builders/script_builders.js ***!
  1519. \*************************************************************/
  1520. /*! no static exports found */
  1521. /***/ (function(module, exports, __webpack_require__) {
  1522. "use strict";
  1523. /**
  1524. * @license
  1525. * SPDX-License-Identifier: Apache-2.0
  1526. */
  1527. Object.defineProperty(exports, "__esModule", { value: true });
  1528. exports.safeScriptWithArgs = exports.scriptFromJson = exports.concatScripts = exports.safeScript = void 0;
  1529. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  1530. var script_impl_1 = __webpack_require__(/*! ../internals/script_impl */ "./node_modules/safevalues/internals/script_impl.js");
  1531. var string_literal_1 = __webpack_require__(/*! ../internals/string_literal */ "./node_modules/safevalues/internals/string_literal.js");
  1532. /**
  1533. * Creates a SafeScript object from a template literal (without any embedded
  1534. * expressions).
  1535. *
  1536. * This function is a template literal tag function. It should be called with
  1537. * a template literal that does not contain any expressions. For example,
  1538. * safeScript`foo`;
  1539. *
  1540. * @param templateObj This contains the literal part of the template literal.
  1541. */
  1542. function safeScript(templateObj) {
  1543. if (true) {
  1544. (0, string_literal_1.assertIsTemplateObject)(templateObj, false, 'safeScript is a template literal tag function ' +
  1545. 'that only accepts template literals without expressions. ' +
  1546. 'For example, safeScript`foo`;');
  1547. }
  1548. return (0, script_impl_1.createScript)(templateObj[0]);
  1549. }
  1550. exports.safeScript = safeScript;
  1551. /** Creates a `SafeScript` value by concatenating multiple `SafeScript`s. */
  1552. function concatScripts(scripts) {
  1553. return (0, script_impl_1.createScript)(scripts.map(script_impl_1.unwrapScript).join(''));
  1554. }
  1555. exports.concatScripts = concatScripts;
  1556. /**
  1557. * Converts a serializable value into JSON that is safe to interpolate into a
  1558. * script context. In particular it escapes < characters so that a value of
  1559. * "</script>" doesn't break out of the context.
  1560. * @param value The value to serialize.
  1561. */
  1562. function scriptFromJson(value) {
  1563. return (0, script_impl_1.createScript)(JSON.stringify(value).replace(/</g, '\\x3c'));
  1564. }
  1565. exports.scriptFromJson = scriptFromJson;
  1566. /**
  1567. * Creates a `SafeScript` object from a template literal (without any embedded
  1568. * expressions) along with additional arguments that the script should have
  1569. * access to. These arguments will be JSON-encoded and passed to the script as
  1570. * a function call.
  1571. * @example
  1572. * ```ts
  1573. * safeScriptWithArgs`function (name, props) {
  1574. * console.log(name + ' is ' + props.age);
  1575. * }`('Bob', { 'age': 42 })
  1576. * ```
  1577. * would return a `SafeScript` that represents the following code:
  1578. * ```js
  1579. * (function (name, props) {
  1580. * console.log(name + ' is ' + props.age);
  1581. * })("Bob",{"age":42})
  1582. * ```
  1583. * @note Be careful when passing objects as arguments, as unquoted property
  1584. * names may be changed during compilation.
  1585. * @param templateObj This contains the literal part of the template literal.
  1586. * @param emptyArgs Expressions that evaluate to the empty string to enable
  1587. * inline comments.
  1588. */
  1589. function safeScriptWithArgs(templateObj) {
  1590. var emptyArgs = [];
  1591. for (var _i = 1; _i < arguments.length; _i++) {
  1592. emptyArgs[_i - 1] = arguments[_i];
  1593. }
  1594. if (true) {
  1595. if (emptyArgs.some(function (a) { return a !== ''; })) {
  1596. throw new Error('safeScriptWithArgs only allows empty string expressions ' +
  1597. 'to enable inline comments.');
  1598. }
  1599. (0, string_literal_1.assertIsTemplateObject)(templateObj, true, 'safeScriptWithArgs is a template literal tag function ' +
  1600. 'that only accepts template literals. ' +
  1601. 'For example, safeScriptWithArgs`foo`;');
  1602. }
  1603. return function () {
  1604. var argValues = [];
  1605. for (var _i = 0; _i < arguments.length; _i++) {
  1606. argValues[_i] = arguments[_i];
  1607. }
  1608. var values = argValues.map(function (v) { return scriptFromJson(v).toString(); });
  1609. return (0, script_impl_1.createScript)("(".concat(templateObj.join(''), ")(").concat(values.join(','), ")"));
  1610. };
  1611. }
  1612. exports.safeScriptWithArgs = safeScriptWithArgs;
  1613. /***/ }),
  1614. /***/ "./node_modules/safevalues/builders/sensitive_attributes.js":
  1615. /*!******************************************************************!*\
  1616. !*** ./node_modules/safevalues/builders/sensitive_attributes.js ***!
  1617. \******************************************************************/
  1618. /*! no static exports found */
  1619. /***/ (function(module, exports, __webpack_require__) {
  1620. "use strict";
  1621. /**
  1622. * @license
  1623. * SPDX-License-Identifier: Apache-2.0
  1624. */
  1625. Object.defineProperty(exports, "__esModule", { value: true });
  1626. exports.SECURITY_SENSITIVE_ATTRIBUTES = void 0;
  1627. // AUTOGENERATED. DO NOT EDIT.
  1628. /**
  1629. * Security sensitive attribute names that should not be set through
  1630. * `setAttribute` or similar functions.
  1631. */
  1632. exports.SECURITY_SENSITIVE_ATTRIBUTES = [
  1633. 'href',
  1634. 'rel',
  1635. 'src',
  1636. 'srcdoc',
  1637. 'action',
  1638. 'formaction',
  1639. 'sandbox',
  1640. 'cite',
  1641. 'poster',
  1642. 'icon',
  1643. ];
  1644. /***/ }),
  1645. /***/ "./node_modules/safevalues/builders/style_builders.js":
  1646. /*!************************************************************!*\
  1647. !*** ./node_modules/safevalues/builders/style_builders.js ***!
  1648. \************************************************************/
  1649. /*! no static exports found */
  1650. /***/ (function(module, exports, __webpack_require__) {
  1651. "use strict";
  1652. /**
  1653. * @license
  1654. * SPDX-License-Identifier: Apache-2.0
  1655. */
  1656. Object.defineProperty(exports, "__esModule", { value: true });
  1657. exports.concatStyles = exports.safeStyle = void 0;
  1658. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  1659. var string_literal_1 = __webpack_require__(/*! ../internals/string_literal */ "./node_modules/safevalues/internals/string_literal.js");
  1660. var style_impl_1 = __webpack_require__(/*! ../internals/style_impl */ "./node_modules/safevalues/internals/style_impl.js");
  1661. /**
  1662. * Creates a SafeStyle object from a template literal (without any embedded
  1663. * expressions).
  1664. *
  1665. * ` style` should be in the format
  1666. * ` name: value; [name: value; ...]` and must not have any < or >
  1667. * characters in it. This is so that SafeStyle's contract is preserved,
  1668. * allowing the SafeStyle to correctly be interpreted as a sequence of CSS
  1669. * declarations and without affecting the syntactic structure of any
  1670. * surrounding CSS and HTML.
  1671. *
  1672. * This function is a template literal tag function. It should be called with
  1673. * a template literal that does not contain any expressions. For example,
  1674. * safeStyle`foo`;
  1675. * This function first checks if it is called with a literal template, and
  1676. * then performs basic sanity checks on the format of ` style`
  1677. * but does not constrain the format of ` name} and {@code value`, except
  1678. * for disallowing tag characters.
  1679. *
  1680. * @param templateObj This contains the literal part of the template literal.
  1681. */
  1682. function safeStyle(templateObj) {
  1683. if (true) {
  1684. (0, string_literal_1.assertIsTemplateObject)(templateObj, false, 'safeStyle is a template literal tag function ' +
  1685. 'that only accepts template literals without expressions. ' +
  1686. 'For example, safeStyle`foo`;');
  1687. }
  1688. var style = templateObj[0];
  1689. if (true) {
  1690. if (/[<>]/.test(style)) {
  1691. throw new Error('Forbidden characters in style string: ' + style);
  1692. }
  1693. if (!/;$/.test(style)) {
  1694. throw new Error('Style string does not end with ";": ' + style);
  1695. }
  1696. if (!/:/.test(style)) {
  1697. throw new Error('Style string should contain one or more ":": ' + style);
  1698. }
  1699. }
  1700. return (0, style_impl_1.createStyle)(style);
  1701. }
  1702. exports.safeStyle = safeStyle;
  1703. /** Creates a `SafeStyle` value by concatenating multiple `SafeStyle`s. */
  1704. function concatStyles(styles) {
  1705. return (0, style_impl_1.createStyle)(styles.map(style_impl_1.unwrapStyle).join(''));
  1706. }
  1707. exports.concatStyles = concatStyles;
  1708. /***/ }),
  1709. /***/ "./node_modules/safevalues/builders/style_sheet_builders.js":
  1710. /*!******************************************************************!*\
  1711. !*** ./node_modules/safevalues/builders/style_sheet_builders.js ***!
  1712. \******************************************************************/
  1713. /*! no static exports found */
  1714. /***/ (function(module, exports, __webpack_require__) {
  1715. "use strict";
  1716. /**
  1717. * @license
  1718. * SPDX-License-Identifier: Apache-2.0
  1719. */
  1720. Object.defineProperty(exports, "__esModule", { value: true });
  1721. exports.concatStyleSheets = exports.safeStyleSheet = void 0;
  1722. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  1723. var string_literal_1 = __webpack_require__(/*! ../internals/string_literal */ "./node_modules/safevalues/internals/string_literal.js");
  1724. var style_sheet_impl_1 = __webpack_require__(/*! ../internals/style_sheet_impl */ "./node_modules/safevalues/internals/style_sheet_impl.js");
  1725. /**
  1726. * Creates a SafeStyleSheet object from a template literal (without any
  1727. * embedded expressions).
  1728. *
  1729. * This function is a template literal tag function. It should be called with
  1730. * a template literal that does not contain any expressions. For example,
  1731. * safeStyleSheet`foo`;
  1732. * The argument must not have any < or > characters in it. This is so that
  1733. * SafeStyleSheet's contract is preserved, allowing the SafeStyleSheet to
  1734. * correctly be interpreted as a sequence of CSS declarations and without
  1735. * affecting the syntactic structure of any surrounding CSS and HTML.
  1736. *
  1737. * @param templateObj This contains the literal part of the template literal.
  1738. */
  1739. function safeStyleSheet(templateObj) {
  1740. if (true) {
  1741. (0, string_literal_1.assertIsTemplateObject)(templateObj, false, 'safeStyleSheet is a template literal tag ' +
  1742. 'function that only accepts template literals without ' +
  1743. 'expressions. For example, safeStyleSheet`foo`;');
  1744. }
  1745. var styleSheet = templateObj[0];
  1746. if (true) {
  1747. if (/[<>]/.test(styleSheet)) {
  1748. throw new Error('Forbidden characters in styleSheet string: ' + styleSheet);
  1749. }
  1750. }
  1751. return (0, style_sheet_impl_1.createStyleSheet)(styleSheet);
  1752. }
  1753. exports.safeStyleSheet = safeStyleSheet;
  1754. /**
  1755. * Creates a `SafeStyleSheet` value by concatenating multiple `SafeStyleSheet`s.
  1756. */
  1757. function concatStyleSheets(sheets) {
  1758. return (0, style_sheet_impl_1.createStyleSheet)(sheets.map(style_sheet_impl_1.unwrapStyleSheet).join(''));
  1759. }
  1760. exports.concatStyleSheets = concatStyleSheets;
  1761. /***/ }),
  1762. /***/ "./node_modules/safevalues/builders/url_sanitizer.js":
  1763. /*!***********************************************************!*\
  1764. !*** ./node_modules/safevalues/builders/url_sanitizer.js ***!
  1765. \***********************************************************/
  1766. /*! no static exports found */
  1767. /***/ (function(module, exports, __webpack_require__) {
  1768. "use strict";
  1769. /**
  1770. * @license
  1771. * SPDX-License-Identifier: Apache-2.0
  1772. */
  1773. Object.defineProperty(exports, "__esModule", { value: true });
  1774. exports.restrictivelySanitizeUrl = exports.unwrapUrlOrSanitize = exports.sanitizeJavascriptUrl = void 0;
  1775. /**
  1776. * @fileoverview Provides functions to enforce the SafeUrl contract at the sink
  1777. * level.
  1778. */
  1779. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  1780. function extractScheme(url) {
  1781. var parsedUrl;
  1782. try {
  1783. parsedUrl = new URL(url);
  1784. }
  1785. catch (e) {
  1786. // According to https://url.spec.whatwg.org/#constructors, the URL
  1787. // constructor with one parameter throws if `url` is not absolute. In this
  1788. // case, we are sure that no explicit scheme (javascript: ) is set.
  1789. // This can also be a URL parsing error, but in this case the URL won't be
  1790. // run anyway.
  1791. return 'https:';
  1792. }
  1793. return parsedUrl.protocol;
  1794. }
  1795. // We can't use an ES6 Set here because gws somehow depends on this code and
  1796. // doesn't want to pay the cost of a polyfill.
  1797. var ALLOWED_SCHEMES = ['data:', 'http:', 'https:', 'mailto:', 'ftp:'];
  1798. /**
  1799. * Checks that the URL scheme is not javascript.
  1800. * The URL parsing relies on the URL API in browsers that support it.
  1801. * @param url The URL to sanitize for a SafeUrl sink.
  1802. * @return undefined if url has a javascript: scheme, the original URL
  1803. * otherwise.
  1804. */
  1805. function sanitizeJavascriptUrl(url) {
  1806. var parsedScheme = extractScheme(url);
  1807. if (parsedScheme === 'javascript:') {
  1808. if (true) {
  1809. console.error("A URL with content '".concat(url, "' was sanitized away."));
  1810. }
  1811. return undefined;
  1812. }
  1813. return url;
  1814. }
  1815. exports.sanitizeJavascriptUrl = sanitizeJavascriptUrl;
  1816. /**
  1817. * Adapter to sanitize string URLs in DOM sink wrappers.
  1818. * @return undefined if the URL was sanitized.
  1819. */
  1820. function unwrapUrlOrSanitize(url) {
  1821. return sanitizeJavascriptUrl(url);
  1822. }
  1823. exports.unwrapUrlOrSanitize = unwrapUrlOrSanitize;
  1824. /**
  1825. * Sanitizes a URL restrictively.
  1826. * This sanitizer protects against XSS and potentially other uncommon and
  1827. * undesirable schemes that an attacker could use for e.g. phishing (tel:,
  1828. * callto: ssh: etc schemes). This sanitizer is primarily meant to be used by
  1829. * the HTML sanitizer.
  1830. */
  1831. function restrictivelySanitizeUrl(url) {
  1832. var parsedScheme = extractScheme(url);
  1833. if (parsedScheme !== undefined &&
  1834. ALLOWED_SCHEMES.indexOf(parsedScheme.toLowerCase()) !== -1) {
  1835. return url;
  1836. }
  1837. return 'about:invalid#zClosurez';
  1838. }
  1839. exports.restrictivelySanitizeUrl = restrictivelySanitizeUrl;
  1840. /***/ }),
  1841. /***/ "./node_modules/safevalues/dom/elements/anchor.js":
  1842. /*!********************************************************!*\
  1843. !*** ./node_modules/safevalues/dom/elements/anchor.js ***!
  1844. \********************************************************/
  1845. /*! no static exports found */
  1846. /***/ (function(module, exports, __webpack_require__) {
  1847. "use strict";
  1848. /**
  1849. * @license
  1850. * SPDX-License-Identifier: Apache-2.0
  1851. */
  1852. Object.defineProperty(exports, "__esModule", { value: true });
  1853. exports.setHref = void 0;
  1854. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  1855. /**
  1856. * Sets the Href attribute from the given Url.
  1857. */
  1858. function setHref(anchor, url) {
  1859. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  1860. if (sanitizedUrl !== undefined) {
  1861. anchor.href = sanitizedUrl;
  1862. }
  1863. }
  1864. exports.setHref = setHref;
  1865. /***/ }),
  1866. /***/ "./node_modules/safevalues/dom/elements/area.js":
  1867. /*!******************************************************!*\
  1868. !*** ./node_modules/safevalues/dom/elements/area.js ***!
  1869. \******************************************************/
  1870. /*! no static exports found */
  1871. /***/ (function(module, exports, __webpack_require__) {
  1872. "use strict";
  1873. /**
  1874. * @license
  1875. * SPDX-License-Identifier: Apache-2.0
  1876. */
  1877. Object.defineProperty(exports, "__esModule", { value: true });
  1878. exports.setHref = void 0;
  1879. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  1880. /**
  1881. * Sets the Href attribute from the given Url.
  1882. */
  1883. function setHref(area, url) {
  1884. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  1885. if (sanitizedUrl !== undefined) {
  1886. area.href = sanitizedUrl;
  1887. }
  1888. }
  1889. exports.setHref = setHref;
  1890. /***/ }),
  1891. /***/ "./node_modules/safevalues/dom/elements/button.js":
  1892. /*!********************************************************!*\
  1893. !*** ./node_modules/safevalues/dom/elements/button.js ***!
  1894. \********************************************************/
  1895. /*! no static exports found */
  1896. /***/ (function(module, exports, __webpack_require__) {
  1897. "use strict";
  1898. /**
  1899. * @license
  1900. * SPDX-License-Identifier: Apache-2.0
  1901. */
  1902. Object.defineProperty(exports, "__esModule", { value: true });
  1903. exports.setFormaction = void 0;
  1904. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  1905. /**
  1906. * Sets the Formaction attribute from the given Url.
  1907. */
  1908. function setFormaction(button, url) {
  1909. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  1910. if (sanitizedUrl !== undefined) {
  1911. button.formAction = sanitizedUrl;
  1912. }
  1913. }
  1914. exports.setFormaction = setFormaction;
  1915. /***/ }),
  1916. /***/ "./node_modules/safevalues/dom/elements/element.js":
  1917. /*!*********************************************************!*\
  1918. !*** ./node_modules/safevalues/dom/elements/element.js ***!
  1919. \*********************************************************/
  1920. /*! no static exports found */
  1921. /***/ (function(module, exports, __webpack_require__) {
  1922. "use strict";
  1923. /**
  1924. * @license
  1925. * SPDX-License-Identifier: Apache-2.0
  1926. */
  1927. var __read = (this && this.__read) || function (o, n) {
  1928. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1929. if (!m) return o;
  1930. var i = m.call(o), r, ar = [], e;
  1931. try {
  1932. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1933. }
  1934. catch (error) { e = { error: error }; }
  1935. finally {
  1936. try {
  1937. if (r && !r.done && (m = i["return"])) m.call(i);
  1938. }
  1939. finally { if (e) throw e.error; }
  1940. }
  1941. return ar;
  1942. };
  1943. var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
  1944. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  1945. if (ar || !(i in from)) {
  1946. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  1947. ar[i] = from[i];
  1948. }
  1949. }
  1950. return to.concat(ar || Array.prototype.slice.call(from));
  1951. };
  1952. Object.defineProperty(exports, "__esModule", { value: true });
  1953. exports.setPrefixedAttribute = exports.buildPrefixedAttributeSetter = exports.insertAdjacentHtml = exports.setCssText = exports.setOuterHtml = exports.setInnerHtml = void 0;
  1954. /**
  1955. * @fileoverview This contains safe wrappers for properties that aren't specific
  1956. * to one kind of HTMLElement (like innerHTML), plus other setters and functions
  1957. * that are not tied to elements (like location.href or Worker constructor).
  1958. */
  1959. var attribute_impl_1 = __webpack_require__(/*! ../../internals/attribute_impl */ "./node_modules/safevalues/internals/attribute_impl.js");
  1960. var html_impl_1 = __webpack_require__(/*! ../../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  1961. var style_impl_1 = __webpack_require__(/*! ../../internals/style_impl */ "./node_modules/safevalues/internals/style_impl.js");
  1962. /**
  1963. * Safely set {@link Element.innerHTML} on a given ShadowRoot or Element which
  1964. * may not be a `<script>` element or a `<style>` element.
  1965. */
  1966. function setInnerHtml(elOrRoot, v) {
  1967. if (isElement(elOrRoot)) {
  1968. throwIfScriptOrStyle(elOrRoot);
  1969. }
  1970. elOrRoot.innerHTML = (0, html_impl_1.unwrapHtml)(v);
  1971. }
  1972. exports.setInnerHtml = setInnerHtml;
  1973. /**
  1974. * Safely set {@link Element.outerHTML} for the given Element.
  1975. */
  1976. function setOuterHtml(e, v) {
  1977. var parent = e.parentElement;
  1978. if (parent !== null) {
  1979. throwIfScriptOrStyle(parent);
  1980. }
  1981. e.outerHTML = (0, html_impl_1.unwrapHtml)(v);
  1982. }
  1983. exports.setOuterHtml = setOuterHtml;
  1984. /**
  1985. * Set `ElementCSSInlineStyle.cssText` for the given `ElementCSSInlineStyle`.
  1986. */
  1987. function setCssText(e, v) {
  1988. e.style.cssText = (0, style_impl_1.unwrapStyle)(v);
  1989. }
  1990. exports.setCssText = setCssText;
  1991. /**
  1992. * Safely call {@link Element.insertAdjacentHTML} for the given Element.
  1993. */
  1994. function insertAdjacentHtml(element, position, v) {
  1995. var tagContext = (position === 'beforebegin' || position === 'afterend') ?
  1996. element.parentElement :
  1997. element;
  1998. if (tagContext !== null) {
  1999. throwIfScriptOrStyle(tagContext);
  2000. }
  2001. element.insertAdjacentHTML(position, (0, html_impl_1.unwrapHtml)(v));
  2002. }
  2003. exports.insertAdjacentHtml = insertAdjacentHtml;
  2004. /**
  2005. * Given a set of known-to-be-safe prefixes (e.g., "data-", "aria-", "js"),
  2006. * return a setter function that allows you to set attributes on an element,
  2007. * as long as the names of the attributes to be set has one of the prefixes.
  2008. *
  2009. * The returned setter ensures that setting any dangerous attribute, e.g.,
  2010. * "src", "href" will cause an exception. This is intended to be used as the
  2011. * safe alterantive of `Element#setAttribute`, when applications need to set
  2012. * attributes that do not have security implications and do not have a
  2013. * corresponding DOM property.
  2014. */
  2015. function buildPrefixedAttributeSetter(prefix) {
  2016. var otherPrefixes = [];
  2017. for (var _i = 1; _i < arguments.length; _i++) {
  2018. otherPrefixes[_i - 1] = arguments[_i];
  2019. }
  2020. var prefixes = __spreadArray([prefix], __read(otherPrefixes), false);
  2021. return function (e, attr, value) {
  2022. setPrefixedAttribute(prefixes, e, attr, value);
  2023. };
  2024. }
  2025. exports.buildPrefixedAttributeSetter = buildPrefixedAttributeSetter;
  2026. /**
  2027. * The safe alternative to Element#setAttribute. The function takes a list of
  2028. * `SafeAttributePrefix`, making developer intention explicit. The attribute
  2029. * to be set must has one of the safe prefixes, otherwise the function throws
  2030. * an Error.
  2031. */
  2032. function setPrefixedAttribute(attrPrefixes, e, attr, value) {
  2033. if (attrPrefixes.length === 0) {
  2034. throw new Error('No prefixes are provided');
  2035. }
  2036. var prefixes = attrPrefixes.map(function (s) { return (0, attribute_impl_1.unwrapAttributePrefix)(s); });
  2037. var attrLower = attr.toLowerCase();
  2038. if (prefixes.every(function (p) { return attrLower.indexOf(p) !== 0; })) {
  2039. throw new Error("Attribute \"".concat(attr, "\" does not match any of the allowed prefixes."));
  2040. }
  2041. e.setAttribute(attr, value);
  2042. }
  2043. exports.setPrefixedAttribute = setPrefixedAttribute;
  2044. function throwIfScriptOrStyle(element) {
  2045. if (element.tagName.toLowerCase() === 'script') {
  2046. throw new Error('Use setTextContent with a SafeScript.');
  2047. }
  2048. else if (element.tagName.toLowerCase() === 'style') {
  2049. throw new Error('Use setTextContent with a SafeStyleSheet.');
  2050. }
  2051. }
  2052. function isElement(elOrRoot) {
  2053. return elOrRoot.tagName !== undefined;
  2054. }
  2055. /***/ }),
  2056. /***/ "./node_modules/safevalues/dom/elements/embed.js":
  2057. /*!*******************************************************!*\
  2058. !*** ./node_modules/safevalues/dom/elements/embed.js ***!
  2059. \*******************************************************/
  2060. /*! no static exports found */
  2061. /***/ (function(module, exports, __webpack_require__) {
  2062. "use strict";
  2063. /**
  2064. * @license
  2065. * SPDX-License-Identifier: Apache-2.0
  2066. */
  2067. Object.defineProperty(exports, "__esModule", { value: true });
  2068. exports.setSrc = void 0;
  2069. var resource_url_impl_1 = __webpack_require__(/*! ../../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2070. /**
  2071. * Sets the Src attribute from the given SafeUrl.
  2072. */
  2073. function setSrc(embedEl, url) {
  2074. embedEl.src = (0, resource_url_impl_1.unwrapResourceUrl)(url);
  2075. }
  2076. exports.setSrc = setSrc;
  2077. /***/ }),
  2078. /***/ "./node_modules/safevalues/dom/elements/form.js":
  2079. /*!******************************************************!*\
  2080. !*** ./node_modules/safevalues/dom/elements/form.js ***!
  2081. \******************************************************/
  2082. /*! no static exports found */
  2083. /***/ (function(module, exports, __webpack_require__) {
  2084. "use strict";
  2085. /**
  2086. * @license
  2087. * SPDX-License-Identifier: Apache-2.0
  2088. */
  2089. Object.defineProperty(exports, "__esModule", { value: true });
  2090. exports.setAction = void 0;
  2091. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  2092. /**
  2093. * Sets the Action attribute from the given Url.
  2094. */
  2095. function setAction(form, url) {
  2096. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  2097. if (sanitizedUrl !== undefined) {
  2098. form.action = sanitizedUrl;
  2099. }
  2100. }
  2101. exports.setAction = setAction;
  2102. /***/ }),
  2103. /***/ "./node_modules/safevalues/dom/elements/iframe.js":
  2104. /*!********************************************************!*\
  2105. !*** ./node_modules/safevalues/dom/elements/iframe.js ***!
  2106. \********************************************************/
  2107. /*! no static exports found */
  2108. /***/ (function(module, exports, __webpack_require__) {
  2109. "use strict";
  2110. /**
  2111. * @license
  2112. * SPDX-License-Identifier: Apache-2.0
  2113. */
  2114. Object.defineProperty(exports, "__esModule", { value: true });
  2115. exports.setSrcdoc = exports.setSrc = void 0;
  2116. /**
  2117. * @fileoverview Safe iframe helpers and go/intents-for-iframes-for-closure
  2118. */
  2119. var html_impl_1 = __webpack_require__(/*! ../../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  2120. var resource_url_impl_1 = __webpack_require__(/*! ../../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2121. /** Sets the Src attribute using a TrustedResourceUrl */
  2122. function setSrc(iframe, v) {
  2123. iframe.src = (0, resource_url_impl_1.unwrapResourceUrl)(v).toString();
  2124. }
  2125. exports.setSrc = setSrc;
  2126. /** Sets the Srcdoc attribute using a SafeHtml */
  2127. function setSrcdoc(iframe, v) {
  2128. iframe.srcdoc = (0, html_impl_1.unwrapHtml)(v);
  2129. }
  2130. exports.setSrcdoc = setSrcdoc;
  2131. /***/ }),
  2132. /***/ "./node_modules/safevalues/dom/elements/input.js":
  2133. /*!*******************************************************!*\
  2134. !*** ./node_modules/safevalues/dom/elements/input.js ***!
  2135. \*******************************************************/
  2136. /*! no static exports found */
  2137. /***/ (function(module, exports, __webpack_require__) {
  2138. "use strict";
  2139. /**
  2140. * @license
  2141. * SPDX-License-Identifier: Apache-2.0
  2142. */
  2143. Object.defineProperty(exports, "__esModule", { value: true });
  2144. exports.setFormaction = void 0;
  2145. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  2146. /**
  2147. * Sets the Formaction attribute from the given Url.
  2148. */
  2149. function setFormaction(input, url) {
  2150. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  2151. if (sanitizedUrl !== undefined) {
  2152. input.formAction = sanitizedUrl;
  2153. }
  2154. }
  2155. exports.setFormaction = setFormaction;
  2156. /***/ }),
  2157. /***/ "./node_modules/safevalues/dom/elements/link.js":
  2158. /*!******************************************************!*\
  2159. !*** ./node_modules/safevalues/dom/elements/link.js ***!
  2160. \******************************************************/
  2161. /*! no static exports found */
  2162. /***/ (function(module, exports, __webpack_require__) {
  2163. "use strict";
  2164. /**
  2165. * @license
  2166. * SPDX-License-Identifier: Apache-2.0
  2167. */
  2168. Object.defineProperty(exports, "__esModule", { value: true });
  2169. exports.setHrefAndRel = void 0;
  2170. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  2171. var resource_url_impl_1 = __webpack_require__(/*! ../../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2172. var SAFE_URL_REL_VALUES = [
  2173. 'alternate',
  2174. 'author',
  2175. 'bookmark',
  2176. 'canonical',
  2177. 'cite',
  2178. 'help',
  2179. 'icon',
  2180. 'license',
  2181. 'next',
  2182. 'prefetch',
  2183. 'dns-prefetch',
  2184. 'prerender',
  2185. 'preconnect',
  2186. 'preload',
  2187. 'prev',
  2188. 'search',
  2189. 'subresource',
  2190. ];
  2191. function setHrefAndRel(link, url, rel) {
  2192. if (url instanceof resource_url_impl_1.TrustedResourceUrl) {
  2193. link.href = (0, resource_url_impl_1.unwrapResourceUrl)(url).toString();
  2194. }
  2195. else {
  2196. if (SAFE_URL_REL_VALUES.indexOf(rel) === -1) {
  2197. throw new Error("TrustedResourceUrl href attribute required with rel=\"".concat(rel, "\""));
  2198. }
  2199. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  2200. if (sanitizedUrl === undefined) {
  2201. return;
  2202. }
  2203. link.href = sanitizedUrl;
  2204. }
  2205. link.rel = rel;
  2206. }
  2207. exports.setHrefAndRel = setHrefAndRel;
  2208. /***/ }),
  2209. /***/ "./node_modules/safevalues/dom/elements/object.js":
  2210. /*!********************************************************!*\
  2211. !*** ./node_modules/safevalues/dom/elements/object.js ***!
  2212. \********************************************************/
  2213. /*! no static exports found */
  2214. /***/ (function(module, exports, __webpack_require__) {
  2215. "use strict";
  2216. /**
  2217. * @license
  2218. * SPDX-License-Identifier: Apache-2.0
  2219. */
  2220. Object.defineProperty(exports, "__esModule", { value: true });
  2221. exports.setData = void 0;
  2222. var resource_url_impl_1 = __webpack_require__(/*! ../../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2223. /** Sets the data attribute using a TrustedResourceUrl */
  2224. function setData(obj, v) {
  2225. obj.data = (0, resource_url_impl_1.unwrapResourceUrl)(v);
  2226. }
  2227. exports.setData = setData;
  2228. /***/ }),
  2229. /***/ "./node_modules/safevalues/dom/elements/script.js":
  2230. /*!********************************************************!*\
  2231. !*** ./node_modules/safevalues/dom/elements/script.js ***!
  2232. \********************************************************/
  2233. /*! no static exports found */
  2234. /***/ (function(module, exports, __webpack_require__) {
  2235. "use strict";
  2236. /**
  2237. * @license
  2238. * SPDX-License-Identifier: Apache-2.0
  2239. */
  2240. Object.defineProperty(exports, "__esModule", { value: true });
  2241. exports.setSrc = exports.setTextContent = void 0;
  2242. var resource_url_impl_1 = __webpack_require__(/*! ../../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2243. var script_impl_1 = __webpack_require__(/*! ../../internals/script_impl */ "./node_modules/safevalues/internals/script_impl.js");
  2244. /** Returns CSP nonce, if set for any script tag. */
  2245. function getScriptNonceFromWindow(win) {
  2246. var _a;
  2247. var doc = win.document;
  2248. // document.querySelector can be undefined in non-browser environments.
  2249. var script = (_a = doc.querySelector) === null || _a === void 0 ? void 0 : _a.call(doc, 'script[nonce]');
  2250. if (script) {
  2251. // Try to get the nonce from the IDL property first, because browsers that
  2252. // implement additional nonce protection features (currently only Chrome) to
  2253. // prevent nonce stealing via CSS do not expose the nonce via attributes.
  2254. // See https://github.com/whatwg/html/issues/2369
  2255. return script['nonce'] || script.getAttribute('nonce') || '';
  2256. }
  2257. return '';
  2258. }
  2259. /** Propagates CSP nonce to dynamically created scripts. */
  2260. function setNonceForScriptElement(script) {
  2261. var win = script.ownerDocument && script.ownerDocument.defaultView;
  2262. var nonce = getScriptNonceFromWindow(win || window);
  2263. if (nonce) {
  2264. script.setAttribute('nonce', nonce);
  2265. }
  2266. }
  2267. /** Sets textContent from the given SafeScript. */
  2268. function setTextContent(script, v) {
  2269. script.textContent = (0, script_impl_1.unwrapScript)(v);
  2270. setNonceForScriptElement(script);
  2271. }
  2272. exports.setTextContent = setTextContent;
  2273. /** Sets the Src attribute using a TrustedResourceUrl */
  2274. function setSrc(script, v) {
  2275. script.src = (0, resource_url_impl_1.unwrapResourceUrl)(v);
  2276. setNonceForScriptElement(script);
  2277. }
  2278. exports.setSrc = setSrc;
  2279. /***/ }),
  2280. /***/ "./node_modules/safevalues/dom/elements/style.js":
  2281. /*!*******************************************************!*\
  2282. !*** ./node_modules/safevalues/dom/elements/style.js ***!
  2283. \*******************************************************/
  2284. /*! no static exports found */
  2285. /***/ (function(module, exports, __webpack_require__) {
  2286. "use strict";
  2287. /**
  2288. * @license
  2289. * SPDX-License-Identifier: Apache-2.0
  2290. */
  2291. Object.defineProperty(exports, "__esModule", { value: true });
  2292. exports.setTextContent = void 0;
  2293. var style_sheet_impl_1 = __webpack_require__(/*! ../../internals/style_sheet_impl */ "./node_modules/safevalues/internals/style_sheet_impl.js");
  2294. /** Safe setters for `HTMLStyleElement`s. */
  2295. function setTextContent(elem, safeStyleSheet) {
  2296. elem.textContent = (0, style_sheet_impl_1.unwrapStyleSheet)(safeStyleSheet);
  2297. }
  2298. exports.setTextContent = setTextContent;
  2299. /***/ }),
  2300. /***/ "./node_modules/safevalues/dom/globals/document.js":
  2301. /*!*********************************************************!*\
  2302. !*** ./node_modules/safevalues/dom/globals/document.js ***!
  2303. \*********************************************************/
  2304. /*! no static exports found */
  2305. /***/ (function(module, exports, __webpack_require__) {
  2306. "use strict";
  2307. /**
  2308. * @license
  2309. * SPDX-License-Identifier: Apache-2.0
  2310. */
  2311. Object.defineProperty(exports, "__esModule", { value: true });
  2312. exports.execCommandInsertHtml = exports.execCommand = exports.write = void 0;
  2313. var html_impl_1 = __webpack_require__(/*! ../../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  2314. /**
  2315. * write safely calls {@link Document.write} on the given {@link Document} with
  2316. * the given {@link SafeHtml}.
  2317. */
  2318. function write(doc, text) {
  2319. doc.write((0, html_impl_1.unwrapHtml)(text));
  2320. }
  2321. exports.write = write;
  2322. /**
  2323. * Safely calls {@link Document.execCommand}. When command is insertHtml, a
  2324. * SafeHtml must be passed in as value.
  2325. */
  2326. function execCommand(doc, command, value) {
  2327. var commandString = String(command);
  2328. var valueArgument = value;
  2329. if (commandString.toLowerCase() === 'inserthtml') {
  2330. valueArgument = (0, html_impl_1.unwrapHtml)(value);
  2331. }
  2332. return doc.execCommand(commandString, /* showUi= */ false, valueArgument);
  2333. }
  2334. exports.execCommand = execCommand;
  2335. /**
  2336. * Safely calls {@link Document.execCommand}('insertHtml').
  2337. * @deprecated Use safeDocument.execCommand.
  2338. */
  2339. function execCommandInsertHtml(doc, html) {
  2340. return doc.execCommand('insertHTML', /* showUi= */ false, (0, html_impl_1.unwrapHtml)(html));
  2341. }
  2342. exports.execCommandInsertHtml = execCommandInsertHtml;
  2343. /***/ }),
  2344. /***/ "./node_modules/safevalues/dom/globals/dom_parser.js":
  2345. /*!***********************************************************!*\
  2346. !*** ./node_modules/safevalues/dom/globals/dom_parser.js ***!
  2347. \***********************************************************/
  2348. /*! no static exports found */
  2349. /***/ (function(module, exports, __webpack_require__) {
  2350. "use strict";
  2351. /**
  2352. * @license
  2353. * SPDX-License-Identifier: Apache-2.0
  2354. */
  2355. Object.defineProperty(exports, "__esModule", { value: true });
  2356. exports.parseFromString = exports.parseHtml = void 0;
  2357. var html_impl_1 = __webpack_require__(/*! ../../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  2358. /** Safely parses a string using the HTML parser. */
  2359. function parseHtml(parser, html) {
  2360. return parseFromString(parser, html, 'text/html');
  2361. }
  2362. exports.parseHtml = parseHtml;
  2363. /** Safely parses a string using the HTML or XML parser. */
  2364. function parseFromString(parser, content, contentType) {
  2365. return parser.parseFromString((0, html_impl_1.unwrapHtml)(content), contentType);
  2366. }
  2367. exports.parseFromString = parseFromString;
  2368. /***/ }),
  2369. /***/ "./node_modules/safevalues/dom/globals/global.js":
  2370. /*!*******************************************************!*\
  2371. !*** ./node_modules/safevalues/dom/globals/global.js ***!
  2372. \*******************************************************/
  2373. /*! no static exports found */
  2374. /***/ (function(module, exports, __webpack_require__) {
  2375. "use strict";
  2376. /**
  2377. * @license
  2378. * SPDX-License-Identifier: Apache-2.0
  2379. */
  2380. Object.defineProperty(exports, "__esModule", { value: true });
  2381. exports.globalEval = void 0;
  2382. var script_impl_1 = __webpack_require__(/*! ../../internals/script_impl */ "./node_modules/safevalues/internals/script_impl.js");
  2383. /**
  2384. * Evaluates a SafeScript value in the given scope using eval.
  2385. *
  2386. * Strongly consider avoiding this, as eval blocks CSP adoption and does not
  2387. * benefit from compiler optimizations.
  2388. */
  2389. function globalEval(win, script) {
  2390. var trustedScript = (0, script_impl_1.unwrapScript)(script);
  2391. var result = win.eval(trustedScript);
  2392. if (result === trustedScript) {
  2393. // https://crbug.com/1024786 manifesting in workers.
  2394. result = win.eval(trustedScript.toString());
  2395. }
  2396. return result;
  2397. }
  2398. exports.globalEval = globalEval;
  2399. /***/ }),
  2400. /***/ "./node_modules/safevalues/dom/globals/location.js":
  2401. /*!*********************************************************!*\
  2402. !*** ./node_modules/safevalues/dom/globals/location.js ***!
  2403. \*********************************************************/
  2404. /*! no static exports found */
  2405. /***/ (function(module, exports, __webpack_require__) {
  2406. "use strict";
  2407. /**
  2408. * @license
  2409. * SPDX-License-Identifier: Apache-2.0
  2410. */
  2411. Object.defineProperty(exports, "__esModule", { value: true });
  2412. exports.assign = exports.replace = exports.setHref = void 0;
  2413. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  2414. /**
  2415. * setHref safely sets {@link Location.href} on the given {@link Location} with
  2416. * given {@link Url}.
  2417. */
  2418. function setHref(loc, url) {
  2419. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  2420. if (sanitizedUrl !== undefined) {
  2421. loc.href = sanitizedUrl;
  2422. }
  2423. }
  2424. exports.setHref = setHref;
  2425. /**
  2426. * replace safely calls {@link Location.replace} on the given {@link Location}
  2427. * with given {@link Url}.
  2428. */
  2429. function replace(loc, url) {
  2430. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  2431. if (sanitizedUrl !== undefined) {
  2432. loc.replace(sanitizedUrl);
  2433. }
  2434. }
  2435. exports.replace = replace;
  2436. /**
  2437. * assign safely calls {@link Location.assign} on the given {@link Location}
  2438. * with given {@link Url}.
  2439. */
  2440. function assign(loc, url) {
  2441. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  2442. if (sanitizedUrl !== undefined) {
  2443. loc.assign(sanitizedUrl);
  2444. }
  2445. }
  2446. exports.assign = assign;
  2447. /***/ }),
  2448. /***/ "./node_modules/safevalues/dom/globals/range.js":
  2449. /*!******************************************************!*\
  2450. !*** ./node_modules/safevalues/dom/globals/range.js ***!
  2451. \******************************************************/
  2452. /*! no static exports found */
  2453. /***/ (function(module, exports, __webpack_require__) {
  2454. "use strict";
  2455. /**
  2456. * @license
  2457. * SPDX-License-Identifier: Apache-2.0
  2458. */
  2459. Object.defineProperty(exports, "__esModule", { value: true });
  2460. exports.createContextualFragment = void 0;
  2461. var html_impl_1 = __webpack_require__(/*! ../../internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  2462. /** Safely creates a contextualFragment. */
  2463. function createContextualFragment(range, html) {
  2464. return range.createContextualFragment((0, html_impl_1.unwrapHtml)(html));
  2465. }
  2466. exports.createContextualFragment = createContextualFragment;
  2467. /***/ }),
  2468. /***/ "./node_modules/safevalues/dom/globals/service_worker_container.js":
  2469. /*!*************************************************************************!*\
  2470. !*** ./node_modules/safevalues/dom/globals/service_worker_container.js ***!
  2471. \*************************************************************************/
  2472. /*! no static exports found */
  2473. /***/ (function(module, exports, __webpack_require__) {
  2474. "use strict";
  2475. /**
  2476. * @license
  2477. * SPDX-License-Identifier: Apache-2.0
  2478. */
  2479. Object.defineProperty(exports, "__esModule", { value: true });
  2480. exports.register = void 0;
  2481. var resource_url_impl_1 = __webpack_require__(/*! ../../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2482. /** Safely registers a service worker by URL */
  2483. function register(container, scriptURL, options) {
  2484. return container.register((0, resource_url_impl_1.unwrapResourceUrl)(scriptURL), options);
  2485. }
  2486. exports.register = register;
  2487. /***/ }),
  2488. /***/ "./node_modules/safevalues/dom/globals/window.js":
  2489. /*!*******************************************************!*\
  2490. !*** ./node_modules/safevalues/dom/globals/window.js ***!
  2491. \*******************************************************/
  2492. /*! no static exports found */
  2493. /***/ (function(module, exports, __webpack_require__) {
  2494. "use strict";
  2495. /**
  2496. * @license
  2497. * SPDX-License-Identifier: Apache-2.0
  2498. */
  2499. Object.defineProperty(exports, "__esModule", { value: true });
  2500. exports.open = void 0;
  2501. var url_sanitizer_1 = __webpack_require__(/*! ../../builders/url_sanitizer */ "./node_modules/safevalues/builders/url_sanitizer.js");
  2502. /**
  2503. * open calls {@link Window.open} on the given {@link Window}, given a
  2504. * target {@link Url}.
  2505. */
  2506. function open(win, url, target, features) {
  2507. var sanitizedUrl = (0, url_sanitizer_1.unwrapUrlOrSanitize)(url);
  2508. if (sanitizedUrl !== undefined) {
  2509. return win.open(sanitizedUrl, target, features);
  2510. }
  2511. return null;
  2512. }
  2513. exports.open = open;
  2514. /***/ }),
  2515. /***/ "./node_modules/safevalues/dom/globals/worker.js":
  2516. /*!*******************************************************!*\
  2517. !*** ./node_modules/safevalues/dom/globals/worker.js ***!
  2518. \*******************************************************/
  2519. /*! no static exports found */
  2520. /***/ (function(module, exports, __webpack_require__) {
  2521. "use strict";
  2522. /**
  2523. * @license
  2524. * SPDX-License-Identifier: Apache-2.0
  2525. */
  2526. var __read = (this && this.__read) || function (o, n) {
  2527. var m = typeof Symbol === "function" && o[Symbol.iterator];
  2528. if (!m) return o;
  2529. var i = m.call(o), r, ar = [], e;
  2530. try {
  2531. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  2532. }
  2533. catch (error) { e = { error: error }; }
  2534. finally {
  2535. try {
  2536. if (r && !r.done && (m = i["return"])) m.call(i);
  2537. }
  2538. finally { if (e) throw e.error; }
  2539. }
  2540. return ar;
  2541. };
  2542. var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
  2543. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  2544. if (ar || !(i in from)) {
  2545. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  2546. ar[i] = from[i];
  2547. }
  2548. }
  2549. return to.concat(ar || Array.prototype.slice.call(from));
  2550. };
  2551. Object.defineProperty(exports, "__esModule", { value: true });
  2552. exports.importScripts = exports.createShared = exports.create = void 0;
  2553. var resource_url_impl_1 = __webpack_require__(/*! ../../internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2554. /**
  2555. * Safely creates a Web Worker.
  2556. *
  2557. * Example usage:
  2558. * const trustedResourceUrl = trustedResourceUrl`/safe_script.js`;
  2559. * safedom.safeWorker.create(trustedResourceUrl);
  2560. * which is a safe alternative to
  2561. * new Worker(url);
  2562. * The latter can result in loading untrusted code.
  2563. */
  2564. function create(url, options) {
  2565. return new Worker((0, resource_url_impl_1.unwrapResourceUrl)(url), options);
  2566. }
  2567. exports.create = create;
  2568. /** Safely creates a shared Web Worker. */
  2569. function createShared(url, options) {
  2570. return new SharedWorker((0, resource_url_impl_1.unwrapResourceUrl)(url), options);
  2571. }
  2572. exports.createShared = createShared;
  2573. /** Safely calls importScripts */
  2574. function importScripts(scope) {
  2575. var urls = [];
  2576. for (var _i = 1; _i < arguments.length; _i++) {
  2577. urls[_i - 1] = arguments[_i];
  2578. }
  2579. scope.importScripts.apply(scope, __spreadArray([], __read(urls.map(function (url) { return (0, resource_url_impl_1.unwrapResourceUrl)(url); })), false));
  2580. }
  2581. exports.importScripts = importScripts;
  2582. /***/ }),
  2583. /***/ "./node_modules/safevalues/dom/index.js":
  2584. /*!**********************************************!*\
  2585. !*** ./node_modules/safevalues/dom/index.js ***!
  2586. \**********************************************/
  2587. /*! no static exports found */
  2588. /***/ (function(module, exports, __webpack_require__) {
  2589. "use strict";
  2590. /**
  2591. * @license
  2592. * SPDX-License-Identifier: Apache-2.0
  2593. */
  2594. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  2595. if (k2 === undefined) k2 = k;
  2596. var desc = Object.getOwnPropertyDescriptor(m, k);
  2597. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  2598. desc = { enumerable: true, get: function() { return m[k]; } };
  2599. }
  2600. Object.defineProperty(o, k2, desc);
  2601. }) : (function(o, m, k, k2) {
  2602. if (k2 === undefined) k2 = k;
  2603. o[k2] = m[k];
  2604. }));
  2605. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  2606. Object.defineProperty(o, "default", { enumerable: true, value: v });
  2607. }) : function(o, v) {
  2608. o["default"] = v;
  2609. });
  2610. var __importStar = (this && this.__importStar) || function (mod) {
  2611. if (mod && mod.__esModule) return mod;
  2612. var result = {};
  2613. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  2614. __setModuleDefault(result, mod);
  2615. return result;
  2616. };
  2617. Object.defineProperty(exports, "__esModule", { value: true });
  2618. exports.safeWorker = exports.safeWindow = exports.safeServiceWorkerContainer = exports.safeRange = exports.safeLocation = exports.safeGlobal = exports.safeDomParser = exports.safeDocument = exports.safeStyleEl = exports.safeScriptEl = exports.safeObjectEl = exports.safeLinkEl = exports.safeInputEl = exports.safeIframeEl = exports.safeFormEl = exports.safeEmbedEl = exports.safeElement = exports.safeButtonEl = exports.safeAreaEl = exports.safeAnchorEl = void 0;
  2619. /**
  2620. * @fileoverview This file re-exports all of the wrappers to ensure that we have
  2621. * a clearly defined interface.
  2622. */
  2623. exports.safeAnchorEl = __importStar(__webpack_require__(/*! ./elements/anchor */ "./node_modules/safevalues/dom/elements/anchor.js"));
  2624. exports.safeAreaEl = __importStar(__webpack_require__(/*! ./elements/area */ "./node_modules/safevalues/dom/elements/area.js"));
  2625. exports.safeButtonEl = __importStar(__webpack_require__(/*! ./elements/button */ "./node_modules/safevalues/dom/elements/button.js"));
  2626. exports.safeElement = __importStar(__webpack_require__(/*! ./elements/element */ "./node_modules/safevalues/dom/elements/element.js"));
  2627. exports.safeEmbedEl = __importStar(__webpack_require__(/*! ./elements/embed */ "./node_modules/safevalues/dom/elements/embed.js"));
  2628. exports.safeFormEl = __importStar(__webpack_require__(/*! ./elements/form */ "./node_modules/safevalues/dom/elements/form.js"));
  2629. exports.safeIframeEl = __importStar(__webpack_require__(/*! ./elements/iframe */ "./node_modules/safevalues/dom/elements/iframe.js"));
  2630. exports.safeInputEl = __importStar(__webpack_require__(/*! ./elements/input */ "./node_modules/safevalues/dom/elements/input.js"));
  2631. exports.safeLinkEl = __importStar(__webpack_require__(/*! ./elements/link */ "./node_modules/safevalues/dom/elements/link.js"));
  2632. exports.safeObjectEl = __importStar(__webpack_require__(/*! ./elements/object */ "./node_modules/safevalues/dom/elements/object.js"));
  2633. exports.safeScriptEl = __importStar(__webpack_require__(/*! ./elements/script */ "./node_modules/safevalues/dom/elements/script.js"));
  2634. exports.safeStyleEl = __importStar(__webpack_require__(/*! ./elements/style */ "./node_modules/safevalues/dom/elements/style.js"));
  2635. exports.safeDocument = __importStar(__webpack_require__(/*! ./globals/document */ "./node_modules/safevalues/dom/globals/document.js"));
  2636. exports.safeDomParser = __importStar(__webpack_require__(/*! ./globals/dom_parser */ "./node_modules/safevalues/dom/globals/dom_parser.js"));
  2637. exports.safeGlobal = __importStar(__webpack_require__(/*! ./globals/global */ "./node_modules/safevalues/dom/globals/global.js"));
  2638. exports.safeLocation = __importStar(__webpack_require__(/*! ./globals/location */ "./node_modules/safevalues/dom/globals/location.js"));
  2639. exports.safeRange = __importStar(__webpack_require__(/*! ./globals/range */ "./node_modules/safevalues/dom/globals/range.js"));
  2640. exports.safeServiceWorkerContainer = __importStar(__webpack_require__(/*! ./globals/service_worker_container */ "./node_modules/safevalues/dom/globals/service_worker_container.js"));
  2641. exports.safeWindow = __importStar(__webpack_require__(/*! ./globals/window */ "./node_modules/safevalues/dom/globals/window.js"));
  2642. exports.safeWorker = __importStar(__webpack_require__(/*! ./globals/worker */ "./node_modules/safevalues/dom/globals/worker.js"));
  2643. /***/ }),
  2644. /***/ "./node_modules/safevalues/environment/dev.js":
  2645. /*!****************************************************!*\
  2646. !*** ./node_modules/safevalues/environment/dev.js ***!
  2647. \****************************************************/
  2648. /*! no static exports found */
  2649. /***/ (function(module, exports, __webpack_require__) {
  2650. "use strict";
  2651. /* WEBPACK VAR INJECTION */(function(process) {
  2652. /**
  2653. * @license
  2654. * SPDX-License-Identifier: Apache-2.0
  2655. */
  2656. /**
  2657. * Ensure process.env.NODE_ENV is set even when not running under Webpack or
  2658. * Node. Terser will strip this out of production binaries.
  2659. */
  2660. /*#__PURE__*/ (function () {
  2661. if (typeof process === 'undefined') {
  2662. window.process = { env: { NODE_ENV: 'development' } };
  2663. }
  2664. })();
  2665. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  2666. /***/ }),
  2667. /***/ "./node_modules/safevalues/index.js":
  2668. /*!******************************************!*\
  2669. !*** ./node_modules/safevalues/index.js ***!
  2670. \******************************************/
  2671. /*! no static exports found */
  2672. /***/ (function(module, exports, __webpack_require__) {
  2673. "use strict";
  2674. /**
  2675. * @license
  2676. * SPDX-License-Identifier: Apache-2.0
  2677. */
  2678. Object.defineProperty(exports, "__esModule", { value: true });
  2679. exports.unwrapStyleSheet = exports.SafeStyleSheet = exports.isStyleSheet = exports.unwrapStyle = exports.SafeStyle = exports.isStyle = exports.unwrapScript = exports.SafeScript = exports.isScript = exports.EMPTY_SCRIPT = exports.unwrapResourceUrl = exports.TrustedResourceUrl = exports.isResourceUrl = exports.unwrapHtml = exports.SafeHtml = exports.isHtml = exports.EMPTY_HTML = exports.unwrapAttributePrefix = exports.SafeAttributePrefix = exports.safeStyleSheet = exports.concatStyleSheets = exports.safeStyle = exports.concatStyles = exports.scriptFromJson = exports.safeScriptWithArgs = exports.safeScript = exports.concatScripts = exports.trustedResourceUrl = exports.replaceFragment = exports.blobUrlFromScript = exports.appendParams = exports.HtmlSanitizerBuilder = exports.sanitizeHtmlToFragment = exports.sanitizeHtmlAssertUnchanged = exports.sanitizeHtml = exports.htmlEscape = exports.createScriptSrc = exports.createScript = exports.concatHtmls = exports.safeAttrPrefix = void 0;
  2680. /** Safe builders */
  2681. var attribute_builders_1 = __webpack_require__(/*! ./builders/attribute_builders */ "./node_modules/safevalues/builders/attribute_builders.js");
  2682. Object.defineProperty(exports, "safeAttrPrefix", { enumerable: true, get: function () { return attribute_builders_1.safeAttrPrefix; } });
  2683. var html_builders_1 = __webpack_require__(/*! ./builders/html_builders */ "./node_modules/safevalues/builders/html_builders.js");
  2684. Object.defineProperty(exports, "concatHtmls", { enumerable: true, get: function () { return html_builders_1.concatHtmls; } });
  2685. Object.defineProperty(exports, "createScript", { enumerable: true, get: function () { return html_builders_1.createScript; } });
  2686. Object.defineProperty(exports, "createScriptSrc", { enumerable: true, get: function () { return html_builders_1.createScriptSrc; } });
  2687. Object.defineProperty(exports, "htmlEscape", { enumerable: true, get: function () { return html_builders_1.htmlEscape; } });
  2688. var html_sanitizer_1 = __webpack_require__(/*! ./builders/html_sanitizer/html_sanitizer */ "./node_modules/safevalues/builders/html_sanitizer/html_sanitizer.js");
  2689. Object.defineProperty(exports, "sanitizeHtml", { enumerable: true, get: function () { return html_sanitizer_1.sanitizeHtml; } });
  2690. Object.defineProperty(exports, "sanitizeHtmlAssertUnchanged", { enumerable: true, get: function () { return html_sanitizer_1.sanitizeHtmlAssertUnchanged; } });
  2691. Object.defineProperty(exports, "sanitizeHtmlToFragment", { enumerable: true, get: function () { return html_sanitizer_1.sanitizeHtmlToFragment; } });
  2692. var html_sanitizer_builder_1 = __webpack_require__(/*! ./builders/html_sanitizer/html_sanitizer_builder */ "./node_modules/safevalues/builders/html_sanitizer/html_sanitizer_builder.js");
  2693. Object.defineProperty(exports, "HtmlSanitizerBuilder", { enumerable: true, get: function () { return html_sanitizer_builder_1.HtmlSanitizerBuilder; } });
  2694. var resource_url_builders_1 = __webpack_require__(/*! ./builders/resource_url_builders */ "./node_modules/safevalues/builders/resource_url_builders.js");
  2695. Object.defineProperty(exports, "appendParams", { enumerable: true, get: function () { return resource_url_builders_1.appendParams; } });
  2696. Object.defineProperty(exports, "blobUrlFromScript", { enumerable: true, get: function () { return resource_url_builders_1.blobUrlFromScript; } });
  2697. Object.defineProperty(exports, "replaceFragment", { enumerable: true, get: function () { return resource_url_builders_1.replaceFragment; } });
  2698. Object.defineProperty(exports, "trustedResourceUrl", { enumerable: true, get: function () { return resource_url_builders_1.trustedResourceUrl; } });
  2699. var script_builders_1 = __webpack_require__(/*! ./builders/script_builders */ "./node_modules/safevalues/builders/script_builders.js");
  2700. Object.defineProperty(exports, "concatScripts", { enumerable: true, get: function () { return script_builders_1.concatScripts; } });
  2701. Object.defineProperty(exports, "safeScript", { enumerable: true, get: function () { return script_builders_1.safeScript; } });
  2702. Object.defineProperty(exports, "safeScriptWithArgs", { enumerable: true, get: function () { return script_builders_1.safeScriptWithArgs; } });
  2703. Object.defineProperty(exports, "scriptFromJson", { enumerable: true, get: function () { return script_builders_1.scriptFromJson; } });
  2704. var style_builders_1 = __webpack_require__(/*! ./builders/style_builders */ "./node_modules/safevalues/builders/style_builders.js");
  2705. Object.defineProperty(exports, "concatStyles", { enumerable: true, get: function () { return style_builders_1.concatStyles; } });
  2706. Object.defineProperty(exports, "safeStyle", { enumerable: true, get: function () { return style_builders_1.safeStyle; } });
  2707. var style_sheet_builders_1 = __webpack_require__(/*! ./builders/style_sheet_builders */ "./node_modules/safevalues/builders/style_sheet_builders.js");
  2708. Object.defineProperty(exports, "concatStyleSheets", { enumerable: true, get: function () { return style_sheet_builders_1.concatStyleSheets; } });
  2709. Object.defineProperty(exports, "safeStyleSheet", { enumerable: true, get: function () { return style_sheet_builders_1.safeStyleSheet; } });
  2710. /** Types, constants and unwrappers */
  2711. var attribute_impl_1 = __webpack_require__(/*! ./internals/attribute_impl */ "./node_modules/safevalues/internals/attribute_impl.js");
  2712. Object.defineProperty(exports, "SafeAttributePrefix", { enumerable: true, get: function () { return attribute_impl_1.SafeAttributePrefix; } });
  2713. Object.defineProperty(exports, "unwrapAttributePrefix", { enumerable: true, get: function () { return attribute_impl_1.unwrapAttributePrefix; } });
  2714. var html_impl_1 = __webpack_require__(/*! ./internals/html_impl */ "./node_modules/safevalues/internals/html_impl.js");
  2715. Object.defineProperty(exports, "EMPTY_HTML", { enumerable: true, get: function () { return html_impl_1.EMPTY_HTML; } });
  2716. Object.defineProperty(exports, "isHtml", { enumerable: true, get: function () { return html_impl_1.isHtml; } });
  2717. Object.defineProperty(exports, "SafeHtml", { enumerable: true, get: function () { return html_impl_1.SafeHtml; } });
  2718. Object.defineProperty(exports, "unwrapHtml", { enumerable: true, get: function () { return html_impl_1.unwrapHtml; } });
  2719. var resource_url_impl_1 = __webpack_require__(/*! ./internals/resource_url_impl */ "./node_modules/safevalues/internals/resource_url_impl.js");
  2720. Object.defineProperty(exports, "isResourceUrl", { enumerable: true, get: function () { return resource_url_impl_1.isResourceUrl; } });
  2721. Object.defineProperty(exports, "TrustedResourceUrl", { enumerable: true, get: function () { return resource_url_impl_1.TrustedResourceUrl; } });
  2722. Object.defineProperty(exports, "unwrapResourceUrl", { enumerable: true, get: function () { return resource_url_impl_1.unwrapResourceUrl; } });
  2723. var script_impl_1 = __webpack_require__(/*! ./internals/script_impl */ "./node_modules/safevalues/internals/script_impl.js");
  2724. Object.defineProperty(exports, "EMPTY_SCRIPT", { enumerable: true, get: function () { return script_impl_1.EMPTY_SCRIPT; } });
  2725. Object.defineProperty(exports, "isScript", { enumerable: true, get: function () { return script_impl_1.isScript; } });
  2726. Object.defineProperty(exports, "SafeScript", { enumerable: true, get: function () { return script_impl_1.SafeScript; } });
  2727. Object.defineProperty(exports, "unwrapScript", { enumerable: true, get: function () { return script_impl_1.unwrapScript; } });
  2728. var style_impl_1 = __webpack_require__(/*! ./internals/style_impl */ "./node_modules/safevalues/internals/style_impl.js");
  2729. Object.defineProperty(exports, "isStyle", { enumerable: true, get: function () { return style_impl_1.isStyle; } });
  2730. Object.defineProperty(exports, "SafeStyle", { enumerable: true, get: function () { return style_impl_1.SafeStyle; } });
  2731. Object.defineProperty(exports, "unwrapStyle", { enumerable: true, get: function () { return style_impl_1.unwrapStyle; } });
  2732. var style_sheet_impl_1 = __webpack_require__(/*! ./internals/style_sheet_impl */ "./node_modules/safevalues/internals/style_sheet_impl.js");
  2733. Object.defineProperty(exports, "isStyleSheet", { enumerable: true, get: function () { return style_sheet_impl_1.isStyleSheet; } });
  2734. Object.defineProperty(exports, "SafeStyleSheet", { enumerable: true, get: function () { return style_sheet_impl_1.SafeStyleSheet; } });
  2735. Object.defineProperty(exports, "unwrapStyleSheet", { enumerable: true, get: function () { return style_sheet_impl_1.unwrapStyleSheet; } });
  2736. /***/ }),
  2737. /***/ "./node_modules/safevalues/internals/attribute_impl.js":
  2738. /*!*************************************************************!*\
  2739. !*** ./node_modules/safevalues/internals/attribute_impl.js ***!
  2740. \*************************************************************/
  2741. /*! no static exports found */
  2742. /***/ (function(module, exports, __webpack_require__) {
  2743. "use strict";
  2744. /**
  2745. * @license
  2746. * SPDX-License-Identifier: Apache-2.0
  2747. */
  2748. var __extends = (this && this.__extends) || (function () {
  2749. var extendStatics = function (d, b) {
  2750. extendStatics = Object.setPrototypeOf ||
  2751. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  2752. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  2753. return extendStatics(d, b);
  2754. };
  2755. return function (d, b) {
  2756. if (typeof b !== "function" && b !== null)
  2757. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  2758. extendStatics(d, b);
  2759. function __() { this.constructor = d; }
  2760. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2761. };
  2762. })();
  2763. Object.defineProperty(exports, "__esModule", { value: true });
  2764. exports.unwrapAttributePrefix = exports.createAttributePrefix = exports.SafeAttributePrefix = void 0;
  2765. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  2766. var secrets_1 = __webpack_require__(/*! ./secrets */ "./node_modules/safevalues/internals/secrets.js");
  2767. /** A prefix with which an attribute is safe to set using plain strings. */
  2768. var SafeAttributePrefix = /** @class */ (function () {
  2769. function SafeAttributePrefix() {
  2770. }
  2771. return SafeAttributePrefix;
  2772. }());
  2773. exports.SafeAttributePrefix = SafeAttributePrefix;
  2774. /** Implementation for `SafeAttributePrefix` */
  2775. var AttributePrefixImpl = /** @class */ (function (_super) {
  2776. __extends(AttributePrefixImpl, _super);
  2777. function AttributePrefixImpl(attrPrefix, token) {
  2778. var _this = _super.call(this) || this;
  2779. if (true) {
  2780. (0, secrets_1.ensureTokenIsValid)(token);
  2781. }
  2782. _this.privateDoNotAccessOrElseWrappedAttrPrefix = attrPrefix;
  2783. return _this;
  2784. }
  2785. AttributePrefixImpl.prototype.toString = function () {
  2786. return this.privateDoNotAccessOrElseWrappedAttrPrefix;
  2787. };
  2788. return AttributePrefixImpl;
  2789. }(SafeAttributePrefix));
  2790. /**
  2791. * Builds a new `SafeAttribute` from the given string, without enforcing
  2792. * safety guarantees. This shouldn't be exposed to application developers, and
  2793. * must only be used as a step towards safe builders or safe constants.
  2794. */
  2795. function createAttributePrefix(attrPrefix) {
  2796. return new AttributePrefixImpl(attrPrefix, secrets_1.secretToken);
  2797. }
  2798. exports.createAttributePrefix = createAttributePrefix;
  2799. /**
  2800. * Returns the string value of the passed `SafeAttributePrefix` object while
  2801. * ensuring it has the correct type.
  2802. */
  2803. function unwrapAttributePrefix(value) {
  2804. if (value instanceof AttributePrefixImpl) {
  2805. return value.privateDoNotAccessOrElseWrappedAttrPrefix;
  2806. }
  2807. else {
  2808. var message = '';
  2809. if (true) {
  2810. message = 'Unexpected type when unwrapping SafeAttributePrefix';
  2811. }
  2812. throw new Error(message);
  2813. }
  2814. }
  2815. exports.unwrapAttributePrefix = unwrapAttributePrefix;
  2816. /***/ }),
  2817. /***/ "./node_modules/safevalues/internals/html_impl.js":
  2818. /*!********************************************************!*\
  2819. !*** ./node_modules/safevalues/internals/html_impl.js ***!
  2820. \********************************************************/
  2821. /*! no static exports found */
  2822. /***/ (function(module, exports, __webpack_require__) {
  2823. "use strict";
  2824. /**
  2825. * @license
  2826. * SPDX-License-Identifier: Apache-2.0
  2827. */
  2828. Object.defineProperty(exports, "__esModule", { value: true });
  2829. exports.unwrapHtml = exports.isHtml = exports.EMPTY_HTML = exports.createHtml = exports.SafeHtml = void 0;
  2830. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  2831. /* g3_import_pure from './pure' */
  2832. var secrets_1 = __webpack_require__(/*! ./secrets */ "./node_modules/safevalues/internals/secrets.js");
  2833. var trusted_types_1 = __webpack_require__(/*! ./trusted_types */ "./node_modules/safevalues/internals/trusted_types.js");
  2834. /**
  2835. * Runtime implementation of `TrustedHTML` in browsers that don't support it.
  2836. */
  2837. var HtmlImpl = /** @class */ (function () {
  2838. function HtmlImpl(html, token) {
  2839. if (true) {
  2840. (0, secrets_1.ensureTokenIsValid)(token);
  2841. }
  2842. this.privateDoNotAccessOrElseWrappedHtml = html;
  2843. }
  2844. HtmlImpl.prototype.toString = function () {
  2845. return this.privateDoNotAccessOrElseWrappedHtml.toString();
  2846. };
  2847. return HtmlImpl;
  2848. }());
  2849. function createHtmlInternal(html, trusted) {
  2850. return (trusted !== null && trusted !== void 0 ? trusted : new HtmlImpl(html, secrets_1.secretToken));
  2851. }
  2852. var GlobalTrustedHTML = (typeof window !== undefined) ? window.TrustedHTML : undefined;
  2853. /**
  2854. * Also exports the constructor so that instanceof checks work.
  2855. */
  2856. exports.SafeHtml = (GlobalTrustedHTML !== null && GlobalTrustedHTML !== void 0 ? GlobalTrustedHTML : HtmlImpl);
  2857. /**
  2858. * Builds a new `SafeHtml` from the given string, without enforcing safety
  2859. * guarantees. It may cause side effects by creating a Trusted Types policy.
  2860. * This shouldn't be exposed to application developers, and must only be used as
  2861. * a step towards safe builders or safe constants.
  2862. */
  2863. function createHtml(html) {
  2864. var _a;
  2865. /** @noinline */
  2866. var noinlineHtml = html;
  2867. return createHtmlInternal(noinlineHtml, (_a = (0, trusted_types_1.getTrustedTypesPolicy)()) === null || _a === void 0 ? void 0 : _a.createHTML(noinlineHtml));
  2868. }
  2869. exports.createHtml = createHtml;
  2870. /**
  2871. * An empty `SafeHtml` constant.
  2872. * Unlike the function above, using this will not create a policy.
  2873. */
  2874. exports.EMPTY_HTML =
  2875. /* #__PURE__ */ (function () { var _a; return createHtmlInternal('', (_a = (0, trusted_types_1.getTrustedTypes)()) === null || _a === void 0 ? void 0 : _a.emptyHTML); })();
  2876. /**
  2877. * Checks if the given value is a `SafeHtml` instance.
  2878. */
  2879. function isHtml(value) {
  2880. return value instanceof exports.SafeHtml;
  2881. }
  2882. exports.isHtml = isHtml;
  2883. /**
  2884. * Returns the value of the passed `SafeHtml` object while ensuring it
  2885. * has the correct type.
  2886. *
  2887. * Returns a native `TrustedHTML` or a string if Trusted Types are disabled.
  2888. */
  2889. function unwrapHtml(value) {
  2890. var _a;
  2891. if ((_a = (0, trusted_types_1.getTrustedTypes)()) === null || _a === void 0 ? void 0 : _a.isHTML(value)) {
  2892. return value;
  2893. }
  2894. else if (value instanceof HtmlImpl) {
  2895. return value.privateDoNotAccessOrElseWrappedHtml;
  2896. }
  2897. else {
  2898. var message = '';
  2899. if (true) {
  2900. message = 'Unexpected type when unwrapping SafeHtml';
  2901. }
  2902. throw new Error(message);
  2903. }
  2904. }
  2905. exports.unwrapHtml = unwrapHtml;
  2906. /***/ }),
  2907. /***/ "./node_modules/safevalues/internals/resource_url_impl.js":
  2908. /*!****************************************************************!*\
  2909. !*** ./node_modules/safevalues/internals/resource_url_impl.js ***!
  2910. \****************************************************************/
  2911. /*! no static exports found */
  2912. /***/ (function(module, exports, __webpack_require__) {
  2913. "use strict";
  2914. /**
  2915. * @license
  2916. * SPDX-License-Identifier: Apache-2.0
  2917. */
  2918. Object.defineProperty(exports, "__esModule", { value: true });
  2919. exports.unwrapResourceUrl = exports.isResourceUrl = exports.createResourceUrl = exports.TrustedResourceUrl = void 0;
  2920. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  2921. var secrets_1 = __webpack_require__(/*! ./secrets */ "./node_modules/safevalues/internals/secrets.js");
  2922. var trusted_types_1 = __webpack_require__(/*! ./trusted_types */ "./node_modules/safevalues/internals/trusted_types.js");
  2923. /**
  2924. * Runtime implementation of `TrustedScriptURL` in browsers that don't support
  2925. * it.
  2926. */
  2927. var ResourceUrlImpl = /** @class */ (function () {
  2928. function ResourceUrlImpl(url, token) {
  2929. if (true) {
  2930. (0, secrets_1.ensureTokenIsValid)(token);
  2931. }
  2932. this.privateDoNotAccessOrElseWrappedResourceUrl = url;
  2933. }
  2934. ResourceUrlImpl.prototype.toString = function () {
  2935. return this.privateDoNotAccessOrElseWrappedResourceUrl.toString();
  2936. };
  2937. return ResourceUrlImpl;
  2938. }());
  2939. var GlobalTrustedScriptURL = (typeof window !== undefined) ? window.TrustedScriptURL : undefined;
  2940. /**
  2941. * Also exports the constructor so that instanceof checks work.
  2942. */
  2943. exports.TrustedResourceUrl = (GlobalTrustedScriptURL !== null && GlobalTrustedScriptURL !== void 0 ? GlobalTrustedScriptURL : ResourceUrlImpl);
  2944. /**
  2945. * Builds a new `TrustedResourceUrl` from the given string, without
  2946. * enforcing safety guarantees. It may cause side effects by creating a Trusted
  2947. * Types policy. This shouldn't be exposed to application developers, and must
  2948. * only be used as a step towards safe builders or safe constants.
  2949. */
  2950. function createResourceUrl(url) {
  2951. var _a;
  2952. /** @noinline */
  2953. var noinlineUrl = url;
  2954. var trustedScriptURL = (_a = (0, trusted_types_1.getTrustedTypesPolicy)()) === null || _a === void 0 ? void 0 : _a.createScriptURL(noinlineUrl);
  2955. return (trustedScriptURL !== null && trustedScriptURL !== void 0 ? trustedScriptURL : new ResourceUrlImpl(noinlineUrl, secrets_1.secretToken));
  2956. }
  2957. exports.createResourceUrl = createResourceUrl;
  2958. /**
  2959. * Checks if the given value is a `TrustedResourceUrl` instance.
  2960. */
  2961. function isResourceUrl(value) {
  2962. return value instanceof exports.TrustedResourceUrl;
  2963. }
  2964. exports.isResourceUrl = isResourceUrl;
  2965. /**
  2966. * Returns the value of the passed `TrustedResourceUrl` object while ensuring it
  2967. * has the correct type.
  2968. *
  2969. * Returns a native `TrustedScriptURL` or a string if Trusted Types are
  2970. * disabled.
  2971. */
  2972. function unwrapResourceUrl(value) {
  2973. var _a;
  2974. if ((_a = (0, trusted_types_1.getTrustedTypes)()) === null || _a === void 0 ? void 0 : _a.isScriptURL(value)) {
  2975. return value;
  2976. }
  2977. else if (value instanceof ResourceUrlImpl) {
  2978. return value.privateDoNotAccessOrElseWrappedResourceUrl;
  2979. }
  2980. else {
  2981. var message = '';
  2982. if (true) {
  2983. message = 'Unexpected type when unwrapping TrustedResourceUrl';
  2984. }
  2985. throw new Error(message);
  2986. }
  2987. }
  2988. exports.unwrapResourceUrl = unwrapResourceUrl;
  2989. /***/ }),
  2990. /***/ "./node_modules/safevalues/internals/script_impl.js":
  2991. /*!**********************************************************!*\
  2992. !*** ./node_modules/safevalues/internals/script_impl.js ***!
  2993. \**********************************************************/
  2994. /*! no static exports found */
  2995. /***/ (function(module, exports, __webpack_require__) {
  2996. "use strict";
  2997. /**
  2998. * @license
  2999. * SPDX-License-Identifier: Apache-2.0
  3000. */
  3001. Object.defineProperty(exports, "__esModule", { value: true });
  3002. exports.unwrapScript = exports.isScript = exports.EMPTY_SCRIPT = exports.createScript = exports.SafeScript = void 0;
  3003. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  3004. /* g3_import_pure from './pure' */
  3005. var secrets_1 = __webpack_require__(/*! ./secrets */ "./node_modules/safevalues/internals/secrets.js");
  3006. var trusted_types_1 = __webpack_require__(/*! ./trusted_types */ "./node_modules/safevalues/internals/trusted_types.js");
  3007. /**
  3008. * Runtime implementation of `TrustedScript` in browswers that don't support it.
  3009. * script element.
  3010. */
  3011. var ScriptImpl = /** @class */ (function () {
  3012. function ScriptImpl(script, token) {
  3013. if (true) {
  3014. (0, secrets_1.ensureTokenIsValid)(token);
  3015. }
  3016. this.privateDoNotAccessOrElseWrappedScript = script;
  3017. }
  3018. ScriptImpl.prototype.toString = function () {
  3019. return this.privateDoNotAccessOrElseWrappedScript.toString();
  3020. };
  3021. return ScriptImpl;
  3022. }());
  3023. function createScriptInternal(script, trusted) {
  3024. return (trusted !== null && trusted !== void 0 ? trusted : new ScriptImpl(script, secrets_1.secretToken));
  3025. }
  3026. var GlobalTrustedScript = (typeof window !== undefined) ? window.TrustedScript : undefined;
  3027. /**
  3028. * Also exports the constructor so that instanceof checks work.
  3029. */
  3030. exports.SafeScript = (GlobalTrustedScript !== null && GlobalTrustedScript !== void 0 ? GlobalTrustedScript : ScriptImpl);
  3031. /**
  3032. * Builds a new `SafeScript` from the given string, without enforcing
  3033. * safety guarantees. It may cause side effects by creating a Trusted Types
  3034. * policy. This shouldn't be exposed to application developers, and must only be
  3035. * used as a step towards safe builders or safe constants.
  3036. */
  3037. function createScript(script) {
  3038. var _a;
  3039. /** @noinline */
  3040. var noinlineScript = script;
  3041. return createScriptInternal(noinlineScript, (_a = (0, trusted_types_1.getTrustedTypesPolicy)()) === null || _a === void 0 ? void 0 : _a.createScript(noinlineScript));
  3042. }
  3043. exports.createScript = createScript;
  3044. /**
  3045. * An empty `SafeScript` constant.
  3046. * Unlike the functions above, using this will not create a policy.
  3047. */
  3048. exports.EMPTY_SCRIPT =
  3049. /* #__PURE__ */ (function () { var _a; return createScriptInternal('', (_a = (0, trusted_types_1.getTrustedTypes)()) === null || _a === void 0 ? void 0 : _a.emptyScript); })();
  3050. /**
  3051. * Checks if the given value is a `SafeScript` instance.
  3052. */
  3053. function isScript(value) {
  3054. return value instanceof exports.SafeScript;
  3055. }
  3056. exports.isScript = isScript;
  3057. /**
  3058. * Returns the value of the passed `SafeScript` object while ensuring it
  3059. * has the correct type.
  3060. *
  3061. * Returns a native `TrustedScript` or a string if Trusted Types are disabled.
  3062. */
  3063. function unwrapScript(value) {
  3064. var _a;
  3065. if ((_a = (0, trusted_types_1.getTrustedTypes)()) === null || _a === void 0 ? void 0 : _a.isScript(value)) {
  3066. return value;
  3067. }
  3068. else if (value instanceof ScriptImpl) {
  3069. return value.privateDoNotAccessOrElseWrappedScript;
  3070. }
  3071. else {
  3072. var message = '';
  3073. if (true) {
  3074. message = 'Unexpected type when unwrapping SafeScript';
  3075. }
  3076. throw new Error(message);
  3077. }
  3078. }
  3079. exports.unwrapScript = unwrapScript;
  3080. /***/ }),
  3081. /***/ "./node_modules/safevalues/internals/secrets.js":
  3082. /*!******************************************************!*\
  3083. !*** ./node_modules/safevalues/internals/secrets.js ***!
  3084. \******************************************************/
  3085. /*! no static exports found */
  3086. /***/ (function(module, exports, __webpack_require__) {
  3087. "use strict";
  3088. /**
  3089. * @license
  3090. * SPDX-License-Identifier: Apache-2.0
  3091. */
  3092. Object.defineProperty(exports, "__esModule", { value: true });
  3093. exports.ensureTokenIsValid = exports.secretToken = void 0;
  3094. /**
  3095. * A secret token that must be passed to safe type constructors. It is only
  3096. * accessible from within safevalues, ensuring that unrestricted safe type
  3097. * creation is only possible within safevalues. In particular, this prevents
  3098. * forgery such as `safeHtmlValue.constructor('javascript:evil')`.
  3099. */
  3100. exports.secretToken = {};
  3101. /**
  3102. * Asserts that the given token matches the secret safevalues token. An
  3103. * exception is thrown if that is not the case.
  3104. */
  3105. function ensureTokenIsValid(token) {
  3106. if (token !== exports.secretToken) {
  3107. throw new Error('Bad secret');
  3108. }
  3109. }
  3110. exports.ensureTokenIsValid = ensureTokenIsValid;
  3111. /***/ }),
  3112. /***/ "./node_modules/safevalues/internals/string_literal.js":
  3113. /*!*************************************************************!*\
  3114. !*** ./node_modules/safevalues/internals/string_literal.js ***!
  3115. \*************************************************************/
  3116. /*! no static exports found */
  3117. /***/ (function(module, exports, __webpack_require__) {
  3118. "use strict";
  3119. /**
  3120. * @license
  3121. * SPDX-License-Identifier: Apache-2.0
  3122. */
  3123. Object.defineProperty(exports, "__esModule", { value: true });
  3124. exports.assertIsTemplateObject = void 0;
  3125. /**
  3126. * An object of type TemplateStringsArray represents the literal part(s) of a
  3127. * template literal. This function checks if a TemplateStringsArray object is
  3128. * actually from a template literal.
  3129. *
  3130. * @param templateObj This contains the literal part of the template literal.
  3131. * @param hasExprs If true, the input template may contain embedded expressions.
  3132. * @param errorMsg The custom error message in case any checks fail.
  3133. */
  3134. function assertIsTemplateObject(templateObj, hasExprs, errorMsg) {
  3135. if (!Array.isArray(templateObj) || !Array.isArray(templateObj.raw) ||
  3136. (!hasExprs && templateObj.length !== 1)) {
  3137. throw new TypeError(errorMsg);
  3138. }
  3139. }
  3140. exports.assertIsTemplateObject = assertIsTemplateObject;
  3141. /***/ }),
  3142. /***/ "./node_modules/safevalues/internals/style_impl.js":
  3143. /*!*********************************************************!*\
  3144. !*** ./node_modules/safevalues/internals/style_impl.js ***!
  3145. \*********************************************************/
  3146. /*! no static exports found */
  3147. /***/ (function(module, exports, __webpack_require__) {
  3148. "use strict";
  3149. /**
  3150. * @license
  3151. * SPDX-License-Identifier: Apache-2.0
  3152. */
  3153. var __extends = (this && this.__extends) || (function () {
  3154. var extendStatics = function (d, b) {
  3155. extendStatics = Object.setPrototypeOf ||
  3156. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3157. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  3158. return extendStatics(d, b);
  3159. };
  3160. return function (d, b) {
  3161. if (typeof b !== "function" && b !== null)
  3162. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  3163. extendStatics(d, b);
  3164. function __() { this.constructor = d; }
  3165. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3166. };
  3167. })();
  3168. Object.defineProperty(exports, "__esModule", { value: true });
  3169. exports.unwrapStyle = exports.isStyle = exports.createStyle = exports.SafeStyle = void 0;
  3170. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  3171. var secrets_1 = __webpack_require__(/*! ./secrets */ "./node_modules/safevalues/internals/secrets.js");
  3172. /**
  3173. * Sequence of CSS declarations safe to use in style contexts in an HTML
  3174. * document or in DOM APIs.
  3175. */
  3176. var SafeStyle = /** @class */ (function () {
  3177. function SafeStyle() {
  3178. }
  3179. return SafeStyle;
  3180. }());
  3181. exports.SafeStyle = SafeStyle;
  3182. /** Implementation for `SafeStyle` */
  3183. var StyleImpl = /** @class */ (function (_super) {
  3184. __extends(StyleImpl, _super);
  3185. function StyleImpl(style, token) {
  3186. var _this = _super.call(this) || this;
  3187. if (true) {
  3188. (0, secrets_1.ensureTokenIsValid)(token);
  3189. }
  3190. _this.privateDoNotAccessOrElseWrappedStyle = style;
  3191. return _this;
  3192. }
  3193. StyleImpl.prototype.toString = function () {
  3194. return this.privateDoNotAccessOrElseWrappedStyle;
  3195. };
  3196. return StyleImpl;
  3197. }(SafeStyle));
  3198. /**
  3199. * Builds a new `SafeStyle` from the given string, without enforcing
  3200. * safety guarantees. This shouldn't be exposed to application developers, and
  3201. * must only be used as a step towards safe builders or safe constants.
  3202. */
  3203. function createStyle(style) {
  3204. return new StyleImpl(style, secrets_1.secretToken);
  3205. }
  3206. exports.createStyle = createStyle;
  3207. /**
  3208. * Checks if the given value is a `SafeStyle` instance.
  3209. */
  3210. function isStyle(value) {
  3211. return value instanceof StyleImpl;
  3212. }
  3213. exports.isStyle = isStyle;
  3214. /**
  3215. * Returns the string value of the passed `SafeStyle` object while ensuring it
  3216. * has the correct type.
  3217. */
  3218. function unwrapStyle(value) {
  3219. if (value instanceof StyleImpl) {
  3220. return value.privateDoNotAccessOrElseWrappedStyle;
  3221. }
  3222. else {
  3223. var message = '';
  3224. if (true) {
  3225. message = 'Unexpected type when unwrapping SafeStyle';
  3226. }
  3227. throw new Error(message);
  3228. }
  3229. }
  3230. exports.unwrapStyle = unwrapStyle;
  3231. /***/ }),
  3232. /***/ "./node_modules/safevalues/internals/style_sheet_impl.js":
  3233. /*!***************************************************************!*\
  3234. !*** ./node_modules/safevalues/internals/style_sheet_impl.js ***!
  3235. \***************************************************************/
  3236. /*! no static exports found */
  3237. /***/ (function(module, exports, __webpack_require__) {
  3238. "use strict";
  3239. /**
  3240. * @license
  3241. * SPDX-License-Identifier: Apache-2.0
  3242. */
  3243. var __extends = (this && this.__extends) || (function () {
  3244. var extendStatics = function (d, b) {
  3245. extendStatics = Object.setPrototypeOf ||
  3246. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3247. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  3248. return extendStatics(d, b);
  3249. };
  3250. return function (d, b) {
  3251. if (typeof b !== "function" && b !== null)
  3252. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  3253. extendStatics(d, b);
  3254. function __() { this.constructor = d; }
  3255. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3256. };
  3257. })();
  3258. Object.defineProperty(exports, "__esModule", { value: true });
  3259. exports.unwrapStyleSheet = exports.isStyleSheet = exports.createStyleSheet = exports.SafeStyleSheet = void 0;
  3260. __webpack_require__(/*! ../environment/dev */ "./node_modules/safevalues/environment/dev.js");
  3261. var secrets_1 = __webpack_require__(/*! ./secrets */ "./node_modules/safevalues/internals/secrets.js");
  3262. /**
  3263. * A complete CSS style sheet, safe to use in style contexts in an HTML document
  3264. * or DOM APIs.
  3265. */
  3266. var SafeStyleSheet = /** @class */ (function () {
  3267. function SafeStyleSheet() {
  3268. }
  3269. return SafeStyleSheet;
  3270. }());
  3271. exports.SafeStyleSheet = SafeStyleSheet;
  3272. /** Implementation for `SafeStyleSheet` */
  3273. var StyleSheetImpl = /** @class */ (function (_super) {
  3274. __extends(StyleSheetImpl, _super);
  3275. function StyleSheetImpl(styleSheet, token) {
  3276. var _this = _super.call(this) || this;
  3277. if (true) {
  3278. (0, secrets_1.ensureTokenIsValid)(token);
  3279. }
  3280. _this.privateDoNotAccessOrElseWrappedStyleSheet = styleSheet;
  3281. return _this;
  3282. }
  3283. StyleSheetImpl.prototype.toString = function () {
  3284. return this.privateDoNotAccessOrElseWrappedStyleSheet;
  3285. };
  3286. return StyleSheetImpl;
  3287. }(SafeStyleSheet));
  3288. /**
  3289. * Builds a new `SafeStyleSheet` from the given string, without enforcing
  3290. * safety guarantees. This shouldn't be exposed to application developers, and
  3291. * must only be used as a step towards safe builders or safe constants.
  3292. */
  3293. function createStyleSheet(styleSheet) {
  3294. return new StyleSheetImpl(styleSheet, secrets_1.secretToken);
  3295. }
  3296. exports.createStyleSheet = createStyleSheet;
  3297. /**
  3298. * Checks if the given value is a `SafeStyleSheet` instance.
  3299. */
  3300. function isStyleSheet(value) {
  3301. return value instanceof StyleSheetImpl;
  3302. }
  3303. exports.isStyleSheet = isStyleSheet;
  3304. /**
  3305. * Returns the string value of the passed `SafeStyleSheet` object while
  3306. * ensuring it has the correct type.
  3307. */
  3308. function unwrapStyleSheet(value) {
  3309. if (value instanceof StyleSheetImpl) {
  3310. return value.privateDoNotAccessOrElseWrappedStyleSheet;
  3311. }
  3312. else {
  3313. var message = '';
  3314. if (true) {
  3315. message = 'Unexpected type when unwrapping SafeStyleSheet';
  3316. }
  3317. throw new Error(message);
  3318. }
  3319. }
  3320. exports.unwrapStyleSheet = unwrapStyleSheet;
  3321. /***/ }),
  3322. /***/ "./node_modules/safevalues/internals/trusted_types.js":
  3323. /*!************************************************************!*\
  3324. !*** ./node_modules/safevalues/internals/trusted_types.js ***!
  3325. \************************************************************/
  3326. /*! no static exports found */
  3327. /***/ (function(module, exports, __webpack_require__) {
  3328. "use strict";
  3329. /**
  3330. * @license
  3331. * SPDX-License-Identifier: Apache-2.0
  3332. */
  3333. Object.defineProperty(exports, "__esModule", { value: true });
  3334. exports.TEST_ONLY = exports.getTrustedTypesPolicy = exports.getTrustedTypes = void 0;
  3335. /**
  3336. * The name of the Trusted Types policy used by TS safevalues, or empty
  3337. * to disable Trusted Types. This duplicates the 'google#safe', but
  3338. * can be overridden in tests.
  3339. */
  3340. var trustedTypesPolicyName = 'google#safe';
  3341. /** Helper to retrieve the value of `window.trustedTypes`. */
  3342. function trustedTypes() {
  3343. if (typeof window !== 'undefined') {
  3344. return window.trustedTypes;
  3345. }
  3346. return undefined;
  3347. }
  3348. /**
  3349. * Returns window.trustedTypes if Trusted Types are enabled and supported, or
  3350. * null otherwise.
  3351. */
  3352. function getTrustedTypes() {
  3353. var _a;
  3354. return (trustedTypesPolicyName !== '') ? ((_a = trustedTypes()) !== null && _a !== void 0 ? _a : null) : null;
  3355. }
  3356. exports.getTrustedTypes = getTrustedTypes;
  3357. /**
  3358. * The Trusted Types policy used by TS safevalues, or null if Trusted Types
  3359. * are not enabled/supported, or undefined if the policy has not been created
  3360. * yet.
  3361. */
  3362. var trustedTypesPolicy;
  3363. /**
  3364. * Returns the Trusted Types policy used by TS safevalues, or null if Trusted
  3365. * Types are not enabled/supported. The first call to this function will
  3366. * create the policy.
  3367. */
  3368. function getTrustedTypesPolicy() {
  3369. var _a, _b;
  3370. if (trustedTypesPolicy === undefined) {
  3371. try {
  3372. trustedTypesPolicy =
  3373. (_b = (_a = getTrustedTypes()) === null || _a === void 0 ? void 0 : _a.createPolicy(trustedTypesPolicyName, {
  3374. createHTML: function (s) { return s; },
  3375. createScript: function (s) { return s; },
  3376. createScriptURL: function (s) { return s; }
  3377. })) !== null && _b !== void 0 ? _b : null;
  3378. }
  3379. catch (_c) {
  3380. // In Chromium versions before 81, trustedTypes.createPolicy throws if
  3381. // called with a name that is already registered, even if no CSP is set.
  3382. // Until users have largely migrated to 81 or above, catch the error not
  3383. // to break the applications functionally. In such case, the code will
  3384. // fall back to using regular Safe Types.
  3385. trustedTypesPolicy = null;
  3386. }
  3387. }
  3388. return trustedTypesPolicy;
  3389. }
  3390. exports.getTrustedTypesPolicy = getTrustedTypesPolicy;
  3391. /** Helpers for tests. */
  3392. exports.TEST_ONLY = {
  3393. resetDefaults: function () {
  3394. trustedTypesPolicy = undefined;
  3395. trustedTypesPolicyName = 'google#safe';
  3396. },
  3397. setTrustedTypesPolicyName: function (name) {
  3398. trustedTypesPolicyName = name;
  3399. },
  3400. };
  3401. /***/ }),
  3402. /***/ "./packages/mdc-base/component.ts":
  3403. /*!****************************************!*\
  3404. !*** ./packages/mdc-base/component.ts ***!
  3405. \****************************************/
  3406. /*! no static exports found */
  3407. /***/ (function(module, exports, __webpack_require__) {
  3408. "use strict";
  3409. /**
  3410. * @license
  3411. * Copyright 2016 Google Inc.
  3412. *
  3413. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3414. * of this software and associated documentation files (the "Software"), to deal
  3415. * in the Software without restriction, including without limitation the rights
  3416. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3417. * copies of the Software, and to permit persons to whom the Software is
  3418. * furnished to do so, subject to the following conditions:
  3419. *
  3420. * The above copyright notice and this permission notice shall be included in
  3421. * all copies or substantial portions of the Software.
  3422. *
  3423. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3424. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3425. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3426. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3427. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3428. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3429. * THE SOFTWARE.
  3430. */
  3431. var __makeTemplateObject = this && this.__makeTemplateObject || function (cooked, raw) {
  3432. if (Object.defineProperty) {
  3433. Object.defineProperty(cooked, "raw", { value: raw });
  3434. } else {
  3435. cooked.raw = raw;
  3436. }
  3437. return cooked;
  3438. };
  3439. var __read = this && this.__read || function (o, n) {
  3440. var m = typeof Symbol === "function" && o[Symbol.iterator];
  3441. if (!m) return o;
  3442. var i = m.call(o),
  3443. r,
  3444. ar = [],
  3445. e;
  3446. try {
  3447. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  3448. ar.push(r.value);
  3449. }
  3450. } catch (error) {
  3451. e = { error: error };
  3452. } finally {
  3453. try {
  3454. if (r && !r.done && (m = i["return"])) m.call(i);
  3455. } finally {
  3456. if (e) throw e.error;
  3457. }
  3458. }
  3459. return ar;
  3460. };
  3461. var __spreadArray = this && this.__spreadArray || function (to, from) {
  3462. for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
  3463. to[j] = from[i];
  3464. }return to;
  3465. };
  3466. Object.defineProperty(exports, "__esModule", { value: true });
  3467. exports.MDCComponent = void 0;
  3468. var safevalues_1 = __webpack_require__(/*! safevalues */ "./node_modules/safevalues/index.js");
  3469. var dom_1 = __webpack_require__(/*! safevalues/dom */ "./node_modules/safevalues/dom/index.js");
  3470. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
  3471. function toCamelCase(str) {
  3472. // tslint:disable-next-line:enforce-name-casing
  3473. return String(str).replace(/\-([a-z])/g, function (_, match) {
  3474. return match.toUpperCase();
  3475. });
  3476. }
  3477. /** MDC Component base */
  3478. var MDCComponent = /** @class */function () {
  3479. function MDCComponent(root, foundation) {
  3480. var args = [];
  3481. for (var _i = 2; _i < arguments.length; _i++) {
  3482. args[_i - 2] = arguments[_i];
  3483. }
  3484. this.root = root;
  3485. this.initialize.apply(this, __spreadArray([], __read(args)));
  3486. // Note that we initialize foundation here and not within the constructor's
  3487. // default param so that this.root is defined and can be used within the
  3488. // foundation class.
  3489. this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
  3490. this.foundation.init();
  3491. this.initialSyncWithDOM();
  3492. }
  3493. MDCComponent.attachTo = function (root) {
  3494. // Subclasses which extend MDCBase should provide an attachTo() method that
  3495. // takes a root element and returns an instantiated component with its root
  3496. // set to that element. Also note that in the cases of subclasses, an
  3497. // explicit foundation class will not have to be passed in; it will simply
  3498. // be initialized from getDefaultFoundation().
  3499. return new MDCComponent(root, new foundation_1.MDCFoundation({}));
  3500. };
  3501. /* istanbul ignore next: method param only exists for typing purposes; it does
  3502. * not need to be unit tested */
  3503. // tslint:disable-next-line:enforce-name-casing
  3504. MDCComponent.prototype.initialize = function () {
  3505. var _args = [];
  3506. for (var _i = 0; _i < arguments.length; _i++) {
  3507. _args[_i] = arguments[_i];
  3508. }
  3509. // Subclasses can override this to do any additional setup work that would
  3510. // be considered part of a "constructor". Essentially, it is a hook into the
  3511. // parent constructor before the foundation is initialized. Any additional
  3512. // arguments besides root and foundation will be passed in here.
  3513. };
  3514. MDCComponent.prototype.getDefaultFoundation = function () {
  3515. // Subclasses must override this method to return a properly configured
  3516. // foundation class for the component.
  3517. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
  3518. };
  3519. MDCComponent.prototype.initialSyncWithDOM = function () {
  3520. // Subclasses should override this method if they need to perform work to
  3521. // synchronize with a host DOM object. An example of this would be a form
  3522. // control wrapper that needs to synchronize its internal state to some
  3523. // property or attribute of the host DOM. Please note: this is *not* the
  3524. // place to perform DOM reads/writes that would cause layout / paint, as
  3525. // this is called synchronously from within the constructor.
  3526. };
  3527. MDCComponent.prototype.destroy = function () {
  3528. // Subclasses may implement this method to release any resources /
  3529. // deregister any listeners they have attached. An example of this might be
  3530. // deregistering a resize event from the window object.
  3531. this.foundation.destroy();
  3532. };
  3533. MDCComponent.prototype.listen = function (evtType, handler, options) {
  3534. this.root.addEventListener(evtType, handler, options);
  3535. };
  3536. MDCComponent.prototype.unlisten = function (evtType, handler, options) {
  3537. this.root.removeEventListener(evtType, handler, options);
  3538. };
  3539. /**
  3540. * Fires a cross-browser-compatible custom event from the component root of
  3541. * the given type, with the given data.
  3542. */
  3543. MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
  3544. if (shouldBubble === void 0) {
  3545. shouldBubble = false;
  3546. }
  3547. var evt;
  3548. if (typeof CustomEvent === 'function') {
  3549. evt = new CustomEvent(evtType, {
  3550. bubbles: shouldBubble,
  3551. detail: evtData
  3552. });
  3553. } else {
  3554. evt = document.createEvent('CustomEvent');
  3555. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  3556. }
  3557. this.root.dispatchEvent(evt);
  3558. };
  3559. /**
  3560. * This is a intermediate fix to allow components to use safevalues. This
  3561. * limits setAttribute to setting tabindex, data attributes, and aria
  3562. * attributes.
  3563. *
  3564. * TODO(b/263990206): remove this method and add these directly in each
  3565. * component. This will remove this abstraction and make it clear that the
  3566. * caller can't set any attribute.
  3567. */
  3568. MDCComponent.prototype.safeSetAttribute = function (element, attribute, value) {
  3569. if (attribute.toLowerCase() === 'tabindex') {
  3570. element.tabIndex = Number(value);
  3571. } else if (attribute.indexOf('data-') === 0) {
  3572. var dataKey = toCamelCase(attribute.replace(/^data-/, ''));
  3573. element.dataset[dataKey] = value;
  3574. } else {
  3575. dom_1.safeElement.setPrefixedAttribute([safevalues_1.safeAttrPrefix(templateObject_1 || (templateObject_1 = __makeTemplateObject(["aria-"], ["aria-"]))), safevalues_1.safeAttrPrefix(templateObject_2 || (templateObject_2 = __makeTemplateObject(["role"], ["role"])))], element, attribute, value);
  3576. }
  3577. };
  3578. return MDCComponent;
  3579. }();
  3580. exports.MDCComponent = MDCComponent;
  3581. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  3582. exports.default = MDCComponent;
  3583. var templateObject_1, templateObject_2;
  3584. /***/ }),
  3585. /***/ "./packages/mdc-base/foundation.ts":
  3586. /*!*****************************************!*\
  3587. !*** ./packages/mdc-base/foundation.ts ***!
  3588. \*****************************************/
  3589. /*! no static exports found */
  3590. /***/ (function(module, exports, __webpack_require__) {
  3591. "use strict";
  3592. /**
  3593. * @license
  3594. * Copyright 2016 Google Inc.
  3595. *
  3596. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3597. * of this software and associated documentation files (the "Software"), to deal
  3598. * in the Software without restriction, including without limitation the rights
  3599. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3600. * copies of the Software, and to permit persons to whom the Software is
  3601. * furnished to do so, subject to the following conditions:
  3602. *
  3603. * The above copyright notice and this permission notice shall be included in
  3604. * all copies or substantial portions of the Software.
  3605. *
  3606. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3607. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3608. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3609. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3610. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3611. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3612. * THE SOFTWARE.
  3613. */
  3614. Object.defineProperty(exports, "__esModule", { value: true });
  3615. exports.MDCFoundation = void 0;
  3616. /** MDC Foundation */
  3617. var MDCFoundation = /** @class */function () {
  3618. function MDCFoundation(adapter) {
  3619. if (adapter === void 0) {
  3620. adapter = {};
  3621. }
  3622. this.adapter = adapter;
  3623. }
  3624. Object.defineProperty(MDCFoundation, "cssClasses", {
  3625. get: function get() {
  3626. // Classes extending MDCFoundation should implement this method to return an
  3627. // object which exports every CSS class the foundation class needs as a
  3628. // property. e.g. {ACTIVE: 'mdc-component--active'}
  3629. return {};
  3630. },
  3631. enumerable: false,
  3632. configurable: true
  3633. });
  3634. Object.defineProperty(MDCFoundation, "strings", {
  3635. get: function get() {
  3636. // Classes extending MDCFoundation should implement this method to return an
  3637. // object which exports all semantic strings as constants. e.g. {ARIA_ROLE:
  3638. // 'tablist'}
  3639. return {};
  3640. },
  3641. enumerable: false,
  3642. configurable: true
  3643. });
  3644. Object.defineProperty(MDCFoundation, "numbers", {
  3645. get: function get() {
  3646. // Classes extending MDCFoundation should implement this method to return an
  3647. // object which exports all of its semantic numbers as constants.
  3648. // e.g. {ANIMATION_DELAY_MS: 350}
  3649. return {};
  3650. },
  3651. enumerable: false,
  3652. configurable: true
  3653. });
  3654. Object.defineProperty(MDCFoundation, "defaultAdapter", {
  3655. get: function get() {
  3656. // Classes extending MDCFoundation may choose to implement this getter in
  3657. // order to provide a convenient way of viewing the necessary methods of an
  3658. // adapter. In the future, this could also be used for adapter validation.
  3659. return {};
  3660. },
  3661. enumerable: false,
  3662. configurable: true
  3663. });
  3664. MDCFoundation.prototype.init = function () {
  3665. // Subclasses should override this method to perform initialization routines
  3666. // (registering events, etc.)
  3667. };
  3668. MDCFoundation.prototype.destroy = function () {
  3669. // Subclasses should override this method to perform de-initialization
  3670. // routines (de-registering events, etc.)
  3671. };
  3672. return MDCFoundation;
  3673. }();
  3674. exports.MDCFoundation = MDCFoundation;
  3675. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  3676. exports.default = MDCFoundation;
  3677. /***/ }),
  3678. /***/ "./packages/mdc-dom/events.ts":
  3679. /*!************************************!*\
  3680. !*** ./packages/mdc-dom/events.ts ***!
  3681. \************************************/
  3682. /*! no static exports found */
  3683. /***/ (function(module, exports, __webpack_require__) {
  3684. "use strict";
  3685. /**
  3686. * @license
  3687. * Copyright 2019 Google Inc.
  3688. *
  3689. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3690. * of this software and associated documentation files (the "Software"), to deal
  3691. * in the Software without restriction, including without limitation the rights
  3692. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3693. * copies of the Software, and to permit persons to whom the Software is
  3694. * furnished to do so, subject to the following conditions:
  3695. *
  3696. * The above copyright notice and this permission notice shall be included in
  3697. * all copies or substantial portions of the Software.
  3698. *
  3699. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3700. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3701. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3702. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3703. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3704. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3705. * THE SOFTWARE.
  3706. */
  3707. Object.defineProperty(exports, "__esModule", { value: true });
  3708. exports.applyPassive = void 0;
  3709. /**
  3710. * Determine whether the current browser supports passive event listeners, and
  3711. * if so, use them.
  3712. */
  3713. function applyPassive(globalObj) {
  3714. if (globalObj === void 0) {
  3715. globalObj = window;
  3716. }
  3717. return supportsPassiveOption(globalObj) ? { passive: true } : false;
  3718. }
  3719. exports.applyPassive = applyPassive;
  3720. function supportsPassiveOption(globalObj) {
  3721. if (globalObj === void 0) {
  3722. globalObj = window;
  3723. }
  3724. // See
  3725. // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  3726. var passiveSupported = false;
  3727. try {
  3728. var options = {
  3729. // This function will be called when the browser
  3730. // attempts to access the passive property.
  3731. get passive() {
  3732. passiveSupported = true;
  3733. return false;
  3734. }
  3735. };
  3736. var handler = function handler() {};
  3737. globalObj.document.addEventListener('test', handler, options);
  3738. globalObj.document.removeEventListener('test', handler, options);
  3739. } catch (err) {
  3740. passiveSupported = false;
  3741. }
  3742. return passiveSupported;
  3743. }
  3744. /***/ }),
  3745. /***/ "./packages/mdc-dom/ponyfill.ts":
  3746. /*!**************************************!*\
  3747. !*** ./packages/mdc-dom/ponyfill.ts ***!
  3748. \**************************************/
  3749. /*! no static exports found */
  3750. /***/ (function(module, exports, __webpack_require__) {
  3751. "use strict";
  3752. /**
  3753. * @license
  3754. * Copyright 2018 Google Inc.
  3755. *
  3756. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3757. * of this software and associated documentation files (the "Software"), to deal
  3758. * in the Software without restriction, including without limitation the rights
  3759. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3760. * copies of the Software, and to permit persons to whom the Software is
  3761. * furnished to do so, subject to the following conditions:
  3762. *
  3763. * The above copyright notice and this permission notice shall be included in
  3764. * all copies or substantial portions of the Software.
  3765. *
  3766. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3767. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3768. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3769. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3770. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3771. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3772. * THE SOFTWARE.
  3773. */
  3774. Object.defineProperty(exports, "__esModule", { value: true });
  3775. exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
  3776. /**
  3777. * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global
  3778. * prototype chain. This makes ponyfills safer than traditional polyfills,
  3779. * especially for libraries like MDC.
  3780. */
  3781. function closest(element, selector) {
  3782. if (element.closest) {
  3783. return element.closest(selector);
  3784. }
  3785. var el = element;
  3786. while (el) {
  3787. if (matches(el, selector)) {
  3788. return el;
  3789. }
  3790. el = el.parentElement;
  3791. }
  3792. return null;
  3793. }
  3794. exports.closest = closest;
  3795. /** Element.matches with support for webkit and IE. */
  3796. function matches(element, selector) {
  3797. var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
  3798. return nativeMatches.call(element, selector);
  3799. }
  3800. exports.matches = matches;
  3801. /**
  3802. * Used to compute the estimated scroll width of elements. When an element is
  3803. * hidden due to display: none; being applied to a parent element, the width is
  3804. * returned as 0. However, the element will have a true width once no longer
  3805. * inside a display: none context. This method computes an estimated width when
  3806. * the element is hidden or returns the true width when the element is visble.
  3807. * @param {Element} element the element whose width to estimate
  3808. */
  3809. function estimateScrollWidth(element) {
  3810. // Check the offsetParent. If the element inherits display: none from any
  3811. // parent, the offsetParent property will be null (see
  3812. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
  3813. // This check ensures we only clone the node when necessary.
  3814. var htmlEl = element;
  3815. if (htmlEl.offsetParent !== null) {
  3816. return htmlEl.scrollWidth;
  3817. }
  3818. var clone = htmlEl.cloneNode(true);
  3819. clone.style.setProperty('position', 'absolute');
  3820. clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
  3821. document.documentElement.appendChild(clone);
  3822. var scrollWidth = clone.scrollWidth;
  3823. document.documentElement.removeChild(clone);
  3824. return scrollWidth;
  3825. }
  3826. exports.estimateScrollWidth = estimateScrollWidth;
  3827. /***/ }),
  3828. /***/ "./packages/mdc-floating-label/component.ts":
  3829. /*!**************************************************!*\
  3830. !*** ./packages/mdc-floating-label/component.ts ***!
  3831. \**************************************************/
  3832. /*! no static exports found */
  3833. /***/ (function(module, exports, __webpack_require__) {
  3834. "use strict";
  3835. /**
  3836. * @license
  3837. * Copyright 2016 Google Inc.
  3838. *
  3839. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3840. * of this software and associated documentation files (the "Software"), to deal
  3841. * in the Software without restriction, including without limitation the rights
  3842. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3843. * copies of the Software, and to permit persons to whom the Software is
  3844. * furnished to do so, subject to the following conditions:
  3845. *
  3846. * The above copyright notice and this permission notice shall be included in
  3847. * all copies or substantial portions of the Software.
  3848. *
  3849. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3850. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3851. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3852. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3853. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3854. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3855. * THE SOFTWARE.
  3856. */
  3857. var __extends = this && this.__extends || function () {
  3858. var _extendStatics = function extendStatics(d, b) {
  3859. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3860. d.__proto__ = b;
  3861. } || function (d, b) {
  3862. for (var p in b) {
  3863. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  3864. }
  3865. };
  3866. return _extendStatics(d, b);
  3867. };
  3868. return function (d, b) {
  3869. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  3870. _extendStatics(d, b);
  3871. function __() {
  3872. this.constructor = d;
  3873. }
  3874. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3875. };
  3876. }();
  3877. Object.defineProperty(exports, "__esModule", { value: true });
  3878. exports.MDCFloatingLabel = void 0;
  3879. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3880. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  3881. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts");
  3882. /** MDC Floating Label */
  3883. var MDCFloatingLabel = /** @class */function (_super) {
  3884. __extends(MDCFloatingLabel, _super);
  3885. function MDCFloatingLabel() {
  3886. return _super !== null && _super.apply(this, arguments) || this;
  3887. }
  3888. MDCFloatingLabel.attachTo = function (root) {
  3889. return new MDCFloatingLabel(root);
  3890. };
  3891. /**
  3892. * Styles the label to produce the label shake for errors.
  3893. * @param shouldShake If true, shakes the label by adding a CSS class;
  3894. * otherwise, stops shaking by removing the class.
  3895. */
  3896. MDCFloatingLabel.prototype.shake = function (shouldShake) {
  3897. this.foundation.shake(shouldShake);
  3898. };
  3899. /**
  3900. * Styles the label to float/dock.
  3901. * @param shouldFloat If true, floats the label by adding a CSS class;
  3902. * otherwise, docks it by removing the class.
  3903. */
  3904. MDCFloatingLabel.prototype.float = function (shouldFloat) {
  3905. this.foundation.float(shouldFloat);
  3906. };
  3907. /**
  3908. * Styles the label as required.
  3909. * @param isRequired If true, adds an asterisk to the label, indicating that
  3910. * it is required.
  3911. */
  3912. MDCFloatingLabel.prototype.setRequired = function (isRequired) {
  3913. this.foundation.setRequired(isRequired);
  3914. };
  3915. MDCFloatingLabel.prototype.getWidth = function () {
  3916. return this.foundation.getWidth();
  3917. };
  3918. MDCFloatingLabel.prototype.getDefaultFoundation = function () {
  3919. var _this = this;
  3920. // DO NOT INLINE this variable. For backward compatibility, foundations take
  3921. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  3922. // methods, we need a separate, strongly typed adapter variable.
  3923. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  3924. var adapter = {
  3925. addClass: function addClass(className) {
  3926. _this.root.classList.add(className);
  3927. },
  3928. removeClass: function removeClass(className) {
  3929. _this.root.classList.remove(className);
  3930. },
  3931. hasClass: function hasClass(className) {
  3932. return _this.root.classList.contains(className);
  3933. },
  3934. getWidth: function getWidth() {
  3935. return ponyfill_1.estimateScrollWidth(_this.root);
  3936. },
  3937. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  3938. _this.listen(evtType, handler);
  3939. },
  3940. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  3941. _this.unlisten(evtType, handler);
  3942. }
  3943. };
  3944. // tslint:enable:object-literal-sort-keys
  3945. return new foundation_1.MDCFloatingLabelFoundation(adapter);
  3946. };
  3947. return MDCFloatingLabel;
  3948. }(component_1.MDCComponent);
  3949. exports.MDCFloatingLabel = MDCFloatingLabel;
  3950. /***/ }),
  3951. /***/ "./packages/mdc-floating-label/constants.ts":
  3952. /*!**************************************************!*\
  3953. !*** ./packages/mdc-floating-label/constants.ts ***!
  3954. \**************************************************/
  3955. /*! no static exports found */
  3956. /***/ (function(module, exports, __webpack_require__) {
  3957. "use strict";
  3958. /**
  3959. * @license
  3960. * Copyright 2016 Google Inc.
  3961. *
  3962. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3963. * of this software and associated documentation files (the "Software"), to deal
  3964. * in the Software without restriction, including without limitation the rights
  3965. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3966. * copies of the Software, and to permit persons to whom the Software is
  3967. * furnished to do so, subject to the following conditions:
  3968. *
  3969. * The above copyright notice and this permission notice shall be included in
  3970. * all copies or substantial portions of the Software.
  3971. *
  3972. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3973. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3974. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3975. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3976. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3977. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3978. * THE SOFTWARE.
  3979. */
  3980. Object.defineProperty(exports, "__esModule", { value: true });
  3981. exports.cssClasses = void 0;
  3982. exports.cssClasses = {
  3983. LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
  3984. LABEL_REQUIRED: 'mdc-floating-label--required',
  3985. LABEL_HIDE_REQUIRED_MARKER: 'mdc-floating-label--hide-required-marker',
  3986. LABEL_SHAKE: 'mdc-floating-label--shake',
  3987. ROOT: 'mdc-floating-label'
  3988. };
  3989. /***/ }),
  3990. /***/ "./packages/mdc-floating-label/foundation.ts":
  3991. /*!***************************************************!*\
  3992. !*** ./packages/mdc-floating-label/foundation.ts ***!
  3993. \***************************************************/
  3994. /*! no static exports found */
  3995. /***/ (function(module, exports, __webpack_require__) {
  3996. "use strict";
  3997. /**
  3998. * @license
  3999. * Copyright 2016 Google Inc.
  4000. *
  4001. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4002. * of this software and associated documentation files (the "Software"), to deal
  4003. * in the Software without restriction, including without limitation the rights
  4004. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4005. * copies of the Software, and to permit persons to whom the Software is
  4006. * furnished to do so, subject to the following conditions:
  4007. *
  4008. * The above copyright notice and this permission notice shall be included in
  4009. * all copies or substantial portions of the Software.
  4010. *
  4011. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4012. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4013. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4014. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4015. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4016. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4017. * THE SOFTWARE.
  4018. */
  4019. var __extends = this && this.__extends || function () {
  4020. var _extendStatics = function extendStatics(d, b) {
  4021. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4022. d.__proto__ = b;
  4023. } || function (d, b) {
  4024. for (var p in b) {
  4025. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4026. }
  4027. };
  4028. return _extendStatics(d, b);
  4029. };
  4030. return function (d, b) {
  4031. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4032. _extendStatics(d, b);
  4033. function __() {
  4034. this.constructor = d;
  4035. }
  4036. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4037. };
  4038. }();
  4039. var __assign = this && this.__assign || function () {
  4040. __assign = Object.assign || function (t) {
  4041. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4042. s = arguments[i];
  4043. for (var p in s) {
  4044. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4045. }
  4046. }
  4047. return t;
  4048. };
  4049. return __assign.apply(this, arguments);
  4050. };
  4051. Object.defineProperty(exports, "__esModule", { value: true });
  4052. exports.MDCFloatingLabelFoundation = void 0;
  4053. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4054. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts");
  4055. /** MDC Floating Label Foundation */
  4056. var MDCFloatingLabelFoundation = /** @class */function (_super) {
  4057. __extends(MDCFloatingLabelFoundation, _super);
  4058. function MDCFloatingLabelFoundation(adapter) {
  4059. var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
  4060. _this.shakeAnimationEndHandler = function () {
  4061. _this.handleShakeAnimationEnd();
  4062. };
  4063. return _this;
  4064. }
  4065. Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
  4066. get: function get() {
  4067. return constants_1.cssClasses;
  4068. },
  4069. enumerable: false,
  4070. configurable: true
  4071. });
  4072. Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
  4073. /**
  4074. * See {@link MDCFloatingLabelAdapter} for typing information on parameters
  4075. * and return types.
  4076. */
  4077. get: function get() {
  4078. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4079. return {
  4080. addClass: function addClass() {
  4081. return undefined;
  4082. },
  4083. removeClass: function removeClass() {
  4084. return undefined;
  4085. },
  4086. hasClass: function hasClass() {
  4087. return false;
  4088. },
  4089. getWidth: function getWidth() {
  4090. return 0;
  4091. },
  4092. registerInteractionHandler: function registerInteractionHandler() {
  4093. return undefined;
  4094. },
  4095. deregisterInteractionHandler: function deregisterInteractionHandler() {
  4096. return undefined;
  4097. }
  4098. };
  4099. // tslint:enable:object-literal-sort-keys
  4100. },
  4101. enumerable: false,
  4102. configurable: true
  4103. });
  4104. MDCFloatingLabelFoundation.prototype.init = function () {
  4105. this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
  4106. };
  4107. MDCFloatingLabelFoundation.prototype.destroy = function () {
  4108. this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
  4109. };
  4110. /**
  4111. * Returns the width of the label element.
  4112. */
  4113. MDCFloatingLabelFoundation.prototype.getWidth = function () {
  4114. return this.adapter.getWidth();
  4115. };
  4116. /**
  4117. * Styles the label to produce a shake animation to indicate an error.
  4118. * @param shouldShake If true, adds the shake CSS class; otherwise, removes
  4119. * shake class.
  4120. */
  4121. MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
  4122. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  4123. if (shouldShake) {
  4124. this.adapter.addClass(LABEL_SHAKE);
  4125. } else {
  4126. this.adapter.removeClass(LABEL_SHAKE);
  4127. }
  4128. };
  4129. /**
  4130. * Styles the label to float or dock.
  4131. * @param shouldFloat If true, adds the float CSS class; otherwise, removes
  4132. * float and shake classes to dock the label.
  4133. */
  4134. MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
  4135. var _a = MDCFloatingLabelFoundation.cssClasses,
  4136. LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE,
  4137. LABEL_SHAKE = _a.LABEL_SHAKE;
  4138. if (shouldFloat) {
  4139. this.adapter.addClass(LABEL_FLOAT_ABOVE);
  4140. } else {
  4141. this.adapter.removeClass(LABEL_FLOAT_ABOVE);
  4142. this.adapter.removeClass(LABEL_SHAKE);
  4143. }
  4144. };
  4145. /**
  4146. * Styles the label as required.
  4147. * @param isRequired If true, adds an asterisk to the label, indicating that
  4148. * it is required.
  4149. */
  4150. MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
  4151. var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
  4152. if (isRequired) {
  4153. this.adapter.addClass(LABEL_REQUIRED);
  4154. } else {
  4155. this.adapter.removeClass(LABEL_REQUIRED);
  4156. }
  4157. };
  4158. MDCFloatingLabelFoundation.prototype.setHideRequiredMarker = function (hideRequiredMarker) {
  4159. var LABEL_HIDE_REQUIRED_MARKER = MDCFloatingLabelFoundation.cssClasses.LABEL_HIDE_REQUIRED_MARKER;
  4160. if (hideRequiredMarker) {
  4161. this.adapter.addClass(LABEL_HIDE_REQUIRED_MARKER);
  4162. } else {
  4163. this.adapter.removeClass(LABEL_HIDE_REQUIRED_MARKER);
  4164. }
  4165. };
  4166. MDCFloatingLabelFoundation.prototype.getHideRequiredMarker = function () {
  4167. var LABEL_HIDE_REQUIRED_MARKER = MDCFloatingLabelFoundation.cssClasses.LABEL_HIDE_REQUIRED_MARKER;
  4168. return this.adapter.hasClass(LABEL_HIDE_REQUIRED_MARKER);
  4169. };
  4170. MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
  4171. var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
  4172. this.adapter.removeClass(LABEL_SHAKE);
  4173. };
  4174. return MDCFloatingLabelFoundation;
  4175. }(foundation_1.MDCFoundation);
  4176. exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation;
  4177. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  4178. exports.default = MDCFloatingLabelFoundation;
  4179. /***/ }),
  4180. /***/ "./packages/mdc-line-ripple/component.ts":
  4181. /*!***********************************************!*\
  4182. !*** ./packages/mdc-line-ripple/component.ts ***!
  4183. \***********************************************/
  4184. /*! no static exports found */
  4185. /***/ (function(module, exports, __webpack_require__) {
  4186. "use strict";
  4187. /**
  4188. * @license
  4189. * Copyright 2018 Google Inc.
  4190. *
  4191. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4192. * of this software and associated documentation files (the "Software"), to deal
  4193. * in the Software without restriction, including without limitation the rights
  4194. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4195. * copies of the Software, and to permit persons to whom the Software is
  4196. * furnished to do so, subject to the following conditions:
  4197. *
  4198. * The above copyright notice and this permission notice shall be included in
  4199. * all copies or substantial portions of the Software.
  4200. *
  4201. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4202. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4203. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4204. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4205. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4206. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4207. * THE SOFTWARE.
  4208. */
  4209. var __extends = this && this.__extends || function () {
  4210. var _extendStatics = function extendStatics(d, b) {
  4211. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4212. d.__proto__ = b;
  4213. } || function (d, b) {
  4214. for (var p in b) {
  4215. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4216. }
  4217. };
  4218. return _extendStatics(d, b);
  4219. };
  4220. return function (d, b) {
  4221. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4222. _extendStatics(d, b);
  4223. function __() {
  4224. this.constructor = d;
  4225. }
  4226. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4227. };
  4228. }();
  4229. Object.defineProperty(exports, "__esModule", { value: true });
  4230. exports.MDCLineRipple = void 0;
  4231. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4232. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts");
  4233. /** MDC Line Ripple */
  4234. var MDCLineRipple = /** @class */function (_super) {
  4235. __extends(MDCLineRipple, _super);
  4236. function MDCLineRipple() {
  4237. return _super !== null && _super.apply(this, arguments) || this;
  4238. }
  4239. MDCLineRipple.attachTo = function (root) {
  4240. return new MDCLineRipple(root);
  4241. };
  4242. /**
  4243. * Activates the line ripple
  4244. */
  4245. MDCLineRipple.prototype.activate = function () {
  4246. this.foundation.activate();
  4247. };
  4248. /**
  4249. * Deactivates the line ripple
  4250. */
  4251. MDCLineRipple.prototype.deactivate = function () {
  4252. this.foundation.deactivate();
  4253. };
  4254. /**
  4255. * Sets the transform origin given a user's click location.
  4256. * The `rippleCenter` is the x-coordinate of the middle of the ripple.
  4257. */
  4258. MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
  4259. this.foundation.setRippleCenter(xCoordinate);
  4260. };
  4261. MDCLineRipple.prototype.getDefaultFoundation = function () {
  4262. var _this = this;
  4263. // DO NOT INLINE this variable. For backward compatibility, foundations take
  4264. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  4265. // methods, we need a separate, strongly typed adapter variable.
  4266. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4267. var adapter = {
  4268. addClass: function addClass(className) {
  4269. _this.root.classList.add(className);
  4270. },
  4271. removeClass: function removeClass(className) {
  4272. _this.root.classList.remove(className);
  4273. },
  4274. hasClass: function hasClass(className) {
  4275. return _this.root.classList.contains(className);
  4276. },
  4277. setStyle: function setStyle(propertyName, value) {
  4278. _this.root.style.setProperty(propertyName, value);
  4279. },
  4280. registerEventHandler: function registerEventHandler(evtType, handler) {
  4281. _this.listen(evtType, handler);
  4282. },
  4283. deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
  4284. _this.unlisten(evtType, handler);
  4285. }
  4286. };
  4287. // tslint:enable:object-literal-sort-keys
  4288. return new foundation_1.MDCLineRippleFoundation(adapter);
  4289. };
  4290. return MDCLineRipple;
  4291. }(component_1.MDCComponent);
  4292. exports.MDCLineRipple = MDCLineRipple;
  4293. /***/ }),
  4294. /***/ "./packages/mdc-line-ripple/constants.ts":
  4295. /*!***********************************************!*\
  4296. !*** ./packages/mdc-line-ripple/constants.ts ***!
  4297. \***********************************************/
  4298. /*! no static exports found */
  4299. /***/ (function(module, exports, __webpack_require__) {
  4300. "use strict";
  4301. /**
  4302. * @license
  4303. * Copyright 2018 Google Inc.
  4304. *
  4305. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4306. * of this software and associated documentation files (the "Software"), to deal
  4307. * in the Software without restriction, including without limitation the rights
  4308. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4309. * copies of the Software, and to permit persons to whom the Software is
  4310. * furnished to do so, subject to the following conditions:
  4311. *
  4312. * The above copyright notice and this permission notice shall be included in
  4313. * all copies or substantial portions of the Software.
  4314. *
  4315. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4316. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4317. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4318. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4319. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4320. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4321. * THE SOFTWARE.
  4322. */
  4323. Object.defineProperty(exports, "__esModule", { value: true });
  4324. exports.cssClasses = void 0;
  4325. var cssClasses = {
  4326. LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
  4327. LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'
  4328. };
  4329. exports.cssClasses = cssClasses;
  4330. /***/ }),
  4331. /***/ "./packages/mdc-line-ripple/foundation.ts":
  4332. /*!************************************************!*\
  4333. !*** ./packages/mdc-line-ripple/foundation.ts ***!
  4334. \************************************************/
  4335. /*! no static exports found */
  4336. /***/ (function(module, exports, __webpack_require__) {
  4337. "use strict";
  4338. /**
  4339. * @license
  4340. * Copyright 2018 Google Inc.
  4341. *
  4342. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4343. * of this software and associated documentation files (the "Software"), to deal
  4344. * in the Software without restriction, including without limitation the rights
  4345. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4346. * copies of the Software, and to permit persons to whom the Software is
  4347. * furnished to do so, subject to the following conditions:
  4348. *
  4349. * The above copyright notice and this permission notice shall be included in
  4350. * all copies or substantial portions of the Software.
  4351. *
  4352. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4353. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4354. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4355. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4356. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4357. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4358. * THE SOFTWARE.
  4359. */
  4360. var __extends = this && this.__extends || function () {
  4361. var _extendStatics = function extendStatics(d, b) {
  4362. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4363. d.__proto__ = b;
  4364. } || function (d, b) {
  4365. for (var p in b) {
  4366. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4367. }
  4368. };
  4369. return _extendStatics(d, b);
  4370. };
  4371. return function (d, b) {
  4372. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4373. _extendStatics(d, b);
  4374. function __() {
  4375. this.constructor = d;
  4376. }
  4377. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4378. };
  4379. }();
  4380. var __assign = this && this.__assign || function () {
  4381. __assign = Object.assign || function (t) {
  4382. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4383. s = arguments[i];
  4384. for (var p in s) {
  4385. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4386. }
  4387. }
  4388. return t;
  4389. };
  4390. return __assign.apply(this, arguments);
  4391. };
  4392. Object.defineProperty(exports, "__esModule", { value: true });
  4393. exports.MDCLineRippleFoundation = void 0;
  4394. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4395. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts");
  4396. /** MDC Line Ripple Foundation */
  4397. var MDCLineRippleFoundation = /** @class */function (_super) {
  4398. __extends(MDCLineRippleFoundation, _super);
  4399. function MDCLineRippleFoundation(adapter) {
  4400. var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
  4401. _this.transitionEndHandler = function (evt) {
  4402. _this.handleTransitionEnd(evt);
  4403. };
  4404. return _this;
  4405. }
  4406. Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
  4407. get: function get() {
  4408. return constants_1.cssClasses;
  4409. },
  4410. enumerable: false,
  4411. configurable: true
  4412. });
  4413. Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
  4414. /**
  4415. * See {@link MDCLineRippleAdapter} for typing information on parameters and
  4416. * return types.
  4417. */
  4418. get: function get() {
  4419. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4420. return {
  4421. addClass: function addClass() {
  4422. return undefined;
  4423. },
  4424. removeClass: function removeClass() {
  4425. return undefined;
  4426. },
  4427. hasClass: function hasClass() {
  4428. return false;
  4429. },
  4430. setStyle: function setStyle() {
  4431. return undefined;
  4432. },
  4433. registerEventHandler: function registerEventHandler() {
  4434. return undefined;
  4435. },
  4436. deregisterEventHandler: function deregisterEventHandler() {
  4437. return undefined;
  4438. }
  4439. };
  4440. // tslint:enable:object-literal-sort-keys
  4441. },
  4442. enumerable: false,
  4443. configurable: true
  4444. });
  4445. MDCLineRippleFoundation.prototype.init = function () {
  4446. this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
  4447. };
  4448. MDCLineRippleFoundation.prototype.destroy = function () {
  4449. this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
  4450. };
  4451. MDCLineRippleFoundation.prototype.activate = function () {
  4452. this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  4453. this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  4454. };
  4455. MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
  4456. this.adapter.setStyle('transform-origin', xCoordinate + "px center");
  4457. };
  4458. MDCLineRippleFoundation.prototype.deactivate = function () {
  4459. this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  4460. };
  4461. MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
  4462. // Wait for the line ripple to be either transparent or opaque
  4463. // before emitting the animation end event
  4464. var isDeactivating = this.adapter.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  4465. if (evt.propertyName === 'opacity') {
  4466. if (isDeactivating) {
  4467. this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
  4468. this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
  4469. }
  4470. }
  4471. };
  4472. return MDCLineRippleFoundation;
  4473. }(foundation_1.MDCFoundation);
  4474. exports.MDCLineRippleFoundation = MDCLineRippleFoundation;
  4475. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  4476. exports.default = MDCLineRippleFoundation;
  4477. /***/ }),
  4478. /***/ "./packages/mdc-notched-outline/component.ts":
  4479. /*!***************************************************!*\
  4480. !*** ./packages/mdc-notched-outline/component.ts ***!
  4481. \***************************************************/
  4482. /*! no static exports found */
  4483. /***/ (function(module, exports, __webpack_require__) {
  4484. "use strict";
  4485. /**
  4486. * @license
  4487. * Copyright 2017 Google Inc.
  4488. *
  4489. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4490. * of this software and associated documentation files (the "Software"), to deal
  4491. * in the Software without restriction, including without limitation the rights
  4492. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4493. * copies of the Software, and to permit persons to whom the Software is
  4494. * furnished to do so, subject to the following conditions:
  4495. *
  4496. * The above copyright notice and this permission notice shall be included in
  4497. * all copies or substantial portions of the Software.
  4498. *
  4499. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4500. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4501. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4502. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4503. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4504. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4505. * THE SOFTWARE.
  4506. */
  4507. var __extends = this && this.__extends || function () {
  4508. var _extendStatics = function extendStatics(d, b) {
  4509. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4510. d.__proto__ = b;
  4511. } || function (d, b) {
  4512. for (var p in b) {
  4513. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4514. }
  4515. };
  4516. return _extendStatics(d, b);
  4517. };
  4518. return function (d, b) {
  4519. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4520. _extendStatics(d, b);
  4521. function __() {
  4522. this.constructor = d;
  4523. }
  4524. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4525. };
  4526. }();
  4527. Object.defineProperty(exports, "__esModule", { value: true });
  4528. exports.MDCNotchedOutline = void 0;
  4529. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4530. var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts");
  4531. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  4532. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts");
  4533. /** MDC Notched Outline */
  4534. var MDCNotchedOutline = /** @class */function (_super) {
  4535. __extends(MDCNotchedOutline, _super);
  4536. function MDCNotchedOutline() {
  4537. return _super !== null && _super.apply(this, arguments) || this;
  4538. }
  4539. MDCNotchedOutline.attachTo = function (root) {
  4540. return new MDCNotchedOutline(root);
  4541. };
  4542. MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
  4543. this.notchElement = this.root.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR);
  4544. var label = this.root.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT);
  4545. if (label) {
  4546. label.style.transitionDuration = '0s';
  4547. this.root.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED);
  4548. requestAnimationFrame(function () {
  4549. label.style.transitionDuration = '';
  4550. });
  4551. } else {
  4552. this.root.classList.add(constants_1.cssClasses.NO_LABEL);
  4553. }
  4554. };
  4555. /**
  4556. * Updates classes and styles to open the notch to the specified width.
  4557. * @param notchWidth The notch width in the outline.
  4558. */
  4559. MDCNotchedOutline.prototype.notch = function (notchWidth) {
  4560. this.foundation.notch(notchWidth);
  4561. };
  4562. /**
  4563. * Updates classes and styles to close the notch.
  4564. */
  4565. MDCNotchedOutline.prototype.closeNotch = function () {
  4566. this.foundation.closeNotch();
  4567. };
  4568. MDCNotchedOutline.prototype.getDefaultFoundation = function () {
  4569. var _this = this;
  4570. // DO NOT INLINE this variable. For backward compatibility, foundations take
  4571. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  4572. // methods, we need a separate, strongly typed adapter variable.
  4573. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4574. var adapter = {
  4575. addClass: function addClass(className) {
  4576. _this.root.classList.add(className);
  4577. },
  4578. removeClass: function removeClass(className) {
  4579. _this.root.classList.remove(className);
  4580. },
  4581. setNotchWidthProperty: function setNotchWidthProperty(width) {
  4582. _this.notchElement.style.setProperty('width', width + 'px');
  4583. },
  4584. removeNotchWidthProperty: function removeNotchWidthProperty() {
  4585. _this.notchElement.style.removeProperty('width');
  4586. }
  4587. };
  4588. // tslint:enable:object-literal-sort-keys
  4589. return new foundation_2.MDCNotchedOutlineFoundation(adapter);
  4590. };
  4591. return MDCNotchedOutline;
  4592. }(component_1.MDCComponent);
  4593. exports.MDCNotchedOutline = MDCNotchedOutline;
  4594. /***/ }),
  4595. /***/ "./packages/mdc-notched-outline/constants.ts":
  4596. /*!***************************************************!*\
  4597. !*** ./packages/mdc-notched-outline/constants.ts ***!
  4598. \***************************************************/
  4599. /*! no static exports found */
  4600. /***/ (function(module, exports, __webpack_require__) {
  4601. "use strict";
  4602. /**
  4603. * @license
  4604. * Copyright 2018 Google Inc.
  4605. *
  4606. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4607. * of this software and associated documentation files (the "Software"), to deal
  4608. * in the Software without restriction, including without limitation the rights
  4609. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4610. * copies of the Software, and to permit persons to whom the Software is
  4611. * furnished to do so, subject to the following conditions:
  4612. *
  4613. * The above copyright notice and this permission notice shall be included in
  4614. * all copies or substantial portions of the Software.
  4615. *
  4616. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4617. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4618. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4619. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4620. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4621. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4622. * THE SOFTWARE.
  4623. */
  4624. Object.defineProperty(exports, "__esModule", { value: true });
  4625. exports.strings = exports.numbers = exports.cssClasses = void 0;
  4626. var strings = {
  4627. NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch'
  4628. };
  4629. exports.strings = strings;
  4630. var numbers = {
  4631. // This should stay in sync with $mdc-notched-outline-padding * 2.
  4632. NOTCH_ELEMENT_PADDING: 8
  4633. };
  4634. exports.numbers = numbers;
  4635. var cssClasses = {
  4636. NO_LABEL: 'mdc-notched-outline--no-label',
  4637. OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
  4638. OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded'
  4639. };
  4640. exports.cssClasses = cssClasses;
  4641. /***/ }),
  4642. /***/ "./packages/mdc-notched-outline/foundation.ts":
  4643. /*!****************************************************!*\
  4644. !*** ./packages/mdc-notched-outline/foundation.ts ***!
  4645. \****************************************************/
  4646. /*! no static exports found */
  4647. /***/ (function(module, exports, __webpack_require__) {
  4648. "use strict";
  4649. /**
  4650. * @license
  4651. * Copyright 2017 Google Inc.
  4652. *
  4653. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4654. * of this software and associated documentation files (the "Software"), to deal
  4655. * in the Software without restriction, including without limitation the rights
  4656. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4657. * copies of the Software, and to permit persons to whom the Software is
  4658. * furnished to do so, subject to the following conditions:
  4659. *
  4660. * The above copyright notice and this permission notice shall be included in
  4661. * all copies or substantial portions of the Software.
  4662. *
  4663. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4664. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4665. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4666. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4667. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4668. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4669. * THE SOFTWARE.
  4670. */
  4671. var __extends = this && this.__extends || function () {
  4672. var _extendStatics = function extendStatics(d, b) {
  4673. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4674. d.__proto__ = b;
  4675. } || function (d, b) {
  4676. for (var p in b) {
  4677. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4678. }
  4679. };
  4680. return _extendStatics(d, b);
  4681. };
  4682. return function (d, b) {
  4683. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4684. _extendStatics(d, b);
  4685. function __() {
  4686. this.constructor = d;
  4687. }
  4688. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4689. };
  4690. }();
  4691. var __assign = this && this.__assign || function () {
  4692. __assign = Object.assign || function (t) {
  4693. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4694. s = arguments[i];
  4695. for (var p in s) {
  4696. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4697. }
  4698. }
  4699. return t;
  4700. };
  4701. return __assign.apply(this, arguments);
  4702. };
  4703. Object.defineProperty(exports, "__esModule", { value: true });
  4704. exports.MDCNotchedOutlineFoundation = void 0;
  4705. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4706. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
  4707. /** MDC Notched Outline Foundation */
  4708. var MDCNotchedOutlineFoundation = /** @class */function (_super) {
  4709. __extends(MDCNotchedOutlineFoundation, _super);
  4710. function MDCNotchedOutlineFoundation(adapter) {
  4711. return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
  4712. }
  4713. Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
  4714. get: function get() {
  4715. return constants_1.strings;
  4716. },
  4717. enumerable: false,
  4718. configurable: true
  4719. });
  4720. Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
  4721. get: function get() {
  4722. return constants_1.cssClasses;
  4723. },
  4724. enumerable: false,
  4725. configurable: true
  4726. });
  4727. Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
  4728. get: function get() {
  4729. return constants_1.numbers;
  4730. },
  4731. enumerable: false,
  4732. configurable: true
  4733. });
  4734. Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
  4735. /**
  4736. * See {@link MDCNotchedOutlineAdapter} for typing information on parameters
  4737. * and return types.
  4738. */
  4739. get: function get() {
  4740. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4741. return {
  4742. addClass: function addClass() {
  4743. return undefined;
  4744. },
  4745. removeClass: function removeClass() {
  4746. return undefined;
  4747. },
  4748. setNotchWidthProperty: function setNotchWidthProperty() {
  4749. return undefined;
  4750. },
  4751. removeNotchWidthProperty: function removeNotchWidthProperty() {
  4752. return undefined;
  4753. }
  4754. };
  4755. // tslint:enable:object-literal-sort-keys
  4756. },
  4757. enumerable: false,
  4758. configurable: true
  4759. });
  4760. /**
  4761. * Adds the outline notched selector and updates the notch width calculated
  4762. * based off of notchWidth.
  4763. */
  4764. MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
  4765. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  4766. if (notchWidth > 0) {
  4767. notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
  4768. }
  4769. this.adapter.setNotchWidthProperty(notchWidth);
  4770. this.adapter.addClass(OUTLINE_NOTCHED);
  4771. };
  4772. /**
  4773. * Removes notched outline selector to close the notch in the outline.
  4774. */
  4775. MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
  4776. var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
  4777. this.adapter.removeClass(OUTLINE_NOTCHED);
  4778. this.adapter.removeNotchWidthProperty();
  4779. };
  4780. return MDCNotchedOutlineFoundation;
  4781. }(foundation_1.MDCFoundation);
  4782. exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation;
  4783. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  4784. exports.default = MDCNotchedOutlineFoundation;
  4785. /***/ }),
  4786. /***/ "./packages/mdc-ripple/component.ts":
  4787. /*!******************************************!*\
  4788. !*** ./packages/mdc-ripple/component.ts ***!
  4789. \******************************************/
  4790. /*! no static exports found */
  4791. /***/ (function(module, exports, __webpack_require__) {
  4792. "use strict";
  4793. /**
  4794. * @license
  4795. * Copyright 2016 Google Inc.
  4796. *
  4797. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4798. * of this software and associated documentation files (the "Software"), to deal
  4799. * in the Software without restriction, including without limitation the rights
  4800. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4801. * copies of the Software, and to permit persons to whom the Software is
  4802. * furnished to do so, subject to the following conditions:
  4803. *
  4804. * The above copyright notice and this permission notice shall be included in
  4805. * all copies or substantial portions of the Software.
  4806. *
  4807. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4808. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4809. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4810. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4811. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4812. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4813. * THE SOFTWARE.
  4814. */
  4815. var __extends = this && this.__extends || function () {
  4816. var _extendStatics = function extendStatics(d, b) {
  4817. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4818. d.__proto__ = b;
  4819. } || function (d, b) {
  4820. for (var p in b) {
  4821. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4822. }
  4823. };
  4824. return _extendStatics(d, b);
  4825. };
  4826. return function (d, b) {
  4827. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4828. _extendStatics(d, b);
  4829. function __() {
  4830. this.constructor = d;
  4831. }
  4832. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4833. };
  4834. }();
  4835. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  4836. if (k2 === undefined) k2 = k;
  4837. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  4838. return m[k];
  4839. } });
  4840. } : function (o, m, k, k2) {
  4841. if (k2 === undefined) k2 = k;
  4842. o[k2] = m[k];
  4843. });
  4844. var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
  4845. Object.defineProperty(o, "default", { enumerable: true, value: v });
  4846. } : function (o, v) {
  4847. o["default"] = v;
  4848. });
  4849. var __importStar = this && this.__importStar || function (mod) {
  4850. if (mod && mod.__esModule) return mod;
  4851. var result = {};
  4852. if (mod != null) for (var k in mod) {
  4853. if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  4854. }__setModuleDefault(result, mod);
  4855. return result;
  4856. };
  4857. Object.defineProperty(exports, "__esModule", { value: true });
  4858. exports.MDCRipple = void 0;
  4859. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4860. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  4861. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  4862. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
  4863. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  4864. /** MDC Ripple */
  4865. var MDCRipple = /** @class */function (_super) {
  4866. __extends(MDCRipple, _super);
  4867. function MDCRipple() {
  4868. var _this = _super !== null && _super.apply(this, arguments) || this;
  4869. _this.disabled = false;
  4870. return _this;
  4871. }
  4872. MDCRipple.attachTo = function (root, opts) {
  4873. if (opts === void 0) {
  4874. opts = {
  4875. isUnbounded: undefined
  4876. };
  4877. }
  4878. var ripple = new MDCRipple(root);
  4879. // Only override unbounded behavior if option is explicitly specified
  4880. if (opts.isUnbounded !== undefined) {
  4881. ripple.unbounded = opts.isUnbounded;
  4882. }
  4883. return ripple;
  4884. };
  4885. MDCRipple.createAdapter = function (instance) {
  4886. return {
  4887. addClass: function addClass(className) {
  4888. instance.root.classList.add(className);
  4889. },
  4890. browserSupportsCssVars: function browserSupportsCssVars() {
  4891. return util.supportsCssVariables(window);
  4892. },
  4893. computeBoundingRect: function computeBoundingRect() {
  4894. return instance.root.getBoundingClientRect();
  4895. },
  4896. containsEventTarget: function containsEventTarget(target) {
  4897. return instance.root.contains(target);
  4898. },
  4899. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  4900. document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
  4901. },
  4902. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  4903. instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
  4904. },
  4905. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  4906. window.removeEventListener('resize', handler);
  4907. },
  4908. getWindowPageOffset: function getWindowPageOffset() {
  4909. return { x: window.pageXOffset, y: window.pageYOffset };
  4910. },
  4911. isSurfaceActive: function isSurfaceActive() {
  4912. return ponyfill_1.matches(instance.root, ':active');
  4913. },
  4914. isSurfaceDisabled: function isSurfaceDisabled() {
  4915. return Boolean(instance.disabled);
  4916. },
  4917. isUnbounded: function isUnbounded() {
  4918. return Boolean(instance.unbounded);
  4919. },
  4920. registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  4921. document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
  4922. },
  4923. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  4924. instance.root.addEventListener(evtType, handler, events_1.applyPassive());
  4925. },
  4926. registerResizeHandler: function registerResizeHandler(handler) {
  4927. window.addEventListener('resize', handler);
  4928. },
  4929. removeClass: function removeClass(className) {
  4930. instance.root.classList.remove(className);
  4931. },
  4932. updateCssVariable: function updateCssVariable(varName, value) {
  4933. instance.root.style.setProperty(varName, value);
  4934. }
  4935. };
  4936. };
  4937. Object.defineProperty(MDCRipple.prototype, "unbounded", {
  4938. get: function get() {
  4939. return Boolean(this.isUnbounded);
  4940. },
  4941. set: function set(unbounded) {
  4942. this.isUnbounded = Boolean(unbounded);
  4943. this.setUnbounded();
  4944. },
  4945. enumerable: false,
  4946. configurable: true
  4947. });
  4948. MDCRipple.prototype.activate = function () {
  4949. this.foundation.activate();
  4950. };
  4951. MDCRipple.prototype.deactivate = function () {
  4952. this.foundation.deactivate();
  4953. };
  4954. MDCRipple.prototype.layout = function () {
  4955. this.foundation.layout();
  4956. };
  4957. MDCRipple.prototype.getDefaultFoundation = function () {
  4958. return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
  4959. };
  4960. MDCRipple.prototype.initialSyncWithDOM = function () {
  4961. var root = this.root;
  4962. this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
  4963. };
  4964. /**
  4965. * Closure Compiler throws an access control error when directly accessing a
  4966. * protected or private property inside a getter/setter, like unbounded above.
  4967. * By accessing the protected property inside a method, we solve that problem.
  4968. * That's why this function exists.
  4969. */
  4970. MDCRipple.prototype.setUnbounded = function () {
  4971. this.foundation.setUnbounded(Boolean(this.isUnbounded));
  4972. };
  4973. return MDCRipple;
  4974. }(component_1.MDCComponent);
  4975. exports.MDCRipple = MDCRipple;
  4976. /***/ }),
  4977. /***/ "./packages/mdc-ripple/constants.ts":
  4978. /*!******************************************!*\
  4979. !*** ./packages/mdc-ripple/constants.ts ***!
  4980. \******************************************/
  4981. /*! no static exports found */
  4982. /***/ (function(module, exports, __webpack_require__) {
  4983. "use strict";
  4984. /**
  4985. * @license
  4986. * Copyright 2016 Google Inc.
  4987. *
  4988. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4989. * of this software and associated documentation files (the "Software"), to deal
  4990. * in the Software without restriction, including without limitation the rights
  4991. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4992. * copies of the Software, and to permit persons to whom the Software is
  4993. * furnished to do so, subject to the following conditions:
  4994. *
  4995. * The above copyright notice and this permission notice shall be included in
  4996. * all copies or substantial portions of the Software.
  4997. *
  4998. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4999. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5000. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5001. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5002. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5003. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5004. * THE SOFTWARE.
  5005. */
  5006. Object.defineProperty(exports, "__esModule", { value: true });
  5007. exports.numbers = exports.strings = exports.cssClasses = void 0;
  5008. exports.cssClasses = {
  5009. // Ripple is a special case where the "root" component is really a "mixin" of
  5010. // sorts,
  5011. // given that it's an 'upgrade' to an existing component. That being said it
  5012. // is the root
  5013. // CSS class that all other CSS classes derive from.
  5014. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  5015. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  5016. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  5017. ROOT: 'mdc-ripple-upgraded',
  5018. UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
  5019. };
  5020. exports.strings = {
  5021. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  5022. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  5023. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  5024. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  5025. VAR_LEFT: '--mdc-ripple-left',
  5026. VAR_TOP: '--mdc-ripple-top'
  5027. };
  5028. exports.numbers = {
  5029. DEACTIVATION_TIMEOUT_MS: 225,
  5030. // animation duration)
  5031. FG_DEACTIVATION_MS: 150,
  5032. // (i.e. deactivation animation duration)
  5033. INITIAL_ORIGIN_SCALE: 0.6,
  5034. PADDING: 10,
  5035. TAP_DELAY_MS: 300 };
  5036. /***/ }),
  5037. /***/ "./packages/mdc-ripple/foundation.ts":
  5038. /*!*******************************************!*\
  5039. !*** ./packages/mdc-ripple/foundation.ts ***!
  5040. \*******************************************/
  5041. /*! no static exports found */
  5042. /***/ (function(module, exports, __webpack_require__) {
  5043. "use strict";
  5044. /**
  5045. * @license
  5046. * Copyright 2016 Google Inc.
  5047. *
  5048. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5049. * of this software and associated documentation files (the "Software"), to deal
  5050. * in the Software without restriction, including without limitation the rights
  5051. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5052. * copies of the Software, and to permit persons to whom the Software is
  5053. * furnished to do so, subject to the following conditions:
  5054. *
  5055. * The above copyright notice and this permission notice shall be included in
  5056. * all copies or substantial portions of the Software.
  5057. *
  5058. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5059. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5060. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5061. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5062. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5063. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5064. * THE SOFTWARE.
  5065. */
  5066. var __extends = this && this.__extends || function () {
  5067. var _extendStatics = function extendStatics(d, b) {
  5068. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5069. d.__proto__ = b;
  5070. } || function (d, b) {
  5071. for (var p in b) {
  5072. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  5073. }
  5074. };
  5075. return _extendStatics(d, b);
  5076. };
  5077. return function (d, b) {
  5078. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  5079. _extendStatics(d, b);
  5080. function __() {
  5081. this.constructor = d;
  5082. }
  5083. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5084. };
  5085. }();
  5086. var __assign = this && this.__assign || function () {
  5087. __assign = Object.assign || function (t) {
  5088. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5089. s = arguments[i];
  5090. for (var p in s) {
  5091. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  5092. }
  5093. }
  5094. return t;
  5095. };
  5096. return __assign.apply(this, arguments);
  5097. };
  5098. var __values = this && this.__values || function (o) {
  5099. var s = typeof Symbol === "function" && Symbol.iterator,
  5100. m = s && o[s],
  5101. i = 0;
  5102. if (m) return m.call(o);
  5103. if (o && typeof o.length === "number") return {
  5104. next: function next() {
  5105. if (o && i >= o.length) o = void 0;
  5106. return { value: o && o[i++], done: !o };
  5107. }
  5108. };
  5109. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  5110. };
  5111. Object.defineProperty(exports, "__esModule", { value: true });
  5112. exports.MDCRippleFoundation = void 0;
  5113. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5114. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
  5115. var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
  5116. // Activation events registered on the root element of each instance for
  5117. // activation
  5118. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  5119. // Deactivation events registered on documentElement when a pointer-related down
  5120. // event occurs
  5121. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
  5122. // simultaneous nested activations
  5123. var activatedTargets = [];
  5124. /** MDC Ripple Foundation */
  5125. var MDCRippleFoundation = /** @class */function (_super) {
  5126. __extends(MDCRippleFoundation, _super);
  5127. function MDCRippleFoundation(adapter) {
  5128. var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
  5129. _this.activationAnimationHasEnded = false;
  5130. _this.activationTimer = 0;
  5131. _this.fgDeactivationRemovalTimer = 0;
  5132. _this.fgScale = '0';
  5133. _this.frame = { width: 0, height: 0 };
  5134. _this.initialSize = 0;
  5135. _this.layoutFrame = 0;
  5136. _this.maxRadius = 0;
  5137. _this.unboundedCoords = { left: 0, top: 0 };
  5138. _this.activationState = _this.defaultActivationState();
  5139. _this.activationTimerCallback = function () {
  5140. _this.activationAnimationHasEnded = true;
  5141. _this.runDeactivationUXLogicIfReady();
  5142. };
  5143. _this.activateHandler = function (e) {
  5144. _this.activateImpl(e);
  5145. };
  5146. _this.deactivateHandler = function () {
  5147. _this.deactivateImpl();
  5148. };
  5149. _this.focusHandler = function () {
  5150. _this.handleFocus();
  5151. };
  5152. _this.blurHandler = function () {
  5153. _this.handleBlur();
  5154. };
  5155. _this.resizeHandler = function () {
  5156. _this.layout();
  5157. };
  5158. return _this;
  5159. }
  5160. Object.defineProperty(MDCRippleFoundation, "cssClasses", {
  5161. get: function get() {
  5162. return constants_1.cssClasses;
  5163. },
  5164. enumerable: false,
  5165. configurable: true
  5166. });
  5167. Object.defineProperty(MDCRippleFoundation, "strings", {
  5168. get: function get() {
  5169. return constants_1.strings;
  5170. },
  5171. enumerable: false,
  5172. configurable: true
  5173. });
  5174. Object.defineProperty(MDCRippleFoundation, "numbers", {
  5175. get: function get() {
  5176. return constants_1.numbers;
  5177. },
  5178. enumerable: false,
  5179. configurable: true
  5180. });
  5181. Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
  5182. get: function get() {
  5183. return {
  5184. addClass: function addClass() {
  5185. return undefined;
  5186. },
  5187. browserSupportsCssVars: function browserSupportsCssVars() {
  5188. return true;
  5189. },
  5190. computeBoundingRect: function computeBoundingRect() {
  5191. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  5192. },
  5193. containsEventTarget: function containsEventTarget() {
  5194. return true;
  5195. },
  5196. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
  5197. return undefined;
  5198. },
  5199. deregisterInteractionHandler: function deregisterInteractionHandler() {
  5200. return undefined;
  5201. },
  5202. deregisterResizeHandler: function deregisterResizeHandler() {
  5203. return undefined;
  5204. },
  5205. getWindowPageOffset: function getWindowPageOffset() {
  5206. return { x: 0, y: 0 };
  5207. },
  5208. isSurfaceActive: function isSurfaceActive() {
  5209. return true;
  5210. },
  5211. isSurfaceDisabled: function isSurfaceDisabled() {
  5212. return true;
  5213. },
  5214. isUnbounded: function isUnbounded() {
  5215. return true;
  5216. },
  5217. registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
  5218. return undefined;
  5219. },
  5220. registerInteractionHandler: function registerInteractionHandler() {
  5221. return undefined;
  5222. },
  5223. registerResizeHandler: function registerResizeHandler() {
  5224. return undefined;
  5225. },
  5226. removeClass: function removeClass() {
  5227. return undefined;
  5228. },
  5229. updateCssVariable: function updateCssVariable() {
  5230. return undefined;
  5231. }
  5232. };
  5233. },
  5234. enumerable: false,
  5235. configurable: true
  5236. });
  5237. MDCRippleFoundation.prototype.init = function () {
  5238. var _this = this;
  5239. var supportsPressRipple = this.supportsPressRipple();
  5240. this.registerRootHandlers(supportsPressRipple);
  5241. if (supportsPressRipple) {
  5242. var _a = MDCRippleFoundation.cssClasses,
  5243. ROOT_1 = _a.ROOT,
  5244. UNBOUNDED_1 = _a.UNBOUNDED;
  5245. requestAnimationFrame(function () {
  5246. _this.adapter.addClass(ROOT_1);
  5247. if (_this.adapter.isUnbounded()) {
  5248. _this.adapter.addClass(UNBOUNDED_1);
  5249. // Unbounded ripples need layout logic applied immediately to set
  5250. // coordinates for both shade and ripple
  5251. _this.layoutInternal();
  5252. }
  5253. });
  5254. }
  5255. };
  5256. MDCRippleFoundation.prototype.destroy = function () {
  5257. var _this = this;
  5258. if (this.supportsPressRipple()) {
  5259. if (this.activationTimer) {
  5260. clearTimeout(this.activationTimer);
  5261. this.activationTimer = 0;
  5262. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  5263. }
  5264. if (this.fgDeactivationRemovalTimer) {
  5265. clearTimeout(this.fgDeactivationRemovalTimer);
  5266. this.fgDeactivationRemovalTimer = 0;
  5267. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  5268. }
  5269. var _a = MDCRippleFoundation.cssClasses,
  5270. ROOT_2 = _a.ROOT,
  5271. UNBOUNDED_2 = _a.UNBOUNDED;
  5272. requestAnimationFrame(function () {
  5273. _this.adapter.removeClass(ROOT_2);
  5274. _this.adapter.removeClass(UNBOUNDED_2);
  5275. _this.removeCssVars();
  5276. });
  5277. }
  5278. this.deregisterRootHandlers();
  5279. this.deregisterDeactivationHandlers();
  5280. };
  5281. /**
  5282. * @param evt Optional event containing position information.
  5283. */
  5284. MDCRippleFoundation.prototype.activate = function (evt) {
  5285. this.activateImpl(evt);
  5286. };
  5287. MDCRippleFoundation.prototype.deactivate = function () {
  5288. this.deactivateImpl();
  5289. };
  5290. MDCRippleFoundation.prototype.layout = function () {
  5291. var _this = this;
  5292. if (this.layoutFrame) {
  5293. cancelAnimationFrame(this.layoutFrame);
  5294. }
  5295. this.layoutFrame = requestAnimationFrame(function () {
  5296. _this.layoutInternal();
  5297. _this.layoutFrame = 0;
  5298. });
  5299. };
  5300. MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
  5301. var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  5302. if (unbounded) {
  5303. this.adapter.addClass(UNBOUNDED);
  5304. } else {
  5305. this.adapter.removeClass(UNBOUNDED);
  5306. }
  5307. };
  5308. MDCRippleFoundation.prototype.handleFocus = function () {
  5309. var _this = this;
  5310. requestAnimationFrame(function () {
  5311. _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  5312. });
  5313. };
  5314. MDCRippleFoundation.prototype.handleBlur = function () {
  5315. var _this = this;
  5316. requestAnimationFrame(function () {
  5317. _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  5318. });
  5319. };
  5320. /**
  5321. * We compute this property so that we are not querying information about the
  5322. * client until the point in time where the foundation requests it. This
  5323. * prevents scenarios where client-side feature-detection may happen too
  5324. * early, such as when components are rendered on the server and then
  5325. * initialized at mount time on the client.
  5326. */
  5327. MDCRippleFoundation.prototype.supportsPressRipple = function () {
  5328. return this.adapter.browserSupportsCssVars();
  5329. };
  5330. MDCRippleFoundation.prototype.defaultActivationState = function () {
  5331. return {
  5332. activationEvent: undefined,
  5333. hasDeactivationUXRun: false,
  5334. isActivated: false,
  5335. isProgrammatic: false,
  5336. wasActivatedByPointer: false,
  5337. wasElementMadeActive: false
  5338. };
  5339. };
  5340. /**
  5341. * supportsPressRipple Passed from init to save a redundant function call
  5342. */
  5343. MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
  5344. var e_1, _a;
  5345. if (supportsPressRipple) {
  5346. try {
  5347. for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {
  5348. var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
  5349. this.adapter.registerInteractionHandler(evtType, this.activateHandler);
  5350. }
  5351. } catch (e_1_1) {
  5352. e_1 = { error: e_1_1 };
  5353. } finally {
  5354. try {
  5355. if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
  5356. } finally {
  5357. if (e_1) throw e_1.error;
  5358. }
  5359. }
  5360. if (this.adapter.isUnbounded()) {
  5361. this.adapter.registerResizeHandler(this.resizeHandler);
  5362. }
  5363. }
  5364. this.adapter.registerInteractionHandler('focus', this.focusHandler);
  5365. this.adapter.registerInteractionHandler('blur', this.blurHandler);
  5366. };
  5367. MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
  5368. var e_2, _a;
  5369. if (evt.type === 'keydown') {
  5370. this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
  5371. } else {
  5372. try {
  5373. for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {
  5374. var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
  5375. this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
  5376. }
  5377. } catch (e_2_1) {
  5378. e_2 = { error: e_2_1 };
  5379. } finally {
  5380. try {
  5381. if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);
  5382. } finally {
  5383. if (e_2) throw e_2.error;
  5384. }
  5385. }
  5386. }
  5387. };
  5388. MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
  5389. var e_3, _a;
  5390. try {
  5391. for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {
  5392. var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
  5393. this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
  5394. }
  5395. } catch (e_3_1) {
  5396. e_3 = { error: e_3_1 };
  5397. } finally {
  5398. try {
  5399. if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
  5400. } finally {
  5401. if (e_3) throw e_3.error;
  5402. }
  5403. }
  5404. this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
  5405. this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
  5406. if (this.adapter.isUnbounded()) {
  5407. this.adapter.deregisterResizeHandler(this.resizeHandler);
  5408. }
  5409. };
  5410. MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
  5411. var e_4, _a;
  5412. this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
  5413. try {
  5414. for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {
  5415. var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
  5416. this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
  5417. }
  5418. } catch (e_4_1) {
  5419. e_4 = { error: e_4_1 };
  5420. } finally {
  5421. try {
  5422. if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);
  5423. } finally {
  5424. if (e_4) throw e_4.error;
  5425. }
  5426. }
  5427. };
  5428. MDCRippleFoundation.prototype.removeCssVars = function () {
  5429. var _this = this;
  5430. var rippleStrings = MDCRippleFoundation.strings;
  5431. var keys = Object.keys(rippleStrings);
  5432. keys.forEach(function (key) {
  5433. if (key.indexOf('VAR_') === 0) {
  5434. _this.adapter.updateCssVariable(rippleStrings[key], null);
  5435. }
  5436. });
  5437. };
  5438. MDCRippleFoundation.prototype.activateImpl = function (evt) {
  5439. var _this = this;
  5440. if (this.adapter.isSurfaceDisabled()) {
  5441. return;
  5442. }
  5443. var activationState = this.activationState;
  5444. if (activationState.isActivated) {
  5445. return;
  5446. }
  5447. // Avoid reacting to follow-on events fired by touch device after an
  5448. // already-processed user interaction
  5449. var previousActivationEvent = this.previousActivationEvent;
  5450. var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
  5451. if (isSameInteraction) {
  5452. return;
  5453. }
  5454. activationState.isActivated = true;
  5455. activationState.isProgrammatic = evt === undefined;
  5456. activationState.activationEvent = evt;
  5457. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
  5458. var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  5459. return _this.adapter.containsEventTarget(target);
  5460. });
  5461. if (hasActivatedChild) {
  5462. // Immediately reset activation state, while preserving logic that
  5463. // prevents touch follow-on events
  5464. this.resetActivationState();
  5465. return;
  5466. }
  5467. if (evt !== undefined) {
  5468. activatedTargets.push(evt.target);
  5469. this.registerDeactivationHandlers(evt);
  5470. }
  5471. activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
  5472. if (activationState.wasElementMadeActive) {
  5473. this.animateActivation();
  5474. }
  5475. requestAnimationFrame(function () {
  5476. // Reset array on next frame after the current event has had a chance to
  5477. // bubble to prevent ancestor ripples
  5478. activatedTargets = [];
  5479. if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
  5480. // If space was pressed, try again within an rAF call to detect :active,
  5481. // because different UAs report active states inconsistently when
  5482. // they're called within event handling code:
  5483. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  5484. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  5485. // We try first outside rAF to support Edge, which does not exhibit this
  5486. // problem, but will crash if a CSS variable is set within a rAF
  5487. // callback for a submit button interaction (#2241).
  5488. activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
  5489. if (activationState.wasElementMadeActive) {
  5490. _this.animateActivation();
  5491. }
  5492. }
  5493. if (!activationState.wasElementMadeActive) {
  5494. // Reset activation state immediately if element was not made active.
  5495. _this.activationState = _this.defaultActivationState();
  5496. }
  5497. });
  5498. };
  5499. MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
  5500. return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
  5501. };
  5502. MDCRippleFoundation.prototype.animateActivation = function () {
  5503. var _this = this;
  5504. var _a = MDCRippleFoundation.strings,
  5505. VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
  5506. VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
  5507. var _b = MDCRippleFoundation.cssClasses,
  5508. FG_DEACTIVATION = _b.FG_DEACTIVATION,
  5509. FG_ACTIVATION = _b.FG_ACTIVATION;
  5510. var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  5511. this.layoutInternal();
  5512. var translateStart = '';
  5513. var translateEnd = '';
  5514. if (!this.adapter.isUnbounded()) {
  5515. var _c = this.getFgTranslationCoordinates(),
  5516. startPoint = _c.startPoint,
  5517. endPoint = _c.endPoint;
  5518. translateStart = startPoint.x + "px, " + startPoint.y + "px";
  5519. translateEnd = endPoint.x + "px, " + endPoint.y + "px";
  5520. }
  5521. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  5522. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  5523. // Cancel any ongoing activation/deactivation animations
  5524. clearTimeout(this.activationTimer);
  5525. clearTimeout(this.fgDeactivationRemovalTimer);
  5526. this.rmBoundedActivationClasses();
  5527. this.adapter.removeClass(FG_DEACTIVATION);
  5528. // Force layout in order to re-trigger the animation.
  5529. this.adapter.computeBoundingRect();
  5530. this.adapter.addClass(FG_ACTIVATION);
  5531. this.activationTimer = setTimeout(function () {
  5532. _this.activationTimerCallback();
  5533. }, DEACTIVATION_TIMEOUT_MS);
  5534. };
  5535. MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
  5536. var _a = this.activationState,
  5537. activationEvent = _a.activationEvent,
  5538. wasActivatedByPointer = _a.wasActivatedByPointer;
  5539. var startPoint;
  5540. if (wasActivatedByPointer) {
  5541. startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
  5542. } else {
  5543. startPoint = {
  5544. x: this.frame.width / 2,
  5545. y: this.frame.height / 2
  5546. };
  5547. }
  5548. // Center the element around the start point.
  5549. startPoint = {
  5550. x: startPoint.x - this.initialSize / 2,
  5551. y: startPoint.y - this.initialSize / 2
  5552. };
  5553. var endPoint = {
  5554. x: this.frame.width / 2 - this.initialSize / 2,
  5555. y: this.frame.height / 2 - this.initialSize / 2
  5556. };
  5557. return { startPoint: startPoint, endPoint: endPoint };
  5558. };
  5559. MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
  5560. var _this = this;
  5561. // This method is called both when a pointing device is released, and when
  5562. // the activation animation ends. The deactivation animation should only run
  5563. // after both of those occur.
  5564. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  5565. var _a = this.activationState,
  5566. hasDeactivationUXRun = _a.hasDeactivationUXRun,
  5567. isActivated = _a.isActivated;
  5568. var activationHasEnded = hasDeactivationUXRun || !isActivated;
  5569. if (activationHasEnded && this.activationAnimationHasEnded) {
  5570. this.rmBoundedActivationClasses();
  5571. this.adapter.addClass(FG_DEACTIVATION);
  5572. this.fgDeactivationRemovalTimer = setTimeout(function () {
  5573. _this.adapter.removeClass(FG_DEACTIVATION);
  5574. }, constants_1.numbers.FG_DEACTIVATION_MS);
  5575. }
  5576. };
  5577. MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
  5578. var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  5579. this.adapter.removeClass(FG_ACTIVATION);
  5580. this.activationAnimationHasEnded = false;
  5581. this.adapter.computeBoundingRect();
  5582. };
  5583. MDCRippleFoundation.prototype.resetActivationState = function () {
  5584. var _this = this;
  5585. this.previousActivationEvent = this.activationState.activationEvent;
  5586. this.activationState = this.defaultActivationState();
  5587. // Touch devices may fire additional events for the same interaction within
  5588. // a short time. Store the previous event until it's safe to assume that
  5589. // subsequent events are for new interactions.
  5590. setTimeout(function () {
  5591. return _this.previousActivationEvent = undefined;
  5592. }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  5593. };
  5594. MDCRippleFoundation.prototype.deactivateImpl = function () {
  5595. var _this = this;
  5596. var activationState = this.activationState;
  5597. // This can happen in scenarios such as when you have a keyup event that
  5598. // blurs the element.
  5599. if (!activationState.isActivated) {
  5600. return;
  5601. }
  5602. var state = __assign({}, activationState);
  5603. if (activationState.isProgrammatic) {
  5604. requestAnimationFrame(function () {
  5605. _this.animateDeactivation(state);
  5606. });
  5607. this.resetActivationState();
  5608. } else {
  5609. this.deregisterDeactivationHandlers();
  5610. requestAnimationFrame(function () {
  5611. _this.activationState.hasDeactivationUXRun = true;
  5612. _this.animateDeactivation(state);
  5613. _this.resetActivationState();
  5614. });
  5615. }
  5616. };
  5617. MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
  5618. var wasActivatedByPointer = _a.wasActivatedByPointer,
  5619. wasElementMadeActive = _a.wasElementMadeActive;
  5620. if (wasActivatedByPointer || wasElementMadeActive) {
  5621. this.runDeactivationUXLogicIfReady();
  5622. }
  5623. };
  5624. MDCRippleFoundation.prototype.layoutInternal = function () {
  5625. var _this = this;
  5626. this.frame = this.adapter.computeBoundingRect();
  5627. var maxDim = Math.max(this.frame.height, this.frame.width);
  5628. // Surface diameter is treated differently for unbounded vs. bounded
  5629. // ripples. Unbounded ripple diameter is calculated smaller since the
  5630. // surface is expected to already be padded appropriately to extend the
  5631. // hitbox, and the ripple is expected to meet the edges of the padded hitbox
  5632. // (which is typically square). Bounded ripples, on the other hand, are
  5633. // fully expected to expand beyond the surface's longest diameter
  5634. // (calculated based on the diagonal plus a constant padding), and are
  5635. // clipped at the surface's border via `overflow: hidden`.
  5636. var getBoundedRadius = function getBoundedRadius() {
  5637. var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
  5638. return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  5639. };
  5640. this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
  5641. // Ripple is sized as a fraction of the largest dimension of the surface,
  5642. // then scales up using a CSS scale transform
  5643. var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  5644. // Unbounded ripple size should always be even number to equally center
  5645. // align.
  5646. if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
  5647. this.initialSize = initialSize - 1;
  5648. } else {
  5649. this.initialSize = initialSize;
  5650. }
  5651. this.fgScale = "" + this.maxRadius / this.initialSize;
  5652. this.updateLayoutCssVars();
  5653. };
  5654. MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
  5655. var _a = MDCRippleFoundation.strings,
  5656. VAR_FG_SIZE = _a.VAR_FG_SIZE,
  5657. VAR_LEFT = _a.VAR_LEFT,
  5658. VAR_TOP = _a.VAR_TOP,
  5659. VAR_FG_SCALE = _a.VAR_FG_SCALE;
  5660. this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
  5661. this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
  5662. if (this.adapter.isUnbounded()) {
  5663. this.unboundedCoords = {
  5664. left: Math.round(this.frame.width / 2 - this.initialSize / 2),
  5665. top: Math.round(this.frame.height / 2 - this.initialSize / 2)
  5666. };
  5667. this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
  5668. this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
  5669. }
  5670. };
  5671. return MDCRippleFoundation;
  5672. }(foundation_1.MDCFoundation);
  5673. exports.MDCRippleFoundation = MDCRippleFoundation;
  5674. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5675. exports.default = MDCRippleFoundation;
  5676. /***/ }),
  5677. /***/ "./packages/mdc-ripple/util.ts":
  5678. /*!*************************************!*\
  5679. !*** ./packages/mdc-ripple/util.ts ***!
  5680. \*************************************/
  5681. /*! no static exports found */
  5682. /***/ (function(module, exports, __webpack_require__) {
  5683. "use strict";
  5684. Object.defineProperty(exports, "__esModule", { value: true });
  5685. exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
  5686. /**
  5687. * Stores result from supportsCssVariables to avoid redundant processing to
  5688. * detect CSS custom variable support.
  5689. */
  5690. var supportsCssVariables_;
  5691. function supportsCssVariables(windowObj, forceRefresh) {
  5692. if (forceRefresh === void 0) {
  5693. forceRefresh = false;
  5694. }
  5695. var CSS = windowObj.CSS;
  5696. var supportsCssVars = supportsCssVariables_;
  5697. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  5698. return supportsCssVariables_;
  5699. }
  5700. var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
  5701. if (!supportsFunctionPresent) {
  5702. return false;
  5703. }
  5704. var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
  5705. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  5706. // See: README section on Safari
  5707. var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
  5708. supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
  5709. if (!forceRefresh) {
  5710. supportsCssVariables_ = supportsCssVars;
  5711. }
  5712. return supportsCssVars;
  5713. }
  5714. exports.supportsCssVariables = supportsCssVariables;
  5715. function getNormalizedEventCoords(evt, pageOffset, clientRect) {
  5716. if (!evt) {
  5717. return { x: 0, y: 0 };
  5718. }
  5719. var x = pageOffset.x,
  5720. y = pageOffset.y;
  5721. var documentX = x + clientRect.left;
  5722. var documentY = y + clientRect.top;
  5723. var normalizedX;
  5724. var normalizedY;
  5725. // Determine touch point relative to the ripple container.
  5726. if (evt.type === 'touchstart') {
  5727. var touchEvent = evt;
  5728. normalizedX = touchEvent.changedTouches[0].pageX - documentX;
  5729. normalizedY = touchEvent.changedTouches[0].pageY - documentY;
  5730. } else {
  5731. var mouseEvent = evt;
  5732. normalizedX = mouseEvent.pageX - documentX;
  5733. normalizedY = mouseEvent.pageY - documentY;
  5734. }
  5735. return { x: normalizedX, y: normalizedY };
  5736. }
  5737. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  5738. /***/ }),
  5739. /***/ "./packages/mdc-textfield/adapter.ts":
  5740. /*!*******************************************!*\
  5741. !*** ./packages/mdc-textfield/adapter.ts ***!
  5742. \*******************************************/
  5743. /*! no static exports found */
  5744. /***/ (function(module, exports, __webpack_require__) {
  5745. "use strict";
  5746. /**
  5747. * @license
  5748. * Copyright 2017 Google Inc.
  5749. *
  5750. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5751. * of this software and associated documentation files (the "Software"), to deal
  5752. * in the Software without restriction, including without limitation the rights
  5753. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5754. * copies of the Software, and to permit persons to whom the Software is
  5755. * furnished to do so, subject to the following conditions:
  5756. *
  5757. * The above copyright notice and this permission notice shall be included in
  5758. * all copies or substantial portions of the Software.
  5759. *
  5760. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5761. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5762. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5763. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5764. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5765. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5766. * THE SOFTWARE.
  5767. */
  5768. Object.defineProperty(exports, "__esModule", { value: true });
  5769. /***/ }),
  5770. /***/ "./packages/mdc-textfield/character-counter/adapter.ts":
  5771. /*!*************************************************************!*\
  5772. !*** ./packages/mdc-textfield/character-counter/adapter.ts ***!
  5773. \*************************************************************/
  5774. /*! no static exports found */
  5775. /***/ (function(module, exports, __webpack_require__) {
  5776. "use strict";
  5777. /**
  5778. * @license
  5779. * Copyright 2019 Google Inc.
  5780. *
  5781. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5782. * of this software and associated documentation files (the "Software"), to deal
  5783. * in the Software without restriction, including without limitation the rights
  5784. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5785. * copies of the Software, and to permit persons to whom the Software is
  5786. * furnished to do so, subject to the following conditions:
  5787. *
  5788. * The above copyright notice and this permission notice shall be included in
  5789. * all copies or substantial portions of the Software.
  5790. *
  5791. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5792. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5793. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5794. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5795. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5796. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5797. * THE SOFTWARE.
  5798. */
  5799. Object.defineProperty(exports, "__esModule", { value: true });
  5800. /***/ }),
  5801. /***/ "./packages/mdc-textfield/character-counter/component.ts":
  5802. /*!***************************************************************!*\
  5803. !*** ./packages/mdc-textfield/character-counter/component.ts ***!
  5804. \***************************************************************/
  5805. /*! no static exports found */
  5806. /***/ (function(module, exports, __webpack_require__) {
  5807. "use strict";
  5808. /**
  5809. * @license
  5810. * Copyright 2019 Google Inc.
  5811. *
  5812. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5813. * of this software and associated documentation files (the "Software"), to deal
  5814. * in the Software without restriction, including without limitation the rights
  5815. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5816. * copies of the Software, and to permit persons to whom the Software is
  5817. * furnished to do so, subject to the following conditions:
  5818. *
  5819. * The above copyright notice and this permission notice shall be included in
  5820. * all copies or substantial portions of the Software.
  5821. *
  5822. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5823. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5824. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5825. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5826. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5827. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5828. * THE SOFTWARE.
  5829. */
  5830. var __extends = this && this.__extends || function () {
  5831. var _extendStatics = function extendStatics(d, b) {
  5832. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5833. d.__proto__ = b;
  5834. } || function (d, b) {
  5835. for (var p in b) {
  5836. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  5837. }
  5838. };
  5839. return _extendStatics(d, b);
  5840. };
  5841. return function (d, b) {
  5842. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  5843. _extendStatics(d, b);
  5844. function __() {
  5845. this.constructor = d;
  5846. }
  5847. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5848. };
  5849. }();
  5850. Object.defineProperty(exports, "__esModule", { value: true });
  5851. exports.MDCTextFieldCharacterCounter = void 0;
  5852. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  5853. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  5854. /** MDC Text Field Character Counter */
  5855. var MDCTextFieldCharacterCounter = /** @class */function (_super) {
  5856. __extends(MDCTextFieldCharacterCounter, _super);
  5857. function MDCTextFieldCharacterCounter() {
  5858. return _super !== null && _super.apply(this, arguments) || this;
  5859. }
  5860. MDCTextFieldCharacterCounter.attachTo = function (root) {
  5861. return new MDCTextFieldCharacterCounter(root);
  5862. };
  5863. Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundationForTextField", {
  5864. // Provided for access by MDCTextField component
  5865. get: function get() {
  5866. return this.foundation;
  5867. },
  5868. enumerable: false,
  5869. configurable: true
  5870. });
  5871. MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
  5872. var _this = this;
  5873. // DO NOT INLINE this variable. For backward compatibility, foundations take
  5874. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  5875. // methods, we need a separate, strongly typed adapter variable.
  5876. var adapter = {
  5877. setContent: function setContent(content) {
  5878. _this.root.textContent = content;
  5879. },
  5880. setCounterValue: function setCounterValue() {
  5881. return undefined;
  5882. }
  5883. };
  5884. return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter);
  5885. };
  5886. return MDCTextFieldCharacterCounter;
  5887. }(component_1.MDCComponent);
  5888. exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter;
  5889. /***/ }),
  5890. /***/ "./packages/mdc-textfield/character-counter/constants.ts":
  5891. /*!***************************************************************!*\
  5892. !*** ./packages/mdc-textfield/character-counter/constants.ts ***!
  5893. \***************************************************************/
  5894. /*! no static exports found */
  5895. /***/ (function(module, exports, __webpack_require__) {
  5896. "use strict";
  5897. /**
  5898. * @license
  5899. * Copyright 2019 Google Inc.
  5900. *
  5901. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5902. * of this software and associated documentation files (the "Software"), to deal
  5903. * in the Software without restriction, including without limitation the rights
  5904. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5905. * copies of the Software, and to permit persons to whom the Software is
  5906. * furnished to do so, subject to the following conditions:
  5907. *
  5908. * The above copyright notice and this permission notice shall be included in
  5909. * all copies or substantial portions of the Software.
  5910. *
  5911. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5912. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5913. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5914. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5915. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5916. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5917. * THE SOFTWARE.
  5918. */
  5919. Object.defineProperty(exports, "__esModule", { value: true });
  5920. exports.cssClasses = exports.strings = void 0;
  5921. var cssClasses = {
  5922. ROOT: 'mdc-text-field-character-counter'
  5923. };
  5924. exports.cssClasses = cssClasses;
  5925. var strings = {
  5926. ROOT_SELECTOR: "." + cssClasses.ROOT
  5927. };
  5928. exports.strings = strings;
  5929. /***/ }),
  5930. /***/ "./packages/mdc-textfield/character-counter/foundation.ts":
  5931. /*!****************************************************************!*\
  5932. !*** ./packages/mdc-textfield/character-counter/foundation.ts ***!
  5933. \****************************************************************/
  5934. /*! no static exports found */
  5935. /***/ (function(module, exports, __webpack_require__) {
  5936. "use strict";
  5937. /**
  5938. * @license
  5939. * Copyright 2019 Google Inc.
  5940. *
  5941. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5942. * of this software and associated documentation files (the "Software"), to deal
  5943. * in the Software without restriction, including without limitation the rights
  5944. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5945. * copies of the Software, and to permit persons to whom the Software is
  5946. * furnished to do so, subject to the following conditions:
  5947. *
  5948. * The above copyright notice and this permission notice shall be included in
  5949. * all copies or substantial portions of the Software.
  5950. *
  5951. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5952. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5953. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5954. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5955. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5956. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5957. * THE SOFTWARE.
  5958. */
  5959. var __extends = this && this.__extends || function () {
  5960. var _extendStatics = function extendStatics(d, b) {
  5961. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5962. d.__proto__ = b;
  5963. } || function (d, b) {
  5964. for (var p in b) {
  5965. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  5966. }
  5967. };
  5968. return _extendStatics(d, b);
  5969. };
  5970. return function (d, b) {
  5971. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  5972. _extendStatics(d, b);
  5973. function __() {
  5974. this.constructor = d;
  5975. }
  5976. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5977. };
  5978. }();
  5979. var __assign = this && this.__assign || function () {
  5980. __assign = Object.assign || function (t) {
  5981. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5982. s = arguments[i];
  5983. for (var p in s) {
  5984. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  5985. }
  5986. }
  5987. return t;
  5988. };
  5989. return __assign.apply(this, arguments);
  5990. };
  5991. Object.defineProperty(exports, "__esModule", { value: true });
  5992. exports.MDCTextFieldCharacterCounterFoundation = void 0;
  5993. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5994. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  5995. /** MDC Text Field Character Counter Foundation */
  5996. var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) {
  5997. __extends(MDCTextFieldCharacterCounterFoundation, _super);
  5998. function MDCTextFieldCharacterCounterFoundation(adapter) {
  5999. return _super.call(this, __assign(__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this;
  6000. }
  6001. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
  6002. get: function get() {
  6003. return constants_1.cssClasses;
  6004. },
  6005. enumerable: false,
  6006. configurable: true
  6007. });
  6008. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
  6009. get: function get() {
  6010. return constants_1.strings;
  6011. },
  6012. enumerable: false,
  6013. configurable: true
  6014. });
  6015. Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
  6016. /**
  6017. * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on
  6018. * parameters and return types.
  6019. */
  6020. get: function get() {
  6021. return {
  6022. setContent: function setContent() {
  6023. return undefined;
  6024. },
  6025. setCounterValue: function setCounterValue() {
  6026. return undefined;
  6027. }
  6028. };
  6029. },
  6030. enumerable: false,
  6031. configurable: true
  6032. });
  6033. MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
  6034. currentLength = Math.min(currentLength, maxLength);
  6035. this.adapter.setContent(currentLength + " / " + maxLength);
  6036. this.adapter.setCounterValue(currentLength, maxLength);
  6037. };
  6038. return MDCTextFieldCharacterCounterFoundation;
  6039. }(foundation_1.MDCFoundation);
  6040. exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation;
  6041. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6042. exports.default = MDCTextFieldCharacterCounterFoundation;
  6043. /***/ }),
  6044. /***/ "./packages/mdc-textfield/character-counter/index.ts":
  6045. /*!***********************************************************!*\
  6046. !*** ./packages/mdc-textfield/character-counter/index.ts ***!
  6047. \***********************************************************/
  6048. /*! no static exports found */
  6049. /***/ (function(module, exports, __webpack_require__) {
  6050. "use strict";
  6051. /**
  6052. * @license
  6053. * Copyright 2019 Google Inc.
  6054. *
  6055. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6056. * of this software and associated documentation files (the "Software"), to deal
  6057. * in the Software without restriction, including without limitation the rights
  6058. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6059. * copies of the Software, and to permit persons to whom the Software is
  6060. * furnished to do so, subject to the following conditions:
  6061. *
  6062. * The above copyright notice and this permission notice shall be included in
  6063. * all copies or substantial portions of the Software.
  6064. *
  6065. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6066. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6067. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6068. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6069. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6070. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6071. * THE SOFTWARE.
  6072. */
  6073. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  6074. if (k2 === undefined) k2 = k;
  6075. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  6076. return m[k];
  6077. } });
  6078. } : function (o, m, k, k2) {
  6079. if (k2 === undefined) k2 = k;
  6080. o[k2] = m[k];
  6081. });
  6082. var __exportStar = this && this.__exportStar || function (m, exports) {
  6083. for (var p in m) {
  6084. if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  6085. }
  6086. };
  6087. Object.defineProperty(exports, "__esModule", { value: true });
  6088. exports.characterCountStrings = exports.characterCountCssClasses = void 0;
  6089. __exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/character-counter/adapter.ts"), exports);
  6090. __exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts"), exports);
  6091. __exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"), exports);
  6092. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
  6093. Object.defineProperty(exports, "characterCountCssClasses", { enumerable: true, get: function get() {
  6094. return constants_1.cssClasses;
  6095. } });
  6096. Object.defineProperty(exports, "characterCountStrings", { enumerable: true, get: function get() {
  6097. return constants_1.strings;
  6098. } });
  6099. /***/ }),
  6100. /***/ "./packages/mdc-textfield/component.ts":
  6101. /*!*********************************************!*\
  6102. !*** ./packages/mdc-textfield/component.ts ***!
  6103. \*********************************************/
  6104. /*! no static exports found */
  6105. /***/ (function(module, exports, __webpack_require__) {
  6106. "use strict";
  6107. /**
  6108. * @license
  6109. * Copyright 2016 Google Inc.
  6110. *
  6111. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6112. * of this software and associated documentation files (the "Software"), to deal
  6113. * in the Software without restriction, including without limitation the rights
  6114. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6115. * copies of the Software, and to permit persons to whom the Software is
  6116. * furnished to do so, subject to the following conditions:
  6117. *
  6118. * The above copyright notice and this permission notice shall be included in
  6119. * all copies or substantial portions of the Software.
  6120. *
  6121. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6122. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6123. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6124. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6125. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6126. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6127. * THE SOFTWARE.
  6128. */
  6129. var __extends = this && this.__extends || function () {
  6130. var _extendStatics = function extendStatics(d, b) {
  6131. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6132. d.__proto__ = b;
  6133. } || function (d, b) {
  6134. for (var p in b) {
  6135. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  6136. }
  6137. };
  6138. return _extendStatics(d, b);
  6139. };
  6140. return function (d, b) {
  6141. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  6142. _extendStatics(d, b);
  6143. function __() {
  6144. this.constructor = d;
  6145. }
  6146. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6147. };
  6148. }();
  6149. var __assign = this && this.__assign || function () {
  6150. __assign = Object.assign || function (t) {
  6151. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6152. s = arguments[i];
  6153. for (var p in s) {
  6154. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6155. }
  6156. }
  6157. return t;
  6158. };
  6159. return __assign.apply(this, arguments);
  6160. };
  6161. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  6162. if (k2 === undefined) k2 = k;
  6163. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  6164. return m[k];
  6165. } });
  6166. } : function (o, m, k, k2) {
  6167. if (k2 === undefined) k2 = k;
  6168. o[k2] = m[k];
  6169. });
  6170. var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
  6171. Object.defineProperty(o, "default", { enumerable: true, value: v });
  6172. } : function (o, v) {
  6173. o["default"] = v;
  6174. });
  6175. var __importStar = this && this.__importStar || function (mod) {
  6176. if (mod && mod.__esModule) return mod;
  6177. var result = {};
  6178. if (mod != null) for (var k in mod) {
  6179. if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  6180. }__setModuleDefault(result, mod);
  6181. return result;
  6182. };
  6183. Object.defineProperty(exports, "__esModule", { value: true });
  6184. exports.MDCTextField = void 0;
  6185. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6186. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  6187. var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
  6188. var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
  6189. var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
  6190. var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
  6191. var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  6192. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  6193. var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts");
  6194. var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
  6195. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  6196. var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts");
  6197. var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts");
  6198. var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  6199. var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts");
  6200. /** MDC Text Field */
  6201. var MDCTextField = /** @class */function (_super) {
  6202. __extends(MDCTextField, _super);
  6203. function MDCTextField() {
  6204. return _super !== null && _super.apply(this, arguments) || this;
  6205. }
  6206. MDCTextField.attachTo = function (root) {
  6207. return new MDCTextField(root);
  6208. };
  6209. MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
  6210. if (rippleFactory === void 0) {
  6211. rippleFactory = function rippleFactory(el, foundation) {
  6212. return new component_5.MDCRipple(el, foundation);
  6213. };
  6214. }
  6215. if (lineRippleFactory === void 0) {
  6216. lineRippleFactory = function lineRippleFactory(el) {
  6217. return new component_3.MDCLineRipple(el);
  6218. };
  6219. }
  6220. if (helperTextFactory === void 0) {
  6221. helperTextFactory = function helperTextFactory(el) {
  6222. return new component_7.MDCTextFieldHelperText(el);
  6223. };
  6224. }
  6225. if (characterCounterFactory === void 0) {
  6226. characterCounterFactory = function characterCounterFactory(el) {
  6227. return new component_6.MDCTextFieldCharacterCounter(el);
  6228. };
  6229. }
  6230. if (iconFactory === void 0) {
  6231. iconFactory = function iconFactory(el) {
  6232. return new component_8.MDCTextFieldIcon(el);
  6233. };
  6234. }
  6235. if (labelFactory === void 0) {
  6236. labelFactory = function labelFactory(el) {
  6237. return new component_2.MDCFloatingLabel(el);
  6238. };
  6239. }
  6240. if (outlineFactory === void 0) {
  6241. outlineFactory = function outlineFactory(el) {
  6242. return new component_4.MDCNotchedOutline(el);
  6243. };
  6244. }
  6245. this.input = this.root.querySelector(constants_1.strings.INPUT_SELECTOR);
  6246. var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR);
  6247. this.label = labelElement ? labelFactory(labelElement) : null;
  6248. var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
  6249. this.lineRipple = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
  6250. var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR);
  6251. this.outline = outlineElement ? outlineFactory(outlineElement) : null;
  6252. // Helper text
  6253. var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings;
  6254. var nextElementSibling = this.root.nextElementSibling;
  6255. var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasses.HELPER_LINE);
  6256. var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
  6257. this.helperText = helperTextEl ? helperTextFactory(helperTextEl) : null;
  6258. // Character counter
  6259. var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings;
  6260. var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR);
  6261. // If character counter is not found in root element search in sibling
  6262. // element.
  6263. if (!characterCounterEl && hasHelperLine && nextElementSibling) {
  6264. characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
  6265. }
  6266. this.characterCounter = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
  6267. // Leading icon
  6268. var leadingIconEl = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
  6269. this.leadingIcon = leadingIconEl ? iconFactory(leadingIconEl) : null;
  6270. // Trailing icon
  6271. var trailingIconEl = this.root.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR);
  6272. this.trailingIcon = trailingIconEl ? iconFactory(trailingIconEl) : null;
  6273. // Prefix and Suffix
  6274. this.prefix = this.root.querySelector(constants_1.strings.PREFIX_SELECTOR);
  6275. this.suffix = this.root.querySelector(constants_1.strings.SUFFIX_SELECTOR);
  6276. this.ripple = this.createRipple(rippleFactory);
  6277. };
  6278. MDCTextField.prototype.destroy = function () {
  6279. if (this.ripple) {
  6280. this.ripple.destroy();
  6281. }
  6282. if (this.lineRipple) {
  6283. this.lineRipple.destroy();
  6284. }
  6285. if (this.helperText) {
  6286. this.helperText.destroy();
  6287. }
  6288. if (this.characterCounter) {
  6289. this.characterCounter.destroy();
  6290. }
  6291. if (this.leadingIcon) {
  6292. this.leadingIcon.destroy();
  6293. }
  6294. if (this.trailingIcon) {
  6295. this.trailingIcon.destroy();
  6296. }
  6297. if (this.label) {
  6298. this.label.destroy();
  6299. }
  6300. if (this.outline) {
  6301. this.outline.destroy();
  6302. }
  6303. _super.prototype.destroy.call(this);
  6304. };
  6305. /**
  6306. * Initializes the Text Field's internal state based on the environment's
  6307. * state.
  6308. */
  6309. MDCTextField.prototype.initialSyncWithDOM = function () {
  6310. this.disabled = this.input.disabled;
  6311. };
  6312. Object.defineProperty(MDCTextField.prototype, "value", {
  6313. get: function get() {
  6314. return this.foundation.getValue();
  6315. },
  6316. /**
  6317. * @param value The value to set on the input.
  6318. */
  6319. set: function set(value) {
  6320. this.foundation.setValue(value);
  6321. },
  6322. enumerable: false,
  6323. configurable: true
  6324. });
  6325. Object.defineProperty(MDCTextField.prototype, "disabled", {
  6326. get: function get() {
  6327. return this.foundation.isDisabled();
  6328. },
  6329. /**
  6330. * @param disabled Sets the Text Field disabled or enabled.
  6331. */
  6332. set: function set(disabled) {
  6333. this.foundation.setDisabled(disabled);
  6334. },
  6335. enumerable: false,
  6336. configurable: true
  6337. });
  6338. Object.defineProperty(MDCTextField.prototype, "valid", {
  6339. get: function get() {
  6340. return this.foundation.isValid();
  6341. },
  6342. /**
  6343. * @param valid Sets the Text Field valid or invalid.
  6344. */
  6345. set: function set(valid) {
  6346. this.foundation.setValid(valid);
  6347. },
  6348. enumerable: false,
  6349. configurable: true
  6350. });
  6351. Object.defineProperty(MDCTextField.prototype, "required", {
  6352. get: function get() {
  6353. return this.input.required;
  6354. },
  6355. /**
  6356. * @param required Sets the Text Field to required.
  6357. */
  6358. set: function set(required) {
  6359. this.input.required = required;
  6360. },
  6361. enumerable: false,
  6362. configurable: true
  6363. });
  6364. Object.defineProperty(MDCTextField.prototype, "pattern", {
  6365. get: function get() {
  6366. return this.input.pattern;
  6367. },
  6368. /**
  6369. * @param pattern Sets the input element's validation pattern.
  6370. */
  6371. set: function set(pattern) {
  6372. this.input.pattern = pattern;
  6373. },
  6374. enumerable: false,
  6375. configurable: true
  6376. });
  6377. Object.defineProperty(MDCTextField.prototype, "minLength", {
  6378. get: function get() {
  6379. return this.input.minLength;
  6380. },
  6381. /**
  6382. * @param minLength Sets the input element's minLength.
  6383. */
  6384. set: function set(minLength) {
  6385. this.input.minLength = minLength;
  6386. },
  6387. enumerable: false,
  6388. configurable: true
  6389. });
  6390. Object.defineProperty(MDCTextField.prototype, "maxLength", {
  6391. get: function get() {
  6392. return this.input.maxLength;
  6393. },
  6394. /**
  6395. * @param maxLength Sets the input element's maxLength.
  6396. */
  6397. set: function set(maxLength) {
  6398. // Chrome throws exception if maxLength is set to a value less than zero
  6399. if (maxLength < 0) {
  6400. this.input.removeAttribute('maxLength');
  6401. } else {
  6402. this.input.maxLength = maxLength;
  6403. }
  6404. },
  6405. enumerable: false,
  6406. configurable: true
  6407. });
  6408. Object.defineProperty(MDCTextField.prototype, "min", {
  6409. get: function get() {
  6410. return this.input.min;
  6411. },
  6412. /**
  6413. * @param min Sets the input element's min.
  6414. */
  6415. set: function set(min) {
  6416. this.input.min = min;
  6417. },
  6418. enumerable: false,
  6419. configurable: true
  6420. });
  6421. Object.defineProperty(MDCTextField.prototype, "max", {
  6422. get: function get() {
  6423. return this.input.max;
  6424. },
  6425. /**
  6426. * @param max Sets the input element's max.
  6427. */
  6428. set: function set(max) {
  6429. this.input.max = max;
  6430. },
  6431. enumerable: false,
  6432. configurable: true
  6433. });
  6434. Object.defineProperty(MDCTextField.prototype, "step", {
  6435. get: function get() {
  6436. return this.input.step;
  6437. },
  6438. /**
  6439. * @param step Sets the input element's step.
  6440. */
  6441. set: function set(step) {
  6442. this.input.step = step;
  6443. },
  6444. enumerable: false,
  6445. configurable: true
  6446. });
  6447. Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
  6448. /**
  6449. * Sets the helper text element content.
  6450. */
  6451. set: function set(content) {
  6452. this.foundation.setHelperTextContent(content);
  6453. },
  6454. enumerable: false,
  6455. configurable: true
  6456. });
  6457. Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
  6458. /**
  6459. * Sets the aria label of the leading icon.
  6460. */
  6461. set: function set(label) {
  6462. this.foundation.setLeadingIconAriaLabel(label);
  6463. },
  6464. enumerable: false,
  6465. configurable: true
  6466. });
  6467. Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
  6468. /**
  6469. * Sets the text content of the leading icon.
  6470. */
  6471. set: function set(content) {
  6472. this.foundation.setLeadingIconContent(content);
  6473. },
  6474. enumerable: false,
  6475. configurable: true
  6476. });
  6477. Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
  6478. /**
  6479. * Sets the aria label of the trailing icon.
  6480. */
  6481. set: function set(label) {
  6482. this.foundation.setTrailingIconAriaLabel(label);
  6483. },
  6484. enumerable: false,
  6485. configurable: true
  6486. });
  6487. Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
  6488. /**
  6489. * Sets the text content of the trailing icon.
  6490. */
  6491. set: function set(content) {
  6492. this.foundation.setTrailingIconContent(content);
  6493. },
  6494. enumerable: false,
  6495. configurable: true
  6496. });
  6497. Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
  6498. /**
  6499. * Enables or disables the use of native validation. Use this for custom
  6500. * validation.
  6501. * @param useNativeValidation Set this to false to ignore native input
  6502. * validation.
  6503. */
  6504. set: function set(useNativeValidation) {
  6505. this.foundation.setUseNativeValidation(useNativeValidation);
  6506. },
  6507. enumerable: false,
  6508. configurable: true
  6509. });
  6510. Object.defineProperty(MDCTextField.prototype, "prefixText", {
  6511. /**
  6512. * Gets the text content of the prefix, or null if it does not exist.
  6513. */
  6514. get: function get() {
  6515. return this.prefix ? this.prefix.textContent : null;
  6516. },
  6517. /**
  6518. * Sets the text content of the prefix, if it exists.
  6519. */
  6520. set: function set(prefixText) {
  6521. if (this.prefix) {
  6522. this.prefix.textContent = prefixText;
  6523. }
  6524. },
  6525. enumerable: false,
  6526. configurable: true
  6527. });
  6528. Object.defineProperty(MDCTextField.prototype, "suffixText", {
  6529. /**
  6530. * Gets the text content of the suffix, or null if it does not exist.
  6531. */
  6532. get: function get() {
  6533. return this.suffix ? this.suffix.textContent : null;
  6534. },
  6535. /**
  6536. * Sets the text content of the suffix, if it exists.
  6537. */
  6538. set: function set(suffixText) {
  6539. if (this.suffix) {
  6540. this.suffix.textContent = suffixText;
  6541. }
  6542. },
  6543. enumerable: false,
  6544. configurable: true
  6545. });
  6546. /**
  6547. * Focuses the input element.
  6548. */
  6549. MDCTextField.prototype.focus = function () {
  6550. this.input.focus();
  6551. };
  6552. /**
  6553. * Recomputes the outline SVG path for the outline element.
  6554. */
  6555. MDCTextField.prototype.layout = function () {
  6556. var openNotch = this.foundation.shouldFloat;
  6557. this.foundation.notchOutline(openNotch);
  6558. };
  6559. MDCTextField.prototype.getDefaultFoundation = function () {
  6560. // DO NOT INLINE this variable. For backward compatibility, foundations take
  6561. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  6562. // methods, we need a separate, strongly typed adapter variable.
  6563. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6564. var adapter = __assign(__assign(__assign(__assign(__assign({}, this.getRootAdapterMethods()), this.getInputAdapterMethods()), this.getLabelAdapterMethods()), this.getLineRippleAdapterMethods()), this.getOutlineAdapterMethods());
  6565. // tslint:enable:object-literal-sort-keys
  6566. return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap());
  6567. };
  6568. MDCTextField.prototype.getRootAdapterMethods = function () {
  6569. var _this = this;
  6570. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6571. return {
  6572. addClass: function addClass(className) {
  6573. _this.root.classList.add(className);
  6574. },
  6575. removeClass: function removeClass(className) {
  6576. _this.root.classList.remove(className);
  6577. },
  6578. hasClass: function hasClass(className) {
  6579. return _this.root.classList.contains(className);
  6580. },
  6581. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) {
  6582. _this.listen(evtType, handler);
  6583. },
  6584. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) {
  6585. _this.unlisten(evtType, handler);
  6586. },
  6587. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) {
  6588. var getAttributesList = function getAttributesList(mutationsList) {
  6589. return mutationsList.map(function (mutation) {
  6590. return mutation.attributeName;
  6591. }).filter(function (attributeName) {
  6592. return attributeName;
  6593. });
  6594. };
  6595. var observer = new MutationObserver(function (mutationsList) {
  6596. handler(getAttributesList(mutationsList));
  6597. });
  6598. var config = { attributes: true };
  6599. observer.observe(_this.input, config);
  6600. return observer;
  6601. },
  6602. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) {
  6603. observer.disconnect();
  6604. }
  6605. };
  6606. // tslint:enable:object-literal-sort-keys
  6607. };
  6608. MDCTextField.prototype.getInputAdapterMethods = function () {
  6609. var _this = this;
  6610. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6611. return {
  6612. getNativeInput: function getNativeInput() {
  6613. return _this.input;
  6614. },
  6615. setInputAttr: function setInputAttr(attr, value) {
  6616. _this.safeSetAttribute(_this.input, attr, value);
  6617. },
  6618. removeInputAttr: function removeInputAttr(attr) {
  6619. _this.input.removeAttribute(attr);
  6620. },
  6621. isFocused: function isFocused() {
  6622. return document.activeElement === _this.input;
  6623. },
  6624. registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) {
  6625. _this.input.addEventListener(evtType, handler, events_1.applyPassive());
  6626. },
  6627. deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) {
  6628. _this.input.removeEventListener(evtType, handler, events_1.applyPassive());
  6629. }
  6630. };
  6631. // tslint:enable:object-literal-sort-keys
  6632. };
  6633. MDCTextField.prototype.getLabelAdapterMethods = function () {
  6634. var _this = this;
  6635. return {
  6636. floatLabel: function floatLabel(shouldFloat) {
  6637. _this.label && _this.label.float(shouldFloat);
  6638. },
  6639. getLabelWidth: function getLabelWidth() {
  6640. return _this.label ? _this.label.getWidth() : 0;
  6641. },
  6642. hasLabel: function hasLabel() {
  6643. return Boolean(_this.label);
  6644. },
  6645. shakeLabel: function shakeLabel(shouldShake) {
  6646. _this.label && _this.label.shake(shouldShake);
  6647. },
  6648. setLabelRequired: function setLabelRequired(isRequired) {
  6649. _this.label && _this.label.setRequired(isRequired);
  6650. }
  6651. };
  6652. };
  6653. MDCTextField.prototype.getLineRippleAdapterMethods = function () {
  6654. var _this = this;
  6655. return {
  6656. activateLineRipple: function activateLineRipple() {
  6657. if (_this.lineRipple) {
  6658. _this.lineRipple.activate();
  6659. }
  6660. },
  6661. deactivateLineRipple: function deactivateLineRipple() {
  6662. if (_this.lineRipple) {
  6663. _this.lineRipple.deactivate();
  6664. }
  6665. },
  6666. setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) {
  6667. if (_this.lineRipple) {
  6668. _this.lineRipple.setRippleCenter(normalizedX);
  6669. }
  6670. }
  6671. };
  6672. };
  6673. MDCTextField.prototype.getOutlineAdapterMethods = function () {
  6674. var _this = this;
  6675. return {
  6676. closeOutline: function closeOutline() {
  6677. _this.outline && _this.outline.closeNotch();
  6678. },
  6679. hasOutline: function hasOutline() {
  6680. return Boolean(_this.outline);
  6681. },
  6682. notchOutline: function notchOutline(labelWidth) {
  6683. _this.outline && _this.outline.notch(labelWidth);
  6684. }
  6685. };
  6686. };
  6687. /**
  6688. * @return A map of all subcomponents to subfoundations.
  6689. */
  6690. MDCTextField.prototype.getFoundationMap = function () {
  6691. return {
  6692. characterCounter: this.characterCounter ? this.characterCounter.foundationForTextField : undefined,
  6693. helperText: this.helperText ? this.helperText.foundationForTextField : undefined,
  6694. leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForTextField : undefined,
  6695. trailingIcon: this.trailingIcon ? this.trailingIcon.foundationForTextField : undefined
  6696. };
  6697. };
  6698. MDCTextField.prototype.createRipple = function (rippleFactory) {
  6699. var _this = this;
  6700. var isTextArea = this.root.classList.contains(constants_1.cssClasses.TEXTAREA);
  6701. var isOutlined = this.root.classList.contains(constants_1.cssClasses.OUTLINED);
  6702. if (isTextArea || isOutlined) {
  6703. return null;
  6704. }
  6705. // DO NOT INLINE this variable. For backward compatibility, foundations take
  6706. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  6707. // methods, we need a separate, strongly typed adapter variable.
  6708. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6709. var adapter = __assign(__assign({}, component_5.MDCRipple.createAdapter(this)), { isSurfaceActive: function isSurfaceActive() {
  6710. return ponyfill.matches(_this.input, ':active');
  6711. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  6712. _this.input.addEventListener(evtType, handler, events_1.applyPassive());
  6713. }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  6714. _this.input.removeEventListener(evtType, handler, events_1.applyPassive());
  6715. } });
  6716. // tslint:enable:object-literal-sort-keys
  6717. return rippleFactory(this.root, new foundation_1.MDCRippleFoundation(adapter));
  6718. };
  6719. return MDCTextField;
  6720. }(component_1.MDCComponent);
  6721. exports.MDCTextField = MDCTextField;
  6722. /***/ }),
  6723. /***/ "./packages/mdc-textfield/constants.ts":
  6724. /*!*********************************************!*\
  6725. !*** ./packages/mdc-textfield/constants.ts ***!
  6726. \*********************************************/
  6727. /*! no static exports found */
  6728. /***/ (function(module, exports, __webpack_require__) {
  6729. "use strict";
  6730. /**
  6731. * @license
  6732. * Copyright 2016 Google Inc.
  6733. *
  6734. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6735. * of this software and associated documentation files (the "Software"), to deal
  6736. * in the Software without restriction, including without limitation the rights
  6737. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6738. * copies of the Software, and to permit persons to whom the Software is
  6739. * furnished to do so, subject to the following conditions:
  6740. *
  6741. * The above copyright notice and this permission notice shall be included in
  6742. * all copies or substantial portions of the Software.
  6743. *
  6744. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6745. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6746. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6747. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6748. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6749. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6750. * THE SOFTWARE.
  6751. */
  6752. Object.defineProperty(exports, "__esModule", { value: true });
  6753. exports.ALWAYS_FLOAT_TYPES = exports.VALIDATION_ATTR_WHITELIST = exports.numbers = exports.strings = exports.cssClasses = void 0;
  6754. var strings = {
  6755. ARIA_CONTROLS: 'aria-controls',
  6756. ARIA_DESCRIBEDBY: 'aria-describedby',
  6757. INPUT_SELECTOR: '.mdc-text-field__input',
  6758. LABEL_SELECTOR: '.mdc-floating-label',
  6759. LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',
  6760. LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
  6761. OUTLINE_SELECTOR: '.mdc-notched-outline',
  6762. PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',
  6763. SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',
  6764. TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'
  6765. };
  6766. exports.strings = strings;
  6767. var cssClasses = {
  6768. DISABLED: 'mdc-text-field--disabled',
  6769. FOCUSED: 'mdc-text-field--focused',
  6770. HELPER_LINE: 'mdc-text-field-helper-line',
  6771. INVALID: 'mdc-text-field--invalid',
  6772. LABEL_FLOATING: 'mdc-text-field--label-floating',
  6773. NO_LABEL: 'mdc-text-field--no-label',
  6774. OUTLINED: 'mdc-text-field--outlined',
  6775. ROOT: 'mdc-text-field',
  6776. TEXTAREA: 'mdc-text-field--textarea',
  6777. WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
  6778. WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon',
  6779. WITH_INTERNAL_COUNTER: 'mdc-text-field--with-internal-counter'
  6780. };
  6781. exports.cssClasses = cssClasses;
  6782. var numbers = {
  6783. LABEL_SCALE: 0.75
  6784. };
  6785. exports.numbers = numbers;
  6786. /**
  6787. * Whitelist based off of
  6788. * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
  6789. * under the "Validation-related attributes" section.
  6790. */
  6791. var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength'];
  6792. exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST;
  6793. /**
  6794. * Label should always float for these types as they show some UI even if value
  6795. * is empty.
  6796. */
  6797. var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week'];
  6798. exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES;
  6799. /***/ }),
  6800. /***/ "./packages/mdc-textfield/foundation.ts":
  6801. /*!**********************************************!*\
  6802. !*** ./packages/mdc-textfield/foundation.ts ***!
  6803. \**********************************************/
  6804. /*! no static exports found */
  6805. /***/ (function(module, exports, __webpack_require__) {
  6806. "use strict";
  6807. /**
  6808. * @license
  6809. * Copyright 2016 Google Inc.
  6810. *
  6811. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6812. * of this software and associated documentation files (the "Software"), to deal
  6813. * in the Software without restriction, including without limitation the rights
  6814. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6815. * copies of the Software, and to permit persons to whom the Software is
  6816. * furnished to do so, subject to the following conditions:
  6817. *
  6818. * The above copyright notice and this permission notice shall be included in
  6819. * all copies or substantial portions of the Software.
  6820. *
  6821. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6822. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6823. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6824. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6825. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6826. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6827. * THE SOFTWARE.
  6828. */
  6829. var __extends = this && this.__extends || function () {
  6830. var _extendStatics = function extendStatics(d, b) {
  6831. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6832. d.__proto__ = b;
  6833. } || function (d, b) {
  6834. for (var p in b) {
  6835. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  6836. }
  6837. };
  6838. return _extendStatics(d, b);
  6839. };
  6840. return function (d, b) {
  6841. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  6842. _extendStatics(d, b);
  6843. function __() {
  6844. this.constructor = d;
  6845. }
  6846. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6847. };
  6848. }();
  6849. var __assign = this && this.__assign || function () {
  6850. __assign = Object.assign || function (t) {
  6851. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6852. s = arguments[i];
  6853. for (var p in s) {
  6854. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6855. }
  6856. }
  6857. return t;
  6858. };
  6859. return __assign.apply(this, arguments);
  6860. };
  6861. var __values = this && this.__values || function (o) {
  6862. var s = typeof Symbol === "function" && Symbol.iterator,
  6863. m = s && o[s],
  6864. i = 0;
  6865. if (m) return m.call(o);
  6866. if (o && typeof o.length === "number") return {
  6867. next: function next() {
  6868. if (o && i >= o.length) o = void 0;
  6869. return { value: o && o[i++], done: !o };
  6870. }
  6871. };
  6872. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  6873. };
  6874. Object.defineProperty(exports, "__esModule", { value: true });
  6875. exports.MDCTextFieldFoundation = void 0;
  6876. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6877. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
  6878. var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
  6879. var INTERACTION_EVENTS = ['click', 'keydown'];
  6880. /** MDC Text Field Foundation */
  6881. var MDCTextFieldFoundation = /** @class */function (_super) {
  6882. __extends(MDCTextFieldFoundation, _super);
  6883. /**
  6884. * @param adapter
  6885. * @param foundationMap Map from subcomponent names to their subfoundations.
  6886. */
  6887. function MDCTextFieldFoundation(adapter, foundationMap) {
  6888. if (foundationMap === void 0) {
  6889. foundationMap = {};
  6890. }
  6891. var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this;
  6892. _this.isFocused = false;
  6893. _this.receivedUserInput = false;
  6894. _this.useNativeValidation = true;
  6895. _this.validateOnValueChange = true;
  6896. _this.helperText = foundationMap.helperText;
  6897. _this.characterCounter = foundationMap.characterCounter;
  6898. _this.leadingIcon = foundationMap.leadingIcon;
  6899. _this.trailingIcon = foundationMap.trailingIcon;
  6900. _this.valid = !_this.adapter.hasClass(MDCTextFieldFoundation.cssClasses.INVALID);
  6901. _this.inputFocusHandler = function () {
  6902. _this.activateFocus();
  6903. };
  6904. _this.inputBlurHandler = function () {
  6905. _this.deactivateFocus();
  6906. };
  6907. _this.inputInputHandler = function () {
  6908. _this.handleInput();
  6909. };
  6910. _this.setPointerXOffset = function (evt) {
  6911. _this.setTransformOrigin(evt);
  6912. };
  6913. _this.textFieldInteractionHandler = function () {
  6914. _this.handleTextFieldInteraction();
  6915. };
  6916. _this.validationAttributeChangeHandler = function (attributesList) {
  6917. _this.handleValidationAttributeChange(attributesList);
  6918. };
  6919. return _this;
  6920. }
  6921. Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
  6922. get: function get() {
  6923. return constants_1.cssClasses;
  6924. },
  6925. enumerable: false,
  6926. configurable: true
  6927. });
  6928. Object.defineProperty(MDCTextFieldFoundation, "strings", {
  6929. get: function get() {
  6930. return constants_1.strings;
  6931. },
  6932. enumerable: false,
  6933. configurable: true
  6934. });
  6935. Object.defineProperty(MDCTextFieldFoundation, "numbers", {
  6936. get: function get() {
  6937. return constants_1.numbers;
  6938. },
  6939. enumerable: false,
  6940. configurable: true
  6941. });
  6942. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat", {
  6943. get: function get() {
  6944. var type = this.getNativeInput().type;
  6945. return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
  6946. },
  6947. enumerable: false,
  6948. configurable: true
  6949. });
  6950. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
  6951. get: function get() {
  6952. return this.shouldAlwaysFloat || this.isFocused || !!this.getValue() || this.isBadInput();
  6953. },
  6954. enumerable: false,
  6955. configurable: true
  6956. });
  6957. Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
  6958. get: function get() {
  6959. return !this.isFocused && !this.isValid() && !!this.getValue();
  6960. },
  6961. enumerable: false,
  6962. configurable: true
  6963. });
  6964. Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
  6965. /**
  6966. * See {@link MDCTextFieldAdapter} for typing information on parameters and
  6967. * return types.
  6968. */
  6969. get: function get() {
  6970. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  6971. return {
  6972. addClass: function addClass() {
  6973. return undefined;
  6974. },
  6975. removeClass: function removeClass() {
  6976. return undefined;
  6977. },
  6978. hasClass: function hasClass() {
  6979. return true;
  6980. },
  6981. setInputAttr: function setInputAttr() {
  6982. return undefined;
  6983. },
  6984. removeInputAttr: function removeInputAttr() {
  6985. return undefined;
  6986. },
  6987. registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {
  6988. return undefined;
  6989. },
  6990. deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {
  6991. return undefined;
  6992. },
  6993. registerInputInteractionHandler: function registerInputInteractionHandler() {
  6994. return undefined;
  6995. },
  6996. deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {
  6997. return undefined;
  6998. },
  6999. registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {
  7000. return new MutationObserver(function () {
  7001. return undefined;
  7002. });
  7003. },
  7004. deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {
  7005. return undefined;
  7006. },
  7007. getNativeInput: function getNativeInput() {
  7008. return null;
  7009. },
  7010. isFocused: function isFocused() {
  7011. return false;
  7012. },
  7013. activateLineRipple: function activateLineRipple() {
  7014. return undefined;
  7015. },
  7016. deactivateLineRipple: function deactivateLineRipple() {
  7017. return undefined;
  7018. },
  7019. setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {
  7020. return undefined;
  7021. },
  7022. shakeLabel: function shakeLabel() {
  7023. return undefined;
  7024. },
  7025. floatLabel: function floatLabel() {
  7026. return undefined;
  7027. },
  7028. setLabelRequired: function setLabelRequired() {
  7029. return undefined;
  7030. },
  7031. hasLabel: function hasLabel() {
  7032. return false;
  7033. },
  7034. getLabelWidth: function getLabelWidth() {
  7035. return 0;
  7036. },
  7037. hasOutline: function hasOutline() {
  7038. return false;
  7039. },
  7040. notchOutline: function notchOutline() {
  7041. return undefined;
  7042. },
  7043. closeOutline: function closeOutline() {
  7044. return undefined;
  7045. }
  7046. };
  7047. // tslint:enable:object-literal-sort-keys
  7048. },
  7049. enumerable: false,
  7050. configurable: true
  7051. });
  7052. MDCTextFieldFoundation.prototype.init = function () {
  7053. var e_1, _a, e_2, _b;
  7054. if (this.adapter.hasLabel() && this.getNativeInput().required) {
  7055. this.adapter.setLabelRequired(true);
  7056. }
  7057. if (this.adapter.isFocused()) {
  7058. this.inputFocusHandler();
  7059. } else if (this.adapter.hasLabel() && this.shouldFloat) {
  7060. this.notchOutline(true);
  7061. this.adapter.floatLabel(true);
  7062. this.styleFloating(true);
  7063. }
  7064. this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler);
  7065. this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler);
  7066. this.adapter.registerInputInteractionHandler('input', this.inputInputHandler);
  7067. try {
  7068. for (var POINTERDOWN_EVENTS_1 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next(); !POINTERDOWN_EVENTS_1_1.done; POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next()) {
  7069. var evtType = POINTERDOWN_EVENTS_1_1.value;
  7070. this.adapter.registerInputInteractionHandler(evtType, this.setPointerXOffset);
  7071. }
  7072. } catch (e_1_1) {
  7073. e_1 = { error: e_1_1 };
  7074. } finally {
  7075. try {
  7076. if (POINTERDOWN_EVENTS_1_1 && !POINTERDOWN_EVENTS_1_1.done && (_a = POINTERDOWN_EVENTS_1.return)) _a.call(POINTERDOWN_EVENTS_1);
  7077. } finally {
  7078. if (e_1) throw e_1.error;
  7079. }
  7080. }
  7081. try {
  7082. for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
  7083. var evtType = INTERACTION_EVENTS_1_1.value;
  7084. this.adapter.registerTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
  7085. }
  7086. } catch (e_2_1) {
  7087. e_2 = { error: e_2_1 };
  7088. } finally {
  7089. try {
  7090. if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_b = INTERACTION_EVENTS_1.return)) _b.call(INTERACTION_EVENTS_1);
  7091. } finally {
  7092. if (e_2) throw e_2.error;
  7093. }
  7094. }
  7095. this.validationObserver = this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler);
  7096. this.setcharacterCounter(this.getValue().length);
  7097. };
  7098. MDCTextFieldFoundation.prototype.destroy = function () {
  7099. var e_3, _a, e_4, _b;
  7100. this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler);
  7101. this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler);
  7102. this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler);
  7103. try {
  7104. for (var POINTERDOWN_EVENTS_2 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next(); !POINTERDOWN_EVENTS_2_1.done; POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next()) {
  7105. var evtType = POINTERDOWN_EVENTS_2_1.value;
  7106. this.adapter.deregisterInputInteractionHandler(evtType, this.setPointerXOffset);
  7107. }
  7108. } catch (e_3_1) {
  7109. e_3 = { error: e_3_1 };
  7110. } finally {
  7111. try {
  7112. if (POINTERDOWN_EVENTS_2_1 && !POINTERDOWN_EVENTS_2_1.done && (_a = POINTERDOWN_EVENTS_2.return)) _a.call(POINTERDOWN_EVENTS_2);
  7113. } finally {
  7114. if (e_3) throw e_3.error;
  7115. }
  7116. }
  7117. try {
  7118. for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
  7119. var evtType = INTERACTION_EVENTS_2_1.value;
  7120. this.adapter.deregisterTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
  7121. }
  7122. } catch (e_4_1) {
  7123. e_4 = { error: e_4_1 };
  7124. } finally {
  7125. try {
  7126. if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_b = INTERACTION_EVENTS_2.return)) _b.call(INTERACTION_EVENTS_2);
  7127. } finally {
  7128. if (e_4) throw e_4.error;
  7129. }
  7130. }
  7131. this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver);
  7132. };
  7133. /**
  7134. * Handles user interactions with the Text Field.
  7135. */
  7136. MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
  7137. var nativeInput = this.adapter.getNativeInput();
  7138. if (nativeInput && nativeInput.disabled) {
  7139. return;
  7140. }
  7141. this.receivedUserInput = true;
  7142. };
  7143. /**
  7144. * Handles validation attribute changes
  7145. */
  7146. MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
  7147. var _this = this;
  7148. attributesList.some(function (attributeName) {
  7149. if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
  7150. _this.styleValidity(true);
  7151. _this.adapter.setLabelRequired(_this.getNativeInput().required);
  7152. return true;
  7153. }
  7154. return false;
  7155. });
  7156. if (attributesList.indexOf('maxlength') > -1) {
  7157. this.setcharacterCounter(this.getValue().length);
  7158. }
  7159. };
  7160. /**
  7161. * Opens/closes the notched outline.
  7162. */
  7163. MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
  7164. if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) {
  7165. return;
  7166. }
  7167. if (openNotch) {
  7168. var labelWidth = this.adapter.getLabelWidth() * constants_1.numbers.LABEL_SCALE;
  7169. this.adapter.notchOutline(labelWidth);
  7170. } else {
  7171. this.adapter.closeOutline();
  7172. }
  7173. };
  7174. /**
  7175. * Activates the text field focus state.
  7176. */
  7177. MDCTextFieldFoundation.prototype.activateFocus = function () {
  7178. this.isFocused = true;
  7179. this.styleFocused(this.isFocused);
  7180. this.adapter.activateLineRipple();
  7181. if (this.adapter.hasLabel()) {
  7182. this.notchOutline(this.shouldFloat);
  7183. this.adapter.floatLabel(this.shouldFloat);
  7184. this.styleFloating(this.shouldFloat);
  7185. this.adapter.shakeLabel(this.shouldShake);
  7186. }
  7187. if (this.helperText && (this.helperText.isPersistent() || !this.helperText.isValidation() || !this.valid)) {
  7188. this.helperText.showToScreenReader();
  7189. }
  7190. };
  7191. /**
  7192. * Sets the line ripple's transform origin, so that the line ripple activate
  7193. * animation will animate out from the user's click location.
  7194. */
  7195. MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
  7196. if (this.isDisabled() || this.adapter.hasOutline()) {
  7197. return;
  7198. }
  7199. var touches = evt.touches;
  7200. var targetEvent = touches ? touches[0] : evt;
  7201. var targetClientRect = targetEvent.target.getBoundingClientRect();
  7202. var normalizedX = targetEvent.clientX - targetClientRect.left;
  7203. this.adapter.setLineRippleTransformOrigin(normalizedX);
  7204. };
  7205. /**
  7206. * Handles input change of text input and text area.
  7207. */
  7208. MDCTextFieldFoundation.prototype.handleInput = function () {
  7209. this.autoCompleteFocus();
  7210. this.setcharacterCounter(this.getValue().length);
  7211. };
  7212. /**
  7213. * Activates the Text Field's focus state in cases when the input value
  7214. * changes without user input (e.g. programmatically).
  7215. */
  7216. MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
  7217. if (!this.receivedUserInput) {
  7218. this.activateFocus();
  7219. }
  7220. };
  7221. /**
  7222. * Deactivates the Text Field's focus state.
  7223. */
  7224. MDCTextFieldFoundation.prototype.deactivateFocus = function () {
  7225. this.isFocused = false;
  7226. this.adapter.deactivateLineRipple();
  7227. var isValid = this.isValid();
  7228. this.styleValidity(isValid);
  7229. this.styleFocused(this.isFocused);
  7230. if (this.adapter.hasLabel()) {
  7231. this.notchOutline(this.shouldFloat);
  7232. this.adapter.floatLabel(this.shouldFloat);
  7233. this.styleFloating(this.shouldFloat);
  7234. this.adapter.shakeLabel(this.shouldShake);
  7235. }
  7236. if (!this.shouldFloat) {
  7237. this.receivedUserInput = false;
  7238. }
  7239. };
  7240. MDCTextFieldFoundation.prototype.getValue = function () {
  7241. return this.getNativeInput().value;
  7242. };
  7243. /**
  7244. * @param value The value to set on the input Element.
  7245. */
  7246. MDCTextFieldFoundation.prototype.setValue = function (value) {
  7247. // Prevent Safari from moving the caret to the end of the input when the
  7248. // value has not changed.
  7249. if (this.getValue() !== value) {
  7250. this.getNativeInput().value = value;
  7251. }
  7252. this.setcharacterCounter(value.length);
  7253. if (this.validateOnValueChange) {
  7254. var isValid = this.isValid();
  7255. this.styleValidity(isValid);
  7256. }
  7257. if (this.adapter.hasLabel()) {
  7258. this.notchOutline(this.shouldFloat);
  7259. this.adapter.floatLabel(this.shouldFloat);
  7260. this.styleFloating(this.shouldFloat);
  7261. if (this.validateOnValueChange) {
  7262. this.adapter.shakeLabel(this.shouldShake);
  7263. }
  7264. }
  7265. };
  7266. /**
  7267. * @return The custom validity state, if set; otherwise, the result of a
  7268. * native validity check.
  7269. */
  7270. MDCTextFieldFoundation.prototype.isValid = function () {
  7271. return this.useNativeValidation ? this.isNativeInputValid() : this.valid;
  7272. };
  7273. /**
  7274. * @param isValid Sets the custom validity state of the Text Field.
  7275. */
  7276. MDCTextFieldFoundation.prototype.setValid = function (isValid) {
  7277. this.valid = isValid;
  7278. this.styleValidity(isValid);
  7279. var shouldShake = !isValid && !this.isFocused && !!this.getValue();
  7280. if (this.adapter.hasLabel()) {
  7281. this.adapter.shakeLabel(shouldShake);
  7282. }
  7283. };
  7284. /**
  7285. * @param shouldValidate Whether or not validity should be updated on
  7286. * value change.
  7287. */
  7288. MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) {
  7289. this.validateOnValueChange = shouldValidate;
  7290. };
  7291. /**
  7292. * @return Whether or not validity should be updated on value change. `true`
  7293. * by default.
  7294. */
  7295. MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () {
  7296. return this.validateOnValueChange;
  7297. };
  7298. /**
  7299. * Enables or disables the use of native validation. Use this for custom
  7300. * validation.
  7301. * @param useNativeValidation Set this to false to ignore native input
  7302. * validation.
  7303. */
  7304. MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
  7305. this.useNativeValidation = useNativeValidation;
  7306. };
  7307. MDCTextFieldFoundation.prototype.isDisabled = function () {
  7308. return this.getNativeInput().disabled;
  7309. };
  7310. /**
  7311. * @param disabled Sets the text-field disabled or enabled.
  7312. */
  7313. MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
  7314. this.getNativeInput().disabled = disabled;
  7315. this.styleDisabled(disabled);
  7316. };
  7317. /**
  7318. * @param content Sets the content of the helper text.
  7319. */
  7320. MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
  7321. if (this.helperText) {
  7322. this.helperText.setContent(content);
  7323. }
  7324. };
  7325. /**
  7326. * Sets the aria label of the leading icon.
  7327. */
  7328. MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
  7329. if (this.leadingIcon) {
  7330. this.leadingIcon.setAriaLabel(label);
  7331. }
  7332. };
  7333. /**
  7334. * Sets the text content of the leading icon.
  7335. */
  7336. MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
  7337. if (this.leadingIcon) {
  7338. this.leadingIcon.setContent(content);
  7339. }
  7340. };
  7341. /**
  7342. * Sets the aria label of the trailing icon.
  7343. */
  7344. MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
  7345. if (this.trailingIcon) {
  7346. this.trailingIcon.setAriaLabel(label);
  7347. }
  7348. };
  7349. /**
  7350. * Sets the text content of the trailing icon.
  7351. */
  7352. MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
  7353. if (this.trailingIcon) {
  7354. this.trailingIcon.setContent(content);
  7355. }
  7356. };
  7357. /**
  7358. * Sets character counter values that shows characters used and the total
  7359. * character limit.
  7360. */
  7361. MDCTextFieldFoundation.prototype.setcharacterCounter = function (currentLength) {
  7362. if (!this.characterCounter) {
  7363. return;
  7364. }
  7365. var maxLength = this.getNativeInput().maxLength;
  7366. if (maxLength === -1) {
  7367. throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
  7368. }
  7369. this.characterCounter.setCounterValue(currentLength, maxLength);
  7370. };
  7371. /**
  7372. * @return True if the Text Field input fails in converting the user-supplied
  7373. * value.
  7374. */
  7375. MDCTextFieldFoundation.prototype.isBadInput = function () {
  7376. // The badInput property is not supported in IE 11 💩.
  7377. return this.getNativeInput().validity.badInput || false;
  7378. };
  7379. /**
  7380. * @return The result of native validity checking (ValidityState.valid).
  7381. */
  7382. MDCTextFieldFoundation.prototype.isNativeInputValid = function () {
  7383. return this.getNativeInput().validity.valid;
  7384. };
  7385. /**
  7386. * Styles the component based on the validity state.
  7387. */
  7388. MDCTextFieldFoundation.prototype.styleValidity = function (isValid) {
  7389. var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
  7390. if (isValid) {
  7391. this.adapter.removeClass(INVALID);
  7392. } else {
  7393. this.adapter.addClass(INVALID);
  7394. }
  7395. if (this.helperText) {
  7396. this.helperText.setValidity(isValid);
  7397. // We dynamically set or unset aria-describedby for validation helper text
  7398. // only, based on whether the field is valid
  7399. var helperTextValidation = this.helperText.isValidation();
  7400. if (!helperTextValidation) {
  7401. return;
  7402. }
  7403. var helperTextVisible = this.helperText.isVisible();
  7404. var helperTextId = this.helperText.getId();
  7405. if (helperTextVisible && helperTextId) {
  7406. this.adapter.setInputAttr(constants_1.strings.ARIA_DESCRIBEDBY, helperTextId);
  7407. } else {
  7408. this.adapter.removeInputAttr(constants_1.strings.ARIA_DESCRIBEDBY);
  7409. }
  7410. }
  7411. };
  7412. /**
  7413. * Styles the component based on the focused state.
  7414. */
  7415. MDCTextFieldFoundation.prototype.styleFocused = function (isFocused) {
  7416. var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
  7417. if (isFocused) {
  7418. this.adapter.addClass(FOCUSED);
  7419. } else {
  7420. this.adapter.removeClass(FOCUSED);
  7421. }
  7422. };
  7423. /**
  7424. * Styles the component based on the disabled state.
  7425. */
  7426. MDCTextFieldFoundation.prototype.styleDisabled = function (isDisabled) {
  7427. var _a = MDCTextFieldFoundation.cssClasses,
  7428. DISABLED = _a.DISABLED,
  7429. INVALID = _a.INVALID;
  7430. if (isDisabled) {
  7431. this.adapter.addClass(DISABLED);
  7432. this.adapter.removeClass(INVALID);
  7433. } else {
  7434. this.adapter.removeClass(DISABLED);
  7435. }
  7436. if (this.leadingIcon) {
  7437. this.leadingIcon.setDisabled(isDisabled);
  7438. }
  7439. if (this.trailingIcon) {
  7440. this.trailingIcon.setDisabled(isDisabled);
  7441. }
  7442. };
  7443. /**
  7444. * Styles the component based on the label floating state.
  7445. */
  7446. MDCTextFieldFoundation.prototype.styleFloating = function (isFloating) {
  7447. var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING;
  7448. if (isFloating) {
  7449. this.adapter.addClass(LABEL_FLOATING);
  7450. } else {
  7451. this.adapter.removeClass(LABEL_FLOATING);
  7452. }
  7453. };
  7454. /**
  7455. * @return The native text input element from the host environment, or an
  7456. * object with the same shape for unit tests.
  7457. */
  7458. MDCTextFieldFoundation.prototype.getNativeInput = function () {
  7459. // this.adapter may be undefined in foundation unit tests. This happens when
  7460. // testdouble is creating a mock object and invokes the
  7461. // shouldShake/shouldFloat getters (which in turn call getValue(), which
  7462. // calls this method) before init() has been called from the MDCTextField
  7463. // constructor. To work around that issue, we return a dummy object.
  7464. var nativeInput = this.adapter ? this.adapter.getNativeInput() : null;
  7465. return nativeInput || {
  7466. disabled: false,
  7467. maxLength: -1,
  7468. required: false,
  7469. type: 'input',
  7470. validity: {
  7471. badInput: false,
  7472. valid: true
  7473. },
  7474. value: ''
  7475. };
  7476. };
  7477. return MDCTextFieldFoundation;
  7478. }(foundation_1.MDCFoundation);
  7479. exports.MDCTextFieldFoundation = MDCTextFieldFoundation;
  7480. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7481. exports.default = MDCTextFieldFoundation;
  7482. /***/ }),
  7483. /***/ "./packages/mdc-textfield/helper-text/adapter.ts":
  7484. /*!*******************************************************!*\
  7485. !*** ./packages/mdc-textfield/helper-text/adapter.ts ***!
  7486. \*******************************************************/
  7487. /*! no static exports found */
  7488. /***/ (function(module, exports, __webpack_require__) {
  7489. "use strict";
  7490. /**
  7491. * @license
  7492. * Copyright 2017 Google Inc.
  7493. *
  7494. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7495. * of this software and associated documentation files (the "Software"), to deal
  7496. * in the Software without restriction, including without limitation the rights
  7497. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7498. * copies of the Software, and to permit persons to whom the Software is
  7499. * furnished to do so, subject to the following conditions:
  7500. *
  7501. * The above copyright notice and this permission notice shall be included in
  7502. * all copies or substantial portions of the Software.
  7503. *
  7504. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7505. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7506. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7507. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7508. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7509. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7510. * THE SOFTWARE.
  7511. */
  7512. Object.defineProperty(exports, "__esModule", { value: true });
  7513. /***/ }),
  7514. /***/ "./packages/mdc-textfield/helper-text/component.ts":
  7515. /*!*********************************************************!*\
  7516. !*** ./packages/mdc-textfield/helper-text/component.ts ***!
  7517. \*********************************************************/
  7518. /*! no static exports found */
  7519. /***/ (function(module, exports, __webpack_require__) {
  7520. "use strict";
  7521. /**
  7522. * @license
  7523. * Copyright 2017 Google Inc.
  7524. *
  7525. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7526. * of this software and associated documentation files (the "Software"), to deal
  7527. * in the Software without restriction, including without limitation the rights
  7528. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7529. * copies of the Software, and to permit persons to whom the Software is
  7530. * furnished to do so, subject to the following conditions:
  7531. *
  7532. * The above copyright notice and this permission notice shall be included in
  7533. * all copies or substantial portions of the Software.
  7534. *
  7535. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7536. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7537. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7538. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7539. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7540. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7541. * THE SOFTWARE.
  7542. */
  7543. var __extends = this && this.__extends || function () {
  7544. var _extendStatics = function extendStatics(d, b) {
  7545. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7546. d.__proto__ = b;
  7547. } || function (d, b) {
  7548. for (var p in b) {
  7549. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  7550. }
  7551. };
  7552. return _extendStatics(d, b);
  7553. };
  7554. return function (d, b) {
  7555. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  7556. _extendStatics(d, b);
  7557. function __() {
  7558. this.constructor = d;
  7559. }
  7560. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7561. };
  7562. }();
  7563. Object.defineProperty(exports, "__esModule", { value: true });
  7564. exports.MDCTextFieldHelperText = void 0;
  7565. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  7566. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
  7567. /** MDC Text Field Helper Text */
  7568. var MDCTextFieldHelperText = /** @class */function (_super) {
  7569. __extends(MDCTextFieldHelperText, _super);
  7570. function MDCTextFieldHelperText() {
  7571. return _super !== null && _super.apply(this, arguments) || this;
  7572. }
  7573. MDCTextFieldHelperText.attachTo = function (root) {
  7574. return new MDCTextFieldHelperText(root);
  7575. };
  7576. Object.defineProperty(MDCTextFieldHelperText.prototype, "foundationForTextField", {
  7577. // Provided for access by MDCTextField component
  7578. get: function get() {
  7579. return this.foundation;
  7580. },
  7581. enumerable: false,
  7582. configurable: true
  7583. });
  7584. MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
  7585. var _this = this;
  7586. // DO NOT INLINE this variable. For backward compatibility, foundations take
  7587. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  7588. // methods, we need a separate, strongly typed adapter variable.
  7589. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  7590. var adapter = {
  7591. addClass: function addClass(className) {
  7592. _this.root.classList.add(className);
  7593. },
  7594. removeClass: function removeClass(className) {
  7595. _this.root.classList.remove(className);
  7596. },
  7597. hasClass: function hasClass(className) {
  7598. return _this.root.classList.contains(className);
  7599. },
  7600. getAttr: function getAttr(attr) {
  7601. return _this.root.getAttribute(attr);
  7602. },
  7603. setAttr: function setAttr(attr, value) {
  7604. _this.safeSetAttribute(_this.root, attr, value);
  7605. },
  7606. removeAttr: function removeAttr(attr) {
  7607. _this.root.removeAttribute(attr);
  7608. },
  7609. setContent: function setContent(content) {
  7610. _this.root.textContent = content;
  7611. }
  7612. };
  7613. // tslint:enable:object-literal-sort-keys
  7614. return new foundation_1.MDCTextFieldHelperTextFoundation(adapter);
  7615. };
  7616. return MDCTextFieldHelperText;
  7617. }(component_1.MDCComponent);
  7618. exports.MDCTextFieldHelperText = MDCTextFieldHelperText;
  7619. /***/ }),
  7620. /***/ "./packages/mdc-textfield/helper-text/constants.ts":
  7621. /*!*********************************************************!*\
  7622. !*** ./packages/mdc-textfield/helper-text/constants.ts ***!
  7623. \*********************************************************/
  7624. /*! no static exports found */
  7625. /***/ (function(module, exports, __webpack_require__) {
  7626. "use strict";
  7627. /**
  7628. * @license
  7629. * Copyright 2016 Google Inc.
  7630. *
  7631. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7632. * of this software and associated documentation files (the "Software"), to deal
  7633. * in the Software without restriction, including without limitation the rights
  7634. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7635. * copies of the Software, and to permit persons to whom the Software is
  7636. * furnished to do so, subject to the following conditions:
  7637. *
  7638. * The above copyright notice and this permission notice shall be included in
  7639. * all copies or substantial portions of the Software.
  7640. *
  7641. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7642. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7643. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7644. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7645. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7646. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7647. * THE SOFTWARE.
  7648. */
  7649. Object.defineProperty(exports, "__esModule", { value: true });
  7650. exports.cssClasses = exports.strings = void 0;
  7651. var cssClasses = {
  7652. HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
  7653. HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
  7654. ROOT: 'mdc-text-field-helper-text'
  7655. };
  7656. exports.cssClasses = cssClasses;
  7657. var strings = {
  7658. ARIA_HIDDEN: 'aria-hidden',
  7659. ROLE: 'role',
  7660. ROOT_SELECTOR: "." + cssClasses.ROOT
  7661. };
  7662. exports.strings = strings;
  7663. /***/ }),
  7664. /***/ "./packages/mdc-textfield/helper-text/foundation.ts":
  7665. /*!**********************************************************!*\
  7666. !*** ./packages/mdc-textfield/helper-text/foundation.ts ***!
  7667. \**********************************************************/
  7668. /*! no static exports found */
  7669. /***/ (function(module, exports, __webpack_require__) {
  7670. "use strict";
  7671. /**
  7672. * @license
  7673. * Copyright 2017 Google Inc.
  7674. *
  7675. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7676. * of this software and associated documentation files (the "Software"), to deal
  7677. * in the Software without restriction, including without limitation the rights
  7678. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7679. * copies of the Software, and to permit persons to whom the Software is
  7680. * furnished to do so, subject to the following conditions:
  7681. *
  7682. * The above copyright notice and this permission notice shall be included in
  7683. * all copies or substantial portions of the Software.
  7684. *
  7685. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7686. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7687. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7688. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7689. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7690. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7691. * THE SOFTWARE.
  7692. */
  7693. var __extends = this && this.__extends || function () {
  7694. var _extendStatics = function extendStatics(d, b) {
  7695. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7696. d.__proto__ = b;
  7697. } || function (d, b) {
  7698. for (var p in b) {
  7699. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  7700. }
  7701. };
  7702. return _extendStatics(d, b);
  7703. };
  7704. return function (d, b) {
  7705. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  7706. _extendStatics(d, b);
  7707. function __() {
  7708. this.constructor = d;
  7709. }
  7710. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7711. };
  7712. }();
  7713. var __assign = this && this.__assign || function () {
  7714. __assign = Object.assign || function (t) {
  7715. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7716. s = arguments[i];
  7717. for (var p in s) {
  7718. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  7719. }
  7720. }
  7721. return t;
  7722. };
  7723. return __assign.apply(this, arguments);
  7724. };
  7725. Object.defineProperty(exports, "__esModule", { value: true });
  7726. exports.MDCTextFieldHelperTextFoundation = void 0;
  7727. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  7728. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  7729. /** MDC Text Field Helper Text Foundation */
  7730. var MDCTextFieldHelperTextFoundation = /** @class */function (_super) {
  7731. __extends(MDCTextFieldHelperTextFoundation, _super);
  7732. function MDCTextFieldHelperTextFoundation(adapter) {
  7733. return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this;
  7734. }
  7735. Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
  7736. get: function get() {
  7737. return constants_1.cssClasses;
  7738. },
  7739. enumerable: false,
  7740. configurable: true
  7741. });
  7742. Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
  7743. get: function get() {
  7744. return constants_1.strings;
  7745. },
  7746. enumerable: false,
  7747. configurable: true
  7748. });
  7749. Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
  7750. /**
  7751. * See {@link MDCTextFieldHelperTextAdapter} for typing information on
  7752. * parameters and return types.
  7753. */
  7754. get: function get() {
  7755. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  7756. return {
  7757. addClass: function addClass() {
  7758. return undefined;
  7759. },
  7760. removeClass: function removeClass() {
  7761. return undefined;
  7762. },
  7763. hasClass: function hasClass() {
  7764. return false;
  7765. },
  7766. getAttr: function getAttr() {
  7767. return null;
  7768. },
  7769. setAttr: function setAttr() {
  7770. return undefined;
  7771. },
  7772. removeAttr: function removeAttr() {
  7773. return undefined;
  7774. },
  7775. setContent: function setContent() {
  7776. return undefined;
  7777. }
  7778. };
  7779. // tslint:enable:object-literal-sort-keys
  7780. },
  7781. enumerable: false,
  7782. configurable: true
  7783. });
  7784. MDCTextFieldHelperTextFoundation.prototype.getId = function () {
  7785. return this.adapter.getAttr('id');
  7786. };
  7787. MDCTextFieldHelperTextFoundation.prototype.isVisible = function () {
  7788. return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true';
  7789. };
  7790. /**
  7791. * Sets the content of the helper text field.
  7792. */
  7793. MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
  7794. this.adapter.setContent(content);
  7795. };
  7796. MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () {
  7797. return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  7798. };
  7799. /**
  7800. * @param isPersistent Sets the persistency of the helper text.
  7801. */
  7802. MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
  7803. if (isPersistent) {
  7804. this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  7805. } else {
  7806. this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  7807. }
  7808. };
  7809. /**
  7810. * @return whether the helper text acts as an error validation message.
  7811. */
  7812. MDCTextFieldHelperTextFoundation.prototype.isValidation = function () {
  7813. return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  7814. };
  7815. /**
  7816. * @param isValidation True to make the helper text act as an error validation
  7817. * message.
  7818. */
  7819. MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
  7820. if (isValidation) {
  7821. this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  7822. } else {
  7823. this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  7824. }
  7825. };
  7826. /**
  7827. * Makes the helper text visible to the screen reader.
  7828. */
  7829. MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
  7830. this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN);
  7831. };
  7832. /**
  7833. * Sets the validity of the helper text based on the input validity.
  7834. */
  7835. MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
  7836. var helperTextIsPersistent = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
  7837. var helperTextIsValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
  7838. var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
  7839. if (validationMsgNeedsDisplay) {
  7840. this.showToScreenReader();
  7841. // If role is already alert, refresh it to trigger another announcement
  7842. // from screenreader.
  7843. if (this.adapter.getAttr(constants_1.strings.ROLE) === 'alert') {
  7844. this.refreshAlertRole();
  7845. } else {
  7846. this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
  7847. }
  7848. } else {
  7849. this.adapter.removeAttr(constants_1.strings.ROLE);
  7850. }
  7851. if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
  7852. this.hide();
  7853. }
  7854. };
  7855. /**
  7856. * Hides the help text from screen readers.
  7857. */
  7858. MDCTextFieldHelperTextFoundation.prototype.hide = function () {
  7859. this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
  7860. };
  7861. MDCTextFieldHelperTextFoundation.prototype.refreshAlertRole = function () {
  7862. var _this = this;
  7863. this.adapter.removeAttr(constants_1.strings.ROLE);
  7864. requestAnimationFrame(function () {
  7865. _this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
  7866. });
  7867. };
  7868. return MDCTextFieldHelperTextFoundation;
  7869. }(foundation_1.MDCFoundation);
  7870. exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation;
  7871. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7872. exports.default = MDCTextFieldHelperTextFoundation;
  7873. /***/ }),
  7874. /***/ "./packages/mdc-textfield/helper-text/index.ts":
  7875. /*!*****************************************************!*\
  7876. !*** ./packages/mdc-textfield/helper-text/index.ts ***!
  7877. \*****************************************************/
  7878. /*! no static exports found */
  7879. /***/ (function(module, exports, __webpack_require__) {
  7880. "use strict";
  7881. /**
  7882. * @license
  7883. * Copyright 2019 Google Inc.
  7884. *
  7885. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7886. * of this software and associated documentation files (the "Software"), to deal
  7887. * in the Software without restriction, including without limitation the rights
  7888. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7889. * copies of the Software, and to permit persons to whom the Software is
  7890. * furnished to do so, subject to the following conditions:
  7891. *
  7892. * The above copyright notice and this permission notice shall be included in
  7893. * all copies or substantial portions of the Software.
  7894. *
  7895. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7896. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7897. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7898. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7899. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7900. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7901. * THE SOFTWARE.
  7902. */
  7903. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  7904. if (k2 === undefined) k2 = k;
  7905. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  7906. return m[k];
  7907. } });
  7908. } : function (o, m, k, k2) {
  7909. if (k2 === undefined) k2 = k;
  7910. o[k2] = m[k];
  7911. });
  7912. var __exportStar = this && this.__exportStar || function (m, exports) {
  7913. for (var p in m) {
  7914. if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  7915. }
  7916. };
  7917. Object.defineProperty(exports, "__esModule", { value: true });
  7918. exports.helperTextStrings = exports.helperTextCssClasses = void 0;
  7919. __exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/helper-text/adapter.ts"), exports);
  7920. __exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts"), exports);
  7921. __exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"), exports);
  7922. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
  7923. Object.defineProperty(exports, "helperTextCssClasses", { enumerable: true, get: function get() {
  7924. return constants_1.cssClasses;
  7925. } });
  7926. Object.defineProperty(exports, "helperTextStrings", { enumerable: true, get: function get() {
  7927. return constants_1.strings;
  7928. } });
  7929. /***/ }),
  7930. /***/ "./packages/mdc-textfield/icon/adapter.ts":
  7931. /*!************************************************!*\
  7932. !*** ./packages/mdc-textfield/icon/adapter.ts ***!
  7933. \************************************************/
  7934. /*! no static exports found */
  7935. /***/ (function(module, exports, __webpack_require__) {
  7936. "use strict";
  7937. /**
  7938. * @license
  7939. * Copyright 2017 Google Inc.
  7940. *
  7941. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7942. * of this software and associated documentation files (the "Software"), to deal
  7943. * in the Software without restriction, including without limitation the rights
  7944. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7945. * copies of the Software, and to permit persons to whom the Software is
  7946. * furnished to do so, subject to the following conditions:
  7947. *
  7948. * The above copyright notice and this permission notice shall be included in
  7949. * all copies or substantial portions of the Software.
  7950. *
  7951. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7952. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7953. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7954. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7955. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7956. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7957. * THE SOFTWARE.
  7958. */
  7959. Object.defineProperty(exports, "__esModule", { value: true });
  7960. /***/ }),
  7961. /***/ "./packages/mdc-textfield/icon/component.ts":
  7962. /*!**************************************************!*\
  7963. !*** ./packages/mdc-textfield/icon/component.ts ***!
  7964. \**************************************************/
  7965. /*! no static exports found */
  7966. /***/ (function(module, exports, __webpack_require__) {
  7967. "use strict";
  7968. /**
  7969. * @license
  7970. * Copyright 2017 Google Inc.
  7971. *
  7972. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7973. * of this software and associated documentation files (the "Software"), to deal
  7974. * in the Software without restriction, including without limitation the rights
  7975. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7976. * copies of the Software, and to permit persons to whom the Software is
  7977. * furnished to do so, subject to the following conditions:
  7978. *
  7979. * The above copyright notice and this permission notice shall be included in
  7980. * all copies or substantial portions of the Software.
  7981. *
  7982. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  7983. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  7984. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  7985. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  7986. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  7987. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  7988. * THE SOFTWARE.
  7989. */
  7990. var __extends = this && this.__extends || function () {
  7991. var _extendStatics = function extendStatics(d, b) {
  7992. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  7993. d.__proto__ = b;
  7994. } || function (d, b) {
  7995. for (var p in b) {
  7996. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  7997. }
  7998. };
  7999. return _extendStatics(d, b);
  8000. };
  8001. return function (d, b) {
  8002. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  8003. _extendStatics(d, b);
  8004. function __() {
  8005. this.constructor = d;
  8006. }
  8007. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8008. };
  8009. }();
  8010. Object.defineProperty(exports, "__esModule", { value: true });
  8011. exports.MDCTextFieldIcon = void 0;
  8012. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  8013. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts");
  8014. /** MDC Text Field Icon */
  8015. var MDCTextFieldIcon = /** @class */function (_super) {
  8016. __extends(MDCTextFieldIcon, _super);
  8017. function MDCTextFieldIcon() {
  8018. return _super !== null && _super.apply(this, arguments) || this;
  8019. }
  8020. MDCTextFieldIcon.attachTo = function (root) {
  8021. return new MDCTextFieldIcon(root);
  8022. };
  8023. Object.defineProperty(MDCTextFieldIcon.prototype, "foundationForTextField", {
  8024. // Provided for access by MDCTextField component
  8025. get: function get() {
  8026. return this.foundation;
  8027. },
  8028. enumerable: false,
  8029. configurable: true
  8030. });
  8031. MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
  8032. var _this = this;
  8033. // DO NOT INLINE this variable. For backward compatibility, foundations take
  8034. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  8035. // methods, we need a separate, strongly typed adapter variable.
  8036. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8037. var adapter = {
  8038. getAttr: function getAttr(attr) {
  8039. return _this.root.getAttribute(attr);
  8040. },
  8041. setAttr: function setAttr(attr, value) {
  8042. _this.safeSetAttribute(_this.root, attr, value);
  8043. },
  8044. removeAttr: function removeAttr(attr) {
  8045. _this.root.removeAttribute(attr);
  8046. },
  8047. setContent: function setContent(content) {
  8048. _this.root.textContent = content;
  8049. },
  8050. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  8051. _this.listen(evtType, handler);
  8052. },
  8053. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  8054. _this.unlisten(evtType, handler);
  8055. },
  8056. notifyIconAction: function notifyIconAction() {
  8057. _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
  8058. }
  8059. };
  8060. // tslint:enable:object-literal-sort-keys
  8061. return new foundation_1.MDCTextFieldIconFoundation(adapter);
  8062. };
  8063. return MDCTextFieldIcon;
  8064. }(component_1.MDCComponent);
  8065. exports.MDCTextFieldIcon = MDCTextFieldIcon;
  8066. /***/ }),
  8067. /***/ "./packages/mdc-textfield/icon/constants.ts":
  8068. /*!**************************************************!*\
  8069. !*** ./packages/mdc-textfield/icon/constants.ts ***!
  8070. \**************************************************/
  8071. /*! no static exports found */
  8072. /***/ (function(module, exports, __webpack_require__) {
  8073. "use strict";
  8074. /**
  8075. * @license
  8076. * Copyright 2016 Google Inc.
  8077. *
  8078. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8079. * of this software and associated documentation files (the "Software"), to deal
  8080. * in the Software without restriction, including without limitation the rights
  8081. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8082. * copies of the Software, and to permit persons to whom the Software is
  8083. * furnished to do so, subject to the following conditions:
  8084. *
  8085. * The above copyright notice and this permission notice shall be included in
  8086. * all copies or substantial portions of the Software.
  8087. *
  8088. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8089. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8090. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8091. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8092. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8093. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8094. * THE SOFTWARE.
  8095. */
  8096. Object.defineProperty(exports, "__esModule", { value: true });
  8097. exports.cssClasses = exports.strings = void 0;
  8098. var strings = {
  8099. ICON_EVENT: 'MDCTextField:icon',
  8100. ICON_ROLE: 'button'
  8101. };
  8102. exports.strings = strings;
  8103. var cssClasses = {
  8104. ROOT: 'mdc-text-field__icon'
  8105. };
  8106. exports.cssClasses = cssClasses;
  8107. /***/ }),
  8108. /***/ "./packages/mdc-textfield/icon/foundation.ts":
  8109. /*!***************************************************!*\
  8110. !*** ./packages/mdc-textfield/icon/foundation.ts ***!
  8111. \***************************************************/
  8112. /*! no static exports found */
  8113. /***/ (function(module, exports, __webpack_require__) {
  8114. "use strict";
  8115. /**
  8116. * @license
  8117. * Copyright 2017 Google Inc.
  8118. *
  8119. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8120. * of this software and associated documentation files (the "Software"), to deal
  8121. * in the Software without restriction, including without limitation the rights
  8122. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8123. * copies of the Software, and to permit persons to whom the Software is
  8124. * furnished to do so, subject to the following conditions:
  8125. *
  8126. * The above copyright notice and this permission notice shall be included in
  8127. * all copies or substantial portions of the Software.
  8128. *
  8129. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8130. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8131. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8132. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8133. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8134. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8135. * THE SOFTWARE.
  8136. */
  8137. var __extends = this && this.__extends || function () {
  8138. var _extendStatics = function extendStatics(d, b) {
  8139. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  8140. d.__proto__ = b;
  8141. } || function (d, b) {
  8142. for (var p in b) {
  8143. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  8144. }
  8145. };
  8146. return _extendStatics(d, b);
  8147. };
  8148. return function (d, b) {
  8149. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  8150. _extendStatics(d, b);
  8151. function __() {
  8152. this.constructor = d;
  8153. }
  8154. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8155. };
  8156. }();
  8157. var __assign = this && this.__assign || function () {
  8158. __assign = Object.assign || function (t) {
  8159. for (var s, i = 1, n = arguments.length; i < n; i++) {
  8160. s = arguments[i];
  8161. for (var p in s) {
  8162. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  8163. }
  8164. }
  8165. return t;
  8166. };
  8167. return __assign.apply(this, arguments);
  8168. };
  8169. var __values = this && this.__values || function (o) {
  8170. var s = typeof Symbol === "function" && Symbol.iterator,
  8171. m = s && o[s],
  8172. i = 0;
  8173. if (m) return m.call(o);
  8174. if (o && typeof o.length === "number") return {
  8175. next: function next() {
  8176. if (o && i >= o.length) o = void 0;
  8177. return { value: o && o[i++], done: !o };
  8178. }
  8179. };
  8180. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  8181. };
  8182. Object.defineProperty(exports, "__esModule", { value: true });
  8183. exports.MDCTextFieldIconFoundation = void 0;
  8184. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  8185. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  8186. var INTERACTION_EVENTS = ['click', 'keydown'];
  8187. /** MDC Text Field Icon Foundation */
  8188. var MDCTextFieldIconFoundation = /** @class */function (_super) {
  8189. __extends(MDCTextFieldIconFoundation, _super);
  8190. function MDCTextFieldIconFoundation(adapter) {
  8191. var _this = _super.call(this, __assign(__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this;
  8192. _this.savedTabIndex = null;
  8193. _this.interactionHandler = function (evt) {
  8194. _this.handleInteraction(evt);
  8195. };
  8196. return _this;
  8197. }
  8198. Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
  8199. get: function get() {
  8200. return constants_1.strings;
  8201. },
  8202. enumerable: false,
  8203. configurable: true
  8204. });
  8205. Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
  8206. get: function get() {
  8207. return constants_1.cssClasses;
  8208. },
  8209. enumerable: false,
  8210. configurable: true
  8211. });
  8212. Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
  8213. /**
  8214. * See {@link MDCTextFieldIconAdapter} for typing information on parameters
  8215. * and return types.
  8216. */
  8217. get: function get() {
  8218. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  8219. return {
  8220. getAttr: function getAttr() {
  8221. return null;
  8222. },
  8223. setAttr: function setAttr() {
  8224. return undefined;
  8225. },
  8226. removeAttr: function removeAttr() {
  8227. return undefined;
  8228. },
  8229. setContent: function setContent() {
  8230. return undefined;
  8231. },
  8232. registerInteractionHandler: function registerInteractionHandler() {
  8233. return undefined;
  8234. },
  8235. deregisterInteractionHandler: function deregisterInteractionHandler() {
  8236. return undefined;
  8237. },
  8238. notifyIconAction: function notifyIconAction() {
  8239. return undefined;
  8240. }
  8241. };
  8242. // tslint:enable:object-literal-sort-keys
  8243. },
  8244. enumerable: false,
  8245. configurable: true
  8246. });
  8247. MDCTextFieldIconFoundation.prototype.init = function () {
  8248. var e_1, _a;
  8249. this.savedTabIndex = this.adapter.getAttr('tabindex');
  8250. try {
  8251. for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
  8252. var evtType = INTERACTION_EVENTS_1_1.value;
  8253. this.adapter.registerInteractionHandler(evtType, this.interactionHandler);
  8254. }
  8255. } catch (e_1_1) {
  8256. e_1 = { error: e_1_1 };
  8257. } finally {
  8258. try {
  8259. if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_a = INTERACTION_EVENTS_1.return)) _a.call(INTERACTION_EVENTS_1);
  8260. } finally {
  8261. if (e_1) throw e_1.error;
  8262. }
  8263. }
  8264. };
  8265. MDCTextFieldIconFoundation.prototype.destroy = function () {
  8266. var e_2, _a;
  8267. try {
  8268. for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
  8269. var evtType = INTERACTION_EVENTS_2_1.value;
  8270. this.adapter.deregisterInteractionHandler(evtType, this.interactionHandler);
  8271. }
  8272. } catch (e_2_1) {
  8273. e_2 = { error: e_2_1 };
  8274. } finally {
  8275. try {
  8276. if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_a = INTERACTION_EVENTS_2.return)) _a.call(INTERACTION_EVENTS_2);
  8277. } finally {
  8278. if (e_2) throw e_2.error;
  8279. }
  8280. }
  8281. };
  8282. MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
  8283. if (!this.savedTabIndex) {
  8284. return;
  8285. }
  8286. if (disabled) {
  8287. this.adapter.setAttr('tabindex', '-1');
  8288. this.adapter.removeAttr('role');
  8289. } else {
  8290. this.adapter.setAttr('tabindex', this.savedTabIndex);
  8291. this.adapter.setAttr('role', constants_1.strings.ICON_ROLE);
  8292. }
  8293. };
  8294. MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
  8295. this.adapter.setAttr('aria-label', label);
  8296. };
  8297. MDCTextFieldIconFoundation.prototype.setContent = function (content) {
  8298. this.adapter.setContent(content);
  8299. };
  8300. MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
  8301. var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
  8302. var isSpaceKey = evt.key === ' ';
  8303. if (evt.type === 'click' || isEnterKey || isSpaceKey) {
  8304. evt.preventDefault(); // stop click from causing host label to focus
  8305. // input
  8306. this.adapter.notifyIconAction();
  8307. }
  8308. };
  8309. return MDCTextFieldIconFoundation;
  8310. }(foundation_1.MDCFoundation);
  8311. exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation;
  8312. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  8313. exports.default = MDCTextFieldIconFoundation;
  8314. /***/ }),
  8315. /***/ "./packages/mdc-textfield/icon/index.ts":
  8316. /*!**********************************************!*\
  8317. !*** ./packages/mdc-textfield/icon/index.ts ***!
  8318. \**********************************************/
  8319. /*! no static exports found */
  8320. /***/ (function(module, exports, __webpack_require__) {
  8321. "use strict";
  8322. /**
  8323. * @license
  8324. * Copyright 2019 Google Inc.
  8325. *
  8326. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8327. * of this software and associated documentation files (the "Software"), to deal
  8328. * in the Software without restriction, including without limitation the rights
  8329. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8330. * copies of the Software, and to permit persons to whom the Software is
  8331. * furnished to do so, subject to the following conditions:
  8332. *
  8333. * The above copyright notice and this permission notice shall be included in
  8334. * all copies or substantial portions of the Software.
  8335. *
  8336. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8337. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8338. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8339. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8340. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8341. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8342. * THE SOFTWARE.
  8343. */
  8344. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  8345. if (k2 === undefined) k2 = k;
  8346. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  8347. return m[k];
  8348. } });
  8349. } : function (o, m, k, k2) {
  8350. if (k2 === undefined) k2 = k;
  8351. o[k2] = m[k];
  8352. });
  8353. var __exportStar = this && this.__exportStar || function (m, exports) {
  8354. for (var p in m) {
  8355. if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  8356. }
  8357. };
  8358. Object.defineProperty(exports, "__esModule", { value: true });
  8359. exports.iconStrings = exports.iconCssClasses = void 0;
  8360. __exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/icon/adapter.ts"), exports);
  8361. __exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts"), exports);
  8362. __exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"), exports);
  8363. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
  8364. Object.defineProperty(exports, "iconCssClasses", { enumerable: true, get: function get() {
  8365. return constants_1.cssClasses;
  8366. } });
  8367. Object.defineProperty(exports, "iconStrings", { enumerable: true, get: function get() {
  8368. return constants_1.strings;
  8369. } });
  8370. /***/ }),
  8371. /***/ "./packages/mdc-textfield/index.ts":
  8372. /*!*****************************************!*\
  8373. !*** ./packages/mdc-textfield/index.ts ***!
  8374. \*****************************************/
  8375. /*! no static exports found */
  8376. /***/ (function(module, exports, __webpack_require__) {
  8377. "use strict";
  8378. /**
  8379. * @license
  8380. * Copyright 2019 Google Inc.
  8381. *
  8382. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8383. * of this software and associated documentation files (the "Software"), to deal
  8384. * in the Software without restriction, including without limitation the rights
  8385. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8386. * copies of the Software, and to permit persons to whom the Software is
  8387. * furnished to do so, subject to the following conditions:
  8388. *
  8389. * The above copyright notice and this permission notice shall be included in
  8390. * all copies or substantial portions of the Software.
  8391. *
  8392. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8393. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8394. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8395. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8396. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8397. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8398. * THE SOFTWARE.
  8399. */
  8400. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  8401. if (k2 === undefined) k2 = k;
  8402. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  8403. return m[k];
  8404. } });
  8405. } : function (o, m, k, k2) {
  8406. if (k2 === undefined) k2 = k;
  8407. o[k2] = m[k];
  8408. });
  8409. var __exportStar = this && this.__exportStar || function (m, exports) {
  8410. for (var p in m) {
  8411. if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  8412. }
  8413. };
  8414. Object.defineProperty(exports, "__esModule", { value: true });
  8415. __exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/adapter.ts"), exports);
  8416. __exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts"), exports);
  8417. __exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"), exports);
  8418. __exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"), exports);
  8419. __exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-textfield/types.ts"), exports);
  8420. __exportStar(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts"), exports);
  8421. __exportStar(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts"), exports);
  8422. __exportStar(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts"), exports);
  8423. /***/ }),
  8424. /***/ "./packages/mdc-textfield/types.ts":
  8425. /*!*****************************************!*\
  8426. !*** ./packages/mdc-textfield/types.ts ***!
  8427. \*****************************************/
  8428. /*! no static exports found */
  8429. /***/ (function(module, exports, __webpack_require__) {
  8430. "use strict";
  8431. /**
  8432. * @license
  8433. * Copyright 2019 Google Inc.
  8434. *
  8435. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8436. * of this software and associated documentation files (the "Software"), to deal
  8437. * in the Software without restriction, including without limitation the rights
  8438. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8439. * copies of the Software, and to permit persons to whom the Software is
  8440. * furnished to do so, subject to the following conditions:
  8441. *
  8442. * The above copyright notice and this permission notice shall be included in
  8443. * all copies or substantial portions of the Software.
  8444. *
  8445. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8446. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8447. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8448. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8449. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8450. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  8451. * THE SOFTWARE.
  8452. */
  8453. Object.defineProperty(exports, "__esModule", { value: true });
  8454. /***/ })
  8455. /******/ });
  8456. });
  8457. //# sourceMappingURL=mdc.textfield.js.map