mdc.dataTable.js 308 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475
  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/data-table", [], factory);
  13. else if(typeof exports === 'object')
  14. exports["data-table"] = factory();
  15. else
  16. root["mdc"] = root["mdc"] || {}, root["mdc"]["data-table"] = 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-data-table/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-animation/util.ts":
  3403. /*!****************************************!*\
  3404. !*** ./packages/mdc-animation/util.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. Object.defineProperty(exports, "__esModule", { value: true });
  3432. exports.getCorrectEventName = exports.getCorrectPropertyName = void 0;
  3433. var cssPropertyNameMap = {
  3434. animation: {
  3435. prefixed: '-webkit-animation',
  3436. standard: 'animation'
  3437. },
  3438. transform: {
  3439. prefixed: '-webkit-transform',
  3440. standard: 'transform'
  3441. },
  3442. transition: {
  3443. prefixed: '-webkit-transition',
  3444. standard: 'transition'
  3445. }
  3446. };
  3447. var jsEventTypeMap = {
  3448. animationend: {
  3449. cssProperty: 'animation',
  3450. prefixed: 'webkitAnimationEnd',
  3451. standard: 'animationend'
  3452. },
  3453. animationiteration: {
  3454. cssProperty: 'animation',
  3455. prefixed: 'webkitAnimationIteration',
  3456. standard: 'animationiteration'
  3457. },
  3458. animationstart: {
  3459. cssProperty: 'animation',
  3460. prefixed: 'webkitAnimationStart',
  3461. standard: 'animationstart'
  3462. },
  3463. transitionend: {
  3464. cssProperty: 'transition',
  3465. prefixed: 'webkitTransitionEnd',
  3466. standard: 'transitionend'
  3467. }
  3468. };
  3469. function isWindow(windowObj) {
  3470. return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
  3471. }
  3472. function getCorrectPropertyName(windowObj, cssProperty) {
  3473. if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
  3474. var el = windowObj.document.createElement('div');
  3475. var _a = cssPropertyNameMap[cssProperty],
  3476. standard = _a.standard,
  3477. prefixed = _a.prefixed;
  3478. var isStandard = standard in el.style;
  3479. return isStandard ? standard : prefixed;
  3480. }
  3481. return cssProperty;
  3482. }
  3483. exports.getCorrectPropertyName = getCorrectPropertyName;
  3484. function getCorrectEventName(windowObj, eventType) {
  3485. if (isWindow(windowObj) && eventType in jsEventTypeMap) {
  3486. var el = windowObj.document.createElement('div');
  3487. var _a = jsEventTypeMap[eventType],
  3488. standard = _a.standard,
  3489. prefixed = _a.prefixed,
  3490. cssProperty = _a.cssProperty;
  3491. var isStandard = cssProperty in el.style;
  3492. return isStandard ? standard : prefixed;
  3493. }
  3494. return eventType;
  3495. }
  3496. exports.getCorrectEventName = getCorrectEventName;
  3497. /***/ }),
  3498. /***/ "./packages/mdc-base/component.ts":
  3499. /*!****************************************!*\
  3500. !*** ./packages/mdc-base/component.ts ***!
  3501. \****************************************/
  3502. /*! no static exports found */
  3503. /***/ (function(module, exports, __webpack_require__) {
  3504. "use strict";
  3505. /**
  3506. * @license
  3507. * Copyright 2016 Google Inc.
  3508. *
  3509. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3510. * of this software and associated documentation files (the "Software"), to deal
  3511. * in the Software without restriction, including without limitation the rights
  3512. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3513. * copies of the Software, and to permit persons to whom the Software is
  3514. * furnished to do so, subject to the following conditions:
  3515. *
  3516. * The above copyright notice and this permission notice shall be included in
  3517. * all copies or substantial portions of the Software.
  3518. *
  3519. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3520. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3521. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3522. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3523. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3524. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3525. * THE SOFTWARE.
  3526. */
  3527. var __makeTemplateObject = this && this.__makeTemplateObject || function (cooked, raw) {
  3528. if (Object.defineProperty) {
  3529. Object.defineProperty(cooked, "raw", { value: raw });
  3530. } else {
  3531. cooked.raw = raw;
  3532. }
  3533. return cooked;
  3534. };
  3535. var __read = this && this.__read || function (o, n) {
  3536. var m = typeof Symbol === "function" && o[Symbol.iterator];
  3537. if (!m) return o;
  3538. var i = m.call(o),
  3539. r,
  3540. ar = [],
  3541. e;
  3542. try {
  3543. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  3544. ar.push(r.value);
  3545. }
  3546. } catch (error) {
  3547. e = { error: error };
  3548. } finally {
  3549. try {
  3550. if (r && !r.done && (m = i["return"])) m.call(i);
  3551. } finally {
  3552. if (e) throw e.error;
  3553. }
  3554. }
  3555. return ar;
  3556. };
  3557. var __spreadArray = this && this.__spreadArray || function (to, from) {
  3558. for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
  3559. to[j] = from[i];
  3560. }return to;
  3561. };
  3562. Object.defineProperty(exports, "__esModule", { value: true });
  3563. exports.MDCComponent = void 0;
  3564. var safevalues_1 = __webpack_require__(/*! safevalues */ "./node_modules/safevalues/index.js");
  3565. var dom_1 = __webpack_require__(/*! safevalues/dom */ "./node_modules/safevalues/dom/index.js");
  3566. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
  3567. function toCamelCase(str) {
  3568. // tslint:disable-next-line:enforce-name-casing
  3569. return String(str).replace(/\-([a-z])/g, function (_, match) {
  3570. return match.toUpperCase();
  3571. });
  3572. }
  3573. /** MDC Component base */
  3574. var MDCComponent = /** @class */function () {
  3575. function MDCComponent(root, foundation) {
  3576. var args = [];
  3577. for (var _i = 2; _i < arguments.length; _i++) {
  3578. args[_i - 2] = arguments[_i];
  3579. }
  3580. this.root = root;
  3581. this.initialize.apply(this, __spreadArray([], __read(args)));
  3582. // Note that we initialize foundation here and not within the constructor's
  3583. // default param so that this.root is defined and can be used within the
  3584. // foundation class.
  3585. this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
  3586. this.foundation.init();
  3587. this.initialSyncWithDOM();
  3588. }
  3589. MDCComponent.attachTo = function (root) {
  3590. // Subclasses which extend MDCBase should provide an attachTo() method that
  3591. // takes a root element and returns an instantiated component with its root
  3592. // set to that element. Also note that in the cases of subclasses, an
  3593. // explicit foundation class will not have to be passed in; it will simply
  3594. // be initialized from getDefaultFoundation().
  3595. return new MDCComponent(root, new foundation_1.MDCFoundation({}));
  3596. };
  3597. /* istanbul ignore next: method param only exists for typing purposes; it does
  3598. * not need to be unit tested */
  3599. // tslint:disable-next-line:enforce-name-casing
  3600. MDCComponent.prototype.initialize = function () {
  3601. var _args = [];
  3602. for (var _i = 0; _i < arguments.length; _i++) {
  3603. _args[_i] = arguments[_i];
  3604. }
  3605. // Subclasses can override this to do any additional setup work that would
  3606. // be considered part of a "constructor". Essentially, it is a hook into the
  3607. // parent constructor before the foundation is initialized. Any additional
  3608. // arguments besides root and foundation will be passed in here.
  3609. };
  3610. MDCComponent.prototype.getDefaultFoundation = function () {
  3611. // Subclasses must override this method to return a properly configured
  3612. // foundation class for the component.
  3613. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
  3614. };
  3615. MDCComponent.prototype.initialSyncWithDOM = function () {
  3616. // Subclasses should override this method if they need to perform work to
  3617. // synchronize with a host DOM object. An example of this would be a form
  3618. // control wrapper that needs to synchronize its internal state to some
  3619. // property or attribute of the host DOM. Please note: this is *not* the
  3620. // place to perform DOM reads/writes that would cause layout / paint, as
  3621. // this is called synchronously from within the constructor.
  3622. };
  3623. MDCComponent.prototype.destroy = function () {
  3624. // Subclasses may implement this method to release any resources /
  3625. // deregister any listeners they have attached. An example of this might be
  3626. // deregistering a resize event from the window object.
  3627. this.foundation.destroy();
  3628. };
  3629. MDCComponent.prototype.listen = function (evtType, handler, options) {
  3630. this.root.addEventListener(evtType, handler, options);
  3631. };
  3632. MDCComponent.prototype.unlisten = function (evtType, handler, options) {
  3633. this.root.removeEventListener(evtType, handler, options);
  3634. };
  3635. /**
  3636. * Fires a cross-browser-compatible custom event from the component root of
  3637. * the given type, with the given data.
  3638. */
  3639. MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
  3640. if (shouldBubble === void 0) {
  3641. shouldBubble = false;
  3642. }
  3643. var evt;
  3644. if (typeof CustomEvent === 'function') {
  3645. evt = new CustomEvent(evtType, {
  3646. bubbles: shouldBubble,
  3647. detail: evtData
  3648. });
  3649. } else {
  3650. evt = document.createEvent('CustomEvent');
  3651. evt.initCustomEvent(evtType, shouldBubble, false, evtData);
  3652. }
  3653. this.root.dispatchEvent(evt);
  3654. };
  3655. /**
  3656. * This is a intermediate fix to allow components to use safevalues. This
  3657. * limits setAttribute to setting tabindex, data attributes, and aria
  3658. * attributes.
  3659. *
  3660. * TODO(b/263990206): remove this method and add these directly in each
  3661. * component. This will remove this abstraction and make it clear that the
  3662. * caller can't set any attribute.
  3663. */
  3664. MDCComponent.prototype.safeSetAttribute = function (element, attribute, value) {
  3665. if (attribute.toLowerCase() === 'tabindex') {
  3666. element.tabIndex = Number(value);
  3667. } else if (attribute.indexOf('data-') === 0) {
  3668. var dataKey = toCamelCase(attribute.replace(/^data-/, ''));
  3669. element.dataset[dataKey] = value;
  3670. } else {
  3671. 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);
  3672. }
  3673. };
  3674. return MDCComponent;
  3675. }();
  3676. exports.MDCComponent = MDCComponent;
  3677. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  3678. exports.default = MDCComponent;
  3679. var templateObject_1, templateObject_2;
  3680. /***/ }),
  3681. /***/ "./packages/mdc-base/foundation.ts":
  3682. /*!*****************************************!*\
  3683. !*** ./packages/mdc-base/foundation.ts ***!
  3684. \*****************************************/
  3685. /*! no static exports found */
  3686. /***/ (function(module, exports, __webpack_require__) {
  3687. "use strict";
  3688. /**
  3689. * @license
  3690. * Copyright 2016 Google Inc.
  3691. *
  3692. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3693. * of this software and associated documentation files (the "Software"), to deal
  3694. * in the Software without restriction, including without limitation the rights
  3695. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3696. * copies of the Software, and to permit persons to whom the Software is
  3697. * furnished to do so, subject to the following conditions:
  3698. *
  3699. * The above copyright notice and this permission notice shall be included in
  3700. * all copies or substantial portions of the Software.
  3701. *
  3702. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3703. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3704. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3705. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3706. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3707. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3708. * THE SOFTWARE.
  3709. */
  3710. Object.defineProperty(exports, "__esModule", { value: true });
  3711. exports.MDCFoundation = void 0;
  3712. /** MDC Foundation */
  3713. var MDCFoundation = /** @class */function () {
  3714. function MDCFoundation(adapter) {
  3715. if (adapter === void 0) {
  3716. adapter = {};
  3717. }
  3718. this.adapter = adapter;
  3719. }
  3720. Object.defineProperty(MDCFoundation, "cssClasses", {
  3721. get: function get() {
  3722. // Classes extending MDCFoundation should implement this method to return an
  3723. // object which exports every CSS class the foundation class needs as a
  3724. // property. e.g. {ACTIVE: 'mdc-component--active'}
  3725. return {};
  3726. },
  3727. enumerable: false,
  3728. configurable: true
  3729. });
  3730. Object.defineProperty(MDCFoundation, "strings", {
  3731. get: function get() {
  3732. // Classes extending MDCFoundation should implement this method to return an
  3733. // object which exports all semantic strings as constants. e.g. {ARIA_ROLE:
  3734. // 'tablist'}
  3735. return {};
  3736. },
  3737. enumerable: false,
  3738. configurable: true
  3739. });
  3740. Object.defineProperty(MDCFoundation, "numbers", {
  3741. get: function get() {
  3742. // Classes extending MDCFoundation should implement this method to return an
  3743. // object which exports all of its semantic numbers as constants.
  3744. // e.g. {ANIMATION_DELAY_MS: 350}
  3745. return {};
  3746. },
  3747. enumerable: false,
  3748. configurable: true
  3749. });
  3750. Object.defineProperty(MDCFoundation, "defaultAdapter", {
  3751. get: function get() {
  3752. // Classes extending MDCFoundation may choose to implement this getter in
  3753. // order to provide a convenient way of viewing the necessary methods of an
  3754. // adapter. In the future, this could also be used for adapter validation.
  3755. return {};
  3756. },
  3757. enumerable: false,
  3758. configurable: true
  3759. });
  3760. MDCFoundation.prototype.init = function () {
  3761. // Subclasses should override this method to perform initialization routines
  3762. // (registering events, etc.)
  3763. };
  3764. MDCFoundation.prototype.destroy = function () {
  3765. // Subclasses should override this method to perform de-initialization
  3766. // routines (de-registering events, etc.)
  3767. };
  3768. return MDCFoundation;
  3769. }();
  3770. exports.MDCFoundation = MDCFoundation;
  3771. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  3772. exports.default = MDCFoundation;
  3773. /***/ }),
  3774. /***/ "./packages/mdc-checkbox/component.ts":
  3775. /*!********************************************!*\
  3776. !*** ./packages/mdc-checkbox/component.ts ***!
  3777. \********************************************/
  3778. /*! no static exports found */
  3779. /***/ (function(module, exports, __webpack_require__) {
  3780. "use strict";
  3781. /**
  3782. * @license
  3783. * Copyright 2016 Google Inc.
  3784. *
  3785. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3786. * of this software and associated documentation files (the "Software"), to deal
  3787. * in the Software without restriction, including without limitation the rights
  3788. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3789. * copies of the Software, and to permit persons to whom the Software is
  3790. * furnished to do so, subject to the following conditions:
  3791. *
  3792. * The above copyright notice and this permission notice shall be included in
  3793. * all copies or substantial portions of the Software.
  3794. *
  3795. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3796. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3797. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3798. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3799. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3800. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3801. * THE SOFTWARE.
  3802. */
  3803. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  3804. var __extends = this && this.__extends || function () {
  3805. var _extendStatics = function extendStatics(d, b) {
  3806. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3807. d.__proto__ = b;
  3808. } || function (d, b) {
  3809. for (var p in b) {
  3810. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  3811. }
  3812. };
  3813. return _extendStatics(d, b);
  3814. };
  3815. return function (d, b) {
  3816. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  3817. _extendStatics(d, b);
  3818. function __() {
  3819. this.constructor = d;
  3820. }
  3821. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3822. };
  3823. }();
  3824. var __assign = this && this.__assign || function () {
  3825. __assign = Object.assign || function (t) {
  3826. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3827. s = arguments[i];
  3828. for (var p in s) {
  3829. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  3830. }
  3831. }
  3832. return t;
  3833. };
  3834. return __assign.apply(this, arguments);
  3835. };
  3836. var __values = this && this.__values || function (o) {
  3837. var s = typeof Symbol === "function" && Symbol.iterator,
  3838. m = s && o[s],
  3839. i = 0;
  3840. if (m) return m.call(o);
  3841. if (o && typeof o.length === "number") return {
  3842. next: function next() {
  3843. if (o && i >= o.length) o = void 0;
  3844. return { value: o && o[i++], done: !o };
  3845. }
  3846. };
  3847. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  3848. };
  3849. Object.defineProperty(exports, "__esModule", { value: true });
  3850. exports.MDCCheckbox = void 0;
  3851. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  3852. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3853. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  3854. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  3855. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  3856. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  3857. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  3858. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts");
  3859. var CB_PROTO_PROPS = ['checked', 'indeterminate'];
  3860. /** MDC Checkbox */
  3861. var MDCCheckbox = /** @class */function (_super) {
  3862. __extends(MDCCheckbox, _super);
  3863. function MDCCheckbox() {
  3864. var _this = _super !== null && _super.apply(this, arguments) || this;
  3865. _this.rippleSurface = _this.createRipple();
  3866. return _this;
  3867. }
  3868. MDCCheckbox.attachTo = function (root) {
  3869. return new MDCCheckbox(root);
  3870. };
  3871. Object.defineProperty(MDCCheckbox.prototype, "ripple", {
  3872. get: function get() {
  3873. return this.rippleSurface;
  3874. },
  3875. enumerable: false,
  3876. configurable: true
  3877. });
  3878. Object.defineProperty(MDCCheckbox.prototype, "checked", {
  3879. get: function get() {
  3880. return this.getNativeControl().checked;
  3881. },
  3882. set: function set(checked) {
  3883. this.getNativeControl().checked = checked;
  3884. },
  3885. enumerable: false,
  3886. configurable: true
  3887. });
  3888. Object.defineProperty(MDCCheckbox.prototype, "indeterminate", {
  3889. get: function get() {
  3890. return this.getNativeControl().indeterminate;
  3891. },
  3892. set: function set(indeterminate) {
  3893. this.getNativeControl().indeterminate = indeterminate;
  3894. },
  3895. enumerable: false,
  3896. configurable: true
  3897. });
  3898. Object.defineProperty(MDCCheckbox.prototype, "disabled", {
  3899. get: function get() {
  3900. return this.getNativeControl().disabled;
  3901. },
  3902. set: function set(disabled) {
  3903. this.foundation.setDisabled(disabled);
  3904. },
  3905. enumerable: false,
  3906. configurable: true
  3907. });
  3908. Object.defineProperty(MDCCheckbox.prototype, "value", {
  3909. get: function get() {
  3910. return this.getNativeControl().value;
  3911. },
  3912. set: function set(value) {
  3913. this.getNativeControl().value = value;
  3914. },
  3915. enumerable: false,
  3916. configurable: true
  3917. });
  3918. MDCCheckbox.prototype.initialize = function () {
  3919. var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR;
  3920. this.getNativeControl().indeterminate = this.getNativeControl().getAttribute(DATA_INDETERMINATE_ATTR) === 'true';
  3921. this.getNativeControl().removeAttribute(DATA_INDETERMINATE_ATTR);
  3922. };
  3923. MDCCheckbox.prototype.initialSyncWithDOM = function () {
  3924. var _this = this;
  3925. this.handleChange = function () {
  3926. _this.foundation.handleChange();
  3927. };
  3928. this.handleAnimationEnd = function () {
  3929. _this.foundation.handleAnimationEnd();
  3930. };
  3931. this.getNativeControl().addEventListener('change', this.handleChange);
  3932. this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
  3933. this.installPropertyChangeHooks();
  3934. };
  3935. MDCCheckbox.prototype.destroy = function () {
  3936. this.rippleSurface.destroy();
  3937. this.getNativeControl().removeEventListener('change', this.handleChange);
  3938. this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
  3939. this.uninstallPropertyChangeHooks();
  3940. _super.prototype.destroy.call(this);
  3941. };
  3942. MDCCheckbox.prototype.getDefaultFoundation = function () {
  3943. var _this = this;
  3944. // DO NOT INLINE this variable. For backward compatibility, foundations take
  3945. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  3946. // methods, we need a separate, strongly typed adapter variable.
  3947. var adapter = {
  3948. addClass: function addClass(className) {
  3949. _this.root.classList.add(className);
  3950. },
  3951. forceLayout: function forceLayout() {
  3952. return _this.root.offsetWidth;
  3953. },
  3954. hasNativeControl: function hasNativeControl() {
  3955. return !!_this.getNativeControl();
  3956. },
  3957. isAttachedToDOM: function isAttachedToDOM() {
  3958. return Boolean(_this.root.parentNode);
  3959. },
  3960. isChecked: function isChecked() {
  3961. return _this.checked;
  3962. },
  3963. isIndeterminate: function isIndeterminate() {
  3964. return _this.indeterminate;
  3965. },
  3966. removeClass: function removeClass(className) {
  3967. _this.root.classList.remove(className);
  3968. },
  3969. removeNativeControlAttr: function removeNativeControlAttr(attr) {
  3970. _this.getNativeControl().removeAttribute(attr);
  3971. },
  3972. setNativeControlAttr: function setNativeControlAttr(attr, value) {
  3973. _this.safeSetAttribute(_this.getNativeControl(), attr, value);
  3974. },
  3975. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  3976. _this.getNativeControl().disabled = disabled;
  3977. }
  3978. };
  3979. return new foundation_2.MDCCheckboxFoundation(adapter);
  3980. };
  3981. MDCCheckbox.prototype.createRipple = function () {
  3982. var _this = this;
  3983. // DO NOT INLINE this variable. For backward compatibility, foundations take
  3984. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  3985. // methods, we need a separate, strongly typed adapter variable.
  3986. var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  3987. _this.getNativeControl().removeEventListener(evtType, handler, events_1.applyPassive());
  3988. }, isSurfaceActive: function isSurfaceActive() {
  3989. return ponyfill_1.matches(_this.getNativeControl(), ':active');
  3990. }, isUnbounded: function isUnbounded() {
  3991. return true;
  3992. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  3993. _this.getNativeControl().addEventListener(evtType, handler, events_1.applyPassive());
  3994. } });
  3995. return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
  3996. };
  3997. MDCCheckbox.prototype.installPropertyChangeHooks = function () {
  3998. var e_1, _a;
  3999. var _this = this;
  4000. var nativeCb = this.getNativeControl();
  4001. var cbProto = Object.getPrototypeOf(nativeCb);
  4002. var _loop_1 = function _loop_1(controlState) {
  4003. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  4004. // We have to check for this descriptor, since some browsers (Safari)
  4005. // don't support its return. See:
  4006. // https://bugs.webkit.org/show_bug.cgi?id=49739
  4007. if (!validDescriptor(desc)) {
  4008. return { value: void 0 };
  4009. }
  4010. var nativeGetter = desc.get;
  4011. var nativeCbDesc = {
  4012. configurable: desc.configurable,
  4013. enumerable: desc.enumerable,
  4014. get: nativeGetter,
  4015. set: function set(state) {
  4016. desc.set.call(nativeCb, state);
  4017. _this.foundation.handleChange();
  4018. }
  4019. };
  4020. Object.defineProperty(nativeCb, controlState, nativeCbDesc);
  4021. };
  4022. try {
  4023. for (var CB_PROTO_PROPS_1 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next(); !CB_PROTO_PROPS_1_1.done; CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next()) {
  4024. var controlState = CB_PROTO_PROPS_1_1.value;
  4025. var state_1 = _loop_1(controlState);
  4026. if ((typeof state_1 === "undefined" ? "undefined" : _typeof(state_1)) === "object") return state_1.value;
  4027. }
  4028. } catch (e_1_1) {
  4029. e_1 = { error: e_1_1 };
  4030. } finally {
  4031. try {
  4032. if (CB_PROTO_PROPS_1_1 && !CB_PROTO_PROPS_1_1.done && (_a = CB_PROTO_PROPS_1.return)) _a.call(CB_PROTO_PROPS_1);
  4033. } finally {
  4034. if (e_1) throw e_1.error;
  4035. }
  4036. }
  4037. };
  4038. MDCCheckbox.prototype.uninstallPropertyChangeHooks = function () {
  4039. var e_2, _a;
  4040. var nativeCb = this.getNativeControl();
  4041. var cbProto = Object.getPrototypeOf(nativeCb);
  4042. try {
  4043. for (var CB_PROTO_PROPS_2 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next(); !CB_PROTO_PROPS_2_1.done; CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next()) {
  4044. var controlState = CB_PROTO_PROPS_2_1.value;
  4045. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  4046. if (!validDescriptor(desc)) {
  4047. return;
  4048. }
  4049. Object.defineProperty(nativeCb, controlState, desc);
  4050. }
  4051. } catch (e_2_1) {
  4052. e_2 = { error: e_2_1 };
  4053. } finally {
  4054. try {
  4055. if (CB_PROTO_PROPS_2_1 && !CB_PROTO_PROPS_2_1.done && (_a = CB_PROTO_PROPS_2.return)) _a.call(CB_PROTO_PROPS_2);
  4056. } finally {
  4057. if (e_2) throw e_2.error;
  4058. }
  4059. }
  4060. };
  4061. MDCCheckbox.prototype.getNativeControl = function () {
  4062. var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR;
  4063. var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);
  4064. if (!el) {
  4065. throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  4066. }
  4067. return el;
  4068. };
  4069. return MDCCheckbox;
  4070. }(component_1.MDCComponent);
  4071. exports.MDCCheckbox = MDCCheckbox;
  4072. function validDescriptor(inputPropDesc) {
  4073. return !!inputPropDesc && typeof inputPropDesc.set === 'function';
  4074. }
  4075. /***/ }),
  4076. /***/ "./packages/mdc-checkbox/constants.ts":
  4077. /*!********************************************!*\
  4078. !*** ./packages/mdc-checkbox/constants.ts ***!
  4079. \********************************************/
  4080. /*! no static exports found */
  4081. /***/ (function(module, exports, __webpack_require__) {
  4082. "use strict";
  4083. /**
  4084. * @license
  4085. * Copyright 2016 Google Inc.
  4086. *
  4087. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4088. * of this software and associated documentation files (the "Software"), to deal
  4089. * in the Software without restriction, including without limitation the rights
  4090. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4091. * copies of the Software, and to permit persons to whom the Software is
  4092. * furnished to do so, subject to the following conditions:
  4093. *
  4094. * The above copyright notice and this permission notice shall be included in
  4095. * all copies or substantial portions of the Software.
  4096. *
  4097. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4098. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4099. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4100. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4101. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4102. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4103. * THE SOFTWARE.
  4104. */
  4105. Object.defineProperty(exports, "__esModule", { value: true });
  4106. exports.numbers = exports.strings = exports.cssClasses = void 0;
  4107. exports.cssClasses = {
  4108. ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',
  4109. ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',
  4110. ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',
  4111. ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',
  4112. ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',
  4113. ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',
  4114. BACKGROUND: 'mdc-checkbox__background',
  4115. CHECKED: 'mdc-checkbox--checked',
  4116. CHECKMARK: 'mdc-checkbox__checkmark',
  4117. CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',
  4118. DISABLED: 'mdc-checkbox--disabled',
  4119. INDETERMINATE: 'mdc-checkbox--indeterminate',
  4120. MIXEDMARK: 'mdc-checkbox__mixedmark',
  4121. NATIVE_CONTROL: 'mdc-checkbox__native-control',
  4122. ROOT: 'mdc-checkbox',
  4123. SELECTED: 'mdc-checkbox--selected',
  4124. UPGRADED: 'mdc-checkbox--upgraded'
  4125. };
  4126. exports.strings = {
  4127. ARIA_CHECKED_ATTR: 'aria-checked',
  4128. ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',
  4129. DATA_INDETERMINATE_ATTR: 'data-indeterminate',
  4130. NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',
  4131. TRANSITION_STATE_CHECKED: 'checked',
  4132. TRANSITION_STATE_INDETERMINATE: 'indeterminate',
  4133. TRANSITION_STATE_INIT: 'init',
  4134. TRANSITION_STATE_UNCHECKED: 'unchecked'
  4135. };
  4136. exports.numbers = {
  4137. ANIM_END_LATCH_MS: 250
  4138. };
  4139. /***/ }),
  4140. /***/ "./packages/mdc-checkbox/foundation.ts":
  4141. /*!*********************************************!*\
  4142. !*** ./packages/mdc-checkbox/foundation.ts ***!
  4143. \*********************************************/
  4144. /*! no static exports found */
  4145. /***/ (function(module, exports, __webpack_require__) {
  4146. "use strict";
  4147. /**
  4148. * @license
  4149. * Copyright 2016 Google Inc.
  4150. *
  4151. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4152. * of this software and associated documentation files (the "Software"), to deal
  4153. * in the Software without restriction, including without limitation the rights
  4154. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4155. * copies of the Software, and to permit persons to whom the Software is
  4156. * furnished to do so, subject to the following conditions:
  4157. *
  4158. * The above copyright notice and this permission notice shall be included in
  4159. * all copies or substantial portions of the Software.
  4160. *
  4161. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4162. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4163. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4164. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4165. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4166. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4167. * THE SOFTWARE.
  4168. */
  4169. var __extends = this && this.__extends || function () {
  4170. var _extendStatics = function extendStatics(d, b) {
  4171. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4172. d.__proto__ = b;
  4173. } || function (d, b) {
  4174. for (var p in b) {
  4175. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4176. }
  4177. };
  4178. return _extendStatics(d, b);
  4179. };
  4180. return function (d, b) {
  4181. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4182. _extendStatics(d, b);
  4183. function __() {
  4184. this.constructor = d;
  4185. }
  4186. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4187. };
  4188. }();
  4189. var __assign = this && this.__assign || function () {
  4190. __assign = Object.assign || function (t) {
  4191. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4192. s = arguments[i];
  4193. for (var p in s) {
  4194. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4195. }
  4196. }
  4197. return t;
  4198. };
  4199. return __assign.apply(this, arguments);
  4200. };
  4201. Object.defineProperty(exports, "__esModule", { value: true });
  4202. exports.MDCCheckboxFoundation = void 0;
  4203. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4204. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  4205. /** MDC Checkbox Foundation */
  4206. var MDCCheckboxFoundation = /** @class */function (_super) {
  4207. __extends(MDCCheckboxFoundation, _super);
  4208. function MDCCheckboxFoundation(adapter) {
  4209. var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this;
  4210. _this.currentCheckState = constants_1.strings.TRANSITION_STATE_INIT;
  4211. _this.currentAnimationClass = '';
  4212. _this.animEndLatchTimer = 0;
  4213. _this.enableAnimationEndHandler = false;
  4214. return _this;
  4215. }
  4216. Object.defineProperty(MDCCheckboxFoundation, "cssClasses", {
  4217. get: function get() {
  4218. return constants_1.cssClasses;
  4219. },
  4220. enumerable: false,
  4221. configurable: true
  4222. });
  4223. Object.defineProperty(MDCCheckboxFoundation, "strings", {
  4224. get: function get() {
  4225. return constants_1.strings;
  4226. },
  4227. enumerable: false,
  4228. configurable: true
  4229. });
  4230. Object.defineProperty(MDCCheckboxFoundation, "numbers", {
  4231. get: function get() {
  4232. return constants_1.numbers;
  4233. },
  4234. enumerable: false,
  4235. configurable: true
  4236. });
  4237. Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", {
  4238. get: function get() {
  4239. return {
  4240. addClass: function addClass() {
  4241. return undefined;
  4242. },
  4243. forceLayout: function forceLayout() {
  4244. return undefined;
  4245. },
  4246. hasNativeControl: function hasNativeControl() {
  4247. return false;
  4248. },
  4249. isAttachedToDOM: function isAttachedToDOM() {
  4250. return false;
  4251. },
  4252. isChecked: function isChecked() {
  4253. return false;
  4254. },
  4255. isIndeterminate: function isIndeterminate() {
  4256. return false;
  4257. },
  4258. removeClass: function removeClass() {
  4259. return undefined;
  4260. },
  4261. removeNativeControlAttr: function removeNativeControlAttr() {
  4262. return undefined;
  4263. },
  4264. setNativeControlAttr: function setNativeControlAttr() {
  4265. return undefined;
  4266. },
  4267. setNativeControlDisabled: function setNativeControlDisabled() {
  4268. return undefined;
  4269. }
  4270. };
  4271. },
  4272. enumerable: false,
  4273. configurable: true
  4274. });
  4275. MDCCheckboxFoundation.prototype.init = function () {
  4276. this.currentCheckState = this.determineCheckState();
  4277. this.updateAriaChecked();
  4278. this.adapter.addClass(constants_1.cssClasses.UPGRADED);
  4279. };
  4280. MDCCheckboxFoundation.prototype.destroy = function () {
  4281. clearTimeout(this.animEndLatchTimer);
  4282. };
  4283. MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {
  4284. this.adapter.setNativeControlDisabled(disabled);
  4285. if (disabled) {
  4286. this.adapter.addClass(constants_1.cssClasses.DISABLED);
  4287. } else {
  4288. this.adapter.removeClass(constants_1.cssClasses.DISABLED);
  4289. }
  4290. };
  4291. /**
  4292. * Handles the animationend event for the checkbox
  4293. */
  4294. MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {
  4295. var _this = this;
  4296. if (!this.enableAnimationEndHandler) {
  4297. return;
  4298. }
  4299. clearTimeout(this.animEndLatchTimer);
  4300. this.animEndLatchTimer = setTimeout(function () {
  4301. _this.adapter.removeClass(_this.currentAnimationClass);
  4302. _this.enableAnimationEndHandler = false;
  4303. }, constants_1.numbers.ANIM_END_LATCH_MS);
  4304. };
  4305. /**
  4306. * Handles the change event for the checkbox
  4307. */
  4308. MDCCheckboxFoundation.prototype.handleChange = function () {
  4309. this.transitionCheckState();
  4310. };
  4311. MDCCheckboxFoundation.prototype.transitionCheckState = function () {
  4312. if (!this.adapter.hasNativeControl()) {
  4313. return;
  4314. }
  4315. var oldState = this.currentCheckState;
  4316. var newState = this.determineCheckState();
  4317. if (oldState === newState) {
  4318. return;
  4319. }
  4320. this.updateAriaChecked();
  4321. var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  4322. var SELECTED = constants_1.cssClasses.SELECTED;
  4323. if (newState === TRANSITION_STATE_UNCHECKED) {
  4324. this.adapter.removeClass(SELECTED);
  4325. } else {
  4326. this.adapter.addClass(SELECTED);
  4327. }
  4328. // Check to ensure that there isn't a previously existing animation class,
  4329. // in case for example the user interacted with the checkbox before the
  4330. // animation was finished.
  4331. if (this.currentAnimationClass.length > 0) {
  4332. clearTimeout(this.animEndLatchTimer);
  4333. this.adapter.forceLayout();
  4334. this.adapter.removeClass(this.currentAnimationClass);
  4335. }
  4336. this.currentAnimationClass = this.getTransitionAnimationClass(oldState, newState);
  4337. this.currentCheckState = newState;
  4338. // Check for parentNode so that animations are only run when the element is
  4339. // attached to the DOM.
  4340. if (this.adapter.isAttachedToDOM() && this.currentAnimationClass.length > 0) {
  4341. this.adapter.addClass(this.currentAnimationClass);
  4342. this.enableAnimationEndHandler = true;
  4343. }
  4344. };
  4345. MDCCheckboxFoundation.prototype.determineCheckState = function () {
  4346. var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE,
  4347. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  4348. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  4349. if (this.adapter.isIndeterminate()) {
  4350. return TRANSITION_STATE_INDETERMINATE;
  4351. }
  4352. return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED;
  4353. };
  4354. MDCCheckboxFoundation.prototype.getTransitionAnimationClass = function (oldState, newState) {
  4355. var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT,
  4356. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  4357. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  4358. var _a = MDCCheckboxFoundation.cssClasses,
  4359. ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED,
  4360. ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE,
  4361. ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED,
  4362. ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE,
  4363. ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED,
  4364. ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;
  4365. switch (oldState) {
  4366. case TRANSITION_STATE_INIT:
  4367. if (newState === TRANSITION_STATE_UNCHECKED) {
  4368. return '';
  4369. }
  4370. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  4371. case TRANSITION_STATE_UNCHECKED:
  4372. return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;
  4373. case TRANSITION_STATE_CHECKED:
  4374. return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;
  4375. default:
  4376. // TRANSITION_STATE_INDETERMINATE
  4377. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  4378. }
  4379. };
  4380. MDCCheckboxFoundation.prototype.updateAriaChecked = function () {
  4381. // Ensure aria-checked is set to mixed if checkbox is in indeterminate
  4382. // state.
  4383. if (this.adapter.isIndeterminate()) {
  4384. this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE);
  4385. } else {
  4386. // The on/off state does not need to keep track of aria-checked, since
  4387. // the screenreader uses the checked property on the checkbox element.
  4388. this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR);
  4389. }
  4390. };
  4391. return MDCCheckboxFoundation;
  4392. }(foundation_1.MDCFoundation);
  4393. exports.MDCCheckboxFoundation = MDCCheckboxFoundation;
  4394. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  4395. exports.default = MDCCheckboxFoundation;
  4396. /***/ }),
  4397. /***/ "./packages/mdc-data-table/adapter.ts":
  4398. /*!********************************************!*\
  4399. !*** ./packages/mdc-data-table/adapter.ts ***!
  4400. \********************************************/
  4401. /*! no static exports found */
  4402. /***/ (function(module, exports, __webpack_require__) {
  4403. "use strict";
  4404. /**
  4405. * @license
  4406. * Copyright 2019 Google Inc.
  4407. *
  4408. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4409. * of this software and associated documentation files (the "Software"), to deal
  4410. * in the Software without restriction, including without limitation the rights
  4411. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4412. * copies of the Software, and to permit persons to whom the Software is
  4413. * furnished to do so, subject to the following conditions:
  4414. *
  4415. * The above copyright notice and this permission notice shall be included in
  4416. * all copies or substantial portions of the Software.
  4417. *
  4418. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4419. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4420. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4421. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4422. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4423. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4424. * THE SOFTWARE.
  4425. */
  4426. Object.defineProperty(exports, "__esModule", { value: true });
  4427. /***/ }),
  4428. /***/ "./packages/mdc-data-table/component.ts":
  4429. /*!**********************************************!*\
  4430. !*** ./packages/mdc-data-table/component.ts ***!
  4431. \**********************************************/
  4432. /*! no static exports found */
  4433. /***/ (function(module, exports, __webpack_require__) {
  4434. "use strict";
  4435. /**
  4436. * @license
  4437. * Copyright 2019 Google Inc.
  4438. *
  4439. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4440. * of this software and associated documentation files (the "Software"), to deal
  4441. * in the Software without restriction, including without limitation the rights
  4442. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4443. * copies of the Software, and to permit persons to whom the Software is
  4444. * furnished to do so, subject to the following conditions:
  4445. *
  4446. * The above copyright notice and this permission notice shall be included in
  4447. * all copies or substantial portions of the Software.
  4448. *
  4449. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4450. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4451. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4452. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4453. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4454. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4455. * THE SOFTWARE.
  4456. */
  4457. var __extends = this && this.__extends || function () {
  4458. var _extendStatics = function extendStatics(d, b) {
  4459. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4460. d.__proto__ = b;
  4461. } || function (d, b) {
  4462. for (var p in b) {
  4463. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4464. }
  4465. };
  4466. return _extendStatics(d, b);
  4467. };
  4468. return function (d, b) {
  4469. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4470. _extendStatics(d, b);
  4471. function __() {
  4472. this.constructor = d;
  4473. }
  4474. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4475. };
  4476. }();
  4477. var __values = this && this.__values || function (o) {
  4478. var s = typeof Symbol === "function" && Symbol.iterator,
  4479. m = s && o[s],
  4480. i = 0;
  4481. if (m) return m.call(o);
  4482. if (o && typeof o.length === "number") return {
  4483. next: function next() {
  4484. if (o && i >= o.length) o = void 0;
  4485. return { value: o && o[i++], done: !o };
  4486. }
  4487. };
  4488. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  4489. };
  4490. Object.defineProperty(exports, "__esModule", { value: true });
  4491. exports.MDCDataTable = void 0;
  4492. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4493. var component_2 = __webpack_require__(/*! @material/checkbox/component */ "./packages/mdc-checkbox/component.ts");
  4494. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  4495. var component_3 = __webpack_require__(/*! @material/linear-progress/component */ "./packages/mdc-linear-progress/component.ts");
  4496. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  4497. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts");
  4498. /** MDC Data Table */
  4499. var MDCDataTable = /** @class */function (_super) {
  4500. __extends(MDCDataTable, _super);
  4501. function MDCDataTable() {
  4502. return _super !== null && _super.apply(this, arguments) || this;
  4503. }
  4504. MDCDataTable.attachTo = function (root) {
  4505. return new MDCDataTable(root);
  4506. };
  4507. MDCDataTable.prototype.initialize = function (checkboxFactory) {
  4508. if (checkboxFactory === void 0) {
  4509. checkboxFactory = function checkboxFactory(el) {
  4510. return new component_2.MDCCheckbox(el);
  4511. };
  4512. }
  4513. this.checkboxFactory = checkboxFactory;
  4514. };
  4515. MDCDataTable.prototype.initialSyncWithDOM = function () {
  4516. var _this = this;
  4517. this.headerRow = this.root.querySelector("." + constants_1.cssClasses.HEADER_ROW);
  4518. this.handleHeaderRowCheckboxChange = function () {
  4519. _this.foundation.handleHeaderRowCheckboxChange();
  4520. };
  4521. this.headerRow.addEventListener('change', this.handleHeaderRowCheckboxChange);
  4522. this.headerRowClickListener = function (event) {
  4523. _this.handleHeaderRowClick(event);
  4524. };
  4525. this.headerRow.addEventListener('click', this.headerRowClickListener);
  4526. this.content = this.root.querySelector("." + constants_1.cssClasses.CONTENT);
  4527. this.handleContentClick = function (event) {
  4528. var dataRowEl = ponyfill_1.closest(event.target, constants_1.selectors.ROW);
  4529. if (!dataRowEl) return;
  4530. _this.foundation.handleRowClick({
  4531. rowId: _this.getRowIdByRowElement(dataRowEl),
  4532. row: dataRowEl,
  4533. altKey: event.altKey,
  4534. ctrlKey: event.ctrlKey,
  4535. metaKey: event.metaKey,
  4536. shiftKey: event.shiftKey
  4537. });
  4538. };
  4539. this.content.addEventListener('click', this.handleContentClick);
  4540. this.handleRowCheckboxChange = function (event) {
  4541. _this.foundation.handleRowCheckboxChange(event);
  4542. };
  4543. this.content.addEventListener('change', this.handleRowCheckboxChange);
  4544. this.layout();
  4545. };
  4546. /**
  4547. * Re-initializes header row checkbox and row checkboxes when selectable rows
  4548. * are added or removed from table.
  4549. */
  4550. MDCDataTable.prototype.layout = function () {
  4551. this.foundation.layout();
  4552. };
  4553. /**
  4554. * @return Returns array of header row cell elements.
  4555. */
  4556. MDCDataTable.prototype.getHeaderCells = function () {
  4557. return Array.from(this.root.querySelectorAll(constants_1.selectors.HEADER_CELL));
  4558. };
  4559. /**
  4560. * @return Returns array of row elements.
  4561. */
  4562. MDCDataTable.prototype.getRows = function () {
  4563. return this.foundation.getRows();
  4564. };
  4565. /**
  4566. * @return Returns array of selected row ids.
  4567. */
  4568. MDCDataTable.prototype.getSelectedRowIds = function () {
  4569. return this.foundation.getSelectedRowIds();
  4570. };
  4571. /**
  4572. * Sets selected row ids. Overwrites previously selected rows.
  4573. * @param rowIds Array of row ids that needs to be selected.
  4574. */
  4575. MDCDataTable.prototype.setSelectedRowIds = function (rowIds) {
  4576. this.foundation.setSelectedRowIds(rowIds);
  4577. };
  4578. /**
  4579. * Shows progress indicator when data table is in loading state.
  4580. */
  4581. MDCDataTable.prototype.showProgress = function () {
  4582. this.getLinearProgress().open();
  4583. this.foundation.showProgress();
  4584. };
  4585. /**
  4586. * Hides progress indicator after data table is finished loading.
  4587. */
  4588. MDCDataTable.prototype.hideProgress = function () {
  4589. this.foundation.hideProgress();
  4590. this.getLinearProgress().close();
  4591. };
  4592. MDCDataTable.prototype.destroy = function () {
  4593. var e_1, _a;
  4594. if (this.handleHeaderRowCheckboxChange) {
  4595. this.headerRow.removeEventListener('change', this.handleHeaderRowCheckboxChange);
  4596. }
  4597. if (this.headerRowClickListener) {
  4598. this.headerRow.removeEventListener('click', this.headerRowClickListener);
  4599. }
  4600. if (this.handleRowCheckboxChange) {
  4601. this.content.removeEventListener('change', this.handleRowCheckboxChange);
  4602. }
  4603. if (this.headerRowCheckbox) {
  4604. this.headerRowCheckbox.destroy();
  4605. }
  4606. if (this.rowCheckboxList) {
  4607. try {
  4608. for (var _b = __values(this.rowCheckboxList), _c = _b.next(); !_c.done; _c = _b.next()) {
  4609. var checkbox = _c.value;
  4610. checkbox.destroy();
  4611. }
  4612. } catch (e_1_1) {
  4613. e_1 = { error: e_1_1 };
  4614. } finally {
  4615. try {
  4616. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  4617. } finally {
  4618. if (e_1) throw e_1.error;
  4619. }
  4620. }
  4621. }
  4622. if (this.handleContentClick) {
  4623. this.content.removeEventListener('click', this.handleContentClick);
  4624. }
  4625. };
  4626. MDCDataTable.prototype.getDefaultFoundation = function () {
  4627. var _this = this;
  4628. // DO NOT INLINE this variable. For backward compatibility, foundations take
  4629. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  4630. // methods, we need a separate, strongly typed adapter variable.
  4631. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
  4632. var adapter = {
  4633. addClass: function addClass(className) {
  4634. _this.root.classList.add(className);
  4635. },
  4636. removeClass: function removeClass(className) {
  4637. _this.root.classList.remove(className);
  4638. },
  4639. getHeaderCellElements: function getHeaderCellElements() {
  4640. return _this.getHeaderCells();
  4641. },
  4642. getHeaderCellCount: function getHeaderCellCount() {
  4643. return _this.getHeaderCells().length;
  4644. },
  4645. getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex(index, attribute) {
  4646. return _this.getHeaderCells()[index].getAttribute(attribute);
  4647. },
  4648. setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex(index, attribute, value) {
  4649. _this.safeSetAttribute(_this.getHeaderCells()[index], attribute, value);
  4650. },
  4651. setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex(index, className) {
  4652. _this.getHeaderCells()[index].classList.add(className);
  4653. },
  4654. removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex(index, className) {
  4655. _this.getHeaderCells()[index].classList.remove(className);
  4656. },
  4657. notifySortAction: function notifySortAction(data) {
  4658. _this.emit(constants_1.events.SORTED, data, /** shouldBubble */true);
  4659. },
  4660. getTableContainerHeight: function getTableContainerHeight() {
  4661. var tableContainer = _this.root.querySelector("." + constants_1.cssClasses.TABLE_CONTAINER);
  4662. if (!tableContainer) {
  4663. throw new Error('MDCDataTable: Table container element not found.');
  4664. }
  4665. return tableContainer.getBoundingClientRect().height;
  4666. },
  4667. getTableHeaderHeight: function getTableHeaderHeight() {
  4668. var tableHeader = _this.root.querySelector(constants_1.selectors.HEADER_ROW);
  4669. if (!tableHeader) {
  4670. throw new Error('MDCDataTable: Table header element not found.');
  4671. }
  4672. return tableHeader.getBoundingClientRect().height;
  4673. },
  4674. setProgressIndicatorStyles: function setProgressIndicatorStyles(styles) {
  4675. var progressIndicator = _this.root.querySelector(constants_1.selectors.PROGRESS_INDICATOR);
  4676. if (!progressIndicator) {
  4677. throw new Error('MDCDataTable: Progress indicator element not found.');
  4678. }
  4679. progressIndicator.style.setProperty('height', styles.height);
  4680. progressIndicator.style.setProperty('top', styles.top);
  4681. },
  4682. addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) {
  4683. _this.getRows()[rowIndex].classList.add(className);
  4684. },
  4685. getRowCount: function getRowCount() {
  4686. return _this.getRows().length;
  4687. },
  4688. getRowElements: function getRowElements() {
  4689. return Array.from(_this.root.querySelectorAll(constants_1.selectors.ROW));
  4690. },
  4691. getRowIdAtIndex: function getRowIdAtIndex(rowIndex) {
  4692. return _this.getRows()[rowIndex].getAttribute(constants_1.dataAttributes.ROW_ID);
  4693. },
  4694. getRowIndexByChildElement: function getRowIndexByChildElement(el) {
  4695. return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.selectors.ROW));
  4696. },
  4697. getSelectedRowCount: function getSelectedRowCount() {
  4698. return _this.root.querySelectorAll(constants_1.selectors.ROW_SELECTED).length;
  4699. },
  4700. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) {
  4701. return _this.rowCheckboxList[rowIndex].checked;
  4702. },
  4703. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  4704. return _this.headerRowCheckbox.checked;
  4705. },
  4706. isRowsSelectable: function isRowsSelectable() {
  4707. return !!_this.root.querySelector(constants_1.selectors.ROW_CHECKBOX) || !!_this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX);
  4708. },
  4709. notifyRowSelectionChanged: function notifyRowSelectionChanged(data) {
  4710. _this.emit(constants_1.events.ROW_SELECTION_CHANGED, {
  4711. row: _this.getRowByIndex(data.rowIndex),
  4712. rowId: _this.getRowIdByIndex(data.rowIndex),
  4713. rowIndex: data.rowIndex,
  4714. selected: data.selected
  4715. },
  4716. /** shouldBubble */true);
  4717. },
  4718. notifySelectedAll: function notifySelectedAll() {
  4719. _this.emit(constants_1.events.SELECTED_ALL, {}, /** shouldBubble */true);
  4720. },
  4721. notifyUnselectedAll: function notifyUnselectedAll() {
  4722. _this.emit(constants_1.events.UNSELECTED_ALL, {}, /** shouldBubble */true);
  4723. },
  4724. notifyRowClick: function notifyRowClick(data) {
  4725. _this.emit(constants_1.events.ROW_CLICK, data, /** shouldBubble */true);
  4726. },
  4727. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  4728. if (_this.headerRowCheckbox) {
  4729. _this.headerRowCheckbox.destroy();
  4730. }
  4731. var checkboxEl = _this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX);
  4732. _this.headerRowCheckbox = _this.checkboxFactory(checkboxEl);
  4733. },
  4734. registerRowCheckboxes: function registerRowCheckboxes() {
  4735. if (_this.rowCheckboxList) {
  4736. _this.rowCheckboxList.forEach(function (checkbox) {
  4737. checkbox.destroy();
  4738. });
  4739. }
  4740. _this.rowCheckboxList = [];
  4741. _this.getRows().forEach(function (rowEl) {
  4742. var checkbox = _this.checkboxFactory(rowEl.querySelector(constants_1.selectors.ROW_CHECKBOX));
  4743. _this.rowCheckboxList.push(checkbox);
  4744. });
  4745. },
  4746. removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) {
  4747. _this.getRows()[rowIndex].classList.remove(className);
  4748. },
  4749. setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) {
  4750. _this.safeSetAttribute(_this.getRows()[rowIndex], attr, value);
  4751. },
  4752. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) {
  4753. _this.headerRowCheckbox.checked = checked;
  4754. },
  4755. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) {
  4756. _this.headerRowCheckbox.indeterminate = indeterminate;
  4757. },
  4758. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) {
  4759. _this.rowCheckboxList[rowIndex].checked = checked;
  4760. },
  4761. setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue) {
  4762. var headerCell = _this.getHeaderCells()[columnIndex];
  4763. var sortStatusLabel = headerCell.querySelector(constants_1.selectors.SORT_STATUS_LABEL);
  4764. if (!sortStatusLabel) return;
  4765. sortStatusLabel.textContent = _this.getSortStatusMessageBySortValue(sortValue);
  4766. }
  4767. };
  4768. return new foundation_1.MDCDataTableFoundation(adapter);
  4769. };
  4770. MDCDataTable.prototype.getRowByIndex = function (index) {
  4771. return this.getRows()[index];
  4772. };
  4773. MDCDataTable.prototype.getRowIdByIndex = function (index) {
  4774. return this.getRowByIndex(index).getAttribute(constants_1.dataAttributes.ROW_ID);
  4775. };
  4776. MDCDataTable.prototype.handleHeaderRowClick = function (event) {
  4777. var headerCell = ponyfill_1.closest(event.target, constants_1.selectors.HEADER_CELL_WITH_SORT);
  4778. if (!headerCell) {
  4779. return;
  4780. }
  4781. var columnId = headerCell.getAttribute(constants_1.dataAttributes.COLUMN_ID);
  4782. var columnIndex = this.getHeaderCells().indexOf(headerCell);
  4783. if (columnIndex === -1) {
  4784. return;
  4785. }
  4786. this.foundation.handleSortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell });
  4787. };
  4788. MDCDataTable.prototype.getSortStatusMessageBySortValue = function (sortValue) {
  4789. switch (sortValue) {
  4790. case constants_1.SortValue.ASCENDING:
  4791. return constants_1.messages.SORTED_IN_ASCENDING;
  4792. case constants_1.SortValue.DESCENDING:
  4793. return constants_1.messages.SORTED_IN_DESCENDING;
  4794. default:
  4795. return '';
  4796. }
  4797. };
  4798. MDCDataTable.prototype.getLinearProgressElement = function () {
  4799. var el = this.root.querySelector("." + constants_1.cssClasses.LINEAR_PROGRESS);
  4800. if (!el) {
  4801. throw new Error('MDCDataTable: linear progress element is not found.');
  4802. }
  4803. return el;
  4804. };
  4805. MDCDataTable.prototype.getLinearProgress = function () {
  4806. if (!this.linearProgress) {
  4807. var el = this.getLinearProgressElement();
  4808. this.linearProgress = new component_3.MDCLinearProgress(el);
  4809. }
  4810. return this.linearProgress;
  4811. };
  4812. MDCDataTable.prototype.getRowIdByRowElement = function (rowElement) {
  4813. return rowElement.getAttribute(constants_1.dataAttributes.ROW_ID);
  4814. };
  4815. return MDCDataTable;
  4816. }(component_1.MDCComponent);
  4817. exports.MDCDataTable = MDCDataTable;
  4818. /***/ }),
  4819. /***/ "./packages/mdc-data-table/constants.ts":
  4820. /*!**********************************************!*\
  4821. !*** ./packages/mdc-data-table/constants.ts ***!
  4822. \**********************************************/
  4823. /*! no static exports found */
  4824. /***/ (function(module, exports, __webpack_require__) {
  4825. "use strict";
  4826. /**
  4827. * @license
  4828. * Copyright 2019 Google Inc.
  4829. *
  4830. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4831. * of this software and associated documentation files (the "Software"), to deal
  4832. * in the Software without restriction, including without limitation the rights
  4833. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4834. * copies of the Software, and to permit persons to whom the Software is
  4835. * furnished to do so, subject to the following conditions:
  4836. *
  4837. * The above copyright notice and this permission notice shall be included in
  4838. * all copies or substantial portions of the Software.
  4839. *
  4840. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4841. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4842. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4843. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4844. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4845. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4846. * THE SOFTWARE.
  4847. */
  4848. Object.defineProperty(exports, "__esModule", { value: true });
  4849. exports.events = exports.SortValue = exports.messages = exports.selectors = exports.dataAttributes = exports.attributes = exports.cssClasses = void 0;
  4850. /**
  4851. * CSS class names used in component.
  4852. */
  4853. exports.cssClasses = {
  4854. CELL: 'mdc-data-table__cell',
  4855. CELL_NUMERIC: 'mdc-data-table__cell--numeric',
  4856. CONTENT: 'mdc-data-table__content',
  4857. HEADER_CELL: 'mdc-data-table__header-cell',
  4858. HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label',
  4859. HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted',
  4860. HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending',
  4861. HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort',
  4862. HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper',
  4863. HEADER_ROW: 'mdc-data-table__header-row',
  4864. HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox',
  4865. IN_PROGRESS: 'mdc-data-table--in-progress',
  4866. LINEAR_PROGRESS: 'mdc-data-table__linear-progress',
  4867. PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label',
  4868. PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select',
  4869. PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator',
  4870. ROOT: 'mdc-data-table',
  4871. ROW: 'mdc-data-table__row',
  4872. ROW_CHECKBOX: 'mdc-data-table__row-checkbox',
  4873. ROW_SELECTED: 'mdc-data-table__row--selected',
  4874. SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button',
  4875. SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label',
  4876. TABLE_CONTAINER: 'mdc-data-table__table-container'
  4877. };
  4878. /**
  4879. * DOM attributes used in component.
  4880. */
  4881. exports.attributes = {
  4882. ARIA_SELECTED: 'aria-selected',
  4883. ARIA_SORT: 'aria-sort'
  4884. };
  4885. /**
  4886. * List of data attributes used in component.
  4887. */
  4888. exports.dataAttributes = {
  4889. COLUMN_ID: 'data-column-id',
  4890. ROW_ID: 'data-row-id'
  4891. };
  4892. /**
  4893. * CSS selectors used in component.
  4894. */
  4895. exports.selectors = {
  4896. CONTENT: "." + exports.cssClasses.CONTENT,
  4897. HEADER_CELL: "." + exports.cssClasses.HEADER_CELL,
  4898. HEADER_CELL_WITH_SORT: "." + exports.cssClasses.HEADER_CELL_WITH_SORT,
  4899. HEADER_ROW: "." + exports.cssClasses.HEADER_ROW,
  4900. HEADER_ROW_CHECKBOX: "." + exports.cssClasses.HEADER_ROW_CHECKBOX,
  4901. PROGRESS_INDICATOR: "." + exports.cssClasses.PROGRESS_INDICATOR,
  4902. ROW: "." + exports.cssClasses.ROW,
  4903. ROW_CHECKBOX: "." + exports.cssClasses.ROW_CHECKBOX,
  4904. ROW_SELECTED: "." + exports.cssClasses.ROW_SELECTED,
  4905. SORT_ICON_BUTTON: "." + exports.cssClasses.SORT_ICON_BUTTON,
  4906. SORT_STATUS_LABEL: "." + exports.cssClasses.SORT_STATUS_LABEL
  4907. };
  4908. /**
  4909. * Messages used in component.
  4910. */
  4911. exports.messages = {
  4912. SORTED_IN_DESCENDING: 'Sorted in descending order',
  4913. SORTED_IN_ASCENDING: 'Sorted in ascending order'
  4914. };
  4915. /**
  4916. * Sort values defined by ARIA.
  4917. * See https://www.w3.org/WAI/PF/aria/states_and_properties#aria-sort
  4918. */
  4919. var SortValue;
  4920. (function (SortValue) {
  4921. // Items are sorted in ascending order by this column.
  4922. SortValue["ASCENDING"] = "ascending";
  4923. // Items are sorted in descending order by this column.
  4924. SortValue["DESCENDING"] = "descending";
  4925. // There is no defined sort applied to the column.
  4926. SortValue["NONE"] = "none";
  4927. // A sort algorithm other than ascending or descending has been applied.
  4928. SortValue["OTHER"] = "other";
  4929. })(SortValue = exports.SortValue || (exports.SortValue = {}));
  4930. /**
  4931. * Event names used in component.
  4932. */
  4933. exports.events = {
  4934. ROW_CLICK: 'MDCDataTable:rowClick',
  4935. ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged',
  4936. SELECTED_ALL: 'MDCDataTable:selectedAll',
  4937. SORTED: 'MDCDataTable:sorted',
  4938. UNSELECTED_ALL: 'MDCDataTable:unselectedAll'
  4939. };
  4940. /***/ }),
  4941. /***/ "./packages/mdc-data-table/foundation.ts":
  4942. /*!***********************************************!*\
  4943. !*** ./packages/mdc-data-table/foundation.ts ***!
  4944. \***********************************************/
  4945. /*! no static exports found */
  4946. /***/ (function(module, exports, __webpack_require__) {
  4947. "use strict";
  4948. /**
  4949. * @license
  4950. * Copyright 2019 Google Inc.
  4951. *
  4952. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4953. * of this software and associated documentation files (the "Software"), to deal
  4954. * in the Software without restriction, including without limitation the rights
  4955. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4956. * copies of the Software, and to permit persons to whom the Software is
  4957. * furnished to do so, subject to the following conditions:
  4958. *
  4959. * The above copyright notice and this permission notice shall be included in
  4960. * all copies or substantial portions of the Software.
  4961. *
  4962. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4963. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4964. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4965. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4966. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4967. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4968. * THE SOFTWARE.
  4969. */
  4970. var __extends = this && this.__extends || function () {
  4971. var _extendStatics = function extendStatics(d, b) {
  4972. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4973. d.__proto__ = b;
  4974. } || function (d, b) {
  4975. for (var p in b) {
  4976. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4977. }
  4978. };
  4979. return _extendStatics(d, b);
  4980. };
  4981. return function (d, b) {
  4982. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4983. _extendStatics(d, b);
  4984. function __() {
  4985. this.constructor = d;
  4986. }
  4987. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4988. };
  4989. }();
  4990. var __assign = this && this.__assign || function () {
  4991. __assign = Object.assign || function (t) {
  4992. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4993. s = arguments[i];
  4994. for (var p in s) {
  4995. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4996. }
  4997. }
  4998. return t;
  4999. };
  5000. return __assign.apply(this, arguments);
  5001. };
  5002. var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
  5003. function adopt(value) {
  5004. return value instanceof P ? value : new P(function (resolve) {
  5005. resolve(value);
  5006. });
  5007. }
  5008. return new (P || (P = Promise))(function (resolve, reject) {
  5009. function fulfilled(value) {
  5010. try {
  5011. step(generator.next(value));
  5012. } catch (e) {
  5013. reject(e);
  5014. }
  5015. }
  5016. function rejected(value) {
  5017. try {
  5018. step(generator["throw"](value));
  5019. } catch (e) {
  5020. reject(e);
  5021. }
  5022. }
  5023. function step(result) {
  5024. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  5025. }
  5026. step((generator = generator.apply(thisArg, _arguments || [])).next());
  5027. });
  5028. };
  5029. var __generator = this && this.__generator || function (thisArg, body) {
  5030. var _ = { label: 0, sent: function sent() {
  5031. if (t[0] & 1) throw t[1];return t[1];
  5032. }, trys: [], ops: [] },
  5033. f,
  5034. y,
  5035. t,
  5036. g;
  5037. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
  5038. return this;
  5039. }), g;
  5040. function verb(n) {
  5041. return function (v) {
  5042. return step([n, v]);
  5043. };
  5044. }
  5045. function step(op) {
  5046. if (f) throw new TypeError("Generator is already executing.");
  5047. while (_) {
  5048. try {
  5049. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  5050. if (y = 0, t) op = [op[0] & 2, t.value];
  5051. switch (op[0]) {
  5052. case 0:case 1:
  5053. t = op;break;
  5054. case 4:
  5055. _.label++;return { value: op[1], done: false };
  5056. case 5:
  5057. _.label++;y = op[1];op = [0];continue;
  5058. case 7:
  5059. op = _.ops.pop();_.trys.pop();continue;
  5060. default:
  5061. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  5062. _ = 0;continue;
  5063. }
  5064. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  5065. _.label = op[1];break;
  5066. }
  5067. if (op[0] === 6 && _.label < t[1]) {
  5068. _.label = t[1];t = op;break;
  5069. }
  5070. if (t && _.label < t[2]) {
  5071. _.label = t[2];_.ops.push(op);break;
  5072. }
  5073. if (t[2]) _.ops.pop();
  5074. _.trys.pop();continue;
  5075. }
  5076. op = body.call(thisArg, _);
  5077. } catch (e) {
  5078. op = [6, e];y = 0;
  5079. } finally {
  5080. f = t = 0;
  5081. }
  5082. }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
  5083. }
  5084. };
  5085. Object.defineProperty(exports, "__esModule", { value: true });
  5086. exports.MDCDataTableFoundation = void 0;
  5087. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5088. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts");
  5089. /**
  5090. * The Foundation of data table component containing pure business logic, any
  5091. * logic requiring DOM manipulation are delegated to adapter methods.
  5092. */
  5093. var MDCDataTableFoundation = /** @class */function (_super) {
  5094. __extends(MDCDataTableFoundation, _super);
  5095. function MDCDataTableFoundation(adapter) {
  5096. return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this;
  5097. }
  5098. Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", {
  5099. get: function get() {
  5100. return {
  5101. addClass: function addClass() {
  5102. return undefined;
  5103. },
  5104. addClassAtRowIndex: function addClassAtRowIndex() {
  5105. return undefined;
  5106. },
  5107. getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex() {
  5108. return '';
  5109. },
  5110. getHeaderCellCount: function getHeaderCellCount() {
  5111. return 0;
  5112. },
  5113. getHeaderCellElements: function getHeaderCellElements() {
  5114. return [];
  5115. },
  5116. getRowCount: function getRowCount() {
  5117. return 0;
  5118. },
  5119. getRowElements: function getRowElements() {
  5120. return [];
  5121. },
  5122. getRowIdAtIndex: function getRowIdAtIndex() {
  5123. return '';
  5124. },
  5125. getRowIndexByChildElement: function getRowIndexByChildElement() {
  5126. return 0;
  5127. },
  5128. getSelectedRowCount: function getSelectedRowCount() {
  5129. return 0;
  5130. },
  5131. getTableContainerHeight: function getTableContainerHeight() {
  5132. return 0;
  5133. },
  5134. getTableHeaderHeight: function getTableHeaderHeight() {
  5135. return 0;
  5136. },
  5137. isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() {
  5138. return false;
  5139. },
  5140. isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
  5141. return false;
  5142. },
  5143. isRowsSelectable: function isRowsSelectable() {
  5144. return false;
  5145. },
  5146. notifyRowSelectionChanged: function notifyRowSelectionChanged() {
  5147. return undefined;
  5148. },
  5149. notifySelectedAll: function notifySelectedAll() {
  5150. return undefined;
  5151. },
  5152. notifySortAction: function notifySortAction() {
  5153. return undefined;
  5154. },
  5155. notifyUnselectedAll: function notifyUnselectedAll() {
  5156. return undefined;
  5157. },
  5158. notifyRowClick: function notifyRowClick() {
  5159. return undefined;
  5160. },
  5161. registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
  5162. return undefined;
  5163. },
  5164. registerRowCheckboxes: function registerRowCheckboxes() {
  5165. return undefined;
  5166. },
  5167. removeClass: function removeClass() {
  5168. return undefined;
  5169. },
  5170. removeClassAtRowIndex: function removeClassAtRowIndex() {
  5171. return undefined;
  5172. },
  5173. removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex() {
  5174. return undefined;
  5175. },
  5176. setAttributeAtRowIndex: function setAttributeAtRowIndex() {
  5177. return undefined;
  5178. },
  5179. setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex() {
  5180. return undefined;
  5181. },
  5182. setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex() {
  5183. return undefined;
  5184. },
  5185. setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() {
  5186. return undefined;
  5187. },
  5188. setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() {
  5189. return undefined;
  5190. },
  5191. setProgressIndicatorStyles: function setProgressIndicatorStyles() {
  5192. return undefined;
  5193. },
  5194. setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() {
  5195. return undefined;
  5196. },
  5197. setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex() {
  5198. return undefined;
  5199. }
  5200. };
  5201. },
  5202. enumerable: false,
  5203. configurable: true
  5204. });
  5205. /**
  5206. * Re-initializes header row checkbox and row checkboxes when selectable rows
  5207. * are added or removed from table. Use this if registering checkbox is
  5208. * synchronous.
  5209. */
  5210. MDCDataTableFoundation.prototype.layout = function () {
  5211. if (this.adapter.isRowsSelectable()) {
  5212. this.adapter.registerHeaderRowCheckbox();
  5213. this.adapter.registerRowCheckboxes();
  5214. this.setHeaderRowCheckboxState();
  5215. }
  5216. };
  5217. /**
  5218. * Re-initializes header row checkbox and row checkboxes when selectable rows
  5219. * are added or removed from table. Use this if registering checkbox is
  5220. * asynchronous.
  5221. */
  5222. MDCDataTableFoundation.prototype.layoutAsync = function () {
  5223. return __awaiter(this, void 0, void 0, function () {
  5224. return __generator(this, function (_a) {
  5225. switch (_a.label) {
  5226. case 0:
  5227. if (!this.adapter.isRowsSelectable()) return [3 /*break*/, 3];
  5228. return [4 /*yield*/, this.adapter.registerHeaderRowCheckbox()];
  5229. case 1:
  5230. _a.sent();
  5231. return [4 /*yield*/, this.adapter.registerRowCheckboxes()];
  5232. case 2:
  5233. _a.sent();
  5234. this.setHeaderRowCheckboxState();
  5235. _a.label = 3;
  5236. case 3:
  5237. return [2 /*return*/];
  5238. }
  5239. });
  5240. });
  5241. };
  5242. /**
  5243. * @return Returns array of row elements.
  5244. */
  5245. MDCDataTableFoundation.prototype.getRows = function () {
  5246. return this.adapter.getRowElements();
  5247. };
  5248. /**
  5249. * @return Array of header cell elements.
  5250. */
  5251. MDCDataTableFoundation.prototype.getHeaderCells = function () {
  5252. return this.adapter.getHeaderCellElements();
  5253. };
  5254. /**
  5255. * Sets selected row ids. Overwrites previously selected rows.
  5256. * @param rowIds Array of row ids that needs to be selected.
  5257. */
  5258. MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) {
  5259. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  5260. var rowId = this.adapter.getRowIdAtIndex(rowIndex);
  5261. var isSelected = false;
  5262. if (rowId && rowIds.indexOf(rowId) >= 0) {
  5263. isSelected = true;
  5264. }
  5265. this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected);
  5266. this.selectRowAtIndex(rowIndex, isSelected);
  5267. }
  5268. this.setHeaderRowCheckboxState();
  5269. };
  5270. /**
  5271. * @return Returns array of all row ids.
  5272. */
  5273. MDCDataTableFoundation.prototype.getRowIds = function () {
  5274. var rowIds = [];
  5275. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  5276. rowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
  5277. }
  5278. return rowIds;
  5279. };
  5280. /**
  5281. * @return Returns array of selected row ids.
  5282. */
  5283. MDCDataTableFoundation.prototype.getSelectedRowIds = function () {
  5284. var selectedRowIds = [];
  5285. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  5286. if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) {
  5287. selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
  5288. }
  5289. }
  5290. return selectedRowIds;
  5291. };
  5292. /**
  5293. * Handles header row checkbox change event.
  5294. */
  5295. MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () {
  5296. var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked();
  5297. for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
  5298. this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked);
  5299. this.selectRowAtIndex(rowIndex, isHeaderChecked);
  5300. }
  5301. if (isHeaderChecked) {
  5302. this.adapter.notifySelectedAll();
  5303. } else {
  5304. this.adapter.notifyUnselectedAll();
  5305. }
  5306. };
  5307. /**
  5308. * Handles change event originated from row checkboxes.
  5309. */
  5310. MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) {
  5311. var rowIndex = this.adapter.getRowIndexByChildElement(event.target);
  5312. if (rowIndex === -1) {
  5313. return;
  5314. }
  5315. var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex);
  5316. this.selectRowAtIndex(rowIndex, selected);
  5317. this.setHeaderRowCheckboxState();
  5318. var rowId = this.adapter.getRowIdAtIndex(rowIndex);
  5319. this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected });
  5320. };
  5321. /**
  5322. * Handles sort action on sortable header cell.
  5323. */
  5324. MDCDataTableFoundation.prototype.handleSortAction = function (eventData) {
  5325. var columnId = eventData.columnId,
  5326. columnIndex = eventData.columnIndex,
  5327. headerCell = eventData.headerCell;
  5328. // Reset sort attributes / classes on other header cells.
  5329. for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) {
  5330. if (index === columnIndex) {
  5331. continue;
  5332. }
  5333. this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED);
  5334. this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
  5335. this.adapter.setAttributeByHeaderCellIndex(index, constants_1.attributes.ARIA_SORT, constants_1.SortValue.NONE);
  5336. this.adapter.setSortStatusLabelByHeaderCellIndex(index, constants_1.SortValue.NONE);
  5337. }
  5338. // Set appropriate sort attributes / classes on target header cell.
  5339. this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED);
  5340. var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, constants_1.attributes.ARIA_SORT);
  5341. var sortValue = constants_1.SortValue.NONE;
  5342. // Set to descending if sorted on ascending order.
  5343. if (currentSortValue === constants_1.SortValue.ASCENDING) {
  5344. this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
  5345. this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.attributes.ARIA_SORT, constants_1.SortValue.DESCENDING);
  5346. sortValue = constants_1.SortValue.DESCENDING;
  5347. // Set to ascending if sorted on descending order.
  5348. } else if (currentSortValue === constants_1.SortValue.DESCENDING) {
  5349. this.adapter.removeClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
  5350. this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.attributes.ARIA_SORT, constants_1.SortValue.ASCENDING);
  5351. sortValue = constants_1.SortValue.ASCENDING;
  5352. } else {
  5353. // Set to ascending by default when not sorted.
  5354. this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.attributes.ARIA_SORT, constants_1.SortValue.ASCENDING);
  5355. sortValue = constants_1.SortValue.ASCENDING;
  5356. }
  5357. this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue);
  5358. this.adapter.notifySortAction({
  5359. columnId: columnId,
  5360. columnIndex: columnIndex,
  5361. headerCell: headerCell,
  5362. sortValue: sortValue
  5363. });
  5364. };
  5365. /**
  5366. * Handles data table row click event.
  5367. */
  5368. MDCDataTableFoundation.prototype.handleRowClick = function (_a) {
  5369. var rowId = _a.rowId,
  5370. row = _a.row,
  5371. altKey = _a.altKey,
  5372. ctrlKey = _a.ctrlKey,
  5373. metaKey = _a.metaKey,
  5374. shiftKey = _a.shiftKey;
  5375. this.adapter.notifyRowClick({
  5376. rowId: rowId,
  5377. row: row,
  5378. altKey: altKey,
  5379. ctrlKey: ctrlKey,
  5380. metaKey: metaKey,
  5381. shiftKey: shiftKey
  5382. });
  5383. };
  5384. /**
  5385. * Shows progress indicator blocking only the table body content when in
  5386. * loading state.
  5387. */
  5388. MDCDataTableFoundation.prototype.showProgress = function () {
  5389. var tableHeaderHeight = this.adapter.getTableHeaderHeight();
  5390. // Calculate the height of table content (Not scroll content) excluding
  5391. // header row height.
  5392. var height = this.adapter.getTableContainerHeight() - tableHeaderHeight;
  5393. var top = tableHeaderHeight;
  5394. this.adapter.setProgressIndicatorStyles({
  5395. height: height + "px",
  5396. top: top + "px"
  5397. });
  5398. this.adapter.addClass(constants_1.cssClasses.IN_PROGRESS);
  5399. };
  5400. /**
  5401. * Hides progress indicator when data table is finished loading.
  5402. */
  5403. MDCDataTableFoundation.prototype.hideProgress = function () {
  5404. this.adapter.removeClass(constants_1.cssClasses.IN_PROGRESS);
  5405. };
  5406. /**
  5407. * Updates header row checkbox state based on number of rows selected.
  5408. */
  5409. MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () {
  5410. if (this.adapter.getSelectedRowCount() === 0) {
  5411. this.adapter.setHeaderRowCheckboxChecked(false);
  5412. this.adapter.setHeaderRowCheckboxIndeterminate(false);
  5413. } else if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) {
  5414. this.adapter.setHeaderRowCheckboxChecked(true);
  5415. this.adapter.setHeaderRowCheckboxIndeterminate(false);
  5416. } else {
  5417. this.adapter.setHeaderRowCheckboxIndeterminate(true);
  5418. this.adapter.setHeaderRowCheckboxChecked(false);
  5419. }
  5420. };
  5421. /**
  5422. * Sets the attributes of row element based on selection state.
  5423. */
  5424. MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) {
  5425. if (selected) {
  5426. this.adapter.addClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  5427. this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.attributes.ARIA_SELECTED, 'true');
  5428. } else {
  5429. this.adapter.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
  5430. this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.attributes.ARIA_SELECTED, 'false');
  5431. }
  5432. };
  5433. return MDCDataTableFoundation;
  5434. }(foundation_1.MDCFoundation);
  5435. exports.MDCDataTableFoundation = MDCDataTableFoundation;
  5436. /***/ }),
  5437. /***/ "./packages/mdc-data-table/index.ts":
  5438. /*!******************************************!*\
  5439. !*** ./packages/mdc-data-table/index.ts ***!
  5440. \******************************************/
  5441. /*! no static exports found */
  5442. /***/ (function(module, exports, __webpack_require__) {
  5443. "use strict";
  5444. /**
  5445. * @license
  5446. * Copyright 2019 Google Inc.
  5447. *
  5448. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5449. * of this software and associated documentation files (the "Software"), to deal
  5450. * in the Software without restriction, including without limitation the rights
  5451. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5452. * copies of the Software, and to permit persons to whom the Software is
  5453. * furnished to do so, subject to the following conditions:
  5454. *
  5455. * The above copyright notice and this permission notice shall be included in
  5456. * all copies or substantial portions of the Software.
  5457. *
  5458. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5459. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5460. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5461. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5462. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5463. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5464. * THE SOFTWARE.
  5465. */
  5466. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  5467. if (k2 === undefined) k2 = k;
  5468. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  5469. return m[k];
  5470. } });
  5471. } : function (o, m, k, k2) {
  5472. if (k2 === undefined) k2 = k;
  5473. o[k2] = m[k];
  5474. });
  5475. var __exportStar = this && this.__exportStar || function (m, exports) {
  5476. for (var p in m) {
  5477. if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  5478. }
  5479. };
  5480. Object.defineProperty(exports, "__esModule", { value: true });
  5481. __exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-data-table/adapter.ts"), exports);
  5482. __exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-data-table/component.ts"), exports);
  5483. __exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"), exports);
  5484. __exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"), exports);
  5485. __exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-data-table/types.ts"), exports);
  5486. /***/ }),
  5487. /***/ "./packages/mdc-data-table/types.ts":
  5488. /*!******************************************!*\
  5489. !*** ./packages/mdc-data-table/types.ts ***!
  5490. \******************************************/
  5491. /*! no static exports found */
  5492. /***/ (function(module, exports, __webpack_require__) {
  5493. "use strict";
  5494. /**
  5495. * @license
  5496. * Copyright 2019 Google Inc.
  5497. *
  5498. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5499. * of this software and associated documentation files (the "Software"), to deal
  5500. * in the Software without restriction, including without limitation the rights
  5501. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5502. * copies of the Software, and to permit persons to whom the Software is
  5503. * furnished to do so, subject to the following conditions:
  5504. *
  5505. * The above copyright notice and this permission notice shall be included in
  5506. * all copies or substantial portions of the Software.
  5507. *
  5508. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5509. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5510. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5511. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5512. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5513. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5514. * THE SOFTWARE.
  5515. */
  5516. Object.defineProperty(exports, "__esModule", { value: true });
  5517. /***/ }),
  5518. /***/ "./packages/mdc-dom/events.ts":
  5519. /*!************************************!*\
  5520. !*** ./packages/mdc-dom/events.ts ***!
  5521. \************************************/
  5522. /*! no static exports found */
  5523. /***/ (function(module, exports, __webpack_require__) {
  5524. "use strict";
  5525. /**
  5526. * @license
  5527. * Copyright 2019 Google Inc.
  5528. *
  5529. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5530. * of this software and associated documentation files (the "Software"), to deal
  5531. * in the Software without restriction, including without limitation the rights
  5532. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5533. * copies of the Software, and to permit persons to whom the Software is
  5534. * furnished to do so, subject to the following conditions:
  5535. *
  5536. * The above copyright notice and this permission notice shall be included in
  5537. * all copies or substantial portions of the Software.
  5538. *
  5539. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5540. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5541. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5542. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5543. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5544. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5545. * THE SOFTWARE.
  5546. */
  5547. Object.defineProperty(exports, "__esModule", { value: true });
  5548. exports.applyPassive = void 0;
  5549. /**
  5550. * Determine whether the current browser supports passive event listeners, and
  5551. * if so, use them.
  5552. */
  5553. function applyPassive(globalObj) {
  5554. if (globalObj === void 0) {
  5555. globalObj = window;
  5556. }
  5557. return supportsPassiveOption(globalObj) ? { passive: true } : false;
  5558. }
  5559. exports.applyPassive = applyPassive;
  5560. function supportsPassiveOption(globalObj) {
  5561. if (globalObj === void 0) {
  5562. globalObj = window;
  5563. }
  5564. // See
  5565. // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  5566. var passiveSupported = false;
  5567. try {
  5568. var options = {
  5569. // This function will be called when the browser
  5570. // attempts to access the passive property.
  5571. get passive() {
  5572. passiveSupported = true;
  5573. return false;
  5574. }
  5575. };
  5576. var handler = function handler() {};
  5577. globalObj.document.addEventListener('test', handler, options);
  5578. globalObj.document.removeEventListener('test', handler, options);
  5579. } catch (err) {
  5580. passiveSupported = false;
  5581. }
  5582. return passiveSupported;
  5583. }
  5584. /***/ }),
  5585. /***/ "./packages/mdc-dom/ponyfill.ts":
  5586. /*!**************************************!*\
  5587. !*** ./packages/mdc-dom/ponyfill.ts ***!
  5588. \**************************************/
  5589. /*! no static exports found */
  5590. /***/ (function(module, exports, __webpack_require__) {
  5591. "use strict";
  5592. /**
  5593. * @license
  5594. * Copyright 2018 Google Inc.
  5595. *
  5596. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5597. * of this software and associated documentation files (the "Software"), to deal
  5598. * in the Software without restriction, including without limitation the rights
  5599. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5600. * copies of the Software, and to permit persons to whom the Software is
  5601. * furnished to do so, subject to the following conditions:
  5602. *
  5603. * The above copyright notice and this permission notice shall be included in
  5604. * all copies or substantial portions of the Software.
  5605. *
  5606. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5607. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5608. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5609. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5610. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5611. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5612. * THE SOFTWARE.
  5613. */
  5614. Object.defineProperty(exports, "__esModule", { value: true });
  5615. exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
  5616. /**
  5617. * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global
  5618. * prototype chain. This makes ponyfills safer than traditional polyfills,
  5619. * especially for libraries like MDC.
  5620. */
  5621. function closest(element, selector) {
  5622. if (element.closest) {
  5623. return element.closest(selector);
  5624. }
  5625. var el = element;
  5626. while (el) {
  5627. if (matches(el, selector)) {
  5628. return el;
  5629. }
  5630. el = el.parentElement;
  5631. }
  5632. return null;
  5633. }
  5634. exports.closest = closest;
  5635. /** Element.matches with support for webkit and IE. */
  5636. function matches(element, selector) {
  5637. var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
  5638. return nativeMatches.call(element, selector);
  5639. }
  5640. exports.matches = matches;
  5641. /**
  5642. * Used to compute the estimated scroll width of elements. When an element is
  5643. * hidden due to display: none; being applied to a parent element, the width is
  5644. * returned as 0. However, the element will have a true width once no longer
  5645. * inside a display: none context. This method computes an estimated width when
  5646. * the element is hidden or returns the true width when the element is visble.
  5647. * @param {Element} element the element whose width to estimate
  5648. */
  5649. function estimateScrollWidth(element) {
  5650. // Check the offsetParent. If the element inherits display: none from any
  5651. // parent, the offsetParent property will be null (see
  5652. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
  5653. // This check ensures we only clone the node when necessary.
  5654. var htmlEl = element;
  5655. if (htmlEl.offsetParent !== null) {
  5656. return htmlEl.scrollWidth;
  5657. }
  5658. var clone = htmlEl.cloneNode(true);
  5659. clone.style.setProperty('position', 'absolute');
  5660. clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
  5661. document.documentElement.appendChild(clone);
  5662. var scrollWidth = clone.scrollWidth;
  5663. document.documentElement.removeChild(clone);
  5664. return scrollWidth;
  5665. }
  5666. exports.estimateScrollWidth = estimateScrollWidth;
  5667. /***/ }),
  5668. /***/ "./packages/mdc-linear-progress/component.ts":
  5669. /*!***************************************************!*\
  5670. !*** ./packages/mdc-linear-progress/component.ts ***!
  5671. \***************************************************/
  5672. /*! no static exports found */
  5673. /***/ (function(module, exports, __webpack_require__) {
  5674. "use strict";
  5675. /**
  5676. * @license
  5677. * Copyright 2017 Google Inc.
  5678. *
  5679. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5680. * of this software and associated documentation files (the "Software"), to deal
  5681. * in the Software without restriction, including without limitation the rights
  5682. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5683. * copies of the Software, and to permit persons to whom the Software is
  5684. * furnished to do so, subject to the following conditions:
  5685. *
  5686. * The above copyright notice and this permission notice shall be included in
  5687. * all copies or substantial portions of the Software.
  5688. *
  5689. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5690. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5691. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5692. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5693. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5694. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5695. * THE SOFTWARE.
  5696. */
  5697. var __extends = this && this.__extends || function () {
  5698. var _extendStatics = function extendStatics(d, b) {
  5699. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5700. d.__proto__ = b;
  5701. } || function (d, b) {
  5702. for (var p in b) {
  5703. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  5704. }
  5705. };
  5706. return _extendStatics(d, b);
  5707. };
  5708. return function (d, b) {
  5709. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  5710. _extendStatics(d, b);
  5711. function __() {
  5712. this.constructor = d;
  5713. }
  5714. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5715. };
  5716. }();
  5717. Object.defineProperty(exports, "__esModule", { value: true });
  5718. exports.MDCLinearProgress = void 0;
  5719. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  5720. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts");
  5721. /** MDC Linear Progress */
  5722. var MDCLinearProgress = /** @class */function (_super) {
  5723. __extends(MDCLinearProgress, _super);
  5724. function MDCLinearProgress() {
  5725. return _super !== null && _super.apply(this, arguments) || this;
  5726. }
  5727. MDCLinearProgress.attachTo = function (root) {
  5728. return new MDCLinearProgress(root);
  5729. };
  5730. Object.defineProperty(MDCLinearProgress.prototype, "determinate", {
  5731. set: function set(value) {
  5732. this.foundation.setDeterminate(value);
  5733. },
  5734. enumerable: false,
  5735. configurable: true
  5736. });
  5737. Object.defineProperty(MDCLinearProgress.prototype, "progress", {
  5738. set: function set(value) {
  5739. this.foundation.setProgress(value);
  5740. },
  5741. enumerable: false,
  5742. configurable: true
  5743. });
  5744. Object.defineProperty(MDCLinearProgress.prototype, "buffer", {
  5745. set: function set(value) {
  5746. this.foundation.setBuffer(value);
  5747. },
  5748. enumerable: false,
  5749. configurable: true
  5750. });
  5751. MDCLinearProgress.prototype.open = function () {
  5752. this.foundation.open();
  5753. };
  5754. MDCLinearProgress.prototype.close = function () {
  5755. this.foundation.close();
  5756. };
  5757. MDCLinearProgress.prototype.initialSyncWithDOM = function () {
  5758. var _this = this;
  5759. this.root.addEventListener('transitionend', function () {
  5760. _this.foundation.handleTransitionEnd();
  5761. });
  5762. };
  5763. MDCLinearProgress.prototype.getDefaultFoundation = function () {
  5764. var _this = this;
  5765. // DO NOT INLINE this variable. For backward compatibility, foundations take
  5766. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  5767. // methods, we need a separate, strongly typed adapter variable.
  5768. var adapter = {
  5769. addClass: function addClass(className) {
  5770. _this.root.classList.add(className);
  5771. },
  5772. forceLayout: function forceLayout() {
  5773. _this.root.getBoundingClientRect();
  5774. },
  5775. setBufferBarStyle: function setBufferBarStyle(styleProperty, value) {
  5776. var bufferBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR);
  5777. if (bufferBar) {
  5778. bufferBar.style.setProperty(styleProperty, value);
  5779. }
  5780. },
  5781. setPrimaryBarStyle: function setPrimaryBarStyle(styleProperty, value) {
  5782. var primaryBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);
  5783. if (primaryBar) {
  5784. primaryBar.style.setProperty(styleProperty, value);
  5785. }
  5786. },
  5787. hasClass: function hasClass(className) {
  5788. return _this.root.classList.contains(className);
  5789. },
  5790. removeAttribute: function removeAttribute(attributeName) {
  5791. _this.root.removeAttribute(attributeName);
  5792. },
  5793. removeClass: function removeClass(className) {
  5794. _this.root.classList.remove(className);
  5795. },
  5796. setAttribute: function setAttribute(attributeName, value) {
  5797. _this.safeSetAttribute(_this.root, attributeName, value);
  5798. },
  5799. setStyle: function setStyle(name, value) {
  5800. _this.root.style.setProperty(name, value);
  5801. },
  5802. attachResizeObserver: function attachResizeObserver(callback) {
  5803. var RO = window.ResizeObserver;
  5804. if (RO) {
  5805. var ro = new RO(callback);
  5806. ro.observe(_this.root);
  5807. return ro;
  5808. }
  5809. return null;
  5810. },
  5811. getWidth: function getWidth() {
  5812. return _this.root.offsetWidth;
  5813. }
  5814. };
  5815. return new foundation_1.MDCLinearProgressFoundation(adapter);
  5816. };
  5817. return MDCLinearProgress;
  5818. }(component_1.MDCComponent);
  5819. exports.MDCLinearProgress = MDCLinearProgress;
  5820. /***/ }),
  5821. /***/ "./packages/mdc-linear-progress/constants.ts":
  5822. /*!***************************************************!*\
  5823. !*** ./packages/mdc-linear-progress/constants.ts ***!
  5824. \***************************************************/
  5825. /*! no static exports found */
  5826. /***/ (function(module, exports, __webpack_require__) {
  5827. "use strict";
  5828. /**
  5829. * @license
  5830. * Copyright 2017 Google Inc.
  5831. *
  5832. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5833. * of this software and associated documentation files (the "Software"), to deal
  5834. * in the Software without restriction, including without limitation the rights
  5835. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5836. * copies of the Software, and to permit persons to whom the Software is
  5837. * furnished to do so, subject to the following conditions:
  5838. *
  5839. * The above copyright notice and this permission notice shall be included in
  5840. * all copies or substantial portions of the Software.
  5841. *
  5842. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5843. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5844. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5845. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5846. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5847. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5848. * THE SOFTWARE.
  5849. */
  5850. Object.defineProperty(exports, "__esModule", { value: true });
  5851. exports.animationDimensionPercentages = exports.strings = exports.cssClasses = void 0;
  5852. exports.cssClasses = {
  5853. CLOSED_CLASS: 'mdc-linear-progress--closed',
  5854. CLOSED_ANIMATION_OFF_CLASS: 'mdc-linear-progress--closed-animation-off',
  5855. INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',
  5856. REVERSED_CLASS: 'mdc-linear-progress--reversed',
  5857. ANIMATION_READY_CLASS: 'mdc-linear-progress--animation-ready'
  5858. };
  5859. exports.strings = {
  5860. ARIA_HIDDEN: 'aria-hidden',
  5861. ARIA_VALUEMAX: 'aria-valuemax',
  5862. ARIA_VALUEMIN: 'aria-valuemin',
  5863. ARIA_VALUENOW: 'aria-valuenow',
  5864. BUFFER_BAR_SELECTOR: '.mdc-linear-progress__buffer-bar',
  5865. FLEX_BASIS: 'flex-basis',
  5866. PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar'
  5867. };
  5868. // these are percentages pulled from keyframes.scss
  5869. exports.animationDimensionPercentages = {
  5870. PRIMARY_HALF: .8367142,
  5871. PRIMARY_FULL: 2.00611057,
  5872. SECONDARY_QUARTER: .37651913,
  5873. SECONDARY_HALF: .84386165,
  5874. SECONDARY_FULL: 1.60277782
  5875. };
  5876. /***/ }),
  5877. /***/ "./packages/mdc-linear-progress/foundation.ts":
  5878. /*!****************************************************!*\
  5879. !*** ./packages/mdc-linear-progress/foundation.ts ***!
  5880. \****************************************************/
  5881. /*! no static exports found */
  5882. /***/ (function(module, exports, __webpack_require__) {
  5883. "use strict";
  5884. /**
  5885. * @license
  5886. * Copyright 2017 Google Inc.
  5887. *
  5888. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5889. * of this software and associated documentation files (the "Software"), to deal
  5890. * in the Software without restriction, including without limitation the rights
  5891. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  5892. * copies of the Software, and to permit persons to whom the Software is
  5893. * furnished to do so, subject to the following conditions:
  5894. *
  5895. * The above copyright notice and this permission notice shall be included in
  5896. * all copies or substantial portions of the Software.
  5897. *
  5898. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  5899. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  5900. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5901. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  5902. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  5903. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  5904. * THE SOFTWARE.
  5905. */
  5906. var __extends = this && this.__extends || function () {
  5907. var _extendStatics = function extendStatics(d, b) {
  5908. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  5909. d.__proto__ = b;
  5910. } || function (d, b) {
  5911. for (var p in b) {
  5912. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  5913. }
  5914. };
  5915. return _extendStatics(d, b);
  5916. };
  5917. return function (d, b) {
  5918. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  5919. _extendStatics(d, b);
  5920. function __() {
  5921. this.constructor = d;
  5922. }
  5923. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5924. };
  5925. }();
  5926. var __assign = this && this.__assign || function () {
  5927. __assign = Object.assign || function (t) {
  5928. for (var s, i = 1, n = arguments.length; i < n; i++) {
  5929. s = arguments[i];
  5930. for (var p in s) {
  5931. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  5932. }
  5933. }
  5934. return t;
  5935. };
  5936. return __assign.apply(this, arguments);
  5937. };
  5938. var __values = this && this.__values || function (o) {
  5939. var s = typeof Symbol === "function" && Symbol.iterator,
  5940. m = s && o[s],
  5941. i = 0;
  5942. if (m) return m.call(o);
  5943. if (o && typeof o.length === "number") return {
  5944. next: function next() {
  5945. if (o && i >= o.length) o = void 0;
  5946. return { value: o && o[i++], done: !o };
  5947. }
  5948. };
  5949. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  5950. };
  5951. Object.defineProperty(exports, "__esModule", { value: true });
  5952. exports.MDCLinearProgressFoundation = void 0;
  5953. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  5954. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  5955. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts");
  5956. var MDCLinearProgressFoundation = /** @class */function (_super) {
  5957. __extends(MDCLinearProgressFoundation, _super);
  5958. function MDCLinearProgressFoundation(adapter) {
  5959. var _this = _super.call(this, __assign(__assign({}, MDCLinearProgressFoundation.defaultAdapter), adapter)) || this;
  5960. _this.observer = null;
  5961. return _this;
  5962. }
  5963. Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", {
  5964. get: function get() {
  5965. return constants_1.cssClasses;
  5966. },
  5967. enumerable: false,
  5968. configurable: true
  5969. });
  5970. Object.defineProperty(MDCLinearProgressFoundation, "strings", {
  5971. get: function get() {
  5972. return constants_1.strings;
  5973. },
  5974. enumerable: false,
  5975. configurable: true
  5976. });
  5977. Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", {
  5978. get: function get() {
  5979. return {
  5980. addClass: function addClass() {
  5981. return undefined;
  5982. },
  5983. attachResizeObserver: function attachResizeObserver() {
  5984. return null;
  5985. },
  5986. forceLayout: function forceLayout() {
  5987. return undefined;
  5988. },
  5989. getWidth: function getWidth() {
  5990. return 0;
  5991. },
  5992. hasClass: function hasClass() {
  5993. return false;
  5994. },
  5995. setBufferBarStyle: function setBufferBarStyle() {
  5996. return null;
  5997. },
  5998. setPrimaryBarStyle: function setPrimaryBarStyle() {
  5999. return null;
  6000. },
  6001. setStyle: function setStyle() {
  6002. return undefined;
  6003. },
  6004. removeAttribute: function removeAttribute() {
  6005. return undefined;
  6006. },
  6007. removeClass: function removeClass() {
  6008. return undefined;
  6009. },
  6010. setAttribute: function setAttribute() {
  6011. return undefined;
  6012. }
  6013. };
  6014. },
  6015. enumerable: false,
  6016. configurable: true
  6017. });
  6018. MDCLinearProgressFoundation.prototype.init = function () {
  6019. var _this = this;
  6020. this.determinate = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  6021. this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS);
  6022. this.progress = 0;
  6023. this.buffer = 1;
  6024. this.observer = this.adapter.attachResizeObserver(function (entries) {
  6025. var e_1, _a;
  6026. if (_this.determinate) {
  6027. return;
  6028. }
  6029. try {
  6030. for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
  6031. var entry = entries_1_1.value;
  6032. if (entry.contentRect) {
  6033. _this.calculateAndSetDimensions(entry.contentRect.width);
  6034. }
  6035. }
  6036. } catch (e_1_1) {
  6037. e_1 = { error: e_1_1 };
  6038. } finally {
  6039. try {
  6040. if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1);
  6041. } finally {
  6042. if (e_1) throw e_1.error;
  6043. }
  6044. }
  6045. });
  6046. if (!this.determinate && this.observer) {
  6047. this.calculateAndSetDimensions(this.adapter.getWidth());
  6048. }
  6049. };
  6050. MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) {
  6051. this.determinate = isDeterminate;
  6052. if (this.determinate) {
  6053. this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  6054. this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString());
  6055. this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMAX, '1');
  6056. this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMIN, '0');
  6057. this.setPrimaryBarProgress(this.progress);
  6058. this.setBufferBarProgress(this.buffer);
  6059. return;
  6060. }
  6061. if (this.observer) {
  6062. this.calculateAndSetDimensions(this.adapter.getWidth());
  6063. }
  6064. this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
  6065. this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW);
  6066. this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMAX);
  6067. this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMIN);
  6068. this.setPrimaryBarProgress(1);
  6069. this.setBufferBarProgress(1);
  6070. };
  6071. MDCLinearProgressFoundation.prototype.isDeterminate = function () {
  6072. return this.determinate;
  6073. };
  6074. MDCLinearProgressFoundation.prototype.setProgress = function (value) {
  6075. this.progress = value;
  6076. if (this.determinate) {
  6077. this.setPrimaryBarProgress(value);
  6078. this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, value.toString());
  6079. }
  6080. };
  6081. MDCLinearProgressFoundation.prototype.getProgress = function () {
  6082. return this.progress;
  6083. };
  6084. MDCLinearProgressFoundation.prototype.setBuffer = function (value) {
  6085. this.buffer = value;
  6086. if (this.determinate) {
  6087. this.setBufferBarProgress(value);
  6088. }
  6089. };
  6090. MDCLinearProgressFoundation.prototype.getBuffer = function () {
  6091. return this.buffer;
  6092. };
  6093. MDCLinearProgressFoundation.prototype.open = function () {
  6094. this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS);
  6095. this.adapter.removeClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS);
  6096. this.adapter.removeAttribute(constants_1.strings.ARIA_HIDDEN);
  6097. };
  6098. MDCLinearProgressFoundation.prototype.close = function () {
  6099. this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS);
  6100. this.adapter.setAttribute(constants_1.strings.ARIA_HIDDEN, 'true');
  6101. };
  6102. MDCLinearProgressFoundation.prototype.isClosed = function () {
  6103. return this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS);
  6104. };
  6105. /**
  6106. * Handles the transitionend event emitted after `close()` is called and the
  6107. * opacity fades out. This is so that animations are removed only after the
  6108. * progress indicator is completely hidden.
  6109. */
  6110. MDCLinearProgressFoundation.prototype.handleTransitionEnd = function () {
  6111. if (this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS)) {
  6112. this.adapter.addClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS);
  6113. }
  6114. };
  6115. MDCLinearProgressFoundation.prototype.destroy = function () {
  6116. _super.prototype.destroy.call(this);
  6117. if (this.observer) {
  6118. this.observer.disconnect();
  6119. }
  6120. };
  6121. MDCLinearProgressFoundation.prototype.restartAnimation = function () {
  6122. this.adapter.removeClass(constants_1.cssClasses.ANIMATION_READY_CLASS);
  6123. this.adapter.forceLayout();
  6124. this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS);
  6125. };
  6126. MDCLinearProgressFoundation.prototype.setPrimaryBarProgress = function (progressValue) {
  6127. var value = "scaleX(" + progressValue + ")";
  6128. // Accessing `window` without a `typeof` check will throw on Node
  6129. // environments.
  6130. var transformProp = typeof window !== 'undefined' ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
  6131. this.adapter.setPrimaryBarStyle(transformProp, value);
  6132. };
  6133. MDCLinearProgressFoundation.prototype.setBufferBarProgress = function (progressValue) {
  6134. var value = progressValue * 100 + "%";
  6135. this.adapter.setBufferBarStyle(constants_1.strings.FLEX_BASIS, value);
  6136. };
  6137. MDCLinearProgressFoundation.prototype.calculateAndSetDimensions = function (width) {
  6138. var primaryHalf = width * constants_1.animationDimensionPercentages.PRIMARY_HALF;
  6139. var primaryFull = width * constants_1.animationDimensionPercentages.PRIMARY_FULL;
  6140. var secondaryQuarter = width * constants_1.animationDimensionPercentages.SECONDARY_QUARTER;
  6141. var secondaryHalf = width * constants_1.animationDimensionPercentages.SECONDARY_HALF;
  6142. var secondaryFull = width * constants_1.animationDimensionPercentages.SECONDARY_FULL;
  6143. this.adapter.setStyle('--mdc-linear-progress-primary-half', primaryHalf + "px");
  6144. this.adapter.setStyle('--mdc-linear-progress-primary-half-neg', -primaryHalf + "px");
  6145. this.adapter.setStyle('--mdc-linear-progress-primary-full', primaryFull + "px");
  6146. this.adapter.setStyle('--mdc-linear-progress-primary-full-neg', -primaryFull + "px");
  6147. this.adapter.setStyle('--mdc-linear-progress-secondary-quarter', secondaryQuarter + "px");
  6148. this.adapter.setStyle('--mdc-linear-progress-secondary-quarter-neg', -secondaryQuarter + "px");
  6149. this.adapter.setStyle('--mdc-linear-progress-secondary-half', secondaryHalf + "px");
  6150. this.adapter.setStyle('--mdc-linear-progress-secondary-half-neg', -secondaryHalf + "px");
  6151. this.adapter.setStyle('--mdc-linear-progress-secondary-full', secondaryFull + "px");
  6152. this.adapter.setStyle('--mdc-linear-progress-secondary-full-neg', -secondaryFull + "px");
  6153. // need to restart animation for custom props to apply to keyframes
  6154. this.restartAnimation();
  6155. };
  6156. return MDCLinearProgressFoundation;
  6157. }(foundation_1.MDCFoundation);
  6158. exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation;
  6159. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  6160. exports.default = MDCLinearProgressFoundation;
  6161. /***/ }),
  6162. /***/ "./packages/mdc-ripple/component.ts":
  6163. /*!******************************************!*\
  6164. !*** ./packages/mdc-ripple/component.ts ***!
  6165. \******************************************/
  6166. /*! no static exports found */
  6167. /***/ (function(module, exports, __webpack_require__) {
  6168. "use strict";
  6169. /**
  6170. * @license
  6171. * Copyright 2016 Google Inc.
  6172. *
  6173. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6174. * of this software and associated documentation files (the "Software"), to deal
  6175. * in the Software without restriction, including without limitation the rights
  6176. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6177. * copies of the Software, and to permit persons to whom the Software is
  6178. * furnished to do so, subject to the following conditions:
  6179. *
  6180. * The above copyright notice and this permission notice shall be included in
  6181. * all copies or substantial portions of the Software.
  6182. *
  6183. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6184. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6185. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6186. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6187. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6188. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6189. * THE SOFTWARE.
  6190. */
  6191. var __extends = this && this.__extends || function () {
  6192. var _extendStatics = function extendStatics(d, b) {
  6193. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6194. d.__proto__ = b;
  6195. } || function (d, b) {
  6196. for (var p in b) {
  6197. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  6198. }
  6199. };
  6200. return _extendStatics(d, b);
  6201. };
  6202. return function (d, b) {
  6203. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  6204. _extendStatics(d, b);
  6205. function __() {
  6206. this.constructor = d;
  6207. }
  6208. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6209. };
  6210. }();
  6211. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  6212. if (k2 === undefined) k2 = k;
  6213. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  6214. return m[k];
  6215. } });
  6216. } : function (o, m, k, k2) {
  6217. if (k2 === undefined) k2 = k;
  6218. o[k2] = m[k];
  6219. });
  6220. var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
  6221. Object.defineProperty(o, "default", { enumerable: true, value: v });
  6222. } : function (o, v) {
  6223. o["default"] = v;
  6224. });
  6225. var __importStar = this && this.__importStar || function (mod) {
  6226. if (mod && mod.__esModule) return mod;
  6227. var result = {};
  6228. if (mod != null) for (var k in mod) {
  6229. if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  6230. }__setModuleDefault(result, mod);
  6231. return result;
  6232. };
  6233. Object.defineProperty(exports, "__esModule", { value: true });
  6234. exports.MDCRipple = void 0;
  6235. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  6236. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  6237. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  6238. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
  6239. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  6240. /** MDC Ripple */
  6241. var MDCRipple = /** @class */function (_super) {
  6242. __extends(MDCRipple, _super);
  6243. function MDCRipple() {
  6244. var _this = _super !== null && _super.apply(this, arguments) || this;
  6245. _this.disabled = false;
  6246. return _this;
  6247. }
  6248. MDCRipple.attachTo = function (root, opts) {
  6249. if (opts === void 0) {
  6250. opts = {
  6251. isUnbounded: undefined
  6252. };
  6253. }
  6254. var ripple = new MDCRipple(root);
  6255. // Only override unbounded behavior if option is explicitly specified
  6256. if (opts.isUnbounded !== undefined) {
  6257. ripple.unbounded = opts.isUnbounded;
  6258. }
  6259. return ripple;
  6260. };
  6261. MDCRipple.createAdapter = function (instance) {
  6262. return {
  6263. addClass: function addClass(className) {
  6264. instance.root.classList.add(className);
  6265. },
  6266. browserSupportsCssVars: function browserSupportsCssVars() {
  6267. return util.supportsCssVariables(window);
  6268. },
  6269. computeBoundingRect: function computeBoundingRect() {
  6270. return instance.root.getBoundingClientRect();
  6271. },
  6272. containsEventTarget: function containsEventTarget(target) {
  6273. return instance.root.contains(target);
  6274. },
  6275. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  6276. document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
  6277. },
  6278. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  6279. instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
  6280. },
  6281. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  6282. window.removeEventListener('resize', handler);
  6283. },
  6284. getWindowPageOffset: function getWindowPageOffset() {
  6285. return { x: window.pageXOffset, y: window.pageYOffset };
  6286. },
  6287. isSurfaceActive: function isSurfaceActive() {
  6288. return ponyfill_1.matches(instance.root, ':active');
  6289. },
  6290. isSurfaceDisabled: function isSurfaceDisabled() {
  6291. return Boolean(instance.disabled);
  6292. },
  6293. isUnbounded: function isUnbounded() {
  6294. return Boolean(instance.unbounded);
  6295. },
  6296. registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  6297. document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
  6298. },
  6299. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  6300. instance.root.addEventListener(evtType, handler, events_1.applyPassive());
  6301. },
  6302. registerResizeHandler: function registerResizeHandler(handler) {
  6303. window.addEventListener('resize', handler);
  6304. },
  6305. removeClass: function removeClass(className) {
  6306. instance.root.classList.remove(className);
  6307. },
  6308. updateCssVariable: function updateCssVariable(varName, value) {
  6309. instance.root.style.setProperty(varName, value);
  6310. }
  6311. };
  6312. };
  6313. Object.defineProperty(MDCRipple.prototype, "unbounded", {
  6314. get: function get() {
  6315. return Boolean(this.isUnbounded);
  6316. },
  6317. set: function set(unbounded) {
  6318. this.isUnbounded = Boolean(unbounded);
  6319. this.setUnbounded();
  6320. },
  6321. enumerable: false,
  6322. configurable: true
  6323. });
  6324. MDCRipple.prototype.activate = function () {
  6325. this.foundation.activate();
  6326. };
  6327. MDCRipple.prototype.deactivate = function () {
  6328. this.foundation.deactivate();
  6329. };
  6330. MDCRipple.prototype.layout = function () {
  6331. this.foundation.layout();
  6332. };
  6333. MDCRipple.prototype.getDefaultFoundation = function () {
  6334. return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
  6335. };
  6336. MDCRipple.prototype.initialSyncWithDOM = function () {
  6337. var root = this.root;
  6338. this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
  6339. };
  6340. /**
  6341. * Closure Compiler throws an access control error when directly accessing a
  6342. * protected or private property inside a getter/setter, like unbounded above.
  6343. * By accessing the protected property inside a method, we solve that problem.
  6344. * That's why this function exists.
  6345. */
  6346. MDCRipple.prototype.setUnbounded = function () {
  6347. this.foundation.setUnbounded(Boolean(this.isUnbounded));
  6348. };
  6349. return MDCRipple;
  6350. }(component_1.MDCComponent);
  6351. exports.MDCRipple = MDCRipple;
  6352. /***/ }),
  6353. /***/ "./packages/mdc-ripple/constants.ts":
  6354. /*!******************************************!*\
  6355. !*** ./packages/mdc-ripple/constants.ts ***!
  6356. \******************************************/
  6357. /*! no static exports found */
  6358. /***/ (function(module, exports, __webpack_require__) {
  6359. "use strict";
  6360. /**
  6361. * @license
  6362. * Copyright 2016 Google Inc.
  6363. *
  6364. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6365. * of this software and associated documentation files (the "Software"), to deal
  6366. * in the Software without restriction, including without limitation the rights
  6367. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6368. * copies of the Software, and to permit persons to whom the Software is
  6369. * furnished to do so, subject to the following conditions:
  6370. *
  6371. * The above copyright notice and this permission notice shall be included in
  6372. * all copies or substantial portions of the Software.
  6373. *
  6374. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6375. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6376. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6377. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6378. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6379. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6380. * THE SOFTWARE.
  6381. */
  6382. Object.defineProperty(exports, "__esModule", { value: true });
  6383. exports.numbers = exports.strings = exports.cssClasses = void 0;
  6384. exports.cssClasses = {
  6385. // Ripple is a special case where the "root" component is really a "mixin" of
  6386. // sorts,
  6387. // given that it's an 'upgrade' to an existing component. That being said it
  6388. // is the root
  6389. // CSS class that all other CSS classes derive from.
  6390. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  6391. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  6392. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  6393. ROOT: 'mdc-ripple-upgraded',
  6394. UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
  6395. };
  6396. exports.strings = {
  6397. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  6398. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  6399. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  6400. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  6401. VAR_LEFT: '--mdc-ripple-left',
  6402. VAR_TOP: '--mdc-ripple-top'
  6403. };
  6404. exports.numbers = {
  6405. DEACTIVATION_TIMEOUT_MS: 225,
  6406. // animation duration)
  6407. FG_DEACTIVATION_MS: 150,
  6408. // (i.e. deactivation animation duration)
  6409. INITIAL_ORIGIN_SCALE: 0.6,
  6410. PADDING: 10,
  6411. TAP_DELAY_MS: 300 };
  6412. /***/ }),
  6413. /***/ "./packages/mdc-ripple/foundation.ts":
  6414. /*!*******************************************!*\
  6415. !*** ./packages/mdc-ripple/foundation.ts ***!
  6416. \*******************************************/
  6417. /*! no static exports found */
  6418. /***/ (function(module, exports, __webpack_require__) {
  6419. "use strict";
  6420. /**
  6421. * @license
  6422. * Copyright 2016 Google Inc.
  6423. *
  6424. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6425. * of this software and associated documentation files (the "Software"), to deal
  6426. * in the Software without restriction, including without limitation the rights
  6427. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6428. * copies of the Software, and to permit persons to whom the Software is
  6429. * furnished to do so, subject to the following conditions:
  6430. *
  6431. * The above copyright notice and this permission notice shall be included in
  6432. * all copies or substantial portions of the Software.
  6433. *
  6434. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6435. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6436. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6437. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  6438. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  6439. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  6440. * THE SOFTWARE.
  6441. */
  6442. var __extends = this && this.__extends || function () {
  6443. var _extendStatics = function extendStatics(d, b) {
  6444. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  6445. d.__proto__ = b;
  6446. } || function (d, b) {
  6447. for (var p in b) {
  6448. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  6449. }
  6450. };
  6451. return _extendStatics(d, b);
  6452. };
  6453. return function (d, b) {
  6454. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  6455. _extendStatics(d, b);
  6456. function __() {
  6457. this.constructor = d;
  6458. }
  6459. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6460. };
  6461. }();
  6462. var __assign = this && this.__assign || function () {
  6463. __assign = Object.assign || function (t) {
  6464. for (var s, i = 1, n = arguments.length; i < n; i++) {
  6465. s = arguments[i];
  6466. for (var p in s) {
  6467. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  6468. }
  6469. }
  6470. return t;
  6471. };
  6472. return __assign.apply(this, arguments);
  6473. };
  6474. var __values = this && this.__values || function (o) {
  6475. var s = typeof Symbol === "function" && Symbol.iterator,
  6476. m = s && o[s],
  6477. i = 0;
  6478. if (m) return m.call(o);
  6479. if (o && typeof o.length === "number") return {
  6480. next: function next() {
  6481. if (o && i >= o.length) o = void 0;
  6482. return { value: o && o[i++], done: !o };
  6483. }
  6484. };
  6485. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  6486. };
  6487. Object.defineProperty(exports, "__esModule", { value: true });
  6488. exports.MDCRippleFoundation = void 0;
  6489. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  6490. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
  6491. var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
  6492. // Activation events registered on the root element of each instance for
  6493. // activation
  6494. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  6495. // Deactivation events registered on documentElement when a pointer-related down
  6496. // event occurs
  6497. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
  6498. // simultaneous nested activations
  6499. var activatedTargets = [];
  6500. /** MDC Ripple Foundation */
  6501. var MDCRippleFoundation = /** @class */function (_super) {
  6502. __extends(MDCRippleFoundation, _super);
  6503. function MDCRippleFoundation(adapter) {
  6504. var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
  6505. _this.activationAnimationHasEnded = false;
  6506. _this.activationTimer = 0;
  6507. _this.fgDeactivationRemovalTimer = 0;
  6508. _this.fgScale = '0';
  6509. _this.frame = { width: 0, height: 0 };
  6510. _this.initialSize = 0;
  6511. _this.layoutFrame = 0;
  6512. _this.maxRadius = 0;
  6513. _this.unboundedCoords = { left: 0, top: 0 };
  6514. _this.activationState = _this.defaultActivationState();
  6515. _this.activationTimerCallback = function () {
  6516. _this.activationAnimationHasEnded = true;
  6517. _this.runDeactivationUXLogicIfReady();
  6518. };
  6519. _this.activateHandler = function (e) {
  6520. _this.activateImpl(e);
  6521. };
  6522. _this.deactivateHandler = function () {
  6523. _this.deactivateImpl();
  6524. };
  6525. _this.focusHandler = function () {
  6526. _this.handleFocus();
  6527. };
  6528. _this.blurHandler = function () {
  6529. _this.handleBlur();
  6530. };
  6531. _this.resizeHandler = function () {
  6532. _this.layout();
  6533. };
  6534. return _this;
  6535. }
  6536. Object.defineProperty(MDCRippleFoundation, "cssClasses", {
  6537. get: function get() {
  6538. return constants_1.cssClasses;
  6539. },
  6540. enumerable: false,
  6541. configurable: true
  6542. });
  6543. Object.defineProperty(MDCRippleFoundation, "strings", {
  6544. get: function get() {
  6545. return constants_1.strings;
  6546. },
  6547. enumerable: false,
  6548. configurable: true
  6549. });
  6550. Object.defineProperty(MDCRippleFoundation, "numbers", {
  6551. get: function get() {
  6552. return constants_1.numbers;
  6553. },
  6554. enumerable: false,
  6555. configurable: true
  6556. });
  6557. Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
  6558. get: function get() {
  6559. return {
  6560. addClass: function addClass() {
  6561. return undefined;
  6562. },
  6563. browserSupportsCssVars: function browserSupportsCssVars() {
  6564. return true;
  6565. },
  6566. computeBoundingRect: function computeBoundingRect() {
  6567. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  6568. },
  6569. containsEventTarget: function containsEventTarget() {
  6570. return true;
  6571. },
  6572. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
  6573. return undefined;
  6574. },
  6575. deregisterInteractionHandler: function deregisterInteractionHandler() {
  6576. return undefined;
  6577. },
  6578. deregisterResizeHandler: function deregisterResizeHandler() {
  6579. return undefined;
  6580. },
  6581. getWindowPageOffset: function getWindowPageOffset() {
  6582. return { x: 0, y: 0 };
  6583. },
  6584. isSurfaceActive: function isSurfaceActive() {
  6585. return true;
  6586. },
  6587. isSurfaceDisabled: function isSurfaceDisabled() {
  6588. return true;
  6589. },
  6590. isUnbounded: function isUnbounded() {
  6591. return true;
  6592. },
  6593. registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
  6594. return undefined;
  6595. },
  6596. registerInteractionHandler: function registerInteractionHandler() {
  6597. return undefined;
  6598. },
  6599. registerResizeHandler: function registerResizeHandler() {
  6600. return undefined;
  6601. },
  6602. removeClass: function removeClass() {
  6603. return undefined;
  6604. },
  6605. updateCssVariable: function updateCssVariable() {
  6606. return undefined;
  6607. }
  6608. };
  6609. },
  6610. enumerable: false,
  6611. configurable: true
  6612. });
  6613. MDCRippleFoundation.prototype.init = function () {
  6614. var _this = this;
  6615. var supportsPressRipple = this.supportsPressRipple();
  6616. this.registerRootHandlers(supportsPressRipple);
  6617. if (supportsPressRipple) {
  6618. var _a = MDCRippleFoundation.cssClasses,
  6619. ROOT_1 = _a.ROOT,
  6620. UNBOUNDED_1 = _a.UNBOUNDED;
  6621. requestAnimationFrame(function () {
  6622. _this.adapter.addClass(ROOT_1);
  6623. if (_this.adapter.isUnbounded()) {
  6624. _this.adapter.addClass(UNBOUNDED_1);
  6625. // Unbounded ripples need layout logic applied immediately to set
  6626. // coordinates for both shade and ripple
  6627. _this.layoutInternal();
  6628. }
  6629. });
  6630. }
  6631. };
  6632. MDCRippleFoundation.prototype.destroy = function () {
  6633. var _this = this;
  6634. if (this.supportsPressRipple()) {
  6635. if (this.activationTimer) {
  6636. clearTimeout(this.activationTimer);
  6637. this.activationTimer = 0;
  6638. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  6639. }
  6640. if (this.fgDeactivationRemovalTimer) {
  6641. clearTimeout(this.fgDeactivationRemovalTimer);
  6642. this.fgDeactivationRemovalTimer = 0;
  6643. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  6644. }
  6645. var _a = MDCRippleFoundation.cssClasses,
  6646. ROOT_2 = _a.ROOT,
  6647. UNBOUNDED_2 = _a.UNBOUNDED;
  6648. requestAnimationFrame(function () {
  6649. _this.adapter.removeClass(ROOT_2);
  6650. _this.adapter.removeClass(UNBOUNDED_2);
  6651. _this.removeCssVars();
  6652. });
  6653. }
  6654. this.deregisterRootHandlers();
  6655. this.deregisterDeactivationHandlers();
  6656. };
  6657. /**
  6658. * @param evt Optional event containing position information.
  6659. */
  6660. MDCRippleFoundation.prototype.activate = function (evt) {
  6661. this.activateImpl(evt);
  6662. };
  6663. MDCRippleFoundation.prototype.deactivate = function () {
  6664. this.deactivateImpl();
  6665. };
  6666. MDCRippleFoundation.prototype.layout = function () {
  6667. var _this = this;
  6668. if (this.layoutFrame) {
  6669. cancelAnimationFrame(this.layoutFrame);
  6670. }
  6671. this.layoutFrame = requestAnimationFrame(function () {
  6672. _this.layoutInternal();
  6673. _this.layoutFrame = 0;
  6674. });
  6675. };
  6676. MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
  6677. var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  6678. if (unbounded) {
  6679. this.adapter.addClass(UNBOUNDED);
  6680. } else {
  6681. this.adapter.removeClass(UNBOUNDED);
  6682. }
  6683. };
  6684. MDCRippleFoundation.prototype.handleFocus = function () {
  6685. var _this = this;
  6686. requestAnimationFrame(function () {
  6687. _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  6688. });
  6689. };
  6690. MDCRippleFoundation.prototype.handleBlur = function () {
  6691. var _this = this;
  6692. requestAnimationFrame(function () {
  6693. _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  6694. });
  6695. };
  6696. /**
  6697. * We compute this property so that we are not querying information about the
  6698. * client until the point in time where the foundation requests it. This
  6699. * prevents scenarios where client-side feature-detection may happen too
  6700. * early, such as when components are rendered on the server and then
  6701. * initialized at mount time on the client.
  6702. */
  6703. MDCRippleFoundation.prototype.supportsPressRipple = function () {
  6704. return this.adapter.browserSupportsCssVars();
  6705. };
  6706. MDCRippleFoundation.prototype.defaultActivationState = function () {
  6707. return {
  6708. activationEvent: undefined,
  6709. hasDeactivationUXRun: false,
  6710. isActivated: false,
  6711. isProgrammatic: false,
  6712. wasActivatedByPointer: false,
  6713. wasElementMadeActive: false
  6714. };
  6715. };
  6716. /**
  6717. * supportsPressRipple Passed from init to save a redundant function call
  6718. */
  6719. MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
  6720. var e_1, _a;
  6721. if (supportsPressRipple) {
  6722. try {
  6723. 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()) {
  6724. var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
  6725. this.adapter.registerInteractionHandler(evtType, this.activateHandler);
  6726. }
  6727. } catch (e_1_1) {
  6728. e_1 = { error: e_1_1 };
  6729. } finally {
  6730. try {
  6731. if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
  6732. } finally {
  6733. if (e_1) throw e_1.error;
  6734. }
  6735. }
  6736. if (this.adapter.isUnbounded()) {
  6737. this.adapter.registerResizeHandler(this.resizeHandler);
  6738. }
  6739. }
  6740. this.adapter.registerInteractionHandler('focus', this.focusHandler);
  6741. this.adapter.registerInteractionHandler('blur', this.blurHandler);
  6742. };
  6743. MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
  6744. var e_2, _a;
  6745. if (evt.type === 'keydown') {
  6746. this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
  6747. } else {
  6748. try {
  6749. 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()) {
  6750. var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
  6751. this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
  6752. }
  6753. } catch (e_2_1) {
  6754. e_2 = { error: e_2_1 };
  6755. } finally {
  6756. try {
  6757. 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);
  6758. } finally {
  6759. if (e_2) throw e_2.error;
  6760. }
  6761. }
  6762. }
  6763. };
  6764. MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
  6765. var e_3, _a;
  6766. try {
  6767. 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()) {
  6768. var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
  6769. this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
  6770. }
  6771. } catch (e_3_1) {
  6772. e_3 = { error: e_3_1 };
  6773. } finally {
  6774. try {
  6775. if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
  6776. } finally {
  6777. if (e_3) throw e_3.error;
  6778. }
  6779. }
  6780. this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
  6781. this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
  6782. if (this.adapter.isUnbounded()) {
  6783. this.adapter.deregisterResizeHandler(this.resizeHandler);
  6784. }
  6785. };
  6786. MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
  6787. var e_4, _a;
  6788. this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
  6789. try {
  6790. 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()) {
  6791. var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
  6792. this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
  6793. }
  6794. } catch (e_4_1) {
  6795. e_4 = { error: e_4_1 };
  6796. } finally {
  6797. try {
  6798. 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);
  6799. } finally {
  6800. if (e_4) throw e_4.error;
  6801. }
  6802. }
  6803. };
  6804. MDCRippleFoundation.prototype.removeCssVars = function () {
  6805. var _this = this;
  6806. var rippleStrings = MDCRippleFoundation.strings;
  6807. var keys = Object.keys(rippleStrings);
  6808. keys.forEach(function (key) {
  6809. if (key.indexOf('VAR_') === 0) {
  6810. _this.adapter.updateCssVariable(rippleStrings[key], null);
  6811. }
  6812. });
  6813. };
  6814. MDCRippleFoundation.prototype.activateImpl = function (evt) {
  6815. var _this = this;
  6816. if (this.adapter.isSurfaceDisabled()) {
  6817. return;
  6818. }
  6819. var activationState = this.activationState;
  6820. if (activationState.isActivated) {
  6821. return;
  6822. }
  6823. // Avoid reacting to follow-on events fired by touch device after an
  6824. // already-processed user interaction
  6825. var previousActivationEvent = this.previousActivationEvent;
  6826. var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
  6827. if (isSameInteraction) {
  6828. return;
  6829. }
  6830. activationState.isActivated = true;
  6831. activationState.isProgrammatic = evt === undefined;
  6832. activationState.activationEvent = evt;
  6833. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
  6834. var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  6835. return _this.adapter.containsEventTarget(target);
  6836. });
  6837. if (hasActivatedChild) {
  6838. // Immediately reset activation state, while preserving logic that
  6839. // prevents touch follow-on events
  6840. this.resetActivationState();
  6841. return;
  6842. }
  6843. if (evt !== undefined) {
  6844. activatedTargets.push(evt.target);
  6845. this.registerDeactivationHandlers(evt);
  6846. }
  6847. activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
  6848. if (activationState.wasElementMadeActive) {
  6849. this.animateActivation();
  6850. }
  6851. requestAnimationFrame(function () {
  6852. // Reset array on next frame after the current event has had a chance to
  6853. // bubble to prevent ancestor ripples
  6854. activatedTargets = [];
  6855. if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
  6856. // If space was pressed, try again within an rAF call to detect :active,
  6857. // because different UAs report active states inconsistently when
  6858. // they're called within event handling code:
  6859. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  6860. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  6861. // We try first outside rAF to support Edge, which does not exhibit this
  6862. // problem, but will crash if a CSS variable is set within a rAF
  6863. // callback for a submit button interaction (#2241).
  6864. activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
  6865. if (activationState.wasElementMadeActive) {
  6866. _this.animateActivation();
  6867. }
  6868. }
  6869. if (!activationState.wasElementMadeActive) {
  6870. // Reset activation state immediately if element was not made active.
  6871. _this.activationState = _this.defaultActivationState();
  6872. }
  6873. });
  6874. };
  6875. MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
  6876. return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
  6877. };
  6878. MDCRippleFoundation.prototype.animateActivation = function () {
  6879. var _this = this;
  6880. var _a = MDCRippleFoundation.strings,
  6881. VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
  6882. VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
  6883. var _b = MDCRippleFoundation.cssClasses,
  6884. FG_DEACTIVATION = _b.FG_DEACTIVATION,
  6885. FG_ACTIVATION = _b.FG_ACTIVATION;
  6886. var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  6887. this.layoutInternal();
  6888. var translateStart = '';
  6889. var translateEnd = '';
  6890. if (!this.adapter.isUnbounded()) {
  6891. var _c = this.getFgTranslationCoordinates(),
  6892. startPoint = _c.startPoint,
  6893. endPoint = _c.endPoint;
  6894. translateStart = startPoint.x + "px, " + startPoint.y + "px";
  6895. translateEnd = endPoint.x + "px, " + endPoint.y + "px";
  6896. }
  6897. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  6898. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  6899. // Cancel any ongoing activation/deactivation animations
  6900. clearTimeout(this.activationTimer);
  6901. clearTimeout(this.fgDeactivationRemovalTimer);
  6902. this.rmBoundedActivationClasses();
  6903. this.adapter.removeClass(FG_DEACTIVATION);
  6904. // Force layout in order to re-trigger the animation.
  6905. this.adapter.computeBoundingRect();
  6906. this.adapter.addClass(FG_ACTIVATION);
  6907. this.activationTimer = setTimeout(function () {
  6908. _this.activationTimerCallback();
  6909. }, DEACTIVATION_TIMEOUT_MS);
  6910. };
  6911. MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
  6912. var _a = this.activationState,
  6913. activationEvent = _a.activationEvent,
  6914. wasActivatedByPointer = _a.wasActivatedByPointer;
  6915. var startPoint;
  6916. if (wasActivatedByPointer) {
  6917. startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
  6918. } else {
  6919. startPoint = {
  6920. x: this.frame.width / 2,
  6921. y: this.frame.height / 2
  6922. };
  6923. }
  6924. // Center the element around the start point.
  6925. startPoint = {
  6926. x: startPoint.x - this.initialSize / 2,
  6927. y: startPoint.y - this.initialSize / 2
  6928. };
  6929. var endPoint = {
  6930. x: this.frame.width / 2 - this.initialSize / 2,
  6931. y: this.frame.height / 2 - this.initialSize / 2
  6932. };
  6933. return { startPoint: startPoint, endPoint: endPoint };
  6934. };
  6935. MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
  6936. var _this = this;
  6937. // This method is called both when a pointing device is released, and when
  6938. // the activation animation ends. The deactivation animation should only run
  6939. // after both of those occur.
  6940. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  6941. var _a = this.activationState,
  6942. hasDeactivationUXRun = _a.hasDeactivationUXRun,
  6943. isActivated = _a.isActivated;
  6944. var activationHasEnded = hasDeactivationUXRun || !isActivated;
  6945. if (activationHasEnded && this.activationAnimationHasEnded) {
  6946. this.rmBoundedActivationClasses();
  6947. this.adapter.addClass(FG_DEACTIVATION);
  6948. this.fgDeactivationRemovalTimer = setTimeout(function () {
  6949. _this.adapter.removeClass(FG_DEACTIVATION);
  6950. }, constants_1.numbers.FG_DEACTIVATION_MS);
  6951. }
  6952. };
  6953. MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
  6954. var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  6955. this.adapter.removeClass(FG_ACTIVATION);
  6956. this.activationAnimationHasEnded = false;
  6957. this.adapter.computeBoundingRect();
  6958. };
  6959. MDCRippleFoundation.prototype.resetActivationState = function () {
  6960. var _this = this;
  6961. this.previousActivationEvent = this.activationState.activationEvent;
  6962. this.activationState = this.defaultActivationState();
  6963. // Touch devices may fire additional events for the same interaction within
  6964. // a short time. Store the previous event until it's safe to assume that
  6965. // subsequent events are for new interactions.
  6966. setTimeout(function () {
  6967. return _this.previousActivationEvent = undefined;
  6968. }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  6969. };
  6970. MDCRippleFoundation.prototype.deactivateImpl = function () {
  6971. var _this = this;
  6972. var activationState = this.activationState;
  6973. // This can happen in scenarios such as when you have a keyup event that
  6974. // blurs the element.
  6975. if (!activationState.isActivated) {
  6976. return;
  6977. }
  6978. var state = __assign({}, activationState);
  6979. if (activationState.isProgrammatic) {
  6980. requestAnimationFrame(function () {
  6981. _this.animateDeactivation(state);
  6982. });
  6983. this.resetActivationState();
  6984. } else {
  6985. this.deregisterDeactivationHandlers();
  6986. requestAnimationFrame(function () {
  6987. _this.activationState.hasDeactivationUXRun = true;
  6988. _this.animateDeactivation(state);
  6989. _this.resetActivationState();
  6990. });
  6991. }
  6992. };
  6993. MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
  6994. var wasActivatedByPointer = _a.wasActivatedByPointer,
  6995. wasElementMadeActive = _a.wasElementMadeActive;
  6996. if (wasActivatedByPointer || wasElementMadeActive) {
  6997. this.runDeactivationUXLogicIfReady();
  6998. }
  6999. };
  7000. MDCRippleFoundation.prototype.layoutInternal = function () {
  7001. var _this = this;
  7002. this.frame = this.adapter.computeBoundingRect();
  7003. var maxDim = Math.max(this.frame.height, this.frame.width);
  7004. // Surface diameter is treated differently for unbounded vs. bounded
  7005. // ripples. Unbounded ripple diameter is calculated smaller since the
  7006. // surface is expected to already be padded appropriately to extend the
  7007. // hitbox, and the ripple is expected to meet the edges of the padded hitbox
  7008. // (which is typically square). Bounded ripples, on the other hand, are
  7009. // fully expected to expand beyond the surface's longest diameter
  7010. // (calculated based on the diagonal plus a constant padding), and are
  7011. // clipped at the surface's border via `overflow: hidden`.
  7012. var getBoundedRadius = function getBoundedRadius() {
  7013. var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
  7014. return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  7015. };
  7016. this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
  7017. // Ripple is sized as a fraction of the largest dimension of the surface,
  7018. // then scales up using a CSS scale transform
  7019. var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  7020. // Unbounded ripple size should always be even number to equally center
  7021. // align.
  7022. if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
  7023. this.initialSize = initialSize - 1;
  7024. } else {
  7025. this.initialSize = initialSize;
  7026. }
  7027. this.fgScale = "" + this.maxRadius / this.initialSize;
  7028. this.updateLayoutCssVars();
  7029. };
  7030. MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
  7031. var _a = MDCRippleFoundation.strings,
  7032. VAR_FG_SIZE = _a.VAR_FG_SIZE,
  7033. VAR_LEFT = _a.VAR_LEFT,
  7034. VAR_TOP = _a.VAR_TOP,
  7035. VAR_FG_SCALE = _a.VAR_FG_SCALE;
  7036. this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
  7037. this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
  7038. if (this.adapter.isUnbounded()) {
  7039. this.unboundedCoords = {
  7040. left: Math.round(this.frame.width / 2 - this.initialSize / 2),
  7041. top: Math.round(this.frame.height / 2 - this.initialSize / 2)
  7042. };
  7043. this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
  7044. this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
  7045. }
  7046. };
  7047. return MDCRippleFoundation;
  7048. }(foundation_1.MDCFoundation);
  7049. exports.MDCRippleFoundation = MDCRippleFoundation;
  7050. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  7051. exports.default = MDCRippleFoundation;
  7052. /***/ }),
  7053. /***/ "./packages/mdc-ripple/util.ts":
  7054. /*!*************************************!*\
  7055. !*** ./packages/mdc-ripple/util.ts ***!
  7056. \*************************************/
  7057. /*! no static exports found */
  7058. /***/ (function(module, exports, __webpack_require__) {
  7059. "use strict";
  7060. Object.defineProperty(exports, "__esModule", { value: true });
  7061. exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
  7062. /**
  7063. * Stores result from supportsCssVariables to avoid redundant processing to
  7064. * detect CSS custom variable support.
  7065. */
  7066. var supportsCssVariables_;
  7067. function supportsCssVariables(windowObj, forceRefresh) {
  7068. if (forceRefresh === void 0) {
  7069. forceRefresh = false;
  7070. }
  7071. var CSS = windowObj.CSS;
  7072. var supportsCssVars = supportsCssVariables_;
  7073. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  7074. return supportsCssVariables_;
  7075. }
  7076. var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
  7077. if (!supportsFunctionPresent) {
  7078. return false;
  7079. }
  7080. var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
  7081. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  7082. // See: README section on Safari
  7083. var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
  7084. supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
  7085. if (!forceRefresh) {
  7086. supportsCssVariables_ = supportsCssVars;
  7087. }
  7088. return supportsCssVars;
  7089. }
  7090. exports.supportsCssVariables = supportsCssVariables;
  7091. function getNormalizedEventCoords(evt, pageOffset, clientRect) {
  7092. if (!evt) {
  7093. return { x: 0, y: 0 };
  7094. }
  7095. var x = pageOffset.x,
  7096. y = pageOffset.y;
  7097. var documentX = x + clientRect.left;
  7098. var documentY = y + clientRect.top;
  7099. var normalizedX;
  7100. var normalizedY;
  7101. // Determine touch point relative to the ripple container.
  7102. if (evt.type === 'touchstart') {
  7103. var touchEvent = evt;
  7104. normalizedX = touchEvent.changedTouches[0].pageX - documentX;
  7105. normalizedY = touchEvent.changedTouches[0].pageY - documentY;
  7106. } else {
  7107. var mouseEvent = evt;
  7108. normalizedX = mouseEvent.pageX - documentX;
  7109. normalizedY = mouseEvent.pageY - documentY;
  7110. }
  7111. return { x: normalizedX, y: normalizedY };
  7112. }
  7113. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  7114. /***/ })
  7115. /******/ });
  7116. });
  7117. //# sourceMappingURL=mdc.dataTable.js.map