mdc.checkbox.js 240 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905
  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/checkbox", [], factory);
  13. else if(typeof exports === 'object')
  14. exports["checkbox"] = factory();
  15. else
  16. root["mdc"] = root["mdc"] || {}, root["mdc"]["checkbox"] = 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-checkbox/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/adapter.ts":
  3775. /*!******************************************!*\
  3776. !*** ./packages/mdc-checkbox/adapter.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. Object.defineProperty(exports, "__esModule", { value: true });
  3804. /***/ }),
  3805. /***/ "./packages/mdc-checkbox/component.ts":
  3806. /*!********************************************!*\
  3807. !*** ./packages/mdc-checkbox/component.ts ***!
  3808. \********************************************/
  3809. /*! no static exports found */
  3810. /***/ (function(module, exports, __webpack_require__) {
  3811. "use strict";
  3812. /**
  3813. * @license
  3814. * Copyright 2016 Google Inc.
  3815. *
  3816. * Permission is hereby granted, free of charge, to any person obtaining a copy
  3817. * of this software and associated documentation files (the "Software"), to deal
  3818. * in the Software without restriction, including without limitation the rights
  3819. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3820. * copies of the Software, and to permit persons to whom the Software is
  3821. * furnished to do so, subject to the following conditions:
  3822. *
  3823. * The above copyright notice and this permission notice shall be included in
  3824. * all copies or substantial portions of the Software.
  3825. *
  3826. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3827. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3828. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3829. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3830. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3831. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  3832. * THE SOFTWARE.
  3833. */
  3834. 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; };
  3835. var __extends = this && this.__extends || function () {
  3836. var _extendStatics = function extendStatics(d, b) {
  3837. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  3838. d.__proto__ = b;
  3839. } || function (d, b) {
  3840. for (var p in b) {
  3841. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  3842. }
  3843. };
  3844. return _extendStatics(d, b);
  3845. };
  3846. return function (d, b) {
  3847. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  3848. _extendStatics(d, b);
  3849. function __() {
  3850. this.constructor = d;
  3851. }
  3852. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3853. };
  3854. }();
  3855. var __assign = this && this.__assign || function () {
  3856. __assign = Object.assign || function (t) {
  3857. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3858. s = arguments[i];
  3859. for (var p in s) {
  3860. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  3861. }
  3862. }
  3863. return t;
  3864. };
  3865. return __assign.apply(this, arguments);
  3866. };
  3867. var __values = this && this.__values || function (o) {
  3868. var s = typeof Symbol === "function" && Symbol.iterator,
  3869. m = s && o[s],
  3870. i = 0;
  3871. if (m) return m.call(o);
  3872. if (o && typeof o.length === "number") return {
  3873. next: function next() {
  3874. if (o && i >= o.length) o = void 0;
  3875. return { value: o && o[i++], done: !o };
  3876. }
  3877. };
  3878. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  3879. };
  3880. Object.defineProperty(exports, "__esModule", { value: true });
  3881. exports.MDCCheckbox = void 0;
  3882. var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts");
  3883. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  3884. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  3885. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  3886. var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
  3887. var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
  3888. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  3889. var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts");
  3890. var CB_PROTO_PROPS = ['checked', 'indeterminate'];
  3891. /** MDC Checkbox */
  3892. var MDCCheckbox = /** @class */function (_super) {
  3893. __extends(MDCCheckbox, _super);
  3894. function MDCCheckbox() {
  3895. var _this = _super !== null && _super.apply(this, arguments) || this;
  3896. _this.rippleSurface = _this.createRipple();
  3897. return _this;
  3898. }
  3899. MDCCheckbox.attachTo = function (root) {
  3900. return new MDCCheckbox(root);
  3901. };
  3902. Object.defineProperty(MDCCheckbox.prototype, "ripple", {
  3903. get: function get() {
  3904. return this.rippleSurface;
  3905. },
  3906. enumerable: false,
  3907. configurable: true
  3908. });
  3909. Object.defineProperty(MDCCheckbox.prototype, "checked", {
  3910. get: function get() {
  3911. return this.getNativeControl().checked;
  3912. },
  3913. set: function set(checked) {
  3914. this.getNativeControl().checked = checked;
  3915. },
  3916. enumerable: false,
  3917. configurable: true
  3918. });
  3919. Object.defineProperty(MDCCheckbox.prototype, "indeterminate", {
  3920. get: function get() {
  3921. return this.getNativeControl().indeterminate;
  3922. },
  3923. set: function set(indeterminate) {
  3924. this.getNativeControl().indeterminate = indeterminate;
  3925. },
  3926. enumerable: false,
  3927. configurable: true
  3928. });
  3929. Object.defineProperty(MDCCheckbox.prototype, "disabled", {
  3930. get: function get() {
  3931. return this.getNativeControl().disabled;
  3932. },
  3933. set: function set(disabled) {
  3934. this.foundation.setDisabled(disabled);
  3935. },
  3936. enumerable: false,
  3937. configurable: true
  3938. });
  3939. Object.defineProperty(MDCCheckbox.prototype, "value", {
  3940. get: function get() {
  3941. return this.getNativeControl().value;
  3942. },
  3943. set: function set(value) {
  3944. this.getNativeControl().value = value;
  3945. },
  3946. enumerable: false,
  3947. configurable: true
  3948. });
  3949. MDCCheckbox.prototype.initialize = function () {
  3950. var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR;
  3951. this.getNativeControl().indeterminate = this.getNativeControl().getAttribute(DATA_INDETERMINATE_ATTR) === 'true';
  3952. this.getNativeControl().removeAttribute(DATA_INDETERMINATE_ATTR);
  3953. };
  3954. MDCCheckbox.prototype.initialSyncWithDOM = function () {
  3955. var _this = this;
  3956. this.handleChange = function () {
  3957. _this.foundation.handleChange();
  3958. };
  3959. this.handleAnimationEnd = function () {
  3960. _this.foundation.handleAnimationEnd();
  3961. };
  3962. this.getNativeControl().addEventListener('change', this.handleChange);
  3963. this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
  3964. this.installPropertyChangeHooks();
  3965. };
  3966. MDCCheckbox.prototype.destroy = function () {
  3967. this.rippleSurface.destroy();
  3968. this.getNativeControl().removeEventListener('change', this.handleChange);
  3969. this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
  3970. this.uninstallPropertyChangeHooks();
  3971. _super.prototype.destroy.call(this);
  3972. };
  3973. MDCCheckbox.prototype.getDefaultFoundation = function () {
  3974. var _this = this;
  3975. // DO NOT INLINE this variable. For backward compatibility, foundations take
  3976. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  3977. // methods, we need a separate, strongly typed adapter variable.
  3978. var adapter = {
  3979. addClass: function addClass(className) {
  3980. _this.root.classList.add(className);
  3981. },
  3982. forceLayout: function forceLayout() {
  3983. return _this.root.offsetWidth;
  3984. },
  3985. hasNativeControl: function hasNativeControl() {
  3986. return !!_this.getNativeControl();
  3987. },
  3988. isAttachedToDOM: function isAttachedToDOM() {
  3989. return Boolean(_this.root.parentNode);
  3990. },
  3991. isChecked: function isChecked() {
  3992. return _this.checked;
  3993. },
  3994. isIndeterminate: function isIndeterminate() {
  3995. return _this.indeterminate;
  3996. },
  3997. removeClass: function removeClass(className) {
  3998. _this.root.classList.remove(className);
  3999. },
  4000. removeNativeControlAttr: function removeNativeControlAttr(attr) {
  4001. _this.getNativeControl().removeAttribute(attr);
  4002. },
  4003. setNativeControlAttr: function setNativeControlAttr(attr, value) {
  4004. _this.safeSetAttribute(_this.getNativeControl(), attr, value);
  4005. },
  4006. setNativeControlDisabled: function setNativeControlDisabled(disabled) {
  4007. _this.getNativeControl().disabled = disabled;
  4008. }
  4009. };
  4010. return new foundation_2.MDCCheckboxFoundation(adapter);
  4011. };
  4012. MDCCheckbox.prototype.createRipple = function () {
  4013. var _this = this;
  4014. // DO NOT INLINE this variable. For backward compatibility, foundations take
  4015. // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any
  4016. // methods, we need a separate, strongly typed adapter variable.
  4017. var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  4018. _this.getNativeControl().removeEventListener(evtType, handler, events_1.applyPassive());
  4019. }, isSurfaceActive: function isSurfaceActive() {
  4020. return ponyfill_1.matches(_this.getNativeControl(), ':active');
  4021. }, isUnbounded: function isUnbounded() {
  4022. return true;
  4023. }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  4024. _this.getNativeControl().addEventListener(evtType, handler, events_1.applyPassive());
  4025. } });
  4026. return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
  4027. };
  4028. MDCCheckbox.prototype.installPropertyChangeHooks = function () {
  4029. var e_1, _a;
  4030. var _this = this;
  4031. var nativeCb = this.getNativeControl();
  4032. var cbProto = Object.getPrototypeOf(nativeCb);
  4033. var _loop_1 = function _loop_1(controlState) {
  4034. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  4035. // We have to check for this descriptor, since some browsers (Safari)
  4036. // don't support its return. See:
  4037. // https://bugs.webkit.org/show_bug.cgi?id=49739
  4038. if (!validDescriptor(desc)) {
  4039. return { value: void 0 };
  4040. }
  4041. var nativeGetter = desc.get;
  4042. var nativeCbDesc = {
  4043. configurable: desc.configurable,
  4044. enumerable: desc.enumerable,
  4045. get: nativeGetter,
  4046. set: function set(state) {
  4047. desc.set.call(nativeCb, state);
  4048. _this.foundation.handleChange();
  4049. }
  4050. };
  4051. Object.defineProperty(nativeCb, controlState, nativeCbDesc);
  4052. };
  4053. try {
  4054. 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()) {
  4055. var controlState = CB_PROTO_PROPS_1_1.value;
  4056. var state_1 = _loop_1(controlState);
  4057. if ((typeof state_1 === "undefined" ? "undefined" : _typeof(state_1)) === "object") return state_1.value;
  4058. }
  4059. } catch (e_1_1) {
  4060. e_1 = { error: e_1_1 };
  4061. } finally {
  4062. try {
  4063. if (CB_PROTO_PROPS_1_1 && !CB_PROTO_PROPS_1_1.done && (_a = CB_PROTO_PROPS_1.return)) _a.call(CB_PROTO_PROPS_1);
  4064. } finally {
  4065. if (e_1) throw e_1.error;
  4066. }
  4067. }
  4068. };
  4069. MDCCheckbox.prototype.uninstallPropertyChangeHooks = function () {
  4070. var e_2, _a;
  4071. var nativeCb = this.getNativeControl();
  4072. var cbProto = Object.getPrototypeOf(nativeCb);
  4073. try {
  4074. 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()) {
  4075. var controlState = CB_PROTO_PROPS_2_1.value;
  4076. var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
  4077. if (!validDescriptor(desc)) {
  4078. return;
  4079. }
  4080. Object.defineProperty(nativeCb, controlState, desc);
  4081. }
  4082. } catch (e_2_1) {
  4083. e_2 = { error: e_2_1 };
  4084. } finally {
  4085. try {
  4086. if (CB_PROTO_PROPS_2_1 && !CB_PROTO_PROPS_2_1.done && (_a = CB_PROTO_PROPS_2.return)) _a.call(CB_PROTO_PROPS_2);
  4087. } finally {
  4088. if (e_2) throw e_2.error;
  4089. }
  4090. }
  4091. };
  4092. MDCCheckbox.prototype.getNativeControl = function () {
  4093. var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR;
  4094. var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);
  4095. if (!el) {
  4096. throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element");
  4097. }
  4098. return el;
  4099. };
  4100. return MDCCheckbox;
  4101. }(component_1.MDCComponent);
  4102. exports.MDCCheckbox = MDCCheckbox;
  4103. function validDescriptor(inputPropDesc) {
  4104. return !!inputPropDesc && typeof inputPropDesc.set === 'function';
  4105. }
  4106. /***/ }),
  4107. /***/ "./packages/mdc-checkbox/constants.ts":
  4108. /*!********************************************!*\
  4109. !*** ./packages/mdc-checkbox/constants.ts ***!
  4110. \********************************************/
  4111. /*! no static exports found */
  4112. /***/ (function(module, exports, __webpack_require__) {
  4113. "use strict";
  4114. /**
  4115. * @license
  4116. * Copyright 2016 Google Inc.
  4117. *
  4118. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4119. * of this software and associated documentation files (the "Software"), to deal
  4120. * in the Software without restriction, including without limitation the rights
  4121. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4122. * copies of the Software, and to permit persons to whom the Software is
  4123. * furnished to do so, subject to the following conditions:
  4124. *
  4125. * The above copyright notice and this permission notice shall be included in
  4126. * all copies or substantial portions of the Software.
  4127. *
  4128. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4129. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4130. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4131. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4132. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4133. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4134. * THE SOFTWARE.
  4135. */
  4136. Object.defineProperty(exports, "__esModule", { value: true });
  4137. exports.numbers = exports.strings = exports.cssClasses = void 0;
  4138. exports.cssClasses = {
  4139. ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',
  4140. ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',
  4141. ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',
  4142. ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',
  4143. ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',
  4144. ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',
  4145. BACKGROUND: 'mdc-checkbox__background',
  4146. CHECKED: 'mdc-checkbox--checked',
  4147. CHECKMARK: 'mdc-checkbox__checkmark',
  4148. CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',
  4149. DISABLED: 'mdc-checkbox--disabled',
  4150. INDETERMINATE: 'mdc-checkbox--indeterminate',
  4151. MIXEDMARK: 'mdc-checkbox__mixedmark',
  4152. NATIVE_CONTROL: 'mdc-checkbox__native-control',
  4153. ROOT: 'mdc-checkbox',
  4154. SELECTED: 'mdc-checkbox--selected',
  4155. UPGRADED: 'mdc-checkbox--upgraded'
  4156. };
  4157. exports.strings = {
  4158. ARIA_CHECKED_ATTR: 'aria-checked',
  4159. ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',
  4160. DATA_INDETERMINATE_ATTR: 'data-indeterminate',
  4161. NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',
  4162. TRANSITION_STATE_CHECKED: 'checked',
  4163. TRANSITION_STATE_INDETERMINATE: 'indeterminate',
  4164. TRANSITION_STATE_INIT: 'init',
  4165. TRANSITION_STATE_UNCHECKED: 'unchecked'
  4166. };
  4167. exports.numbers = {
  4168. ANIM_END_LATCH_MS: 250
  4169. };
  4170. /***/ }),
  4171. /***/ "./packages/mdc-checkbox/foundation.ts":
  4172. /*!*********************************************!*\
  4173. !*** ./packages/mdc-checkbox/foundation.ts ***!
  4174. \*********************************************/
  4175. /*! no static exports found */
  4176. /***/ (function(module, exports, __webpack_require__) {
  4177. "use strict";
  4178. /**
  4179. * @license
  4180. * Copyright 2016 Google Inc.
  4181. *
  4182. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4183. * of this software and associated documentation files (the "Software"), to deal
  4184. * in the Software without restriction, including without limitation the rights
  4185. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4186. * copies of the Software, and to permit persons to whom the Software is
  4187. * furnished to do so, subject to the following conditions:
  4188. *
  4189. * The above copyright notice and this permission notice shall be included in
  4190. * all copies or substantial portions of the Software.
  4191. *
  4192. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4193. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4194. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4195. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4196. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4197. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4198. * THE SOFTWARE.
  4199. */
  4200. var __extends = this && this.__extends || function () {
  4201. var _extendStatics = function extendStatics(d, b) {
  4202. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4203. d.__proto__ = b;
  4204. } || function (d, b) {
  4205. for (var p in b) {
  4206. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4207. }
  4208. };
  4209. return _extendStatics(d, b);
  4210. };
  4211. return function (d, b) {
  4212. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4213. _extendStatics(d, b);
  4214. function __() {
  4215. this.constructor = d;
  4216. }
  4217. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4218. };
  4219. }();
  4220. var __assign = this && this.__assign || function () {
  4221. __assign = Object.assign || function (t) {
  4222. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4223. s = arguments[i];
  4224. for (var p in s) {
  4225. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4226. }
  4227. }
  4228. return t;
  4229. };
  4230. return __assign.apply(this, arguments);
  4231. };
  4232. Object.defineProperty(exports, "__esModule", { value: true });
  4233. exports.MDCCheckboxFoundation = void 0;
  4234. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4235. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts");
  4236. /** MDC Checkbox Foundation */
  4237. var MDCCheckboxFoundation = /** @class */function (_super) {
  4238. __extends(MDCCheckboxFoundation, _super);
  4239. function MDCCheckboxFoundation(adapter) {
  4240. var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this;
  4241. _this.currentCheckState = constants_1.strings.TRANSITION_STATE_INIT;
  4242. _this.currentAnimationClass = '';
  4243. _this.animEndLatchTimer = 0;
  4244. _this.enableAnimationEndHandler = false;
  4245. return _this;
  4246. }
  4247. Object.defineProperty(MDCCheckboxFoundation, "cssClasses", {
  4248. get: function get() {
  4249. return constants_1.cssClasses;
  4250. },
  4251. enumerable: false,
  4252. configurable: true
  4253. });
  4254. Object.defineProperty(MDCCheckboxFoundation, "strings", {
  4255. get: function get() {
  4256. return constants_1.strings;
  4257. },
  4258. enumerable: false,
  4259. configurable: true
  4260. });
  4261. Object.defineProperty(MDCCheckboxFoundation, "numbers", {
  4262. get: function get() {
  4263. return constants_1.numbers;
  4264. },
  4265. enumerable: false,
  4266. configurable: true
  4267. });
  4268. Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", {
  4269. get: function get() {
  4270. return {
  4271. addClass: function addClass() {
  4272. return undefined;
  4273. },
  4274. forceLayout: function forceLayout() {
  4275. return undefined;
  4276. },
  4277. hasNativeControl: function hasNativeControl() {
  4278. return false;
  4279. },
  4280. isAttachedToDOM: function isAttachedToDOM() {
  4281. return false;
  4282. },
  4283. isChecked: function isChecked() {
  4284. return false;
  4285. },
  4286. isIndeterminate: function isIndeterminate() {
  4287. return false;
  4288. },
  4289. removeClass: function removeClass() {
  4290. return undefined;
  4291. },
  4292. removeNativeControlAttr: function removeNativeControlAttr() {
  4293. return undefined;
  4294. },
  4295. setNativeControlAttr: function setNativeControlAttr() {
  4296. return undefined;
  4297. },
  4298. setNativeControlDisabled: function setNativeControlDisabled() {
  4299. return undefined;
  4300. }
  4301. };
  4302. },
  4303. enumerable: false,
  4304. configurable: true
  4305. });
  4306. MDCCheckboxFoundation.prototype.init = function () {
  4307. this.currentCheckState = this.determineCheckState();
  4308. this.updateAriaChecked();
  4309. this.adapter.addClass(constants_1.cssClasses.UPGRADED);
  4310. };
  4311. MDCCheckboxFoundation.prototype.destroy = function () {
  4312. clearTimeout(this.animEndLatchTimer);
  4313. };
  4314. MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {
  4315. this.adapter.setNativeControlDisabled(disabled);
  4316. if (disabled) {
  4317. this.adapter.addClass(constants_1.cssClasses.DISABLED);
  4318. } else {
  4319. this.adapter.removeClass(constants_1.cssClasses.DISABLED);
  4320. }
  4321. };
  4322. /**
  4323. * Handles the animationend event for the checkbox
  4324. */
  4325. MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {
  4326. var _this = this;
  4327. if (!this.enableAnimationEndHandler) {
  4328. return;
  4329. }
  4330. clearTimeout(this.animEndLatchTimer);
  4331. this.animEndLatchTimer = setTimeout(function () {
  4332. _this.adapter.removeClass(_this.currentAnimationClass);
  4333. _this.enableAnimationEndHandler = false;
  4334. }, constants_1.numbers.ANIM_END_LATCH_MS);
  4335. };
  4336. /**
  4337. * Handles the change event for the checkbox
  4338. */
  4339. MDCCheckboxFoundation.prototype.handleChange = function () {
  4340. this.transitionCheckState();
  4341. };
  4342. MDCCheckboxFoundation.prototype.transitionCheckState = function () {
  4343. if (!this.adapter.hasNativeControl()) {
  4344. return;
  4345. }
  4346. var oldState = this.currentCheckState;
  4347. var newState = this.determineCheckState();
  4348. if (oldState === newState) {
  4349. return;
  4350. }
  4351. this.updateAriaChecked();
  4352. var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  4353. var SELECTED = constants_1.cssClasses.SELECTED;
  4354. if (newState === TRANSITION_STATE_UNCHECKED) {
  4355. this.adapter.removeClass(SELECTED);
  4356. } else {
  4357. this.adapter.addClass(SELECTED);
  4358. }
  4359. // Check to ensure that there isn't a previously existing animation class,
  4360. // in case for example the user interacted with the checkbox before the
  4361. // animation was finished.
  4362. if (this.currentAnimationClass.length > 0) {
  4363. clearTimeout(this.animEndLatchTimer);
  4364. this.adapter.forceLayout();
  4365. this.adapter.removeClass(this.currentAnimationClass);
  4366. }
  4367. this.currentAnimationClass = this.getTransitionAnimationClass(oldState, newState);
  4368. this.currentCheckState = newState;
  4369. // Check for parentNode so that animations are only run when the element is
  4370. // attached to the DOM.
  4371. if (this.adapter.isAttachedToDOM() && this.currentAnimationClass.length > 0) {
  4372. this.adapter.addClass(this.currentAnimationClass);
  4373. this.enableAnimationEndHandler = true;
  4374. }
  4375. };
  4376. MDCCheckboxFoundation.prototype.determineCheckState = function () {
  4377. var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE,
  4378. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  4379. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  4380. if (this.adapter.isIndeterminate()) {
  4381. return TRANSITION_STATE_INDETERMINATE;
  4382. }
  4383. return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED;
  4384. };
  4385. MDCCheckboxFoundation.prototype.getTransitionAnimationClass = function (oldState, newState) {
  4386. var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT,
  4387. TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
  4388. TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
  4389. var _a = MDCCheckboxFoundation.cssClasses,
  4390. ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED,
  4391. ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE,
  4392. ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED,
  4393. ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE,
  4394. ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED,
  4395. ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;
  4396. switch (oldState) {
  4397. case TRANSITION_STATE_INIT:
  4398. if (newState === TRANSITION_STATE_UNCHECKED) {
  4399. return '';
  4400. }
  4401. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  4402. case TRANSITION_STATE_UNCHECKED:
  4403. return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;
  4404. case TRANSITION_STATE_CHECKED:
  4405. return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;
  4406. default:
  4407. // TRANSITION_STATE_INDETERMINATE
  4408. return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
  4409. }
  4410. };
  4411. MDCCheckboxFoundation.prototype.updateAriaChecked = function () {
  4412. // Ensure aria-checked is set to mixed if checkbox is in indeterminate
  4413. // state.
  4414. if (this.adapter.isIndeterminate()) {
  4415. this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE);
  4416. } else {
  4417. // The on/off state does not need to keep track of aria-checked, since
  4418. // the screenreader uses the checked property on the checkbox element.
  4419. this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR);
  4420. }
  4421. };
  4422. return MDCCheckboxFoundation;
  4423. }(foundation_1.MDCFoundation);
  4424. exports.MDCCheckboxFoundation = MDCCheckboxFoundation;
  4425. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  4426. exports.default = MDCCheckboxFoundation;
  4427. /***/ }),
  4428. /***/ "./packages/mdc-checkbox/index.ts":
  4429. /*!****************************************!*\
  4430. !*** ./packages/mdc-checkbox/index.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 __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  4458. if (k2 === undefined) k2 = k;
  4459. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  4460. return m[k];
  4461. } });
  4462. } : function (o, m, k, k2) {
  4463. if (k2 === undefined) k2 = k;
  4464. o[k2] = m[k];
  4465. });
  4466. var __exportStar = this && this.__exportStar || function (m, exports) {
  4467. for (var p in m) {
  4468. if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  4469. }
  4470. };
  4471. Object.defineProperty(exports, "__esModule", { value: true });
  4472. __exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-checkbox/adapter.ts"), exports);
  4473. __exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-checkbox/component.ts"), exports);
  4474. __exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"), exports);
  4475. __exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"), exports);
  4476. /***/ }),
  4477. /***/ "./packages/mdc-dom/events.ts":
  4478. /*!************************************!*\
  4479. !*** ./packages/mdc-dom/events.ts ***!
  4480. \************************************/
  4481. /*! no static exports found */
  4482. /***/ (function(module, exports, __webpack_require__) {
  4483. "use strict";
  4484. /**
  4485. * @license
  4486. * Copyright 2019 Google Inc.
  4487. *
  4488. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4489. * of this software and associated documentation files (the "Software"), to deal
  4490. * in the Software without restriction, including without limitation the rights
  4491. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4492. * copies of the Software, and to permit persons to whom the Software is
  4493. * furnished to do so, subject to the following conditions:
  4494. *
  4495. * The above copyright notice and this permission notice shall be included in
  4496. * all copies or substantial portions of the Software.
  4497. *
  4498. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4499. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4500. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4501. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4502. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4503. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4504. * THE SOFTWARE.
  4505. */
  4506. Object.defineProperty(exports, "__esModule", { value: true });
  4507. exports.applyPassive = void 0;
  4508. /**
  4509. * Determine whether the current browser supports passive event listeners, and
  4510. * if so, use them.
  4511. */
  4512. function applyPassive(globalObj) {
  4513. if (globalObj === void 0) {
  4514. globalObj = window;
  4515. }
  4516. return supportsPassiveOption(globalObj) ? { passive: true } : false;
  4517. }
  4518. exports.applyPassive = applyPassive;
  4519. function supportsPassiveOption(globalObj) {
  4520. if (globalObj === void 0) {
  4521. globalObj = window;
  4522. }
  4523. // See
  4524. // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  4525. var passiveSupported = false;
  4526. try {
  4527. var options = {
  4528. // This function will be called when the browser
  4529. // attempts to access the passive property.
  4530. get passive() {
  4531. passiveSupported = true;
  4532. return false;
  4533. }
  4534. };
  4535. var handler = function handler() {};
  4536. globalObj.document.addEventListener('test', handler, options);
  4537. globalObj.document.removeEventListener('test', handler, options);
  4538. } catch (err) {
  4539. passiveSupported = false;
  4540. }
  4541. return passiveSupported;
  4542. }
  4543. /***/ }),
  4544. /***/ "./packages/mdc-dom/ponyfill.ts":
  4545. /*!**************************************!*\
  4546. !*** ./packages/mdc-dom/ponyfill.ts ***!
  4547. \**************************************/
  4548. /*! no static exports found */
  4549. /***/ (function(module, exports, __webpack_require__) {
  4550. "use strict";
  4551. /**
  4552. * @license
  4553. * Copyright 2018 Google Inc.
  4554. *
  4555. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4556. * of this software and associated documentation files (the "Software"), to deal
  4557. * in the Software without restriction, including without limitation the rights
  4558. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4559. * copies of the Software, and to permit persons to whom the Software is
  4560. * furnished to do so, subject to the following conditions:
  4561. *
  4562. * The above copyright notice and this permission notice shall be included in
  4563. * all copies or substantial portions of the Software.
  4564. *
  4565. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4566. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4567. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4568. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4569. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4570. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4571. * THE SOFTWARE.
  4572. */
  4573. Object.defineProperty(exports, "__esModule", { value: true });
  4574. exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
  4575. /**
  4576. * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global
  4577. * prototype chain. This makes ponyfills safer than traditional polyfills,
  4578. * especially for libraries like MDC.
  4579. */
  4580. function closest(element, selector) {
  4581. if (element.closest) {
  4582. return element.closest(selector);
  4583. }
  4584. var el = element;
  4585. while (el) {
  4586. if (matches(el, selector)) {
  4587. return el;
  4588. }
  4589. el = el.parentElement;
  4590. }
  4591. return null;
  4592. }
  4593. exports.closest = closest;
  4594. /** Element.matches with support for webkit and IE. */
  4595. function matches(element, selector) {
  4596. var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
  4597. return nativeMatches.call(element, selector);
  4598. }
  4599. exports.matches = matches;
  4600. /**
  4601. * Used to compute the estimated scroll width of elements. When an element is
  4602. * hidden due to display: none; being applied to a parent element, the width is
  4603. * returned as 0. However, the element will have a true width once no longer
  4604. * inside a display: none context. This method computes an estimated width when
  4605. * the element is hidden or returns the true width when the element is visble.
  4606. * @param {Element} element the element whose width to estimate
  4607. */
  4608. function estimateScrollWidth(element) {
  4609. // Check the offsetParent. If the element inherits display: none from any
  4610. // parent, the offsetParent property will be null (see
  4611. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
  4612. // This check ensures we only clone the node when necessary.
  4613. var htmlEl = element;
  4614. if (htmlEl.offsetParent !== null) {
  4615. return htmlEl.scrollWidth;
  4616. }
  4617. var clone = htmlEl.cloneNode(true);
  4618. clone.style.setProperty('position', 'absolute');
  4619. clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
  4620. document.documentElement.appendChild(clone);
  4621. var scrollWidth = clone.scrollWidth;
  4622. document.documentElement.removeChild(clone);
  4623. return scrollWidth;
  4624. }
  4625. exports.estimateScrollWidth = estimateScrollWidth;
  4626. /***/ }),
  4627. /***/ "./packages/mdc-ripple/component.ts":
  4628. /*!******************************************!*\
  4629. !*** ./packages/mdc-ripple/component.ts ***!
  4630. \******************************************/
  4631. /*! no static exports found */
  4632. /***/ (function(module, exports, __webpack_require__) {
  4633. "use strict";
  4634. /**
  4635. * @license
  4636. * Copyright 2016 Google Inc.
  4637. *
  4638. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4639. * of this software and associated documentation files (the "Software"), to deal
  4640. * in the Software without restriction, including without limitation the rights
  4641. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4642. * copies of the Software, and to permit persons to whom the Software is
  4643. * furnished to do so, subject to the following conditions:
  4644. *
  4645. * The above copyright notice and this permission notice shall be included in
  4646. * all copies or substantial portions of the Software.
  4647. *
  4648. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4649. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4650. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4651. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4652. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4653. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4654. * THE SOFTWARE.
  4655. */
  4656. var __extends = this && this.__extends || function () {
  4657. var _extendStatics = function extendStatics(d, b) {
  4658. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4659. d.__proto__ = b;
  4660. } || function (d, b) {
  4661. for (var p in b) {
  4662. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4663. }
  4664. };
  4665. return _extendStatics(d, b);
  4666. };
  4667. return function (d, b) {
  4668. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4669. _extendStatics(d, b);
  4670. function __() {
  4671. this.constructor = d;
  4672. }
  4673. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4674. };
  4675. }();
  4676. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  4677. if (k2 === undefined) k2 = k;
  4678. Object.defineProperty(o, k2, { enumerable: true, get: function get() {
  4679. return m[k];
  4680. } });
  4681. } : function (o, m, k, k2) {
  4682. if (k2 === undefined) k2 = k;
  4683. o[k2] = m[k];
  4684. });
  4685. var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
  4686. Object.defineProperty(o, "default", { enumerable: true, value: v });
  4687. } : function (o, v) {
  4688. o["default"] = v;
  4689. });
  4690. var __importStar = this && this.__importStar || function (mod) {
  4691. if (mod && mod.__esModule) return mod;
  4692. var result = {};
  4693. if (mod != null) for (var k in mod) {
  4694. if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  4695. }__setModuleDefault(result, mod);
  4696. return result;
  4697. };
  4698. Object.defineProperty(exports, "__esModule", { value: true });
  4699. exports.MDCRipple = void 0;
  4700. var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
  4701. var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
  4702. var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
  4703. var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
  4704. var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
  4705. /** MDC Ripple */
  4706. var MDCRipple = /** @class */function (_super) {
  4707. __extends(MDCRipple, _super);
  4708. function MDCRipple() {
  4709. var _this = _super !== null && _super.apply(this, arguments) || this;
  4710. _this.disabled = false;
  4711. return _this;
  4712. }
  4713. MDCRipple.attachTo = function (root, opts) {
  4714. if (opts === void 0) {
  4715. opts = {
  4716. isUnbounded: undefined
  4717. };
  4718. }
  4719. var ripple = new MDCRipple(root);
  4720. // Only override unbounded behavior if option is explicitly specified
  4721. if (opts.isUnbounded !== undefined) {
  4722. ripple.unbounded = opts.isUnbounded;
  4723. }
  4724. return ripple;
  4725. };
  4726. MDCRipple.createAdapter = function (instance) {
  4727. return {
  4728. addClass: function addClass(className) {
  4729. instance.root.classList.add(className);
  4730. },
  4731. browserSupportsCssVars: function browserSupportsCssVars() {
  4732. return util.supportsCssVariables(window);
  4733. },
  4734. computeBoundingRect: function computeBoundingRect() {
  4735. return instance.root.getBoundingClientRect();
  4736. },
  4737. containsEventTarget: function containsEventTarget(target) {
  4738. return instance.root.contains(target);
  4739. },
  4740. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
  4741. document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
  4742. },
  4743. deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
  4744. instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
  4745. },
  4746. deregisterResizeHandler: function deregisterResizeHandler(handler) {
  4747. window.removeEventListener('resize', handler);
  4748. },
  4749. getWindowPageOffset: function getWindowPageOffset() {
  4750. return { x: window.pageXOffset, y: window.pageYOffset };
  4751. },
  4752. isSurfaceActive: function isSurfaceActive() {
  4753. return ponyfill_1.matches(instance.root, ':active');
  4754. },
  4755. isSurfaceDisabled: function isSurfaceDisabled() {
  4756. return Boolean(instance.disabled);
  4757. },
  4758. isUnbounded: function isUnbounded() {
  4759. return Boolean(instance.unbounded);
  4760. },
  4761. registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
  4762. document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
  4763. },
  4764. registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
  4765. instance.root.addEventListener(evtType, handler, events_1.applyPassive());
  4766. },
  4767. registerResizeHandler: function registerResizeHandler(handler) {
  4768. window.addEventListener('resize', handler);
  4769. },
  4770. removeClass: function removeClass(className) {
  4771. instance.root.classList.remove(className);
  4772. },
  4773. updateCssVariable: function updateCssVariable(varName, value) {
  4774. instance.root.style.setProperty(varName, value);
  4775. }
  4776. };
  4777. };
  4778. Object.defineProperty(MDCRipple.prototype, "unbounded", {
  4779. get: function get() {
  4780. return Boolean(this.isUnbounded);
  4781. },
  4782. set: function set(unbounded) {
  4783. this.isUnbounded = Boolean(unbounded);
  4784. this.setUnbounded();
  4785. },
  4786. enumerable: false,
  4787. configurable: true
  4788. });
  4789. MDCRipple.prototype.activate = function () {
  4790. this.foundation.activate();
  4791. };
  4792. MDCRipple.prototype.deactivate = function () {
  4793. this.foundation.deactivate();
  4794. };
  4795. MDCRipple.prototype.layout = function () {
  4796. this.foundation.layout();
  4797. };
  4798. MDCRipple.prototype.getDefaultFoundation = function () {
  4799. return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
  4800. };
  4801. MDCRipple.prototype.initialSyncWithDOM = function () {
  4802. var root = this.root;
  4803. this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
  4804. };
  4805. /**
  4806. * Closure Compiler throws an access control error when directly accessing a
  4807. * protected or private property inside a getter/setter, like unbounded above.
  4808. * By accessing the protected property inside a method, we solve that problem.
  4809. * That's why this function exists.
  4810. */
  4811. MDCRipple.prototype.setUnbounded = function () {
  4812. this.foundation.setUnbounded(Boolean(this.isUnbounded));
  4813. };
  4814. return MDCRipple;
  4815. }(component_1.MDCComponent);
  4816. exports.MDCRipple = MDCRipple;
  4817. /***/ }),
  4818. /***/ "./packages/mdc-ripple/constants.ts":
  4819. /*!******************************************!*\
  4820. !*** ./packages/mdc-ripple/constants.ts ***!
  4821. \******************************************/
  4822. /*! no static exports found */
  4823. /***/ (function(module, exports, __webpack_require__) {
  4824. "use strict";
  4825. /**
  4826. * @license
  4827. * Copyright 2016 Google Inc.
  4828. *
  4829. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4830. * of this software and associated documentation files (the "Software"), to deal
  4831. * in the Software without restriction, including without limitation the rights
  4832. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4833. * copies of the Software, and to permit persons to whom the Software is
  4834. * furnished to do so, subject to the following conditions:
  4835. *
  4836. * The above copyright notice and this permission notice shall be included in
  4837. * all copies or substantial portions of the Software.
  4838. *
  4839. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4840. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4841. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4842. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4843. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4844. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4845. * THE SOFTWARE.
  4846. */
  4847. Object.defineProperty(exports, "__esModule", { value: true });
  4848. exports.numbers = exports.strings = exports.cssClasses = void 0;
  4849. exports.cssClasses = {
  4850. // Ripple is a special case where the "root" component is really a "mixin" of
  4851. // sorts,
  4852. // given that it's an 'upgrade' to an existing component. That being said it
  4853. // is the root
  4854. // CSS class that all other CSS classes derive from.
  4855. BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
  4856. FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
  4857. FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
  4858. ROOT: 'mdc-ripple-upgraded',
  4859. UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
  4860. };
  4861. exports.strings = {
  4862. VAR_FG_SCALE: '--mdc-ripple-fg-scale',
  4863. VAR_FG_SIZE: '--mdc-ripple-fg-size',
  4864. VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
  4865. VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
  4866. VAR_LEFT: '--mdc-ripple-left',
  4867. VAR_TOP: '--mdc-ripple-top'
  4868. };
  4869. exports.numbers = {
  4870. DEACTIVATION_TIMEOUT_MS: 225,
  4871. // animation duration)
  4872. FG_DEACTIVATION_MS: 150,
  4873. // (i.e. deactivation animation duration)
  4874. INITIAL_ORIGIN_SCALE: 0.6,
  4875. PADDING: 10,
  4876. TAP_DELAY_MS: 300 };
  4877. /***/ }),
  4878. /***/ "./packages/mdc-ripple/foundation.ts":
  4879. /*!*******************************************!*\
  4880. !*** ./packages/mdc-ripple/foundation.ts ***!
  4881. \*******************************************/
  4882. /*! no static exports found */
  4883. /***/ (function(module, exports, __webpack_require__) {
  4884. "use strict";
  4885. /**
  4886. * @license
  4887. * Copyright 2016 Google Inc.
  4888. *
  4889. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4890. * of this software and associated documentation files (the "Software"), to deal
  4891. * in the Software without restriction, including without limitation the rights
  4892. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  4893. * copies of the Software, and to permit persons to whom the Software is
  4894. * furnished to do so, subject to the following conditions:
  4895. *
  4896. * The above copyright notice and this permission notice shall be included in
  4897. * all copies or substantial portions of the Software.
  4898. *
  4899. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  4900. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  4901. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  4902. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  4903. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  4904. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  4905. * THE SOFTWARE.
  4906. */
  4907. var __extends = this && this.__extends || function () {
  4908. var _extendStatics = function extendStatics(d, b) {
  4909. _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  4910. d.__proto__ = b;
  4911. } || function (d, b) {
  4912. for (var p in b) {
  4913. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  4914. }
  4915. };
  4916. return _extendStatics(d, b);
  4917. };
  4918. return function (d, b) {
  4919. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4920. _extendStatics(d, b);
  4921. function __() {
  4922. this.constructor = d;
  4923. }
  4924. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4925. };
  4926. }();
  4927. var __assign = this && this.__assign || function () {
  4928. __assign = Object.assign || function (t) {
  4929. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4930. s = arguments[i];
  4931. for (var p in s) {
  4932. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4933. }
  4934. }
  4935. return t;
  4936. };
  4937. return __assign.apply(this, arguments);
  4938. };
  4939. var __values = this && this.__values || function (o) {
  4940. var s = typeof Symbol === "function" && Symbol.iterator,
  4941. m = s && o[s],
  4942. i = 0;
  4943. if (m) return m.call(o);
  4944. if (o && typeof o.length === "number") return {
  4945. next: function next() {
  4946. if (o && i >= o.length) o = void 0;
  4947. return { value: o && o[i++], done: !o };
  4948. }
  4949. };
  4950. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  4951. };
  4952. Object.defineProperty(exports, "__esModule", { value: true });
  4953. exports.MDCRippleFoundation = void 0;
  4954. var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
  4955. var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
  4956. var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
  4957. // Activation events registered on the root element of each instance for
  4958. // activation
  4959. var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
  4960. // Deactivation events registered on documentElement when a pointer-related down
  4961. // event occurs
  4962. var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
  4963. // simultaneous nested activations
  4964. var activatedTargets = [];
  4965. /** MDC Ripple Foundation */
  4966. var MDCRippleFoundation = /** @class */function (_super) {
  4967. __extends(MDCRippleFoundation, _super);
  4968. function MDCRippleFoundation(adapter) {
  4969. var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
  4970. _this.activationAnimationHasEnded = false;
  4971. _this.activationTimer = 0;
  4972. _this.fgDeactivationRemovalTimer = 0;
  4973. _this.fgScale = '0';
  4974. _this.frame = { width: 0, height: 0 };
  4975. _this.initialSize = 0;
  4976. _this.layoutFrame = 0;
  4977. _this.maxRadius = 0;
  4978. _this.unboundedCoords = { left: 0, top: 0 };
  4979. _this.activationState = _this.defaultActivationState();
  4980. _this.activationTimerCallback = function () {
  4981. _this.activationAnimationHasEnded = true;
  4982. _this.runDeactivationUXLogicIfReady();
  4983. };
  4984. _this.activateHandler = function (e) {
  4985. _this.activateImpl(e);
  4986. };
  4987. _this.deactivateHandler = function () {
  4988. _this.deactivateImpl();
  4989. };
  4990. _this.focusHandler = function () {
  4991. _this.handleFocus();
  4992. };
  4993. _this.blurHandler = function () {
  4994. _this.handleBlur();
  4995. };
  4996. _this.resizeHandler = function () {
  4997. _this.layout();
  4998. };
  4999. return _this;
  5000. }
  5001. Object.defineProperty(MDCRippleFoundation, "cssClasses", {
  5002. get: function get() {
  5003. return constants_1.cssClasses;
  5004. },
  5005. enumerable: false,
  5006. configurable: true
  5007. });
  5008. Object.defineProperty(MDCRippleFoundation, "strings", {
  5009. get: function get() {
  5010. return constants_1.strings;
  5011. },
  5012. enumerable: false,
  5013. configurable: true
  5014. });
  5015. Object.defineProperty(MDCRippleFoundation, "numbers", {
  5016. get: function get() {
  5017. return constants_1.numbers;
  5018. },
  5019. enumerable: false,
  5020. configurable: true
  5021. });
  5022. Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
  5023. get: function get() {
  5024. return {
  5025. addClass: function addClass() {
  5026. return undefined;
  5027. },
  5028. browserSupportsCssVars: function browserSupportsCssVars() {
  5029. return true;
  5030. },
  5031. computeBoundingRect: function computeBoundingRect() {
  5032. return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
  5033. },
  5034. containsEventTarget: function containsEventTarget() {
  5035. return true;
  5036. },
  5037. deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
  5038. return undefined;
  5039. },
  5040. deregisterInteractionHandler: function deregisterInteractionHandler() {
  5041. return undefined;
  5042. },
  5043. deregisterResizeHandler: function deregisterResizeHandler() {
  5044. return undefined;
  5045. },
  5046. getWindowPageOffset: function getWindowPageOffset() {
  5047. return { x: 0, y: 0 };
  5048. },
  5049. isSurfaceActive: function isSurfaceActive() {
  5050. return true;
  5051. },
  5052. isSurfaceDisabled: function isSurfaceDisabled() {
  5053. return true;
  5054. },
  5055. isUnbounded: function isUnbounded() {
  5056. return true;
  5057. },
  5058. registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
  5059. return undefined;
  5060. },
  5061. registerInteractionHandler: function registerInteractionHandler() {
  5062. return undefined;
  5063. },
  5064. registerResizeHandler: function registerResizeHandler() {
  5065. return undefined;
  5066. },
  5067. removeClass: function removeClass() {
  5068. return undefined;
  5069. },
  5070. updateCssVariable: function updateCssVariable() {
  5071. return undefined;
  5072. }
  5073. };
  5074. },
  5075. enumerable: false,
  5076. configurable: true
  5077. });
  5078. MDCRippleFoundation.prototype.init = function () {
  5079. var _this = this;
  5080. var supportsPressRipple = this.supportsPressRipple();
  5081. this.registerRootHandlers(supportsPressRipple);
  5082. if (supportsPressRipple) {
  5083. var _a = MDCRippleFoundation.cssClasses,
  5084. ROOT_1 = _a.ROOT,
  5085. UNBOUNDED_1 = _a.UNBOUNDED;
  5086. requestAnimationFrame(function () {
  5087. _this.adapter.addClass(ROOT_1);
  5088. if (_this.adapter.isUnbounded()) {
  5089. _this.adapter.addClass(UNBOUNDED_1);
  5090. // Unbounded ripples need layout logic applied immediately to set
  5091. // coordinates for both shade and ripple
  5092. _this.layoutInternal();
  5093. }
  5094. });
  5095. }
  5096. };
  5097. MDCRippleFoundation.prototype.destroy = function () {
  5098. var _this = this;
  5099. if (this.supportsPressRipple()) {
  5100. if (this.activationTimer) {
  5101. clearTimeout(this.activationTimer);
  5102. this.activationTimer = 0;
  5103. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
  5104. }
  5105. if (this.fgDeactivationRemovalTimer) {
  5106. clearTimeout(this.fgDeactivationRemovalTimer);
  5107. this.fgDeactivationRemovalTimer = 0;
  5108. this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
  5109. }
  5110. var _a = MDCRippleFoundation.cssClasses,
  5111. ROOT_2 = _a.ROOT,
  5112. UNBOUNDED_2 = _a.UNBOUNDED;
  5113. requestAnimationFrame(function () {
  5114. _this.adapter.removeClass(ROOT_2);
  5115. _this.adapter.removeClass(UNBOUNDED_2);
  5116. _this.removeCssVars();
  5117. });
  5118. }
  5119. this.deregisterRootHandlers();
  5120. this.deregisterDeactivationHandlers();
  5121. };
  5122. /**
  5123. * @param evt Optional event containing position information.
  5124. */
  5125. MDCRippleFoundation.prototype.activate = function (evt) {
  5126. this.activateImpl(evt);
  5127. };
  5128. MDCRippleFoundation.prototype.deactivate = function () {
  5129. this.deactivateImpl();
  5130. };
  5131. MDCRippleFoundation.prototype.layout = function () {
  5132. var _this = this;
  5133. if (this.layoutFrame) {
  5134. cancelAnimationFrame(this.layoutFrame);
  5135. }
  5136. this.layoutFrame = requestAnimationFrame(function () {
  5137. _this.layoutInternal();
  5138. _this.layoutFrame = 0;
  5139. });
  5140. };
  5141. MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
  5142. var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
  5143. if (unbounded) {
  5144. this.adapter.addClass(UNBOUNDED);
  5145. } else {
  5146. this.adapter.removeClass(UNBOUNDED);
  5147. }
  5148. };
  5149. MDCRippleFoundation.prototype.handleFocus = function () {
  5150. var _this = this;
  5151. requestAnimationFrame(function () {
  5152. _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  5153. });
  5154. };
  5155. MDCRippleFoundation.prototype.handleBlur = function () {
  5156. var _this = this;
  5157. requestAnimationFrame(function () {
  5158. _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
  5159. });
  5160. };
  5161. /**
  5162. * We compute this property so that we are not querying information about the
  5163. * client until the point in time where the foundation requests it. This
  5164. * prevents scenarios where client-side feature-detection may happen too
  5165. * early, such as when components are rendered on the server and then
  5166. * initialized at mount time on the client.
  5167. */
  5168. MDCRippleFoundation.prototype.supportsPressRipple = function () {
  5169. return this.adapter.browserSupportsCssVars();
  5170. };
  5171. MDCRippleFoundation.prototype.defaultActivationState = function () {
  5172. return {
  5173. activationEvent: undefined,
  5174. hasDeactivationUXRun: false,
  5175. isActivated: false,
  5176. isProgrammatic: false,
  5177. wasActivatedByPointer: false,
  5178. wasElementMadeActive: false
  5179. };
  5180. };
  5181. /**
  5182. * supportsPressRipple Passed from init to save a redundant function call
  5183. */
  5184. MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
  5185. var e_1, _a;
  5186. if (supportsPressRipple) {
  5187. try {
  5188. 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()) {
  5189. var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
  5190. this.adapter.registerInteractionHandler(evtType, this.activateHandler);
  5191. }
  5192. } catch (e_1_1) {
  5193. e_1 = { error: e_1_1 };
  5194. } finally {
  5195. try {
  5196. if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
  5197. } finally {
  5198. if (e_1) throw e_1.error;
  5199. }
  5200. }
  5201. if (this.adapter.isUnbounded()) {
  5202. this.adapter.registerResizeHandler(this.resizeHandler);
  5203. }
  5204. }
  5205. this.adapter.registerInteractionHandler('focus', this.focusHandler);
  5206. this.adapter.registerInteractionHandler('blur', this.blurHandler);
  5207. };
  5208. MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
  5209. var e_2, _a;
  5210. if (evt.type === 'keydown') {
  5211. this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
  5212. } else {
  5213. try {
  5214. 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()) {
  5215. var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
  5216. this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
  5217. }
  5218. } catch (e_2_1) {
  5219. e_2 = { error: e_2_1 };
  5220. } finally {
  5221. try {
  5222. 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);
  5223. } finally {
  5224. if (e_2) throw e_2.error;
  5225. }
  5226. }
  5227. }
  5228. };
  5229. MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
  5230. var e_3, _a;
  5231. try {
  5232. 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()) {
  5233. var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
  5234. this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
  5235. }
  5236. } catch (e_3_1) {
  5237. e_3 = { error: e_3_1 };
  5238. } finally {
  5239. try {
  5240. if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
  5241. } finally {
  5242. if (e_3) throw e_3.error;
  5243. }
  5244. }
  5245. this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
  5246. this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
  5247. if (this.adapter.isUnbounded()) {
  5248. this.adapter.deregisterResizeHandler(this.resizeHandler);
  5249. }
  5250. };
  5251. MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
  5252. var e_4, _a;
  5253. this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
  5254. try {
  5255. 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()) {
  5256. var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
  5257. this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
  5258. }
  5259. } catch (e_4_1) {
  5260. e_4 = { error: e_4_1 };
  5261. } finally {
  5262. try {
  5263. 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);
  5264. } finally {
  5265. if (e_4) throw e_4.error;
  5266. }
  5267. }
  5268. };
  5269. MDCRippleFoundation.prototype.removeCssVars = function () {
  5270. var _this = this;
  5271. var rippleStrings = MDCRippleFoundation.strings;
  5272. var keys = Object.keys(rippleStrings);
  5273. keys.forEach(function (key) {
  5274. if (key.indexOf('VAR_') === 0) {
  5275. _this.adapter.updateCssVariable(rippleStrings[key], null);
  5276. }
  5277. });
  5278. };
  5279. MDCRippleFoundation.prototype.activateImpl = function (evt) {
  5280. var _this = this;
  5281. if (this.adapter.isSurfaceDisabled()) {
  5282. return;
  5283. }
  5284. var activationState = this.activationState;
  5285. if (activationState.isActivated) {
  5286. return;
  5287. }
  5288. // Avoid reacting to follow-on events fired by touch device after an
  5289. // already-processed user interaction
  5290. var previousActivationEvent = this.previousActivationEvent;
  5291. var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
  5292. if (isSameInteraction) {
  5293. return;
  5294. }
  5295. activationState.isActivated = true;
  5296. activationState.isProgrammatic = evt === undefined;
  5297. activationState.activationEvent = evt;
  5298. activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
  5299. var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
  5300. return _this.adapter.containsEventTarget(target);
  5301. });
  5302. if (hasActivatedChild) {
  5303. // Immediately reset activation state, while preserving logic that
  5304. // prevents touch follow-on events
  5305. this.resetActivationState();
  5306. return;
  5307. }
  5308. if (evt !== undefined) {
  5309. activatedTargets.push(evt.target);
  5310. this.registerDeactivationHandlers(evt);
  5311. }
  5312. activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
  5313. if (activationState.wasElementMadeActive) {
  5314. this.animateActivation();
  5315. }
  5316. requestAnimationFrame(function () {
  5317. // Reset array on next frame after the current event has had a chance to
  5318. // bubble to prevent ancestor ripples
  5319. activatedTargets = [];
  5320. if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
  5321. // If space was pressed, try again within an rAF call to detect :active,
  5322. // because different UAs report active states inconsistently when
  5323. // they're called within event handling code:
  5324. // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
  5325. // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
  5326. // We try first outside rAF to support Edge, which does not exhibit this
  5327. // problem, but will crash if a CSS variable is set within a rAF
  5328. // callback for a submit button interaction (#2241).
  5329. activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
  5330. if (activationState.wasElementMadeActive) {
  5331. _this.animateActivation();
  5332. }
  5333. }
  5334. if (!activationState.wasElementMadeActive) {
  5335. // Reset activation state immediately if element was not made active.
  5336. _this.activationState = _this.defaultActivationState();
  5337. }
  5338. });
  5339. };
  5340. MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
  5341. return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
  5342. };
  5343. MDCRippleFoundation.prototype.animateActivation = function () {
  5344. var _this = this;
  5345. var _a = MDCRippleFoundation.strings,
  5346. VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
  5347. VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
  5348. var _b = MDCRippleFoundation.cssClasses,
  5349. FG_DEACTIVATION = _b.FG_DEACTIVATION,
  5350. FG_ACTIVATION = _b.FG_ACTIVATION;
  5351. var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
  5352. this.layoutInternal();
  5353. var translateStart = '';
  5354. var translateEnd = '';
  5355. if (!this.adapter.isUnbounded()) {
  5356. var _c = this.getFgTranslationCoordinates(),
  5357. startPoint = _c.startPoint,
  5358. endPoint = _c.endPoint;
  5359. translateStart = startPoint.x + "px, " + startPoint.y + "px";
  5360. translateEnd = endPoint.x + "px, " + endPoint.y + "px";
  5361. }
  5362. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
  5363. this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
  5364. // Cancel any ongoing activation/deactivation animations
  5365. clearTimeout(this.activationTimer);
  5366. clearTimeout(this.fgDeactivationRemovalTimer);
  5367. this.rmBoundedActivationClasses();
  5368. this.adapter.removeClass(FG_DEACTIVATION);
  5369. // Force layout in order to re-trigger the animation.
  5370. this.adapter.computeBoundingRect();
  5371. this.adapter.addClass(FG_ACTIVATION);
  5372. this.activationTimer = setTimeout(function () {
  5373. _this.activationTimerCallback();
  5374. }, DEACTIVATION_TIMEOUT_MS);
  5375. };
  5376. MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
  5377. var _a = this.activationState,
  5378. activationEvent = _a.activationEvent,
  5379. wasActivatedByPointer = _a.wasActivatedByPointer;
  5380. var startPoint;
  5381. if (wasActivatedByPointer) {
  5382. startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
  5383. } else {
  5384. startPoint = {
  5385. x: this.frame.width / 2,
  5386. y: this.frame.height / 2
  5387. };
  5388. }
  5389. // Center the element around the start point.
  5390. startPoint = {
  5391. x: startPoint.x - this.initialSize / 2,
  5392. y: startPoint.y - this.initialSize / 2
  5393. };
  5394. var endPoint = {
  5395. x: this.frame.width / 2 - this.initialSize / 2,
  5396. y: this.frame.height / 2 - this.initialSize / 2
  5397. };
  5398. return { startPoint: startPoint, endPoint: endPoint };
  5399. };
  5400. MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
  5401. var _this = this;
  5402. // This method is called both when a pointing device is released, and when
  5403. // the activation animation ends. The deactivation animation should only run
  5404. // after both of those occur.
  5405. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
  5406. var _a = this.activationState,
  5407. hasDeactivationUXRun = _a.hasDeactivationUXRun,
  5408. isActivated = _a.isActivated;
  5409. var activationHasEnded = hasDeactivationUXRun || !isActivated;
  5410. if (activationHasEnded && this.activationAnimationHasEnded) {
  5411. this.rmBoundedActivationClasses();
  5412. this.adapter.addClass(FG_DEACTIVATION);
  5413. this.fgDeactivationRemovalTimer = setTimeout(function () {
  5414. _this.adapter.removeClass(FG_DEACTIVATION);
  5415. }, constants_1.numbers.FG_DEACTIVATION_MS);
  5416. }
  5417. };
  5418. MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
  5419. var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
  5420. this.adapter.removeClass(FG_ACTIVATION);
  5421. this.activationAnimationHasEnded = false;
  5422. this.adapter.computeBoundingRect();
  5423. };
  5424. MDCRippleFoundation.prototype.resetActivationState = function () {
  5425. var _this = this;
  5426. this.previousActivationEvent = this.activationState.activationEvent;
  5427. this.activationState = this.defaultActivationState();
  5428. // Touch devices may fire additional events for the same interaction within
  5429. // a short time. Store the previous event until it's safe to assume that
  5430. // subsequent events are for new interactions.
  5431. setTimeout(function () {
  5432. return _this.previousActivationEvent = undefined;
  5433. }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
  5434. };
  5435. MDCRippleFoundation.prototype.deactivateImpl = function () {
  5436. var _this = this;
  5437. var activationState = this.activationState;
  5438. // This can happen in scenarios such as when you have a keyup event that
  5439. // blurs the element.
  5440. if (!activationState.isActivated) {
  5441. return;
  5442. }
  5443. var state = __assign({}, activationState);
  5444. if (activationState.isProgrammatic) {
  5445. requestAnimationFrame(function () {
  5446. _this.animateDeactivation(state);
  5447. });
  5448. this.resetActivationState();
  5449. } else {
  5450. this.deregisterDeactivationHandlers();
  5451. requestAnimationFrame(function () {
  5452. _this.activationState.hasDeactivationUXRun = true;
  5453. _this.animateDeactivation(state);
  5454. _this.resetActivationState();
  5455. });
  5456. }
  5457. };
  5458. MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
  5459. var wasActivatedByPointer = _a.wasActivatedByPointer,
  5460. wasElementMadeActive = _a.wasElementMadeActive;
  5461. if (wasActivatedByPointer || wasElementMadeActive) {
  5462. this.runDeactivationUXLogicIfReady();
  5463. }
  5464. };
  5465. MDCRippleFoundation.prototype.layoutInternal = function () {
  5466. var _this = this;
  5467. this.frame = this.adapter.computeBoundingRect();
  5468. var maxDim = Math.max(this.frame.height, this.frame.width);
  5469. // Surface diameter is treated differently for unbounded vs. bounded
  5470. // ripples. Unbounded ripple diameter is calculated smaller since the
  5471. // surface is expected to already be padded appropriately to extend the
  5472. // hitbox, and the ripple is expected to meet the edges of the padded hitbox
  5473. // (which is typically square). Bounded ripples, on the other hand, are
  5474. // fully expected to expand beyond the surface's longest diameter
  5475. // (calculated based on the diagonal plus a constant padding), and are
  5476. // clipped at the surface's border via `overflow: hidden`.
  5477. var getBoundedRadius = function getBoundedRadius() {
  5478. var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
  5479. return hypotenuse + MDCRippleFoundation.numbers.PADDING;
  5480. };
  5481. this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
  5482. // Ripple is sized as a fraction of the largest dimension of the surface,
  5483. // then scales up using a CSS scale transform
  5484. var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
  5485. // Unbounded ripple size should always be even number to equally center
  5486. // align.
  5487. if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
  5488. this.initialSize = initialSize - 1;
  5489. } else {
  5490. this.initialSize = initialSize;
  5491. }
  5492. this.fgScale = "" + this.maxRadius / this.initialSize;
  5493. this.updateLayoutCssVars();
  5494. };
  5495. MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
  5496. var _a = MDCRippleFoundation.strings,
  5497. VAR_FG_SIZE = _a.VAR_FG_SIZE,
  5498. VAR_LEFT = _a.VAR_LEFT,
  5499. VAR_TOP = _a.VAR_TOP,
  5500. VAR_FG_SCALE = _a.VAR_FG_SCALE;
  5501. this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
  5502. this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
  5503. if (this.adapter.isUnbounded()) {
  5504. this.unboundedCoords = {
  5505. left: Math.round(this.frame.width / 2 - this.initialSize / 2),
  5506. top: Math.round(this.frame.height / 2 - this.initialSize / 2)
  5507. };
  5508. this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
  5509. this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
  5510. }
  5511. };
  5512. return MDCRippleFoundation;
  5513. }(foundation_1.MDCFoundation);
  5514. exports.MDCRippleFoundation = MDCRippleFoundation;
  5515. // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
  5516. exports.default = MDCRippleFoundation;
  5517. /***/ }),
  5518. /***/ "./packages/mdc-ripple/util.ts":
  5519. /*!*************************************!*\
  5520. !*** ./packages/mdc-ripple/util.ts ***!
  5521. \*************************************/
  5522. /*! no static exports found */
  5523. /***/ (function(module, exports, __webpack_require__) {
  5524. "use strict";
  5525. Object.defineProperty(exports, "__esModule", { value: true });
  5526. exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
  5527. /**
  5528. * Stores result from supportsCssVariables to avoid redundant processing to
  5529. * detect CSS custom variable support.
  5530. */
  5531. var supportsCssVariables_;
  5532. function supportsCssVariables(windowObj, forceRefresh) {
  5533. if (forceRefresh === void 0) {
  5534. forceRefresh = false;
  5535. }
  5536. var CSS = windowObj.CSS;
  5537. var supportsCssVars = supportsCssVariables_;
  5538. if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
  5539. return supportsCssVariables_;
  5540. }
  5541. var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
  5542. if (!supportsFunctionPresent) {
  5543. return false;
  5544. }
  5545. var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
  5546. // See: https://bugs.webkit.org/show_bug.cgi?id=154669
  5547. // See: README section on Safari
  5548. var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
  5549. supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
  5550. if (!forceRefresh) {
  5551. supportsCssVariables_ = supportsCssVars;
  5552. }
  5553. return supportsCssVars;
  5554. }
  5555. exports.supportsCssVariables = supportsCssVariables;
  5556. function getNormalizedEventCoords(evt, pageOffset, clientRect) {
  5557. if (!evt) {
  5558. return { x: 0, y: 0 };
  5559. }
  5560. var x = pageOffset.x,
  5561. y = pageOffset.y;
  5562. var documentX = x + clientRect.left;
  5563. var documentY = y + clientRect.top;
  5564. var normalizedX;
  5565. var normalizedY;
  5566. // Determine touch point relative to the ripple container.
  5567. if (evt.type === 'touchstart') {
  5568. var touchEvent = evt;
  5569. normalizedX = touchEvent.changedTouches[0].pageX - documentX;
  5570. normalizedY = touchEvent.changedTouches[0].pageY - documentY;
  5571. } else {
  5572. var mouseEvent = evt;
  5573. normalizedX = mouseEvent.pageX - documentX;
  5574. normalizedY = mouseEvent.pageY - documentY;
  5575. }
  5576. return { x: normalizedX, y: normalizedY };
  5577. }
  5578. exports.getNormalizedEventCoords = getNormalizedEventCoords;
  5579. /***/ })
  5580. /******/ });
  5581. });
  5582. //# sourceMappingURL=mdc.checkbox.js.map