12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879 |
- /*!
- * (C) Ionic http://ionicframework.com - MIT License
- */
- 'use strict';
- Object.defineProperty(exports, '__esModule', { value: true });
- var stream = require('stream');
- function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
- var globalThis = $stencilWindow;
- var self = $stencilWindow;
- var top = $stencilWindow;
- var parent = $stencilWindow;
- var addEventListener = $stencilWindow.addEventListener.bind($stencilWindow);
- var alert = $stencilWindow.alert.bind($stencilWindow);
- var blur = $stencilWindow.blur.bind($stencilWindow);
- var cancelAnimationFrame = $stencilWindow.cancelAnimationFrame.bind($stencilWindow);
- var cancelIdleCallback = $stencilWindow.cancelIdleCallback.bind($stencilWindow);
- var clearInterval = $stencilWindow.clearInterval.bind($stencilWindow);
- var clearTimeout = $stencilWindow.clearTimeout.bind($stencilWindow);
- var close = () => {};
- var confirm = $stencilWindow.confirm.bind($stencilWindow);
- var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow);
- var focus = $stencilWindow.focus.bind($stencilWindow);
- var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow);
- var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow);
- var open = $stencilWindow.open.bind($stencilWindow);
- var prompt = $stencilWindow.prompt.bind($stencilWindow);
- var removeEventListener = $stencilWindow.removeEventListener.bind($stencilWindow);
- var requestAnimationFrame = $stencilWindow.requestAnimationFrame.bind($stencilWindow);
- var requestIdleCallback = $stencilWindow.requestIdleCallback.bind($stencilWindow);
- var setInterval = $stencilWindow.setInterval.bind($stencilWindow);
- var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow);
- var CharacterData = $stencilWindow.CharacterData;
- var CSS = $stencilWindow.CSS;
- var CustomEvent = $stencilWindow.CustomEvent;
- var Document = $stencilWindow.Document;
- var DocumentFragment = $stencilWindow.DocumentFragment;
- var DocumentType = $stencilWindow.DocumentType;
- var DOMTokenList = $stencilWindow.DOMTokenList;
- var Element = $stencilWindow.Element;
- var Event = $stencilWindow.Event;
- var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement;
- var HTMLBaseElement = $stencilWindow.HTMLBaseElement;
- var HTMLButtonElement = $stencilWindow.HTMLButtonElement;
- var HTMLCanvasElement = $stencilWindow.HTMLCanvasElement;
- var HTMLElement = $stencilWindow.HTMLElement;
- var HTMLFormElement = $stencilWindow.HTMLFormElement;
- var HTMLImageElement = $stencilWindow.HTMLImageElement;
- var HTMLInputElement = $stencilWindow.HTMLInputElement;
- var HTMLLinkElement = $stencilWindow.HTMLLinkElement;
- var HTMLMetaElement = $stencilWindow.HTMLMetaElement;
- var HTMLScriptElement = $stencilWindow.HTMLScriptElement;
- var HTMLStyleElement = $stencilWindow.HTMLStyleElement;
- var HTMLTemplateElement = $stencilWindow.HTMLTemplateElement;
- var HTMLTitleElement = $stencilWindow.HTMLTitleElement;
- var IntersectionObserver = $stencilWindow.IntersectionObserver;
- var KeyboardEvent = $stencilWindow.KeyboardEvent;
- var MouseEvent = $stencilWindow.MouseEvent;
- var Node = $stencilWindow.Node;
- var NodeList = $stencilWindow.NodeList;
- var URL = $stencilWindow.URL;
- var console = $stencilWindow.console;
- var customElements = $stencilWindow.customElements;
- var history = $stencilWindow.history;
- var localStorage = $stencilWindow.localStorage;
- var location = $stencilWindow.location;
- var navigator = $stencilWindow.navigator;
- var performance = $stencilWindow.performance;
- var sessionStorage = $stencilWindow.sessionStorage;
- var devicePixelRatio = $stencilWindow.devicePixelRatio;
- var innerHeight = $stencilWindow.innerHeight;
- var innerWidth = $stencilWindow.innerWidth;
- var origin = $stencilWindow.origin;
- var pageXOffset = $stencilWindow.pageXOffset;
- var pageYOffset = $stencilWindow.pageYOffset;
- var screen = $stencilWindow.screen;
- var screenLeft = $stencilWindow.screenLeft;
- var screenTop = $stencilWindow.screenTop;
- var screenX = $stencilWindow.screenX;
- var screenY = $stencilWindow.screenY;
- var scrollX = $stencilWindow.scrollX;
- var scrollY = $stencilWindow.scrollY;
- var exports = {};
- var fetch, FetchError, Headers, Request, Response;
- if (typeof $stencilWindow.fetch === 'function') {
- fetch = $stencilWindow.fetch;
- } else {
- fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); };
- }
- if (typeof $stencilWindow.FetchError === 'function') {
- FetchError = $stencilWindow.FetchError;
- } else {
- FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } };
- }
- if (typeof $stencilWindow.Headers === 'function') {
- Headers = $stencilWindow.Headers;
- } else {
- Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } };
- }
- if (typeof $stencilWindow.Request === 'function') {
- Request = $stencilWindow.Request;
- } else {
- Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } };
- }
- if (typeof $stencilWindow.Response === 'function') {
- Response = $stencilWindow.Response;
- } else {
- Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } };
- }
- function hydrateAppClosure($stencilWindow) {
- const window = $stencilWindow;
- const document = $stencilWindow.document;
- /*hydrateAppClosure start*/
- const NAMESPACE = 'ionic';
- const BUILD = /* ionic */ { allRenderFn: false, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: true, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: true, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: true, scopedSlotTextContentFix: true, scriptDataOpts: false, shadowDelegatesFocus: true, shadowDom: true, shadowDomShim: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
- /*
- Stencil Hydrate Platform v4.20.0 | MIT Licensed | https://stenciljs.com
- */
- var __defProp = Object.defineProperty;
- var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
- };
- // src/utils/constants.ts
- var EMPTY_OBJ = {};
- var SVG_NS = "http://www.w3.org/2000/svg";
- var HTML_NS = "http://www.w3.org/1999/xhtml";
- // src/utils/helpers.ts
- var isDef = (v) => v != null;
- var isComplexType = (o) => {
- o = typeof o;
- return o === "object" || o === "function";
- };
- // src/utils/query-nonce-meta-tag-content.ts
- function queryNonceMetaTagContent(doc2) {
- var _a, _b, _c;
- return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
- }
- // src/utils/result.ts
- var result_exports = {};
- __export(result_exports, {
- err: () => err,
- map: () => map,
- ok: () => ok,
- unwrap: () => unwrap,
- unwrapErr: () => unwrapErr
- });
- var ok = (value) => ({
- isOk: true,
- isErr: false,
- value
- });
- var err = (value) => ({
- isOk: false,
- isErr: true,
- value
- });
- function map(result, fn) {
- if (result.isOk) {
- const val = fn(result.value);
- if (val instanceof Promise) {
- return val.then((newVal) => ok(newVal));
- } else {
- return ok(val);
- }
- }
- if (result.isErr) {
- const value = result.value;
- return err(value);
- }
- throw "should never get here";
- }
- var unwrap = (result) => {
- if (result.isOk) {
- return result.value;
- } else {
- throw result.value;
- }
- };
- var unwrapErr = (result) => {
- if (result.isErr) {
- return result.value;
- } else {
- throw result.value;
- }
- };
- var createTime = (fnName, tagName = "") => {
- {
- return () => {
- return;
- };
- }
- };
- var uniqueTime = (key, measureText) => {
- {
- return () => {
- return;
- };
- }
- };
- // src/runtime/runtime-constants.ts
- var CONTENT_REF_ID = "r";
- var ORG_LOCATION_ID = "o";
- var SLOT_NODE_ID = "s";
- var TEXT_NODE_ID = "t";
- var HYDRATE_ID = "s-id";
- var HYDRATED_STYLE_ID = "sty-id";
- var HYDRATE_CHILD_ID = "c-id";
- var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
- var XLINK_NS = "http://www.w3.org/1999/xlink";
- var h = (nodeName, vnodeData, ...children) => {
- let child = null;
- let key = null;
- let slotName = null;
- let simple = false;
- let lastSimple = false;
- const vNodeChildren = [];
- const walk = (c) => {
- for (let i2 = 0; i2 < c.length; i2++) {
- child = c[i2];
- if (Array.isArray(child)) {
- walk(child);
- } else if (child != null && typeof child !== "boolean") {
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
- child = String(child);
- }
- if (simple && lastSimple) {
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
- } else {
- vNodeChildren.push(simple ? newVNode(null, child) : child);
- }
- lastSimple = simple;
- }
- }
- };
- walk(children);
- if (vnodeData) {
- if (vnodeData.key) {
- key = vnodeData.key;
- }
- if (vnodeData.name) {
- slotName = vnodeData.name;
- }
- {
- const classData = vnodeData.className || vnodeData.class;
- if (classData) {
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
- }
- }
- }
- if (typeof nodeName === "function") {
- return nodeName(
- vnodeData === null ? {} : vnodeData,
- vNodeChildren,
- vdomFnUtils
- );
- }
- const vnode = newVNode(nodeName, null);
- vnode.$attrs$ = vnodeData;
- if (vNodeChildren.length > 0) {
- vnode.$children$ = vNodeChildren;
- }
- {
- vnode.$key$ = key;
- }
- {
- vnode.$name$ = slotName;
- }
- return vnode;
- };
- var newVNode = (tag, text) => {
- const vnode = {
- $flags$: 0,
- $tag$: tag,
- $text$: text,
- $elm$: null,
- $children$: null
- };
- {
- vnode.$attrs$ = null;
- }
- {
- vnode.$key$ = null;
- }
- {
- vnode.$name$ = null;
- }
- return vnode;
- };
- var Host = {};
- var isHost = (node) => node && node.$tag$ === Host;
- var vdomFnUtils = {
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
- };
- var convertToPublic = (node) => ({
- vattrs: node.$attrs$,
- vchildren: node.$children$,
- vkey: node.$key$,
- vname: node.$name$,
- vtag: node.$tag$,
- vtext: node.$text$
- });
- var convertToPrivate = (node) => {
- if (typeof node.vtag === "function") {
- const vnodeData = { ...node.vattrs };
- if (node.vkey) {
- vnodeData.key = node.vkey;
- }
- if (node.vname) {
- vnodeData.name = node.vname;
- }
- return h(node.vtag, vnodeData, ...node.vchildren || []);
- }
- const vnode = newVNode(node.vtag, node.vtext);
- vnode.$attrs$ = node.vattrs;
- vnode.$children$ = node.vchildren;
- vnode.$key$ = node.vkey;
- vnode.$name$ = node.vname;
- return vnode;
- };
- // src/runtime/client-hydrate.ts
- var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
- const endHydrate = createTime("hydrateClient", tagName);
- const shadowRoot = hostElm.shadowRoot;
- const childRenderNodes = [];
- const slotNodes = [];
- const shadowRootNodes = shadowRoot ? [] : null;
- const vnode = hostRef.$vnode$ = newVNode(tagName, null);
- if (!plt.$orgLocNodes$) {
- initializeDocumentHydrate(doc$1.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
- }
- hostElm[HYDRATE_ID] = hostId;
- hostElm.removeAttribute(HYDRATE_ID);
- clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
- childRenderNodes.map((c) => {
- const orgLocationId = c.$hostId$ + "." + c.$nodeId$;
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
- const node = c.$elm$;
- if (orgLocationNode && supportsShadow && orgLocationNode["s-en"] === "") {
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
- }
- if (!shadowRoot) {
- node["s-hn"] = tagName;
- if (orgLocationNode) {
- node["s-ol"] = orgLocationNode;
- node["s-ol"]["s-nr"] = node;
- }
- }
- plt.$orgLocNodes$.delete(orgLocationId);
- });
- if (shadowRoot) {
- shadowRootNodes.map((shadowRootNode) => {
- if (shadowRootNode) {
- shadowRoot.appendChild(shadowRootNode);
- }
- });
- }
- endHydrate();
- };
- var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
- let childNodeType;
- let childIdSplt;
- let childVNode;
- let i2;
- if (node.nodeType === 1 /* ElementNode */) {
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
- if (childNodeType) {
- childIdSplt = childNodeType.split(".");
- if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
- childVNode = {
- $flags$: 0,
- $hostId$: childIdSplt[0],
- $nodeId$: childIdSplt[1],
- $depth$: childIdSplt[2],
- $index$: childIdSplt[3],
- $tag$: node.tagName.toLowerCase(),
- $elm$: node,
- $attrs$: null,
- $children$: null,
- $key$: null,
- $name$: null,
- $text$: null
- };
- childRenderNodes.push(childVNode);
- node.removeAttribute(HYDRATE_CHILD_ID);
- if (!parentVNode.$children$) {
- parentVNode.$children$ = [];
- }
- parentVNode.$children$[childVNode.$index$] = childVNode;
- parentVNode = childVNode;
- if (shadowRootNodes && childVNode.$depth$ === "0") {
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
- }
- }
- }
- if (node.shadowRoot) {
- for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
- clientHydrate(
- parentVNode,
- childRenderNodes,
- slotNodes,
- shadowRootNodes,
- hostElm,
- node.shadowRoot.childNodes[i2],
- hostId
- );
- }
- }
- for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
- clientHydrate(
- parentVNode,
- childRenderNodes,
- slotNodes,
- shadowRootNodes,
- hostElm,
- node.childNodes[i2],
- hostId
- );
- }
- } else if (node.nodeType === 8 /* CommentNode */) {
- childIdSplt = node.nodeValue.split(".");
- if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
- childNodeType = childIdSplt[0];
- childVNode = {
- $flags$: 0,
- $hostId$: childIdSplt[1],
- $nodeId$: childIdSplt[2],
- $depth$: childIdSplt[3],
- $index$: childIdSplt[4],
- $elm$: node,
- $attrs$: null,
- $children$: null,
- $key$: null,
- $name$: null,
- $tag$: null,
- $text$: null
- };
- if (childNodeType === TEXT_NODE_ID) {
- childVNode.$elm$ = node.nextSibling;
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
- childVNode.$text$ = childVNode.$elm$.textContent;
- childRenderNodes.push(childVNode);
- node.remove();
- if (!parentVNode.$children$) {
- parentVNode.$children$ = [];
- }
- parentVNode.$children$[childVNode.$index$] = childVNode;
- if (shadowRootNodes && childVNode.$depth$ === "0") {
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
- }
- }
- } else if (childVNode.$hostId$ === hostId) {
- if (childNodeType === SLOT_NODE_ID) {
- childVNode.$tag$ = "slot";
- if (childIdSplt[5]) {
- node["s-sn"] = childVNode.$name$ = childIdSplt[5];
- } else {
- node["s-sn"] = "";
- }
- node["s-sr"] = true;
- if (shadowRootNodes) {
- childVNode.$elm$ = doc$1.createElement(childVNode.$tag$);
- if (childVNode.$name$) {
- childVNode.$elm$.setAttribute("name", childVNode.$name$);
- }
- node.parentNode.insertBefore(childVNode.$elm$, node);
- node.remove();
- if (childVNode.$depth$ === "0") {
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
- }
- }
- slotNodes.push(childVNode);
- if (!parentVNode.$children$) {
- parentVNode.$children$ = [];
- }
- parentVNode.$children$[childVNode.$index$] = childVNode;
- } else if (childNodeType === CONTENT_REF_ID) {
- if (shadowRootNodes) {
- node.remove();
- } else {
- hostElm["s-cr"] = node;
- node["s-cn"] = true;
- }
- }
- }
- }
- } else if (parentVNode && parentVNode.$tag$ === "style") {
- const vnode = newVNode(null, node.textContent);
- vnode.$elm$ = node;
- vnode.$index$ = "0";
- parentVNode.$children$ = [vnode];
- }
- };
- var initializeDocumentHydrate = (node, orgLocNodes) => {
- if (node.nodeType === 1 /* ElementNode */) {
- let i2 = 0;
- if (node.shadowRoot) {
- for (; i2 < node.shadowRoot.childNodes.length; i2++) {
- initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
- }
- }
- for (i2 = 0; i2 < node.childNodes.length; i2++) {
- initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
- }
- } else if (node.nodeType === 8 /* CommentNode */) {
- const childIdSplt = node.nodeValue.split(".");
- if (childIdSplt[0] === ORG_LOCATION_ID) {
- orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
- node.nodeValue = "";
- node["s-en"] = childIdSplt[3];
- }
- }
- };
- // src/runtime/mode.ts
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
- var getMode = (ref) => getHostRef(ref).$modeName$;
- var parsePropertyValue = (propValue, propType) => {
- if (propValue != null && !isComplexType(propValue)) {
- if (propType & 4 /* Boolean */) {
- return propValue === "false" ? false : propValue === "" || !!propValue;
- }
- if (propType & 2 /* Number */) {
- return parseFloat(propValue);
- }
- if (propType & 1 /* String */) {
- return String(propValue);
- }
- return propValue;
- }
- return propValue;
- };
- var getElement = (ref) => getHostRef(ref).$hostElement$ ;
- // src/runtime/event-emitter.ts
- var createEvent = (ref, name, flags) => {
- const elm = getElement(ref);
- return {
- emit: (detail) => {
- return emitEvent(elm, name, {
- bubbles: !!(flags & 4 /* Bubbles */),
- composed: !!(flags & 2 /* Composed */),
- cancelable: !!(flags & 1 /* Cancellable */),
- detail
- });
- }
- };
- };
- var emitEvent = (elm, name, opts) => {
- const ev = plt.ce(name, opts);
- elm.dispatchEvent(ev);
- return ev;
- };
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
- var registerStyle = (scopeId2, cssText, allowCS) => {
- let style = styles.get(scopeId2);
- {
- style = cssText;
- }
- styles.set(scopeId2, style);
- };
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
- var _a;
- const scopeId2 = getScopeId(cmpMeta, mode);
- const style = styles.get(scopeId2);
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc$1;
- if (style) {
- if (typeof style === "string") {
- styleContainerNode = styleContainerNode.head || styleContainerNode;
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
- let styleElm;
- if (!appliedStyles) {
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
- }
- if (!appliedStyles.has(scopeId2)) {
- if (styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
- styleElm.innerHTML = style;
- } else {
- styleElm = doc$1.createElement("style");
- styleElm.innerHTML = style;
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc$1);
- if (nonce != null) {
- styleElm.setAttribute("nonce", nonce);
- }
- if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
- }
- const injectStyle = (
- /**
- * we render a scoped component
- */
- !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) || /**
- * we are using shadow dom and render the style tag within the shadowRoot
- */
- cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD"
- );
- if (injectStyle) {
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
- }
- }
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
- styleElm.innerHTML += SLOT_FB_CSS;
- }
- if (appliedStyles) {
- appliedStyles.add(scopeId2);
- }
- }
- }
- }
- return scopeId2;
- };
- var attachStyles = (hostRef) => {
- const cmpMeta = hostRef.$cmpMeta$;
- const elm = hostRef.$hostElement$;
- const flags = cmpMeta.$flags$;
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
- const scopeId2 = addStyle(
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
- cmpMeta,
- hostRef.$modeName$
- );
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
- elm["s-sc"] = scopeId2;
- elm.classList.add(scopeId2 + "-h");
- if (flags & 2 /* scopedCssEncapsulation */) {
- elm.classList.add(scopeId2 + "-s");
- }
- }
- endAttachStyles();
- };
- var getScopeId = (cmp, mode) => "sc-" + (mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
- if (oldValue !== newValue) {
- let isProp = isMemberInElement(elm, memberName);
- let ln = memberName.toLowerCase();
- if (memberName === "class") {
- const classList = elm.classList;
- const oldClasses = parseClassList(oldValue);
- const newClasses = parseClassList(newValue);
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
- } else if (memberName === "style") {
- {
- for (const prop in oldValue) {
- if (!newValue || newValue[prop] == null) {
- {
- elm.style[prop] = "";
- }
- }
- }
- }
- for (const prop in newValue) {
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
- {
- elm.style[prop] = newValue[prop];
- }
- }
- }
- } else if (memberName === "key") ; else if (memberName === "ref") {
- if (newValue) {
- newValue(elm);
- }
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
- if (memberName[2] === "-") {
- memberName = memberName.slice(3);
- } else if (isMemberInElement(win$2, ln)) {
- memberName = ln.slice(2);
- } else {
- memberName = ln[2] + memberName.slice(3);
- }
- if (oldValue || newValue) {
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
- if (oldValue) {
- plt.rel(elm, memberName, oldValue, capture);
- }
- if (newValue) {
- plt.ael(elm, memberName, newValue, capture);
- }
- }
- } else {
- const isComplex = isComplexType(newValue);
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
- try {
- if (!elm.tagName.includes("-")) {
- const n = newValue == null ? "" : newValue;
- if (memberName === "list") {
- isProp = false;
- } else if (oldValue == null || elm[memberName] != n) {
- elm[memberName] = n;
- }
- } else {
- elm[memberName] = newValue;
- }
- } catch (e) {
- }
- }
- let xlink = false;
- {
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
- memberName = ln;
- xlink = true;
- }
- }
- if (newValue == null || newValue === false) {
- if (newValue !== false || elm.getAttribute(memberName) === "") {
- if (xlink) {
- elm.removeAttributeNS(XLINK_NS, memberName);
- } else {
- elm.removeAttribute(memberName);
- }
- }
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
- newValue = newValue === true ? "" : newValue;
- if (xlink) {
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
- } else {
- elm.setAttribute(memberName, newValue);
- }
- }
- }
- }
- };
- var parseClassListRegex = /\s/;
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
- var CAPTURE_EVENT_SUFFIX = "Capture";
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
- // src/runtime/vdom/update-element.ts
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
- {
- for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
- if (!(memberName in newVnodeAttrs)) {
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
- }
- }
- }
- for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
- }
- };
- function sortedAttrNames(attrNames) {
- return attrNames.includes("ref") ? (
- // we need to sort these to ensure that `'ref'` is the last attr
- [...attrNames.filter((attr) => attr !== "ref"), "ref"]
- ) : (
- // no need to sort, return the original array
- attrNames
- );
- }
- // src/runtime/vdom/vdom-render.ts
- var scopeId;
- var contentRef;
- var hostTagName;
- var useNativeShadowDom = false;
- var checkSlotFallbackVisibility = false;
- var checkSlotRelocate = false;
- var isSvgMode = false;
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
- var _a;
- const newVNode2 = newParentVNode.$children$[childIndex];
- let i2 = 0;
- let elm;
- let childNode;
- let oldVNode;
- if (!useNativeShadowDom) {
- checkSlotRelocate = true;
- if (newVNode2.$tag$ === "slot") {
- if (scopeId) {
- parentElm.classList.add(scopeId + "-s");
- }
- newVNode2.$flags$ |= newVNode2.$children$ ? (
- // slot element has fallback content
- // still create an element that "mocks" the slot element
- 2 /* isSlotFallback */
- ) : (
- // slot element does not have fallback content
- // create an html comment we'll use to always reference
- // where actual slot content should sit next to
- 1 /* isSlotReference */
- );
- }
- }
- if (newVNode2.$text$ !== null) {
- elm = newVNode2.$elm$ = doc$1.createTextNode(newVNode2.$text$);
- } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
- elm = newVNode2.$elm$ = slotReferenceDebugNode(newVNode2) ;
- } else {
- if (!isSvgMode) {
- isSvgMode = newVNode2.$tag$ === "svg";
- }
- elm = newVNode2.$elm$ = doc$1.createElementNS(
- isSvgMode ? SVG_NS : HTML_NS,
- !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
- ) ;
- if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
- isSvgMode = false;
- }
- {
- updateElement(null, newVNode2, isSvgMode);
- }
- const rootNode = elm.getRootNode();
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
- elm.classList.add(elm["s-si"] = scopeId);
- }
- {
- updateElementScopeIds(elm, parentElm);
- }
- if (newVNode2.$children$) {
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
- childNode = createElm(oldParentVNode, newVNode2, i2, elm);
- if (childNode) {
- elm.appendChild(childNode);
- }
- }
- }
- {
- if (newVNode2.$tag$ === "svg") {
- isSvgMode = false;
- } else if (elm.tagName === "foreignObject") {
- isSvgMode = true;
- }
- }
- }
- elm["s-hn"] = hostTagName;
- {
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
- elm["s-sr"] = true;
- elm["s-cr"] = contentRef;
- elm["s-sn"] = newVNode2.$name$ || "";
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
- {
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
- }
- }
- }
- }
- return elm;
- };
- var putBackInOriginalLocation = (parentElm, recursive) => {
- plt.$flags$ |= 1 /* isTmpDisconnected */;
- const oldSlotChildNodes = Array.from(parentElm.childNodes);
- if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
- let node = parentElm;
- while (node = node.nextSibling) {
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
- oldSlotChildNodes.push(node);
- }
- }
- }
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
- const childNode = oldSlotChildNodes[i2];
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
- insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
- childNode["s-ol"].remove();
- childNode["s-ol"] = void 0;
- childNode["s-sh"] = void 0;
- checkSlotRelocate = true;
- }
- if (recursive) {
- putBackInOriginalLocation(childNode, recursive);
- }
- }
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
- };
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
- let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
- let childNode;
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
- containerElm = containerElm.shadowRoot;
- }
- for (; startIdx <= endIdx; ++startIdx) {
- if (vnodes[startIdx]) {
- childNode = createElm(null, parentVNode, startIdx, parentElm);
- if (childNode) {
- vnodes[startIdx].$elm$ = childNode;
- insertBefore(containerElm, childNode, referenceNode(before) );
- }
- }
- }
- };
- var removeVnodes = (vnodes, startIdx, endIdx) => {
- for (let index = startIdx; index <= endIdx; ++index) {
- const vnode = vnodes[index];
- if (vnode) {
- const elm = vnode.$elm$;
- nullifyVNodeRefs(vnode);
- if (elm) {
- {
- checkSlotFallbackVisibility = true;
- if (elm["s-ol"]) {
- elm["s-ol"].remove();
- } else {
- putBackInOriginalLocation(elm, true);
- }
- }
- elm.remove();
- }
- }
- }
- };
- var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
- let oldStartIdx = 0;
- let newStartIdx = 0;
- let idxInOld = 0;
- let i2 = 0;
- let oldEndIdx = oldCh.length - 1;
- let oldStartVnode = oldCh[0];
- let oldEndVnode = oldCh[oldEndIdx];
- let newEndIdx = newCh.length - 1;
- let newStartVnode = newCh[0];
- let newEndVnode = newCh[newEndIdx];
- let node;
- let elmToMove;
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
- if (oldStartVnode == null) {
- oldStartVnode = oldCh[++oldStartIdx];
- } else if (oldEndVnode == null) {
- oldEndVnode = oldCh[--oldEndIdx];
- } else if (newStartVnode == null) {
- newStartVnode = newCh[++newStartIdx];
- } else if (newEndVnode == null) {
- newEndVnode = newCh[--newEndIdx];
- } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
- patch(oldStartVnode, newStartVnode, isInitialRender);
- oldStartVnode = oldCh[++oldStartIdx];
- newStartVnode = newCh[++newStartIdx];
- } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
- patch(oldEndVnode, newEndVnode, isInitialRender);
- oldEndVnode = oldCh[--oldEndIdx];
- newEndVnode = newCh[--newEndIdx];
- } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
- }
- patch(oldStartVnode, newEndVnode, isInitialRender);
- insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
- oldStartVnode = oldCh[++oldStartIdx];
- newEndVnode = newCh[--newEndIdx];
- } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
- }
- patch(oldEndVnode, newStartVnode, isInitialRender);
- insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
- oldEndVnode = oldCh[--oldEndIdx];
- newStartVnode = newCh[++newStartIdx];
- } else {
- idxInOld = -1;
- {
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
- idxInOld = i2;
- break;
- }
- }
- }
- if (idxInOld >= 0) {
- elmToMove = oldCh[idxInOld];
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
- } else {
- patch(elmToMove, newStartVnode, isInitialRender);
- oldCh[idxInOld] = void 0;
- node = elmToMove.$elm$;
- }
- newStartVnode = newCh[++newStartIdx];
- } else {
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx, parentElm);
- newStartVnode = newCh[++newStartIdx];
- }
- if (node) {
- {
- insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
- }
- }
- }
- }
- if (oldStartIdx > oldEndIdx) {
- addVnodes(
- parentElm,
- newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
- newVNode2,
- newCh,
- newStartIdx,
- newEndIdx
- );
- } else if (newStartIdx > newEndIdx) {
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
- }
- };
- var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
- if (leftVNode.$tag$ === rightVNode.$tag$) {
- if (leftVNode.$tag$ === "slot") {
- if (
- // The component gets hydrated and no VDOM has been initialized.
- // Here the comparison can't happen as $name$ property is not set for `leftNode`.
- "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
- // hydration comments to be removed
- leftVNode.$elm$.nodeType !== 8
- ) {
- return false;
- }
- return leftVNode.$name$ === rightVNode.$name$;
- }
- if (!isInitialRender) {
- return leftVNode.$key$ === rightVNode.$key$;
- }
- return true;
- }
- return false;
- };
- var referenceNode = (node) => {
- return node && node["s-ol"] || node;
- };
- var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
- var patch = (oldVNode, newVNode2, isInitialRender = false) => {
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
- const oldChildren = oldVNode.$children$;
- const newChildren = newVNode2.$children$;
- const tag = newVNode2.$tag$;
- const text = newVNode2.$text$;
- let defaultHolder;
- if (text === null) {
- {
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
- }
- {
- if (tag === "slot" && !useNativeShadowDom) ; else {
- updateElement(oldVNode, newVNode2, isSvgMode);
- }
- }
- if (oldChildren !== null && newChildren !== null) {
- updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
- } else if (newChildren !== null) {
- if (oldVNode.$text$ !== null) {
- elm.textContent = "";
- }
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
- } else if (
- // don't do this on initial render as it can cause non-hydrated content to be removed
- !isInitialRender && BUILD.updatable && oldChildren !== null
- ) {
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
- }
- if (isSvgMode && tag === "svg") {
- isSvgMode = false;
- }
- } else if ((defaultHolder = elm["s-cr"])) {
- defaultHolder.parentNode.textContent = text;
- } else if (oldVNode.$text$ !== text) {
- elm.data = text;
- }
- };
- var updateFallbackSlotVisibility = (elm) => {
- const childNodes = elm.childNodes;
- for (const childNode of childNodes) {
- if (childNode.nodeType === 1 /* ElementNode */) {
- if (childNode["s-sr"]) {
- const slotName = childNode["s-sn"];
- childNode.hidden = false;
- for (const siblingNode of childNodes) {
- if (siblingNode !== childNode) {
- if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
- if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
- childNode.hidden = true;
- break;
- }
- } else {
- if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
- childNode.hidden = true;
- break;
- }
- }
- }
- }
- }
- updateFallbackSlotVisibility(childNode);
- }
- }
- };
- var relocateNodes = [];
- var markSlotContentForRelocation = (elm) => {
- let node;
- let hostContentNodes;
- let j;
- for (const childNode of elm.childNodes) {
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
- hostContentNodes = node.parentNode.childNodes;
- const slotName = childNode["s-sn"];
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
- node = hostContentNodes[j];
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes )) {
- if (isNodeLocatedInSlot(node, slotName)) {
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
- checkSlotFallbackVisibility = true;
- node["s-sn"] = node["s-sn"] || slotName;
- if (relocateNodeData) {
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
- relocateNodeData.$slotRefNode$ = childNode;
- } else {
- node["s-sh"] = childNode["s-hn"];
- relocateNodes.push({
- $slotRefNode$: childNode,
- $nodeToRelocate$: node
- });
- }
- if (node["s-sr"]) {
- relocateNodes.map((relocateNode) => {
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
- }
- }
- });
- }
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
- relocateNodes.push({
- $nodeToRelocate$: node
- });
- }
- }
- }
- }
- if (childNode.nodeType === 1 /* ElementNode */) {
- markSlotContentForRelocation(childNode);
- }
- }
- };
- var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
- if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
- return true;
- }
- if (nodeToRelocate.getAttribute("slot") === slotName) {
- return true;
- }
- return false;
- }
- if (nodeToRelocate["s-sn"] === slotName) {
- return true;
- }
- return slotName === "";
- };
- var nullifyVNodeRefs = (vNode) => {
- {
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
- }
- };
- var insertBefore = (parent, newNode, reference) => {
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
- {
- updateElementScopeIds(newNode, parent);
- }
- return inserted;
- };
- var findScopeIds = (element) => {
- const scopeIds = [];
- if (element) {
- scopeIds.push(
- ...element["s-scs"] || [],
- element["s-si"],
- element["s-sc"],
- ...findScopeIds(element.parentElement)
- );
- }
- return scopeIds;
- };
- var updateElementScopeIds = (element, parent, iterateChildNodes = false) => {
- var _a;
- if (element && parent && element.nodeType === 1 /* ElementNode */) {
- const scopeIds = new Set(findScopeIds(parent).filter(Boolean));
- if (scopeIds.size) {
- (_a = element.classList) == null ? void 0 : _a.add(...element["s-scs"] = [...scopeIds]);
- if (element["s-ol"] || iterateChildNodes) {
- for (const childNode of Array.from(element.childNodes)) {
- updateElementScopeIds(childNode, element, true);
- }
- }
- }
- }
- };
- var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
- var _a, _b, _c, _d;
- const hostElm = hostRef.$hostElement$;
- const cmpMeta = hostRef.$cmpMeta$;
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
- hostTagName = hostElm.tagName;
- if (cmpMeta.$attrsToReflect$) {
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
- cmpMeta.$attrsToReflect$.map(
- ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
- );
- }
- if (isInitialLoad && rootVnode.$attrs$) {
- for (const key of Object.keys(rootVnode.$attrs$)) {
- if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
- rootVnode.$attrs$[key] = hostElm[key];
- }
- }
- }
- rootVnode.$tag$ = null;
- rootVnode.$flags$ |= 4 /* isHost */;
- hostRef.$vnode$ = rootVnode;
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
- {
- scopeId = hostElm["s-sc"];
- }
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
- {
- contentRef = hostElm["s-cr"];
- checkSlotFallbackVisibility = false;
- }
- patch(oldVNode, rootVnode, isInitialLoad);
- {
- plt.$flags$ |= 1 /* isTmpDisconnected */;
- if (checkSlotRelocate) {
- markSlotContentForRelocation(rootVnode.$elm$);
- for (const relocateData of relocateNodes) {
- const nodeToRelocate = relocateData.$nodeToRelocate$;
- if (!nodeToRelocate["s-ol"]) {
- const orgLocationNode = originalLocationDebugNode(nodeToRelocate) ;
- orgLocationNode["s-nr"] = nodeToRelocate;
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
- }
- }
- for (const relocateData of relocateNodes) {
- const nodeToRelocate = relocateData.$nodeToRelocate$;
- const slotRefNode = relocateData.$slotRefNode$;
- if (slotRefNode) {
- const parentNodeRef = slotRefNode.parentNode;
- let insertBeforeNode = slotRefNode.nextSibling;
- {
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
- while (orgLocationNode) {
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
- refNode = refNode.nextSibling;
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
- refNode = refNode == null ? void 0 : refNode.nextSibling;
- }
- if (!refNode || !refNode["s-nr"]) {
- insertBeforeNode = refNode;
- break;
- }
- }
- orgLocationNode = orgLocationNode.previousSibling;
- }
- }
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
- if (nodeToRelocate !== insertBeforeNode) {
- if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
- }
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
- }
- }
- }
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
- } else {
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
- if (isInitialLoad) {
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
- }
- nodeToRelocate.hidden = true;
- }
- }
- }
- }
- if (checkSlotFallbackVisibility) {
- updateFallbackSlotVisibility(rootVnode.$elm$);
- }
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
- relocateNodes.length = 0;
- }
- contentRef = void 0;
- };
- var slotReferenceDebugNode = (slotVNode) => doc$1.createComment(
- `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
- );
- var originalLocationDebugNode = (nodeToRelocate) => doc$1.createComment(
- `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
- );
- // src/runtime/update-component.ts
- var attachToAncestor = (hostRef, ancestorComponent) => {
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
- }
- };
- var scheduleUpdate = (hostRef, isInitialLoad) => {
- {
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
- }
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
- hostRef.$flags$ |= 512 /* needsRerender */;
- return;
- }
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
- return writeTask(dispatch) ;
- };
- var dispatchHooks = (hostRef, isInitialLoad) => {
- const elm = hostRef.$hostElement$;
- const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
- const instance = hostRef.$lazyInstance$ ;
- if (!instance) {
- throw new Error(
- `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
- );
- }
- let maybePromise;
- if (isInitialLoad) {
- {
- hostRef.$flags$ |= 256 /* isListenReady */;
- if (hostRef.$queuedListeners$) {
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall$1(instance, methodName, event));
- hostRef.$queuedListeners$ = void 0;
- }
- }
- {
- maybePromise = safeCall$1(instance, "componentWillLoad");
- }
- }
- {
- maybePromise = enqueue(maybePromise, () => safeCall$1(instance, "componentWillRender"));
- }
- endSchedule();
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
- };
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
- console.error(err2);
- fn();
- }) : fn();
- var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
- var updateComponent = async (hostRef, instance, isInitialLoad) => {
- var _a;
- const elm = hostRef.$hostElement$;
- const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
- const rc = elm["s-rc"];
- if (isInitialLoad) {
- attachStyles(hostRef);
- }
- const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
- {
- await callRender(hostRef, instance, elm, isInitialLoad);
- }
- {
- try {
- serverSideConnected(elm);
- if (isInitialLoad) {
- if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) {
- elm["s-en"] = "";
- } else if (hostRef.$cmpMeta$.$flags$ & 2 /* scopedCssEncapsulation */) {
- elm["s-en"] = "c";
- }
- }
- } catch (e) {
- consoleError(e, elm);
- }
- }
- if (rc) {
- rc.map((cb) => cb());
- elm["s-rc"] = void 0;
- }
- endRender();
- endUpdate();
- {
- const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
- const postUpdate = () => postUpdateComponent(hostRef);
- if (childrenPromises.length === 0) {
- postUpdate();
- } else {
- Promise.all(childrenPromises).then(postUpdate);
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
- childrenPromises.length = 0;
- }
- }
- };
- var callRender = (hostRef, instance, elm, isInitialLoad) => {
- try {
- instance = instance.render && instance.render();
- {
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
- }
- {
- hostRef.$flags$ |= 2 /* hasRendered */;
- }
- {
- {
- {
- return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
- }
- }
- }
- } catch (e) {
- consoleError(e, hostRef.$hostElement$);
- }
- return null;
- };
- var postUpdateComponent = (hostRef) => {
- const tagName = hostRef.$cmpMeta$.$tagName$;
- const elm = hostRef.$hostElement$;
- const endPostUpdate = createTime("postUpdate", tagName);
- const instance = hostRef.$lazyInstance$ ;
- const ancestorComponent = hostRef.$ancestorComponent$;
- {
- safeCall$1(instance, "componentDidRender");
- }
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
- {
- addHydratedFlag(elm);
- }
- {
- safeCall$1(instance, "componentDidLoad");
- }
- endPostUpdate();
- {
- hostRef.$onReadyResolve$(elm);
- if (!ancestorComponent) {
- appDidLoad();
- }
- }
- } else {
- {
- safeCall$1(instance, "componentDidUpdate");
- }
- endPostUpdate();
- }
- {
- hostRef.$onInstanceResolve$(elm);
- }
- {
- if (hostRef.$onRenderResolve$) {
- hostRef.$onRenderResolve$();
- hostRef.$onRenderResolve$ = void 0;
- }
- if (hostRef.$flags$ & 512 /* needsRerender */) {
- nextTick(() => scheduleUpdate(hostRef, false));
- }
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
- }
- };
- var forceUpdate = (ref) => {
- return false;
- };
- var appDidLoad = (who) => {
- {
- addHydratedFlag(doc$1.documentElement);
- }
- nextTick(() => emitEvent(win$2, "appload", { detail: { namespace: NAMESPACE } }));
- };
- var safeCall$1 = (instance, method, arg) => {
- if (instance && instance[method]) {
- try {
- return instance[method](arg);
- } catch (e) {
- consoleError(e);
- }
- }
- return void 0;
- };
- var addHydratedFlag = (elm) => {
- var _a;
- return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
- };
- var serverSideConnected = (elm) => {
- const children = elm.children;
- if (children != null) {
- for (let i2 = 0, ii = children.length; i2 < ii; i2++) {
- const childElm = children[i2];
- if (typeof childElm.connectedCallback === "function") {
- childElm.connectedCallback();
- }
- serverSideConnected(childElm);
- }
- }
- };
- // src/runtime/set-value.ts
- var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
- var setValue = (ref, propName, newVal, cmpMeta) => {
- const hostRef = getHostRef(ref);
- if (!hostRef) {
- throw new Error(
- `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
- );
- }
- const elm = hostRef.$hostElement$ ;
- const oldVal = hostRef.$instanceValues$.get(propName);
- const flags = hostRef.$flags$;
- const instance = hostRef.$lazyInstance$ ;
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
- const didValueChange = newVal !== oldVal && !areBothNaN;
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
- hostRef.$instanceValues$.set(propName, newVal);
- if (instance) {
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
- const watchMethods = cmpMeta.$watchers$[propName];
- if (watchMethods) {
- watchMethods.map((watchMethodName) => {
- try {
- instance[watchMethodName](newVal, oldVal, propName);
- } catch (e) {
- consoleError(e, elm);
- }
- });
- }
- }
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
- scheduleUpdate(hostRef, false);
- }
- }
- }
- };
- // src/runtime/proxy-component.ts
- var proxyComponent = (Cstr, cmpMeta, flags) => {
- var _a, _b;
- const prototype = Cstr.prototype;
- if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
- if (Cstr.watchers && !cmpMeta.$watchers$) {
- cmpMeta.$watchers$ = Cstr.watchers;
- }
- const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
- members.map(([memberName, [memberFlags]]) => {
- if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
- Object.defineProperty(prototype, memberName, {
- get() {
- return getValue(this, memberName);
- },
- set(newValue) {
- setValue(this, memberName, newValue, cmpMeta);
- },
- configurable: true,
- enumerable: true
- });
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
- Object.defineProperty(prototype, memberName, {
- value(...args) {
- var _a2;
- const ref = getHostRef(this);
- return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
- var _a3;
- return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
- });
- }
- });
- }
- });
- if ((flags & 1 /* isElementConstructor */)) {
- const attrNameToPropName = /* @__PURE__ */ new Map();
- prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
- plt.jmp(() => {
- var _a2;
- const propName = attrNameToPropName.get(attrName);
- if (this.hasOwnProperty(propName)) {
- newValue = this[propName];
- delete this[propName];
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
- this[propName] == newValue) {
- return;
- } else if (propName == null) {
- const hostRef = getHostRef(this);
- const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
- if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
- const instance = hostRef.$lazyInstance$ ;
- const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
- entry == null ? void 0 : entry.forEach((callbackName) => {
- if (instance[callbackName] != null) {
- instance[callbackName].call(instance, newValue, oldValue, attrName);
- }
- });
- }
- return;
- }
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
- });
- };
- Cstr.observedAttributes = Array.from(
- /* @__PURE__ */ new Set([
- ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
- ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
- var _a2;
- const attrName = m[1] || propName;
- attrNameToPropName.set(attrName, propName);
- if (m[0] & 512 /* ReflectAttr */) {
- (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
- }
- return attrName;
- })
- ])
- );
- }
- }
- return Cstr;
- };
- // src/runtime/initialize-component.ts
- var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
- let Cstr;
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
- const bundleId = cmpMeta.$lazyBundleId$;
- if (bundleId) {
- const CstrImport = loadModule(cmpMeta);
- if (CstrImport && "then" in CstrImport) {
- const endLoad = uniqueTime();
- Cstr = await CstrImport;
- endLoad();
- } else {
- Cstr = CstrImport;
- }
- if (!Cstr) {
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
- }
- if (!Cstr.isProxied) {
- {
- cmpMeta.$watchers$ = Cstr.watchers;
- }
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
- Cstr.isProxied = true;
- }
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
- {
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
- }
- try {
- new Cstr(hostRef);
- } catch (e) {
- consoleError(e);
- }
- {
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
- }
- {
- hostRef.$flags$ |= 128 /* isWatchReady */;
- }
- endNewInstance();
- fireConnectedCallback(hostRef.$lazyInstance$);
- } else {
- Cstr = elm.constructor;
- const cmpTag = elm.localName;
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
- }
- if (Cstr && Cstr.style) {
- let style;
- if (typeof Cstr.style === "string") {
- style = Cstr.style;
- } else if (typeof Cstr.style !== "string") {
- hostRef.$modeName$ = computeMode(elm);
- if (hostRef.$modeName$) {
- style = Cstr.style[hostRef.$modeName$];
- }
- if (hostRef.$modeName$) {
- elm.setAttribute("s-mode", hostRef.$modeName$);
- }
- }
- const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
- if (!styles.has(scopeId2)) {
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
- registerStyle(scopeId2, style);
- endRegisterStyles();
- }
- }
- }
- const ancestorComponent = hostRef.$ancestorComponent$;
- const schedule = () => scheduleUpdate(hostRef, true);
- if (ancestorComponent && ancestorComponent["s-rc"]) {
- ancestorComponent["s-rc"].push(schedule);
- } else {
- schedule();
- }
- };
- var fireConnectedCallback = (instance) => {
- {
- safeCall$1(instance, "connectedCallback");
- }
- };
- // src/runtime/connected-callback.ts
- var connectedCallback = (elm) => {
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
- const hostRef = getHostRef(elm);
- const cmpMeta = hostRef.$cmpMeta$;
- const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
- hostRef.$flags$ |= 1 /* hasConnected */;
- let hostId;
- {
- hostId = elm.getAttribute(HYDRATE_ID);
- if (hostId) {
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
- const scopeId2 = addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) ;
- elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
- }
- initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
- }
- }
- if (!hostId) {
- {
- setContentReference(elm);
- }
- }
- {
- let ancestorComponent = elm;
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
- if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
- break;
- }
- }
- }
- {
- initializeComponent(elm, hostRef, cmpMeta);
- }
- } else {
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
- fireConnectedCallback(hostRef.$lazyInstance$);
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
- }
- }
- endConnected();
- }
- };
- var setContentReference = (elm) => {
- const contentRefElm = elm["s-cr"] = doc$1.createComment(
- ""
- );
- contentRefElm["s-cn"] = true;
- insertBefore(elm, contentRefElm, elm.firstChild);
- };
- var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
- if (listeners) {
- listeners.map(([flags, name, method]) => {
- const target = getHostListenerTarget(elm, flags) ;
- const handler = hostListenerProxy(hostRef, method);
- const opts = hostListenerOpts(flags);
- plt.ael(target, name, handler, opts);
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
- });
- }
- };
- var hostListenerProxy = (hostRef, methodName) => (ev) => {
- var _a;
- try {
- {
- if (hostRef.$flags$ & 256 /* isListenReady */) {
- (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
- } else {
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
- }
- }
- } catch (e) {
- consoleError(e);
- }
- };
- var getHostListenerTarget = (elm, flags) => {
- if (flags & 4 /* TargetDocument */) return doc$1;
- if (flags & 8 /* TargetWindow */) return win$2;
- if (flags & 16 /* TargetBody */) return doc$1.body;
- return elm;
- };
- var hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
- // src/runtime/vdom/vdom-annotations.ts
- var insertVdomAnnotations = (doc2, staticComponents) => {
- if (doc2 != null) {
- const docData = {
- hostIds: 0,
- rootLevelIds: 0,
- staticComponents: new Set(staticComponents)
- };
- const orgLocationNodes = [];
- parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
- orgLocationNodes.forEach((orgLocationNode) => {
- var _a;
- if (orgLocationNode != null && orgLocationNode["s-nr"]) {
- const nodeRef = orgLocationNode["s-nr"];
- let hostId = nodeRef["s-host-id"];
- let nodeId = nodeRef["s-node-id"];
- let childId = `${hostId}.${nodeId}`;
- if (hostId == null) {
- hostId = 0;
- docData.rootLevelIds++;
- nodeId = docData.rootLevelIds;
- childId = `${hostId}.${nodeId}`;
- if (nodeRef.nodeType === 1 /* ElementNode */) {
- nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
- } else if (nodeRef.nodeType === 3 /* TextNode */) {
- if (hostId === 0) {
- const textContent = (_a = nodeRef.nodeValue) == null ? void 0 : _a.trim();
- if (textContent === "") {
- orgLocationNode.remove();
- return;
- }
- }
- const commentBeforeTextNode = doc2.createComment(childId);
- commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
- insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
- }
- }
- let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
- const orgLocationParentNode = orgLocationNode.parentElement;
- if (orgLocationParentNode) {
- if (orgLocationParentNode["s-en"] === "") {
- orgLocationNodeId += `.`;
- } else if (orgLocationParentNode["s-en"] === "c") {
- orgLocationNodeId += `.c`;
- }
- }
- orgLocationNode.nodeValue = orgLocationNodeId;
- }
- });
- }
- };
- var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
- var _a;
- if (node == null) {
- return;
- }
- if (node["s-nr"] != null) {
- orgLocationNodes.push(node);
- }
- if (node.nodeType === 1 /* ElementNode */) {
- const childNodes = [...Array.from(node.childNodes), ...Array.from(((_a = node.shadowRoot) == null ? void 0 : _a.childNodes) || [])];
- childNodes.forEach((childNode) => {
- const hostRef = getHostRef(childNode);
- if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
- const cmpData = {
- nodeIds: 0
- };
- insertVNodeAnnotations(doc2, childNode, hostRef.$vnode$, docData, cmpData);
- }
- parseVNodeAnnotations(doc2, childNode, docData, orgLocationNodes);
- });
- }
- };
- var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
- if (vnode != null) {
- const hostId = ++docData.hostIds;
- hostElm.setAttribute(HYDRATE_ID, hostId);
- if (hostElm["s-cr"] != null) {
- hostElm["s-cr"].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
- }
- if (vnode.$children$ != null) {
- const depth = 0;
- vnode.$children$.forEach((vnodeChild, index) => {
- insertChildVNodeAnnotations(doc2, vnodeChild, cmpData, hostId, depth, index);
- });
- }
- if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
- const parent = hostElm.parentElement;
- if (parent && parent.childNodes) {
- const parentChildNodes = Array.from(parent.childNodes);
- const comment = parentChildNodes.find(
- (node) => node.nodeType === 8 /* CommentNode */ && node["s-sr"]
- );
- if (comment) {
- const index = parentChildNodes.indexOf(hostElm) - 1;
- vnode.$elm$.setAttribute(
- HYDRATE_CHILD_ID,
- `${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}`
- );
- }
- }
- }
- }
- };
- var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, index) => {
- const childElm = vnodeChild.$elm$;
- if (childElm == null) {
- return;
- }
- const nodeId = cmpData.nodeIds++;
- const childId = `${hostId}.${nodeId}.${depth}.${index}`;
- childElm["s-host-id"] = hostId;
- childElm["s-node-id"] = nodeId;
- if (childElm.nodeType === 1 /* ElementNode */) {
- childElm.setAttribute(HYDRATE_CHILD_ID, childId);
- } else if (childElm.nodeType === 3 /* TextNode */) {
- const parentNode = childElm.parentNode;
- const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
- if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
- const textNodeId = `${TEXT_NODE_ID}.${childId}`;
- const commentBeforeTextNode = doc2.createComment(textNodeId);
- insertBefore(parentNode, commentBeforeTextNode, childElm);
- }
- } else if (childElm.nodeType === 8 /* CommentNode */) {
- if (childElm["s-sr"]) {
- const slotName = childElm["s-sn"] || "";
- const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
- childElm.nodeValue = slotNodeId;
- }
- }
- if (vnodeChild.$children$ != null) {
- const childDepth = depth + 1;
- vnodeChild.$children$.forEach((vnode, index2) => {
- insertChildVNodeAnnotations(doc2, vnode, cmpData, hostId, childDepth, index2);
- });
- }
- };
- // src/hydrate/platform/h-async.ts
- var hAsync = (nodeName, vnodeData, ...children) => {
- if (Array.isArray(children) && children.length > 0) {
- const flatChildren = children.flat(Infinity);
- if (flatChildren.some((child) => child instanceof Promise)) {
- return Promise.all(flatChildren).then((resolvedChildren) => {
- return h(nodeName, vnodeData, ...resolvedChildren);
- }).catch((err2) => {
- return h(nodeName, vnodeData);
- });
- }
- return h(nodeName, vnodeData, ...flatChildren);
- }
- return h(nodeName, vnodeData);
- };
- function proxyHostElement(elm, cmpMeta) {
- if (typeof elm.componentOnReady !== "function") {
- elm.componentOnReady = componentOnReady$1;
- }
- if (typeof elm.forceUpdate !== "function") {
- elm.forceUpdate = forceUpdate2;
- }
- if (!elm.shadowRoot && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
- {
- elm.attachShadow({
- mode: "open",
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
- });
- }
- }
- if (cmpMeta.$members$ != null) {
- const hostRef = getHostRef(elm);
- const members = Object.entries(cmpMeta.$members$);
- members.forEach(([memberName, m]) => {
- var _a, _b;
- const memberFlags = m[0];
- if (memberFlags & 31 /* Prop */) {
- const attributeName = m[1] || memberName;
- let attrValue = elm.getAttribute(attributeName);
- if ((attrValue == null ? void 0 : attrValue.startsWith("{")) && attrValue.endsWith("}") || (attrValue == null ? void 0 : attrValue.startsWith("[")) && attrValue.endsWith("]")) {
- try {
- attrValue = JSON.parse(attrValue);
- } catch (e) {
- }
- }
- if (attrValue != null) {
- const parsedAttrValue = parsePropertyValue(attrValue, memberFlags);
- (_a = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a.set(memberName, parsedAttrValue);
- }
- const ownValue = elm[memberName];
- if (ownValue !== void 0) {
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, ownValue);
- delete elm[memberName];
- }
- Object.defineProperty(elm, memberName, {
- get() {
- return getValue(this, memberName);
- },
- set(newValue) {
- setValue(this, memberName, newValue, cmpMeta);
- },
- configurable: true,
- enumerable: true
- });
- } else if (memberFlags & 64 /* Method */) {
- Object.defineProperty(elm, memberName, {
- value(...args) {
- var _a2;
- const ref = getHostRef(this);
- return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
- var _a3;
- return (_a3 = ref == null ? void 0 : ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
- }).catch(consoleError);
- }
- });
- }
- });
- }
- }
- function componentOnReady$1() {
- var _a;
- return (_a = getHostRef(this)) == null ? void 0 : _a.$onReadyPromise$;
- }
- function forceUpdate2() {
- }
- // src/hydrate/platform/hydrate-app.ts
- function hydrateApp(win2, opts, results, afterHydrate, resolve) {
- const connectedElements = /* @__PURE__ */ new Set();
- const createdElements = /* @__PURE__ */ new Set();
- const waitingElements = /* @__PURE__ */ new Set();
- const orgDocumentCreateElement = win2.document.createElement;
- const orgDocumentCreateElementNS = win2.document.createElementNS;
- const resolved2 = Promise.resolve();
- let tmrId;
- let ranCompleted = false;
- function hydratedComplete() {
- globalThis.clearTimeout(tmrId);
- createdElements.clear();
- connectedElements.clear();
- if (!ranCompleted) {
- ranCompleted = true;
- try {
- if (opts.clientHydrateAnnotations) {
- insertVdomAnnotations(win2.document, opts.staticComponents);
- }
- win2.dispatchEvent(new win2.Event("DOMContentLoaded"));
- win2.document.createElement = orgDocumentCreateElement;
- win2.document.createElementNS = orgDocumentCreateElementNS;
- } catch (e) {
- renderCatchError(opts, results, e);
- }
- }
- afterHydrate(win2, opts, results, resolve);
- }
- function hydratedError(err2) {
- renderCatchError(opts, results, err2);
- hydratedComplete();
- }
- function timeoutExceeded() {
- hydratedError(`Hydrate exceeded timeout${waitingOnElementsMsg(waitingElements)}`);
- }
- try {
- let patchedConnectedCallback2 = function() {
- return connectElement2(this);
- }, patchElement2 = function(elm) {
- if (isValidComponent(elm, opts)) {
- const hostRef = getHostRef(elm);
- if (!hostRef) {
- const Cstr = loadModule(
- {
- $tagName$: elm.nodeName.toLowerCase(),
- $flags$: null
- });
- if (Cstr != null && Cstr.cmpMeta != null) {
- createdElements.add(elm);
- elm.connectedCallback = patchedConnectedCallback2;
- registerHost(elm, Cstr.cmpMeta);
- proxyHostElement(elm, Cstr.cmpMeta);
- }
- }
- }
- }, patchChild2 = function(elm) {
- if (elm != null && elm.nodeType === 1) {
- patchElement2(elm);
- const children = elm.children;
- for (let i2 = 0, ii = children.length; i2 < ii; i2++) {
- patchChild2(children[i2]);
- }
- }
- }, connectElement2 = function(elm) {
- createdElements.delete(elm);
- if (isValidComponent(elm, opts) && results.hydratedCount < opts.maxHydrateCount) {
- if (!connectedElements.has(elm) && shouldHydrate(elm)) {
- connectedElements.add(elm);
- return hydrateComponent.call(elm, win2, results, elm.nodeName, elm, waitingElements);
- }
- }
- return resolved2;
- }, waitLoop2 = function() {
- const toConnect = Array.from(createdElements).filter((elm) => elm.parentElement);
- if (toConnect.length > 0) {
- return Promise.all(toConnect.map(connectElement2)).then(waitLoop2);
- }
- return resolved2;
- };
- win2.document.createElement = function patchedCreateElement(tagName) {
- const elm = orgDocumentCreateElement.call(win2.document, tagName);
- patchElement2(elm);
- return elm;
- };
- win2.document.createElementNS = function patchedCreateElement(namespaceURI, tagName) {
- const elm = orgDocumentCreateElementNS.call(win2.document, namespaceURI, tagName);
- patchElement2(elm);
- return elm;
- };
- tmrId = globalThis.setTimeout(timeoutExceeded, opts.timeout);
- plt.$resourcesUrl$ = new URL(opts.resourcesUrl || "./", doc$1.baseURI).href;
- patchChild2(win2.document.body);
- waitLoop2().then(hydratedComplete).catch(hydratedError);
- } catch (e) {
- hydratedError(e);
- }
- }
- async function hydrateComponent(win2, results, tagName, elm, waitingElements) {
- tagName = tagName.toLowerCase();
- const Cstr = loadModule(
- {
- $tagName$: tagName,
- $flags$: null
- });
- if (Cstr != null) {
- const cmpMeta = Cstr.cmpMeta;
- if (cmpMeta != null) {
- waitingElements.add(elm);
- const hostRef = getHostRef(this);
- addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
- try {
- connectedCallback(elm);
- await elm.componentOnReady();
- results.hydratedCount++;
- const ref = getHostRef(elm);
- const modeName = !ref.$modeName$ ? "$" : ref.$modeName$;
- if (!results.components.some((c) => c.tag === tagName && c.mode === modeName)) {
- results.components.push({
- tag: tagName,
- mode: modeName,
- count: 0,
- depth: -1
- });
- }
- } catch (e) {
- win2.console.error(e);
- }
- waitingElements.delete(elm);
- }
- }
- }
- function isValidComponent(elm, opts) {
- if (elm != null && elm.nodeType === 1) {
- const tagName = elm.nodeName;
- if (typeof tagName === "string" && tagName.includes("-")) {
- if (opts.excludeComponents.includes(tagName.toLowerCase())) {
- return false;
- }
- return true;
- }
- }
- return false;
- }
- function shouldHydrate(elm) {
- if (elm.nodeType === 9) {
- return true;
- }
- if (NO_HYDRATE_TAGS.has(elm.nodeName)) {
- return false;
- }
- if (elm.hasAttribute("no-prerender")) {
- return false;
- }
- const parentNode = elm.parentNode;
- if (parentNode == null) {
- return true;
- }
- return shouldHydrate(parentNode);
- }
- var NO_HYDRATE_TAGS = /* @__PURE__ */ new Set([
- "CODE",
- "HEAD",
- "IFRAME",
- "INPUT",
- "OBJECT",
- "OUTPUT",
- "NOSCRIPT",
- "PRE",
- "SCRIPT",
- "SELECT",
- "STYLE",
- "TEMPLATE",
- "TEXTAREA"
- ]);
- function renderCatchError(opts, results, err2) {
- const diagnostic = {
- level: "error",
- type: "build",
- header: "Hydrate Error",
- messageText: "",
- relFilePath: void 0,
- absFilePath: void 0,
- lines: []
- };
- if (opts.url) {
- try {
- const u = new URL(opts.url);
- if (u.pathname !== "/") {
- diagnostic.header += ": " + u.pathname;
- }
- } catch (e) {
- }
- }
- if (err2 != null) {
- if (err2.stack != null) {
- diagnostic.messageText = err2.stack.toString();
- } else if (err2.message != null) {
- diagnostic.messageText = err2.message.toString();
- } else {
- diagnostic.messageText = err2.toString();
- }
- }
- results.diagnostics.push(diagnostic);
- }
- function printTag(elm) {
- let tag = `<${elm.nodeName.toLowerCase()}`;
- if (Array.isArray(elm.attributes)) {
- for (let i2 = 0; i2 < elm.attributes.length; i2++) {
- const attr = elm.attributes[i2];
- tag += ` ${attr.name}`;
- if (attr.value !== "") {
- tag += `="${attr.value}"`;
- }
- }
- }
- tag += `>`;
- return tag;
- }
- function waitingOnElementMsg(waitingElement) {
- let msg = "";
- if (waitingElement) {
- const lines = [];
- msg = " - waiting on:";
- let elm = waitingElement;
- while (elm && elm.nodeType !== 9 && elm.nodeName !== "BODY") {
- lines.unshift(printTag(elm));
- elm = elm.parentElement;
- }
- let indent = "";
- for (const ln of lines) {
- indent += " ";
- msg += `
- ${indent}${ln}`;
- }
- }
- return msg;
- }
- function waitingOnElementsMsg(waitingElements) {
- return Array.from(waitingElements).map(waitingOnElementMsg);
- }
- var cmpModules = /* @__PURE__ */ new Map();
- var getModule = (tagName) => {
- if (typeof tagName === "string") {
- tagName = tagName.toLowerCase();
- const cmpModule = cmpModules.get(tagName);
- if (cmpModule != null) {
- return cmpModule[tagName];
- }
- }
- return null;
- };
- var loadModule = (cmpMeta, _hostRef, _hmrVersionId) => {
- return getModule(cmpMeta.$tagName$);
- };
- var isMemberInElement = (elm, memberName) => {
- if (elm != null) {
- if (memberName in elm) {
- return true;
- }
- const cstr = getModule(elm.nodeName);
- if (cstr != null) {
- const hostRef = cstr;
- if (hostRef != null && hostRef.cmpMeta != null && hostRef.cmpMeta.$members$ != null) {
- return memberName in hostRef.cmpMeta.$members$;
- }
- }
- }
- return false;
- };
- var registerComponents = (Cstrs) => {
- for (const Cstr of Cstrs) {
- const exportName = Cstr.cmpMeta.$tagName$;
- cmpModules.set(exportName, {
- [exportName]: Cstr
- });
- }
- };
- var win$2 = window;
- var doc$1 = win$2.document;
- var readTask = (cb) => {
- nextTick(() => {
- try {
- cb();
- } catch (e) {
- consoleError(e);
- }
- });
- };
- var writeTask = (cb) => {
- nextTick(() => {
- try {
- cb();
- } catch (e) {
- consoleError(e);
- }
- });
- };
- var resolved = /* @__PURE__ */ Promise.resolve();
- var nextTick = (cb) => resolved.then(cb);
- var defaultConsoleError = (e) => {
- if (e != null) {
- console.error(e.stack || e.message || e);
- }
- };
- var consoleError = (e, el) => (defaultConsoleError)(e, el);
- var plt = {
- $flags$: 0,
- $resourcesUrl$: "",
- jmp: (h2) => h2(),
- raf: (h2) => requestAnimationFrame(h2),
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
- ce: (eventName, opts) => new win$2.CustomEvent(eventName, opts)
- };
- var supportsShadow = BUILD.shadowDom;
- var hostRefs = /* @__PURE__ */ new WeakMap();
- var getHostRef = (ref) => hostRefs.get(ref);
- var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
- var registerHost = (elm, cmpMeta) => {
- const hostRef = {
- $flags$: 0,
- $cmpMeta$: cmpMeta,
- $hostElement$: elm,
- $instanceValues$: /* @__PURE__ */ new Map(),
- $renderCount$: 0
- };
- hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
- hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
- elm["s-p"] = [];
- elm["s-rc"] = [];
- return hostRefs.set(elm, hostRef);
- };
- var Build = {
- isDev: false,
- isBrowser: false,
- isServer: true,
- isTesting: false
- };
- var styles = /* @__PURE__ */ new Map();
- var modeResolutionChain = [];
- // TODO(FW-2832): types
- class Config {
- constructor() {
- this.m = new Map();
- }
- reset(configObj) {
- this.m = new Map(Object.entries(configObj));
- }
- get(key, fallback) {
- const value = this.m.get(key);
- return value !== undefined ? value : fallback;
- }
- getBoolean(key, fallback = false) {
- const val = this.m.get(key);
- if (val === undefined) {
- return fallback;
- }
- if (typeof val === 'string') {
- return val === 'true';
- }
- return !!val;
- }
- getNumber(key, fallback) {
- const val = parseFloat(this.m.get(key));
- return isNaN(val) ? (fallback !== undefined ? fallback : NaN) : val;
- }
- set(key, value) {
- this.m.set(key, value);
- }
- }
- const config = /*@__PURE__*/ new Config();
- var LogLevel;
- (function (LogLevel) {
- LogLevel["OFF"] = "OFF";
- LogLevel["ERROR"] = "ERROR";
- LogLevel["WARN"] = "WARN";
- })(LogLevel || (LogLevel = {}));
- /**
- * Logs a warning to the console with an Ionic prefix
- * to indicate the library that is warning the developer.
- *
- * @param message - The string message to be logged to the console.
- */
- const printIonWarning = (message, ...params) => {
- const logLevel = config.get('logLevel', LogLevel.WARN);
- if ([LogLevel.WARN].includes(logLevel)) {
- return console.warn(`[Ionic Warning]: ${message}`, ...params);
- }
- };
- /**
- * Logs an error to the console with an Ionic prefix
- * to indicate the library that is warning the developer.
- *
- * @param message - The string message to be logged to the console.
- * @param params - Additional arguments to supply to the console.error.
- */
- const printIonError = (message, ...params) => {
- const logLevel = config.get('logLevel', LogLevel.ERROR);
- if ([LogLevel.ERROR, LogLevel.WARN].includes(logLevel)) {
- return console.error(`[Ionic Error]: ${message}`, ...params);
- }
- };
- /**
- * Prints an error informing developers that an implementation requires an element to be used
- * within a specific selector.
- *
- * @param el The web component element this is requiring the element.
- * @param targetSelectors The selector or selectors that were not found.
- */
- const printRequiredElementError = (el, ...targetSelectors) => {
- return console.error(`<${el.tagName.toLowerCase()}> must be used inside ${targetSelectors.join(' or ')}.`);
- };
- const transitionEndAsync = (el, expectedDuration = 0) => {
- return new Promise((resolve) => {
- transitionEnd(el, expectedDuration, resolve);
- });
- };
- /**
- * Allows developer to wait for a transition
- * to finish and fallback to a timer if the
- * transition is cancelled or otherwise
- * never finishes. Also see transitionEndAsync
- * which is an await-able version of this.
- */
- const transitionEnd = (el, expectedDuration = 0, callback) => {
- let unRegTrans;
- let animationTimeout;
- const opts = { passive: true };
- const ANIMATION_FALLBACK_TIMEOUT = 500;
- const unregister = () => {
- if (unRegTrans) {
- unRegTrans();
- }
- };
- const onTransitionEnd = (ev) => {
- if (ev === undefined || el === ev.target) {
- unregister();
- callback(ev);
- }
- };
- if (el) {
- el.addEventListener('webkitTransitionEnd', onTransitionEnd, opts);
- el.addEventListener('transitionend', onTransitionEnd, opts);
- animationTimeout = setTimeout(onTransitionEnd, expectedDuration + ANIMATION_FALLBACK_TIMEOUT);
- unRegTrans = () => {
- if (animationTimeout !== undefined) {
- clearTimeout(animationTimeout);
- animationTimeout = undefined;
- }
- el.removeEventListener('webkitTransitionEnd', onTransitionEnd, opts);
- el.removeEventListener('transitionend', onTransitionEnd, opts);
- };
- }
- return unregister;
- };
- /**
- * Waits for a component to be ready for
- * both custom element and non-custom element builds.
- * If non-custom element build, el.componentOnReady
- * will be used.
- * For custom element builds, we wait a frame
- * so that the inner contents of the component
- * have a chance to render.
- *
- * Use this utility rather than calling
- * el.componentOnReady yourself.
- */
- const componentOnReady = (el, callback) => {
- if (el.componentOnReady) {
- // eslint-disable-next-line custom-rules/no-component-on-ready-method
- el.componentOnReady().then((resolvedEl) => callback(resolvedEl));
- }
- else {
- raf(() => callback(el));
- }
- };
- /**
- * This functions checks if a Stencil component is using
- * the lazy loaded build of Stencil. Returns `true` if
- * the component is lazy loaded. Returns `false` otherwise.
- */
- const hasLazyBuild = (stencilEl) => {
- return stencilEl.componentOnReady !== undefined;
- };
- /**
- * Elements inside of web components sometimes need to inherit global attributes
- * set on the host. For example, the inner input in `ion-input` should inherit
- * the `title` attribute that developers set directly on `ion-input`. This
- * helper function should be called in componentWillLoad and assigned to a variable
- * that is later used in the render function.
- *
- * This does not need to be reactive as changing attributes on the host element
- * does not trigger a re-render.
- */
- const inheritAttributes$1 = (el, attributes = []) => {
- const attributeObject = {};
- attributes.forEach((attr) => {
- if (el.hasAttribute(attr)) {
- const value = el.getAttribute(attr);
- if (value !== null) {
- attributeObject[attr] = el.getAttribute(attr);
- }
- el.removeAttribute(attr);
- }
- });
- return attributeObject;
- };
- /**
- * List of available ARIA attributes + `role`.
- * Removed deprecated attributes.
- * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes
- */
- const ariaAttributes = [
- 'role',
- 'aria-activedescendant',
- 'aria-atomic',
- 'aria-autocomplete',
- 'aria-braillelabel',
- 'aria-brailleroledescription',
- 'aria-busy',
- 'aria-checked',
- 'aria-colcount',
- 'aria-colindex',
- 'aria-colindextext',
- 'aria-colspan',
- 'aria-controls',
- 'aria-current',
- 'aria-describedby',
- 'aria-description',
- 'aria-details',
- 'aria-disabled',
- 'aria-errormessage',
- 'aria-expanded',
- 'aria-flowto',
- 'aria-haspopup',
- 'aria-hidden',
- 'aria-invalid',
- 'aria-keyshortcuts',
- 'aria-label',
- 'aria-labelledby',
- 'aria-level',
- 'aria-live',
- 'aria-multiline',
- 'aria-multiselectable',
- 'aria-orientation',
- 'aria-owns',
- 'aria-placeholder',
- 'aria-posinset',
- 'aria-pressed',
- 'aria-readonly',
- 'aria-relevant',
- 'aria-required',
- 'aria-roledescription',
- 'aria-rowcount',
- 'aria-rowindex',
- 'aria-rowindextext',
- 'aria-rowspan',
- 'aria-selected',
- 'aria-setsize',
- 'aria-sort',
- 'aria-valuemax',
- 'aria-valuemin',
- 'aria-valuenow',
- 'aria-valuetext',
- ];
- /**
- * Returns an array of aria attributes that should be copied from
- * the shadow host element to a target within the light DOM.
- * @param el The element that the attributes should be copied from.
- * @param ignoreList The list of aria-attributes to ignore reflecting and removing from the host.
- * Use this in instances where we manually specify aria attributes on the `<Host>` element.
- */
- const inheritAriaAttributes = (el, ignoreList) => {
- let attributesToInherit = ariaAttributes;
- if (ignoreList && ignoreList.length > 0) {
- attributesToInherit = attributesToInherit.filter((attr) => !ignoreList.includes(attr));
- }
- return inheritAttributes$1(el, attributesToInherit);
- };
- const addEventListener$1 = (el, eventName, callback, opts) => {
- return el.addEventListener(eventName, callback, opts);
- };
- const removeEventListener = (el, eventName, callback, opts) => {
- return el.removeEventListener(eventName, callback, opts);
- };
- /**
- * Gets the root context of a shadow dom element
- * On newer browsers this will be the shadowRoot,
- * but for older browser this may just be the
- * element itself.
- *
- * Useful for whenever you need to explicitly
- * do "myElement.shadowRoot!.querySelector(...)".
- */
- const getElementRoot = (el, fallback = el) => {
- return el.shadowRoot || fallback;
- };
- /**
- * Patched version of requestAnimationFrame that avoids ngzone
- * Use only when you know ngzone should not run
- */
- const raf = (h) => {
- if (typeof __zone_symbol__requestAnimationFrame === 'function') {
- return __zone_symbol__requestAnimationFrame(h);
- }
- if (typeof requestAnimationFrame === 'function') {
- return requestAnimationFrame(h);
- }
- return setTimeout(h);
- };
- const hasShadowDom = (el) => {
- return !!el.shadowRoot && !!el.attachShadow;
- };
- const focusVisibleElement = (el) => {
- el.focus();
- /**
- * When programmatically focusing an element,
- * the focus-visible utility will not run because
- * it is expecting a keyboard event to have triggered this;
- * however, there are times when we need to manually control
- * this behavior so we call the `setFocus` method on ion-app
- * which will let us explicitly set the elements to focus.
- */
- if (el.classList.contains('ion-focusable')) {
- const app = el.closest('ion-app');
- if (app) {
- app.setFocus([el]);
- }
- }
- };
- /**
- * This method is used to add a hidden input to a host element that contains
- * a Shadow DOM. It does not add the input inside of the Shadow root which
- * allows it to be picked up inside of forms. It should contain the same
- * values as the host element.
- *
- * @param always Add a hidden input even if the container does not use Shadow
- * @param container The element where the input will be added
- * @param name The name of the input
- * @param value The value of the input
- * @param disabled If true, the input is disabled
- */
- const renderHiddenInput = (always, container, name, value, disabled) => {
- if (always || hasShadowDom(container)) {
- let input = container.querySelector('input.aux-input');
- if (!input) {
- input = container.ownerDocument.createElement('input');
- input.type = 'hidden';
- input.classList.add('aux-input');
- container.appendChild(input);
- }
- input.disabled = disabled;
- input.name = name;
- input.value = value || '';
- }
- };
- const clamp = (min, n, max) => {
- return Math.max(min, Math.min(n, max));
- };
- const assert = (actual, reason) => {
- if (!actual) {
- const message = 'ASSERT: ' + reason;
- printIonError(message);
- debugger; // eslint-disable-line
- throw new Error(message);
- }
- };
- /**
- * @hidden
- * Given a side, return if it should be on the end
- * based on the value of dir
- * @param side the side
- * @param isRTL whether the application dir is rtl
- */
- const isEndSide = (side) => {
- const isRTL = document.dir === 'rtl';
- switch (side) {
- case 'start':
- return isRTL;
- case 'end':
- return !isRTL;
- default:
- throw new Error(`"${side}" is not a valid value for [side]. Use "start" or "end" instead.`);
- }
- };
- const debounceEvent = (event, wait) => {
- const original = event._original || event;
- return {
- _original: event,
- emit: debounce(original.emit.bind(original), wait),
- };
- };
- const debounce = (func, wait = 0) => {
- let timer;
- return (...args) => {
- clearTimeout(timer);
- timer = setTimeout(func, wait, ...args);
- };
- };
- /**
- * Check whether the two string maps are shallow equal.
- *
- * undefined is treated as an empty map.
- *
- * @returns whether the keys are the same and the values are shallow equal.
- */
- const shallowEqualStringMap = (map1, map2) => {
- map1 !== null && map1 !== void 0 ? map1 : (map1 = {});
- map2 !== null && map2 !== void 0 ? map2 : (map2 = {});
- if (map1 === map2) {
- return true;
- }
- const keys1 = Object.keys(map1);
- if (keys1.length !== Object.keys(map2).length) {
- return false;
- }
- for (const k1 of keys1) {
- if (!(k1 in map2)) {
- return false;
- }
- if (map1[k1] !== map2[k1]) {
- return false;
- }
- }
- return true;
- };
- /**
- * Checks input for usable number. Not NaN and not Infinite.
- */
- const isSafeNumber = (input) => {
- return typeof input === 'number' && !isNaN(input) && isFinite(input);
- };
- /* Ionicons v7.2.2, ES Modules */
- const arrowBackSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='square' stroke-miterlimit='10' stroke-width='48' d='M244 400L100 256l144-144M120 256h292' class='ionicon-fill-none'/></svg>";
- const arrowDown = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M112 268l144 144 144-144M256 392V100' class='ionicon-fill-none'/></svg>";
- const caretBackSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M368 64L144 256l224 192V64z'/></svg>";
- const caretDownSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M64 144l192 224 192-224H64z'/></svg>";
- const caretUpSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M448 368L256 144 64 368h384z'/></svg>";
- const checkmarkOutline = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' d='M416 128L192 384l-96-96' class='ionicon-fill-none ionicon-stroke-width'/></svg>";
- const chevronBack = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M328 112L184 256l144 144' class='ionicon-fill-none'/></svg>";
- const chevronDown = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M112 184l144 144 144-144' class='ionicon-fill-none'/></svg>";
- const chevronExpand = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M136 208l120-104 120 104M136 304l120 104 120-104' stroke-width='48' stroke-linecap='round' stroke-linejoin='round' class='ionicon-fill-none'/></svg>";
- const chevronForward = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M184 112l144 144-144 144' class='ionicon-fill-none'/></svg>";
- const chevronForwardOutline = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M184 112l144 144-144 144' class='ionicon-fill-none'/></svg>";
- const close = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M289.94 256l95-95A24 24 0 00351 127l-95 95-95-95a24 24 0 00-34 34l95 95-95 95a24 24 0 1034 34l95-95 95 95a24 24 0 0034-34z'/></svg>";
- const closeCircle = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm75.31 260.69a16 16 0 11-22.62 22.62L256 278.63l-52.69 52.68a16 16 0 01-22.62-22.62L233.37 256l-52.68-52.69a16 16 0 0122.62-22.62L256 233.37l52.69-52.68a16 16 0 0122.62 22.62L278.63 256z'/></svg>";
- const closeSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M400 145.49L366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256 400 145.49z'/></svg>";
- const ellipseOutline = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><circle cx='256' cy='256' r='192' stroke-linecap='round' stroke-linejoin='round' class='ionicon-fill-none ionicon-stroke-width'/></svg>";
- const ellipsisHorizontal = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><circle cx='256' cy='256' r='48'/><circle cx='416' cy='256' r='48'/><circle cx='96' cy='256' r='48'/></svg>";
- const eye = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><circle cx='256' cy='256' r='64'/><path d='M490.84 238.6c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.66 96c-42.52 0-84.33 12.15-124.27 36.11-40.73 24.43-77.63 60.12-109.68 106.07a31.92 31.92 0 00-.64 35.54c26.41 41.33 60.4 76.14 98.28 100.65C162 402 207.9 416 255.66 416c46.71 0 93.81-14.43 136.2-41.72 38.46-24.77 72.72-59.66 99.08-100.92a32.2 32.2 0 00-.1-34.76zM256 352a96 96 0 1196-96 96.11 96.11 0 01-96 96z'/></svg>";
- const eyeOff = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M432 448a15.92 15.92 0 01-11.31-4.69l-352-352a16 16 0 0122.62-22.62l352 352A16 16 0 01432 448zM248 315.85l-51.79-51.79a2 2 0 00-3.39 1.69 64.11 64.11 0 0053.49 53.49 2 2 0 001.69-3.39zM264 196.15L315.87 248a2 2 0 003.4-1.69 64.13 64.13 0 00-53.55-53.55 2 2 0 00-1.72 3.39z'/><path d='M491 273.36a32.2 32.2 0 00-.1-34.76c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.68 96a226.54 226.54 0 00-71.82 11.79 4 4 0 00-1.56 6.63l47.24 47.24a4 4 0 003.82 1.05 96 96 0 01116 116 4 4 0 001.05 3.81l67.95 68a4 4 0 005.4.24 343.81 343.81 0 0067.24-77.4zM256 352a96 96 0 01-93.3-118.63 4 4 0 00-1.05-3.81l-66.84-66.87a4 4 0 00-5.41-.23c-24.39 20.81-47 46.13-67.67 75.72a31.92 31.92 0 00-.64 35.54c26.41 41.33 60.39 76.14 98.28 100.65C162.06 402 207.92 416 255.68 416a238.22 238.22 0 0072.64-11.55 4 4 0 001.61-6.64l-47.47-47.46a4 4 0 00-3.81-1.05A96 96 0 01256 352z'/></svg>";
- const menuOutline = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-miterlimit='10' d='M80 160h352M80 256h352M80 352h352' class='ionicon-fill-none ionicon-stroke-width'/></svg>";
- const menuSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M64 384h384v-42.67H64zm0-106.67h384v-42.66H64zM64 128v42.67h384V128z'/></svg>";
- const removeOutline = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' d='M400 256H112' class='ionicon-fill-none ionicon-stroke-width'/></svg>";
- const reorderThreeOutline = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='round' stroke-linejoin='round' d='M96 256h320M96 176h320M96 336h320' class='ionicon-fill-none ionicon-stroke-width'/></svg>";
- const reorderTwoSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path stroke-linecap='square' stroke-linejoin='round' stroke-width='44' d='M118 304h276M118 208h276' class='ionicon-fill-none'/></svg>";
- const searchOutline = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z' stroke-miterlimit='10' class='ionicon-fill-none ionicon-stroke-width'/><path stroke-linecap='round' stroke-miterlimit='10' d='M338.29 338.29L448 448' class='ionicon-fill-none ionicon-stroke-width'/></svg>";
- const searchSharp = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path d='M464 428L339.92 303.9a160.48 160.48 0 0030.72-94.58C370.64 120.37 298.27 48 209.32 48S48 120.37 48 209.32s72.37 161.32 161.32 161.32a160.48 160.48 0 0094.58-30.72L428 464zM209.32 319.69a110.38 110.38 0 11110.37-110.37 110.5 110.5 0 01-110.37 110.37z'/></svg>";
- const getPlatforms = (win) => setupPlatforms(win);
- const isPlatform = (winOrPlatform, platform) => {
- if (typeof winOrPlatform === 'string') {
- platform = winOrPlatform;
- winOrPlatform = undefined;
- }
- return getPlatforms(winOrPlatform).includes(platform);
- };
- const setupPlatforms = (win = window) => {
- if (typeof win === 'undefined') {
- return [];
- }
- win.Ionic = win.Ionic || {};
- let platforms = win.Ionic.platforms;
- if (platforms == null) {
- platforms = win.Ionic.platforms = detectPlatforms(win);
- platforms.forEach((p) => win.document.documentElement.classList.add(`plt-${p}`));
- }
- return platforms;
- };
- const detectPlatforms = (win) => {
- const customPlatformMethods = config.get('platform');
- return Object.keys(PLATFORMS_MAP).filter((p) => {
- const customMethod = customPlatformMethods === null || customPlatformMethods === void 0 ? void 0 : customPlatformMethods[p];
- return typeof customMethod === 'function' ? customMethod(win) : PLATFORMS_MAP[p](win);
- });
- };
- const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
- const isIpad = (win) => {
- // iOS 12 and below
- if (testUserAgent(win, /iPad/i)) {
- return true;
- }
- // iOS 13+
- if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
- return true;
- }
- return false;
- };
- const isIphone = (win) => testUserAgent(win, /iPhone/i);
- const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
- const isAndroid = (win) => testUserAgent(win, /android|sink/i);
- const isAndroidTablet = (win) => {
- return isAndroid(win) && !testUserAgent(win, /mobile/i);
- };
- const isPhablet = (win) => {
- const width = win.innerWidth;
- const height = win.innerHeight;
- const smallest = Math.min(width, height);
- const largest = Math.max(width, height);
- return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
- };
- const isTablet = (win) => {
- const width = win.innerWidth;
- const height = win.innerHeight;
- const smallest = Math.min(width, height);
- const largest = Math.max(width, height);
- return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);
- };
- const isMobile = (win) => matchMedia$1(win, '(any-pointer:coarse)');
- const isDesktop = (win) => !isMobile(win);
- const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
- const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
- const isCapacitorNative = (win) => {
- const capacitor = win['Capacitor'];
- // TODO(ROU-11693): Remove when we no longer support Capacitor 2, which does not have isNativePlatform
- return !!((capacitor === null || capacitor === void 0 ? void 0 : capacitor.isNative) || ((capacitor === null || capacitor === void 0 ? void 0 : capacitor.isNativePlatform) && !!capacitor.isNativePlatform()));
- };
- const isElectron = (win) => testUserAgent(win, /electron/i);
- const isPWA = (win) => { var _a; return !!(((_a = win.matchMedia) === null || _a === void 0 ? void 0 : _a.call(win, '(display-mode: standalone)').matches) || win.navigator.standalone); };
- const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
- const matchMedia$1 = (win, query) => { var _a; return (_a = win.matchMedia) === null || _a === void 0 ? void 0 : _a.call(win, query).matches; };
- const PLATFORMS_MAP = {
- ipad: isIpad,
- iphone: isIphone,
- ios: isIOS,
- android: isAndroid,
- phablet: isPhablet,
- tablet: isTablet,
- cordova: isCordova,
- capacitor: isCapacitorNative,
- electron: isElectron,
- pwa: isPWA,
- mobile: isMobile,
- mobileweb: isMobileWeb,
- desktop: isDesktop,
- hybrid: isHybrid,
- };
- // TODO(FW-2832): types
- let defaultMode;
- const getIonMode$1 = (ref) => {
- return (ref && getMode(ref)) || defaultMode;
- };
- const accordionIosCss = ":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host(.accordion-next) ::slotted(ion-item[slot=header]){--border-width:0.55px 0px 0.55px 0px}";
- var IonAccordionIosStyle0 = accordionIosCss;
- const accordionMdCss = ":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}";
- var IonAccordionMdStyle0 = accordionMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot header - Content is placed at the top and is used to
- * expand or collapse the accordion item.
- * @slot content - Content is placed below the header and is
- * shown or hidden based on expanded state.
- *
- * @part header - The wrapper element for the header slot.
- * @part content - The wrapper element for the content slot.
- * @part expanded - The expanded element. Can be used in combination
- * with the `header` and `content` parts (i.e. `::part(header expanded)`).
- */
- class Accordion {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.updateListener = () => this.updateState(false);
- this.setItemDefaults = () => {
- const ionItem = this.getSlottedHeaderIonItem();
- if (!ionItem) {
- return;
- }
- /**
- * For a11y purposes, we make
- * the ion-item a button so users
- * can tab to it and use keyboard
- * navigation to get around.
- */
- ionItem.button = true;
- ionItem.detail = false;
- /**
- * By default, the lines in an
- * item should be full here, but
- * only do that if a user has
- * not explicitly overridden them
- */
- if (ionItem.lines === undefined) {
- ionItem.lines = 'full';
- }
- };
- this.getSlottedHeaderIonItem = () => {
- const { headerEl } = this;
- if (!headerEl) {
- return;
- }
- /**
- * Get the first ion-item
- * slotted in the header slot
- */
- const slot = headerEl.querySelector('slot');
- if (!slot) {
- return;
- }
- // This is not defined in unit tests
- if (slot.assignedElements === undefined)
- return;
- return slot.assignedElements().find((el) => el.tagName === 'ION-ITEM');
- };
- this.setAria = (expanded = false) => {
- const ionItem = this.getSlottedHeaderIonItem();
- if (!ionItem) {
- return;
- }
- /**
- * Get the native <button> element inside of
- * ion-item because that is what will be focused
- */
- const root = getElementRoot(ionItem);
- const button = root.querySelector('button');
- if (!button) {
- return;
- }
- button.setAttribute('aria-expanded', `${expanded}`);
- };
- this.slotToggleIcon = () => {
- const ionItem = this.getSlottedHeaderIonItem();
- if (!ionItem) {
- return;
- }
- const { toggleIconSlot, toggleIcon } = this;
- /**
- * Check if there already is a toggle icon.
- * If so, do not add another one.
- */
- const existingToggleIcon = ionItem.querySelector('.ion-accordion-toggle-icon');
- if (existingToggleIcon) {
- return;
- }
- const iconEl = document.createElement('ion-icon');
- iconEl.slot = toggleIconSlot;
- iconEl.lazy = false;
- iconEl.classList.add('ion-accordion-toggle-icon');
- iconEl.icon = toggleIcon;
- iconEl.setAttribute('aria-hidden', 'true');
- ionItem.appendChild(iconEl);
- };
- this.expandAccordion = (initialUpdate = false) => {
- const { contentEl, contentElWrapper } = this;
- if (initialUpdate || contentEl === undefined || contentElWrapper === undefined) {
- this.state = 4 /* AccordionState.Expanded */;
- return;
- }
- if (this.state === 4 /* AccordionState.Expanded */) {
- return;
- }
- if (this.currentRaf !== undefined) {
- cancelAnimationFrame(this.currentRaf);
- }
- if (this.shouldAnimate()) {
- raf(() => {
- this.state = 8 /* AccordionState.Expanding */;
- this.currentRaf = raf(async () => {
- const contentHeight = contentElWrapper.offsetHeight;
- const waitForTransition = transitionEndAsync(contentEl, 2000);
- contentEl.style.setProperty('max-height', `${contentHeight}px`);
- await waitForTransition;
- this.state = 4 /* AccordionState.Expanded */;
- contentEl.style.removeProperty('max-height');
- });
- });
- }
- else {
- this.state = 4 /* AccordionState.Expanded */;
- }
- };
- this.collapseAccordion = (initialUpdate = false) => {
- const { contentEl } = this;
- if (initialUpdate || contentEl === undefined) {
- this.state = 1 /* AccordionState.Collapsed */;
- return;
- }
- if (this.state === 1 /* AccordionState.Collapsed */) {
- return;
- }
- if (this.currentRaf !== undefined) {
- cancelAnimationFrame(this.currentRaf);
- }
- if (this.shouldAnimate()) {
- this.currentRaf = raf(async () => {
- const contentHeight = contentEl.offsetHeight;
- contentEl.style.setProperty('max-height', `${contentHeight}px`);
- raf(async () => {
- const waitForTransition = transitionEndAsync(contentEl, 2000);
- this.state = 2 /* AccordionState.Collapsing */;
- await waitForTransition;
- this.state = 1 /* AccordionState.Collapsed */;
- contentEl.style.removeProperty('max-height');
- });
- });
- }
- else {
- this.state = 1 /* AccordionState.Collapsed */;
- }
- };
- /**
- * Helper function to determine if
- * something should animate.
- * If prefers-reduced-motion is set
- * then we should not animate, regardless
- * of what is set in the config.
- */
- this.shouldAnimate = () => {
- if (typeof window === 'undefined') {
- return false;
- }
- const prefersReducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
- if (prefersReducedMotion) {
- return false;
- }
- const animated = config.get('animated', true);
- if (!animated) {
- return false;
- }
- if (this.accordionGroupEl && !this.accordionGroupEl.animated) {
- return false;
- }
- return true;
- };
- this.updateState = async (initialUpdate = false) => {
- const accordionGroup = this.accordionGroupEl;
- const accordionValue = this.value;
- if (!accordionGroup) {
- return;
- }
- const value = accordionGroup.value;
- const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
- if (shouldExpand) {
- this.expandAccordion(initialUpdate);
- this.isNext = this.isPrevious = false;
- }
- else {
- this.collapseAccordion(initialUpdate);
- /**
- * When using popout or inset,
- * the collapsed accordion items
- * may need additional border radius
- * applied. Check to see if the
- * next or previous accordion is selected.
- */
- const nextAccordion = this.getNextSibling();
- const nextAccordionValue = nextAccordion === null || nextAccordion === void 0 ? void 0 : nextAccordion.value;
- if (nextAccordionValue !== undefined) {
- this.isPrevious = Array.isArray(value) ? value.includes(nextAccordionValue) : value === nextAccordionValue;
- }
- const previousAccordion = this.getPreviousSibling();
- const previousAccordionValue = previousAccordion === null || previousAccordion === void 0 ? void 0 : previousAccordion.value;
- if (previousAccordionValue !== undefined) {
- this.isNext = Array.isArray(value) ? value.includes(previousAccordionValue) : value === previousAccordionValue;
- }
- }
- };
- this.getNextSibling = () => {
- if (!this.el) {
- return;
- }
- const nextSibling = this.el.nextElementSibling;
- if ((nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.tagName) !== 'ION-ACCORDION') {
- return;
- }
- return nextSibling;
- };
- this.getPreviousSibling = () => {
- if (!this.el) {
- return;
- }
- const previousSibling = this.el.previousElementSibling;
- if ((previousSibling === null || previousSibling === void 0 ? void 0 : previousSibling.tagName) !== 'ION-ACCORDION') {
- return;
- }
- return previousSibling;
- };
- this.state = 1 /* AccordionState.Collapsed */;
- this.isNext = false;
- this.isPrevious = false;
- this.value = `ion-accordion-${accordionIds++}`;
- this.disabled = false;
- this.readonly = false;
- this.toggleIcon = chevronDown;
- this.toggleIconSlot = 'end';
- }
- valueChanged() {
- this.updateState();
- }
- connectedCallback() {
- var _a;
- const accordionGroupEl = (this.accordionGroupEl = (_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('ion-accordion-group'));
- if (accordionGroupEl) {
- this.updateState(true);
- addEventListener$1(accordionGroupEl, 'ionValueChange', this.updateListener);
- }
- }
- disconnectedCallback() {
- const accordionGroupEl = this.accordionGroupEl;
- if (accordionGroupEl) {
- removeEventListener(accordionGroupEl, 'ionValueChange', this.updateListener);
- }
- }
- componentDidLoad() {
- this.setItemDefaults();
- this.slotToggleIcon();
- /**
- * We need to wait a tick because we
- * just set ionItem.button = true and
- * the button has not have been rendered yet.
- */
- raf(() => {
- /**
- * Set aria label on button inside of ion-item
- * once the inner content has been rendered.
- */
- const expanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
- this.setAria(expanded);
- });
- }
- toggleExpanded() {
- const { accordionGroupEl, disabled, readonly, value, state } = this;
- if (disabled || readonly)
- return;
- if (accordionGroupEl) {
- /**
- * Because the accordion group may or may
- * not allow multiple accordions open, we
- * need to request the toggling of this
- * accordion and the accordion group will
- * make the decision on whether or not
- * to allow it.
- */
- const expand = state === 1 /* AccordionState.Collapsed */ || state === 2 /* AccordionState.Collapsing */;
- accordionGroupEl.requestAccordionToggle(value, expand);
- }
- }
- render() {
- const { disabled, readonly } = this;
- const mode = getIonMode$1(this);
- const expanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
- const headerPart = expanded ? 'header expanded' : 'header';
- const contentPart = expanded ? 'content expanded' : 'content';
- this.setAria(expanded);
- return (hAsync(Host, { key: '073e1d02c18dcbc20c68648426e87c14750c031d', class: {
- [mode]: true,
- 'accordion-expanding': this.state === 8 /* AccordionState.Expanding */,
- 'accordion-expanded': this.state === 4 /* AccordionState.Expanded */,
- 'accordion-collapsing': this.state === 2 /* AccordionState.Collapsing */,
- 'accordion-collapsed': this.state === 1 /* AccordionState.Collapsed */,
- 'accordion-next': this.isNext,
- 'accordion-previous': this.isPrevious,
- 'accordion-disabled': disabled,
- 'accordion-readonly': readonly,
- 'accordion-animated': this.shouldAnimate(),
- } }, hAsync("div", { key: '9b4cf326de8bb6b4033992903c0c1bfd7eea9bcc', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, hAsync("slot", { key: '464c32a37f64655eacf4218284214f5f30b14a1e', name: "header" })), hAsync("div", { key: '8bb52e6a62d7de0106b253201a89a32e79d9a594', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, hAsync("div", { key: '1d9dfd952ad493754aaeea7a8f625b33c2dd90a0', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, hAsync("slot", { key: '970dfbc55a612d739d0ca3b7b1a08e5c96d0c479', name: "content" })))));
- }
- static get delegatesFocus() { return true; }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["valueChanged"]
- }; }
- static get style() { return {
- ios: IonAccordionIosStyle0,
- md: IonAccordionMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 57,
- "$tagName$": "ion-accordion",
- "$members$": {
- "value": [1],
- "disabled": [4],
- "readonly": [4],
- "toggleIcon": [1, "toggle-icon"],
- "toggleIconSlot": [1, "toggle-icon-slot"],
- "state": [32],
- "isNext": [32],
- "isPrevious": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- let accordionIds = 0;
- const accordionGroupIosCss = ":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){border-bottom:none}";
- var IonAccordionGroupIosStyle0 = accordionGroupIosCss;
- const accordionGroupMdCss = ":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion){-webkit-box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){margin-left:0;margin-right:0;margin-top:16px;margin-bottom:16px;border-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-previous){border-end-end-radius:6px;border-end-start-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-next){border-start-start-radius:6px;border-start-end-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion):first-of-type{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
- var IonAccordionGroupMdStyle0 = accordionGroupMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class AccordionGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionValueChange = createEvent(this, "ionValueChange", 7);
- this.animated = true;
- this.multiple = undefined;
- this.value = undefined;
- this.disabled = false;
- this.readonly = false;
- this.expand = 'compact';
- }
- valueChanged() {
- const { value, multiple } = this;
- if (!multiple && Array.isArray(value)) {
- /**
- * We do some processing on the `value` array so
- * that it looks more like an array when logged to
- * the console.
- * Example given ['a', 'b']
- * Default toString() behavior: a,b
- * Custom behavior: ['a', 'b']
- */
- printIonWarning(`[ion-accordion-group] - An array of values was passed, but multiple is "false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
- Value Passed: [${value.map((v) => `'${v}'`).join(', ')}]
- `, this.el);
- }
- /**
- * Do not use `value` here as that will be
- * not account for the adjustment we make above.
- */
- this.ionValueChange.emit({ value: this.value });
- }
- async disabledChanged() {
- const { disabled } = this;
- const accordions = await this.getAccordions();
- for (const accordion of accordions) {
- accordion.disabled = disabled;
- }
- }
- async readonlyChanged() {
- const { readonly } = this;
- const accordions = await this.getAccordions();
- for (const accordion of accordions) {
- accordion.readonly = readonly;
- }
- }
- async onKeydown(ev) {
- const activeElement = document.activeElement;
- if (!activeElement) {
- return;
- }
- /**
- * Make sure focus is in the header, not the body, of the accordion. This ensures
- * that if there are any interactable elements in the body, their keyboard
- * interaction doesn't get stolen by the accordion. Example: using up/down keys
- * in ion-textarea.
- */
- const activeAccordionHeader = activeElement.closest('ion-accordion [slot="header"]');
- if (!activeAccordionHeader) {
- return;
- }
- const accordionEl = activeElement.tagName === 'ION-ACCORDION' ? activeElement : activeElement.closest('ion-accordion');
- if (!accordionEl) {
- return;
- }
- const closestGroup = accordionEl.closest('ion-accordion-group');
- if (closestGroup !== this.el) {
- return;
- }
- // If the active accordion is not in the current array of accordions, do not do anything
- const accordions = await this.getAccordions();
- const startingIndex = accordions.findIndex((a) => a === accordionEl);
- if (startingIndex === -1) {
- return;
- }
- let accordion;
- if (ev.key === 'ArrowDown') {
- accordion = this.findNextAccordion(accordions, startingIndex);
- }
- else if (ev.key === 'ArrowUp') {
- accordion = this.findPreviousAccordion(accordions, startingIndex);
- }
- else if (ev.key === 'Home') {
- accordion = accordions[0];
- }
- else if (ev.key === 'End') {
- accordion = accordions[accordions.length - 1];
- }
- if (accordion !== undefined && accordion !== activeElement) {
- accordion.focus();
- }
- }
- async componentDidLoad() {
- if (this.disabled) {
- this.disabledChanged();
- }
- if (this.readonly) {
- this.readonlyChanged();
- }
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.valueChanged();
- }
- /**
- * Sets the value property and emits ionChange.
- * This should only be called when the user interacts
- * with the accordion and not for any update
- * to the value property. The exception is when
- * the app sets the value of a single-select
- * accordion group to an array.
- */
- setValue(accordionValue) {
- const value = (this.value = accordionValue);
- this.ionChange.emit({ value });
- }
- /**
- * This method is used to ensure that the value
- * of ion-accordion-group is being set in a valid
- * way. This method should only be called in
- * response to a user generated action.
- * @internal
- */
- async requestAccordionToggle(accordionValue, accordionExpand) {
- const { multiple, value, readonly, disabled } = this;
- if (readonly || disabled) {
- return;
- }
- if (accordionExpand) {
- /**
- * If group accepts multiple values
- * check to see if value is already in
- * in values array. If not, add it
- * to the array.
- */
- if (multiple) {
- const groupValue = value !== null && value !== void 0 ? value : [];
- const processedValue = Array.isArray(groupValue) ? groupValue : [groupValue];
- const valueExists = processedValue.find((v) => v === accordionValue);
- if (valueExists === undefined && accordionValue !== undefined) {
- this.setValue([...processedValue, accordionValue]);
- }
- }
- else {
- this.setValue(accordionValue);
- }
- }
- else {
- /**
- * If collapsing accordion, either filter the value
- * out of the values array or unset the value.
- */
- if (multiple) {
- const groupValue = value !== null && value !== void 0 ? value : [];
- const processedValue = Array.isArray(groupValue) ? groupValue : [groupValue];
- this.setValue(processedValue.filter((v) => v !== accordionValue));
- }
- else {
- this.setValue(undefined);
- }
- }
- }
- findNextAccordion(accordions, startingIndex) {
- const nextAccordion = accordions[startingIndex + 1];
- if (nextAccordion === undefined) {
- return accordions[0];
- }
- return nextAccordion;
- }
- findPreviousAccordion(accordions, startingIndex) {
- const prevAccordion = accordions[startingIndex - 1];
- if (prevAccordion === undefined) {
- return accordions[accordions.length - 1];
- }
- return prevAccordion;
- }
- /**
- * @internal
- */
- async getAccordions() {
- return Array.from(this.el.querySelectorAll(':scope > ion-accordion'));
- }
- render() {
- const { disabled, readonly, expand } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'd1a79a93179474fbba66fcf11a92f4871dacc975', class: {
- [mode]: true,
- 'accordion-group-disabled': disabled,
- 'accordion-group-readonly': readonly,
- [`accordion-group-expand-${expand}`]: true,
- }, role: "presentation" }, hAsync("slot", { key: 'e6b8954b686d1fbb4fc92adb07fddc97a24b0a31' })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["valueChanged"],
- "disabled": ["disabledChanged"],
- "readonly": ["readonlyChanged"]
- }; }
- static get style() { return {
- ios: IonAccordionGroupIosStyle0,
- md: IonAccordionGroupMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-accordion-group",
- "$members$": {
- "animated": [4],
- "multiple": [4],
- "value": [1025],
- "disabled": [4],
- "readonly": [4],
- "expand": [1],
- "requestAccordionToggle": [64],
- "getAccordions": [64]
- },
- "$listeners$": [[0, "keydown", "onKeydown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const win$1 = typeof window !== 'undefined' ? window : undefined;
- const doc = typeof document !== 'undefined' ? document : undefined;
- const getCapacitor = () => {
- if (win$1 !== undefined) {
- return win$1.Capacitor;
- }
- return undefined;
- };
- var ImpactStyle;
- (function (ImpactStyle) {
- /**
- * A collision between large, heavy user interface elements
- *
- * @since 1.0.0
- */
- ImpactStyle["Heavy"] = "HEAVY";
- /**
- * A collision between moderately sized user interface elements
- *
- * @since 1.0.0
- */
- ImpactStyle["Medium"] = "MEDIUM";
- /**
- * A collision between small, light user interface elements
- *
- * @since 1.0.0
- */
- ImpactStyle["Light"] = "LIGHT";
- })(ImpactStyle || (ImpactStyle = {}));
- var NotificationType;
- (function (NotificationType) {
- /**
- * A notification feedback type indicating that a task has completed successfully
- *
- * @since 1.0.0
- */
- NotificationType["Success"] = "SUCCESS";
- /**
- * A notification feedback type indicating that a task has produced a warning
- *
- * @since 1.0.0
- */
- NotificationType["Warning"] = "WARNING";
- /**
- * A notification feedback type indicating that a task has failed
- *
- * @since 1.0.0
- */
- NotificationType["Error"] = "ERROR";
- })(NotificationType || (NotificationType = {}));
- const HapticEngine = {
- getEngine() {
- const capacitor = getCapacitor();
- if (capacitor === null || capacitor === void 0 ? void 0 : capacitor.isPluginAvailable('Haptics')) {
- // Capacitor
- return capacitor.Plugins.Haptics;
- }
- return undefined;
- },
- available() {
- const engine = this.getEngine();
- if (!engine) {
- return false;
- }
- const capacitor = getCapacitor();
- /**
- * Developers can manually import the
- * Haptics plugin in their app which will cause
- * getEngine to return the Haptics engine. However,
- * the Haptics engine will throw an error if
- * used in a web browser that does not support
- * the Vibrate API. This check avoids that error
- * if the browser does not support the Vibrate API.
- */
- if ((capacitor === null || capacitor === void 0 ? void 0 : capacitor.getPlatform()) === 'web') {
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- return typeof navigator !== 'undefined' && navigator.vibrate !== undefined;
- }
- return true;
- },
- impact(options) {
- const engine = this.getEngine();
- if (!engine) {
- return;
- }
- engine.impact({ style: options.style });
- },
- notification(options) {
- const engine = this.getEngine();
- if (!engine) {
- return;
- }
- engine.notification({ type: options.type });
- },
- selection() {
- this.impact({ style: ImpactStyle.Light });
- },
- selectionStart() {
- const engine = this.getEngine();
- if (!engine) {
- return;
- }
- engine.selectionStart();
- },
- selectionChanged() {
- const engine = this.getEngine();
- if (!engine) {
- return;
- }
- engine.selectionChanged();
- },
- selectionEnd() {
- const engine = this.getEngine();
- if (!engine) {
- return;
- }
- engine.selectionEnd();
- },
- };
- /**
- * Check to see if the Haptic Plugin is available
- * @return Returns `true` or false if the plugin is available
- */
- const hapticAvailable = () => {
- return HapticEngine.available();
- };
- /**
- * Trigger a selection changed haptic event. Good for one-time events
- * (not for gestures)
- */
- const hapticSelection = () => {
- hapticAvailable() && HapticEngine.selection();
- };
- /**
- * Tell the haptic engine that a gesture for a selection change is starting.
- */
- const hapticSelectionStart = () => {
- hapticAvailable() && HapticEngine.selectionStart();
- };
- /**
- * Tell the haptic engine that a selection changed during a gesture.
- */
- const hapticSelectionChanged = () => {
- hapticAvailable() && HapticEngine.selectionChanged();
- };
- /**
- * Tell the haptic engine we are done with a gesture. This needs to be
- * called lest resources are not properly recycled.
- */
- const hapticSelectionEnd = () => {
- hapticAvailable() && HapticEngine.selectionEnd();
- };
- /**
- * Use this to indicate success/failure/warning to the user.
- * options should be of the type `{ style: ImpactStyle.LIGHT }` (or `MEDIUM`/`HEAVY`)
- */
- const hapticImpact = (options) => {
- hapticAvailable() && HapticEngine.impact(options);
- };
- class GestureController {
- constructor() {
- this.gestureId = 0;
- this.requestedStart = new Map();
- this.disabledGestures = new Map();
- this.disabledScroll = new Set();
- }
- /**
- * Creates a gesture delegate based on the GestureConfig passed
- */
- createGesture(config) {
- var _a;
- return new GestureDelegate(this, this.newID(), config.name, (_a = config.priority) !== null && _a !== void 0 ? _a : 0, !!config.disableScroll);
- }
- /**
- * Creates a blocker that will block any other gesture events from firing. Set in the ion-gesture component.
- */
- createBlocker(opts = {}) {
- return new BlockerDelegate(this, this.newID(), opts.disable, !!opts.disableScroll);
- }
- start(gestureName, id, priority) {
- if (!this.canStart(gestureName)) {
- this.requestedStart.delete(id);
- return false;
- }
- this.requestedStart.set(id, priority);
- return true;
- }
- capture(gestureName, id, priority) {
- if (!this.start(gestureName, id, priority)) {
- return false;
- }
- const requestedStart = this.requestedStart;
- let maxPriority = -10000;
- requestedStart.forEach((value) => {
- maxPriority = Math.max(maxPriority, value);
- });
- if (maxPriority === priority) {
- this.capturedId = id;
- requestedStart.clear();
- const event = new CustomEvent('ionGestureCaptured', { detail: { gestureName } });
- document.dispatchEvent(event);
- return true;
- }
- requestedStart.delete(id);
- return false;
- }
- release(id) {
- this.requestedStart.delete(id);
- if (this.capturedId === id) {
- this.capturedId = undefined;
- }
- }
- disableGesture(gestureName, id) {
- let set = this.disabledGestures.get(gestureName);
- if (set === undefined) {
- set = new Set();
- this.disabledGestures.set(gestureName, set);
- }
- set.add(id);
- }
- enableGesture(gestureName, id) {
- const set = this.disabledGestures.get(gestureName);
- if (set !== undefined) {
- set.delete(id);
- }
- }
- disableScroll(id) {
- this.disabledScroll.add(id);
- if (this.disabledScroll.size === 1) {
- document.body.classList.add(BACKDROP_NO_SCROLL);
- }
- }
- enableScroll(id) {
- this.disabledScroll.delete(id);
- if (this.disabledScroll.size === 0) {
- document.body.classList.remove(BACKDROP_NO_SCROLL);
- }
- }
- canStart(gestureName) {
- if (this.capturedId !== undefined) {
- // a gesture already captured
- return false;
- }
- if (this.isDisabled(gestureName)) {
- return false;
- }
- return true;
- }
- isCaptured() {
- return this.capturedId !== undefined;
- }
- isScrollDisabled() {
- return this.disabledScroll.size > 0;
- }
- isDisabled(gestureName) {
- const disabled = this.disabledGestures.get(gestureName);
- if (disabled && disabled.size > 0) {
- return true;
- }
- return false;
- }
- newID() {
- this.gestureId++;
- return this.gestureId;
- }
- }
- class GestureDelegate {
- constructor(ctrl, id, name, priority, disableScroll) {
- this.id = id;
- this.name = name;
- this.disableScroll = disableScroll;
- this.priority = priority * 1000000 + id;
- this.ctrl = ctrl;
- }
- canStart() {
- if (!this.ctrl) {
- return false;
- }
- return this.ctrl.canStart(this.name);
- }
- start() {
- if (!this.ctrl) {
- return false;
- }
- return this.ctrl.start(this.name, this.id, this.priority);
- }
- capture() {
- if (!this.ctrl) {
- return false;
- }
- const captured = this.ctrl.capture(this.name, this.id, this.priority);
- if (captured && this.disableScroll) {
- this.ctrl.disableScroll(this.id);
- }
- return captured;
- }
- release() {
- if (this.ctrl) {
- this.ctrl.release(this.id);
- if (this.disableScroll) {
- this.ctrl.enableScroll(this.id);
- }
- }
- }
- destroy() {
- this.release();
- this.ctrl = undefined;
- }
- }
- class BlockerDelegate {
- constructor(ctrl, id, disable, disableScroll) {
- this.id = id;
- this.disable = disable;
- this.disableScroll = disableScroll;
- this.ctrl = ctrl;
- }
- block() {
- if (!this.ctrl) {
- return;
- }
- if (this.disable) {
- for (const gesture of this.disable) {
- this.ctrl.disableGesture(gesture, this.id);
- }
- }
- if (this.disableScroll) {
- this.ctrl.disableScroll(this.id);
- }
- }
- unblock() {
- if (!this.ctrl) {
- return;
- }
- if (this.disable) {
- for (const gesture of this.disable) {
- this.ctrl.enableGesture(gesture, this.id);
- }
- }
- if (this.disableScroll) {
- this.ctrl.enableScroll(this.id);
- }
- }
- destroy() {
- this.unblock();
- this.ctrl = undefined;
- }
- }
- const BACKDROP_NO_SCROLL = 'backdrop-no-scroll';
- const GESTURE_CONTROLLER = new GestureController();
- const addEventListener = (el, // TODO(FW-2832): type
- eventName, callback, opts) => {
- // use event listener options when supported
- // otherwise it's just a boolean for the "capture" arg
- const listenerOpts = supportsPassive(el)
- ? {
- capture: !!opts.capture,
- passive: !!opts.passive,
- }
- : !!opts.capture;
- let add;
- let remove;
- if (el['__zone_symbol__addEventListener']) {
- add = '__zone_symbol__addEventListener';
- remove = '__zone_symbol__removeEventListener';
- }
- else {
- add = 'addEventListener';
- remove = 'removeEventListener';
- }
- el[add](eventName, callback, listenerOpts);
- return () => {
- el[remove](eventName, callback, listenerOpts);
- };
- };
- const supportsPassive = (node) => {
- if (_sPassive === undefined) {
- try {
- const opts = Object.defineProperty({}, 'passive', {
- get: () => {
- _sPassive = true;
- },
- });
- node.addEventListener('optsTest', () => {
- return;
- }, opts);
- }
- catch (e) {
- _sPassive = false;
- }
- }
- return !!_sPassive;
- };
- let _sPassive;
- const MOUSE_WAIT = 2000;
- // TODO(FW-2832): types
- const createPointerEvents = (el, pointerDown, pointerMove, pointerUp, options) => {
- let rmTouchStart;
- let rmTouchMove;
- let rmTouchEnd;
- let rmTouchCancel;
- let rmMouseStart;
- let rmMouseMove;
- let rmMouseUp;
- let lastTouchEvent = 0;
- const handleTouchStart = (ev) => {
- lastTouchEvent = Date.now() + MOUSE_WAIT;
- if (!pointerDown(ev)) {
- return;
- }
- if (!rmTouchMove && pointerMove) {
- rmTouchMove = addEventListener(el, 'touchmove', pointerMove, options);
- }
- /**
- * Events are dispatched on the element that is tapped and bubble up to
- * the reference element in the gesture. In the event that the element this
- * event was first dispatched on is removed from the DOM, the event will no
- * longer bubble up to our reference element. This leaves the gesture in an
- * unusable state. To account for this, the touchend and touchcancel listeners
- * should be added to the event target so that they still fire even if the target
- * is removed from the DOM.
- */
- if (!rmTouchEnd) {
- rmTouchEnd = addEventListener(ev.target, 'touchend', handleTouchEnd, options);
- }
- if (!rmTouchCancel) {
- rmTouchCancel = addEventListener(ev.target, 'touchcancel', handleTouchEnd, options);
- }
- };
- const handleMouseDown = (ev) => {
- if (lastTouchEvent > Date.now()) {
- return;
- }
- if (!pointerDown(ev)) {
- return;
- }
- if (!rmMouseMove && pointerMove) {
- rmMouseMove = addEventListener(getDocument(el), 'mousemove', pointerMove, options);
- }
- if (!rmMouseUp) {
- rmMouseUp = addEventListener(getDocument(el), 'mouseup', handleMouseUp, options);
- }
- };
- const handleTouchEnd = (ev) => {
- stopTouch();
- if (pointerUp) {
- pointerUp(ev);
- }
- };
- const handleMouseUp = (ev) => {
- stopMouse();
- if (pointerUp) {
- pointerUp(ev);
- }
- };
- const stopTouch = () => {
- if (rmTouchMove) {
- rmTouchMove();
- }
- if (rmTouchEnd) {
- rmTouchEnd();
- }
- if (rmTouchCancel) {
- rmTouchCancel();
- }
- rmTouchMove = rmTouchEnd = rmTouchCancel = undefined;
- };
- const stopMouse = () => {
- if (rmMouseMove) {
- rmMouseMove();
- }
- if (rmMouseUp) {
- rmMouseUp();
- }
- rmMouseMove = rmMouseUp = undefined;
- };
- const stop = () => {
- stopTouch();
- stopMouse();
- };
- const enable = (isEnabled = true) => {
- if (!isEnabled) {
- if (rmTouchStart) {
- rmTouchStart();
- }
- if (rmMouseStart) {
- rmMouseStart();
- }
- rmTouchStart = rmMouseStart = undefined;
- stop();
- }
- else {
- if (!rmTouchStart) {
- rmTouchStart = addEventListener(el, 'touchstart', handleTouchStart, options);
- }
- if (!rmMouseStart) {
- rmMouseStart = addEventListener(el, 'mousedown', handleMouseDown, options);
- }
- }
- };
- const destroy = () => {
- enable(false);
- pointerUp = pointerMove = pointerDown = undefined;
- };
- return {
- enable,
- stop,
- destroy,
- };
- };
- const getDocument = (node) => {
- return node instanceof Document ? node : node.ownerDocument;
- };
- const createPanRecognizer = (direction, thresh, maxAngle) => {
- const radians = maxAngle * (Math.PI / 180);
- const isDirX = direction === 'x';
- const maxCosine = Math.cos(radians);
- const threshold = thresh * thresh;
- let startX = 0;
- let startY = 0;
- let dirty = false;
- let isPan = 0;
- return {
- start(x, y) {
- startX = x;
- startY = y;
- isPan = 0;
- dirty = true;
- },
- detect(x, y) {
- if (!dirty) {
- return false;
- }
- const deltaX = x - startX;
- const deltaY = y - startY;
- const distance = deltaX * deltaX + deltaY * deltaY;
- if (distance < threshold) {
- return false;
- }
- const hypotenuse = Math.sqrt(distance);
- const cosine = (isDirX ? deltaX : deltaY) / hypotenuse;
- if (cosine > maxCosine) {
- isPan = 1;
- }
- else if (cosine < -maxCosine) {
- isPan = -1;
- }
- else {
- isPan = 0;
- }
- dirty = false;
- return true;
- },
- isGesture() {
- return isPan !== 0;
- },
- getDirection() {
- return isPan;
- },
- };
- };
- // TODO(FW-2832): types
- const createGesture = (config) => {
- let hasCapturedPan = false;
- let hasStartedPan = false;
- let hasFiredStart = true;
- let isMoveQueued = false;
- const finalConfig = Object.assign({ disableScroll: false, direction: 'x', gesturePriority: 0, passive: true, maxAngle: 40, threshold: 10 }, config);
- const canStart = finalConfig.canStart;
- const onWillStart = finalConfig.onWillStart;
- const onStart = finalConfig.onStart;
- const onEnd = finalConfig.onEnd;
- const notCaptured = finalConfig.notCaptured;
- const onMove = finalConfig.onMove;
- const threshold = finalConfig.threshold;
- const passive = finalConfig.passive;
- const blurOnStart = finalConfig.blurOnStart;
- const detail = {
- type: 'pan',
- startX: 0,
- startY: 0,
- startTime: 0,
- currentX: 0,
- currentY: 0,
- velocityX: 0,
- velocityY: 0,
- deltaX: 0,
- deltaY: 0,
- currentTime: 0,
- event: undefined,
- data: undefined,
- };
- const pan = createPanRecognizer(finalConfig.direction, finalConfig.threshold, finalConfig.maxAngle);
- const gesture = GESTURE_CONTROLLER.createGesture({
- name: config.gestureName,
- priority: config.gesturePriority,
- disableScroll: config.disableScroll,
- });
- const pointerDown = (ev) => {
- const timeStamp = now(ev);
- if (hasStartedPan || !hasFiredStart) {
- return false;
- }
- updateDetail(ev, detail);
- detail.startX = detail.currentX;
- detail.startY = detail.currentY;
- detail.startTime = detail.currentTime = timeStamp;
- detail.velocityX = detail.velocityY = detail.deltaX = detail.deltaY = 0;
- detail.event = ev;
- // Check if gesture can start
- if (canStart && canStart(detail) === false) {
- return false;
- }
- // Release fallback
- gesture.release();
- // Start gesture
- if (!gesture.start()) {
- return false;
- }
- hasStartedPan = true;
- if (threshold === 0) {
- return tryToCapturePan();
- }
- pan.start(detail.startX, detail.startY);
- return true;
- };
- const pointerMove = (ev) => {
- // fast path, if gesture is currently captured
- // do minimum job to get user-land even dispatched
- if (hasCapturedPan) {
- if (!isMoveQueued && hasFiredStart) {
- isMoveQueued = true;
- calcGestureData(detail, ev);
- requestAnimationFrame(fireOnMove);
- }
- return;
- }
- // gesture is currently being detected
- calcGestureData(detail, ev);
- if (pan.detect(detail.currentX, detail.currentY)) {
- if (!pan.isGesture() || !tryToCapturePan()) {
- abortGesture();
- }
- }
- };
- const fireOnMove = () => {
- // Since fireOnMove is called inside a RAF, onEnd() might be called,
- // we must double check hasCapturedPan
- if (!hasCapturedPan) {
- return;
- }
- isMoveQueued = false;
- if (onMove) {
- onMove(detail);
- }
- };
- const tryToCapturePan = () => {
- if (!gesture.capture()) {
- return false;
- }
- hasCapturedPan = true;
- hasFiredStart = false;
- // reset start position since the real user-land event starts here
- // If the pan detector threshold is big, not resetting the start position
- // will cause a jump in the animation equal to the detector threshold.
- // the array of positions used to calculate the gesture velocity does not
- // need to be cleaned, more points in the positions array always results in a
- // more accurate value of the velocity.
- detail.startX = detail.currentX;
- detail.startY = detail.currentY;
- detail.startTime = detail.currentTime;
- if (onWillStart) {
- onWillStart(detail).then(fireOnStart);
- }
- else {
- fireOnStart();
- }
- return true;
- };
- const blurActiveElement = () => {
- if (typeof document !== 'undefined') {
- const activeElement = document.activeElement;
- if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur) {
- activeElement.blur();
- }
- }
- };
- const fireOnStart = () => {
- if (blurOnStart) {
- blurActiveElement();
- }
- if (onStart) {
- onStart(detail);
- }
- hasFiredStart = true;
- };
- const reset = () => {
- hasCapturedPan = false;
- hasStartedPan = false;
- isMoveQueued = false;
- hasFiredStart = true;
- gesture.release();
- };
- // END *************************
- const pointerUp = (ev) => {
- const tmpHasCaptured = hasCapturedPan;
- const tmpHasFiredStart = hasFiredStart;
- reset();
- if (!tmpHasFiredStart) {
- return;
- }
- calcGestureData(detail, ev);
- // Try to capture press
- if (tmpHasCaptured) {
- if (onEnd) {
- onEnd(detail);
- }
- return;
- }
- // Not captured any event
- if (notCaptured) {
- notCaptured(detail);
- }
- };
- const pointerEvents = createPointerEvents(finalConfig.el, pointerDown, pointerMove, pointerUp, {
- capture: false,
- passive,
- });
- const abortGesture = () => {
- reset();
- pointerEvents.stop();
- if (notCaptured) {
- notCaptured(detail);
- }
- };
- return {
- enable(enable = true) {
- if (!enable) {
- if (hasCapturedPan) {
- pointerUp(undefined);
- }
- reset();
- }
- pointerEvents.enable(enable);
- },
- destroy() {
- gesture.destroy();
- pointerEvents.destroy();
- },
- };
- };
- const calcGestureData = (detail, ev) => {
- if (!ev) {
- return;
- }
- const prevX = detail.currentX;
- const prevY = detail.currentY;
- const prevT = detail.currentTime;
- updateDetail(ev, detail);
- const currentX = detail.currentX;
- const currentY = detail.currentY;
- const timestamp = (detail.currentTime = now(ev));
- const timeDelta = timestamp - prevT;
- if (timeDelta > 0 && timeDelta < 100) {
- const velocityX = (currentX - prevX) / timeDelta;
- const velocityY = (currentY - prevY) / timeDelta;
- detail.velocityX = velocityX * 0.7 + detail.velocityX * 0.3;
- detail.velocityY = velocityY * 0.7 + detail.velocityY * 0.3;
- }
- detail.deltaX = currentX - detail.startX;
- detail.deltaY = currentY - detail.startY;
- detail.event = ev;
- };
- const updateDetail = (ev, detail) => {
- // get X coordinates for either a mouse click
- // or a touch depending on the given event
- let x = 0;
- let y = 0;
- if (ev) {
- const changedTouches = ev.changedTouches;
- if (changedTouches && changedTouches.length > 0) {
- const touch = changedTouches[0];
- x = touch.clientX;
- y = touch.clientY;
- }
- else if (ev.pageX !== undefined) {
- x = ev.pageX;
- y = ev.pageY;
- }
- }
- detail.currentX = x;
- detail.currentY = y;
- };
- const now = (ev) => {
- return ev.timeStamp || Date.now();
- };
- var index = /*#__PURE__*/Object.freeze({
- __proto__: null,
- createGesture: createGesture,
- GESTURE_CONTROLLER: GESTURE_CONTROLLER
- });
- const createButtonActiveGesture = (el, isButton) => {
- let currentTouchedButton;
- let initialTouchedButton;
- const activateButtonAtPoint = (x, y, hapticFeedbackFn) => {
- if (typeof document === 'undefined') {
- return;
- }
- const target = document.elementFromPoint(x, y);
- if (!target || !isButton(target) || target.disabled) {
- clearActiveButton();
- return;
- }
- if (target !== currentTouchedButton) {
- clearActiveButton();
- setActiveButton(target, hapticFeedbackFn);
- }
- };
- const setActiveButton = (button, hapticFeedbackFn) => {
- currentTouchedButton = button;
- if (!initialTouchedButton) {
- initialTouchedButton = currentTouchedButton;
- }
- const buttonToModify = currentTouchedButton;
- writeTask(() => buttonToModify.classList.add('ion-activated'));
- hapticFeedbackFn();
- };
- const clearActiveButton = (dispatchClick = false) => {
- if (!currentTouchedButton) {
- return;
- }
- const buttonToModify = currentTouchedButton;
- writeTask(() => buttonToModify.classList.remove('ion-activated'));
- /**
- * Clicking on one button, but releasing on another button
- * does not dispatch a click event in browsers, so we
- * need to do it manually here. Some browsers will
- * dispatch a click if clicking on one button, dragging over
- * another button, and releasing on the original button. In that
- * case, we need to make sure we do not cause a double click there.
- */
- if (dispatchClick && initialTouchedButton !== currentTouchedButton) {
- currentTouchedButton.click();
- }
- currentTouchedButton = undefined;
- };
- return createGesture({
- el,
- gestureName: 'buttonActiveDrag',
- threshold: 0,
- onStart: (ev) => activateButtonAtPoint(ev.currentX, ev.currentY, hapticSelectionStart),
- onMove: (ev) => activateButtonAtPoint(ev.currentX, ev.currentY, hapticSelectionChanged),
- onEnd: () => {
- clearActiveButton(true);
- hapticSelectionEnd();
- initialTouchedButton = undefined;
- },
- });
- };
- /**
- * Creates a lock controller.
- *
- * Claiming a lock means that nothing else can acquire the lock until it is released.
- * This can momentarily prevent execution of code that needs to wait for the earlier code to finish.
- * For example, this can be used to prevent multiple transitions from occurring at the same time.
- */
- const createLockController = () => {
- let waitPromise;
- /**
- * When lock() is called, the lock is claimed.
- * Once a lock has been claimed, it cannot be claimed again until it is released.
- * When this function gets resolved, the lock is released, allowing it to be claimed again.
- *
- * @example ```tsx
- * const unlock = await this.lockController.lock();
- * // do other stuff
- * unlock();
- * ```
- */
- const lock = async () => {
- const p = waitPromise;
- let resolve;
- waitPromise = new Promise((r) => (resolve = r));
- if (p !== undefined) {
- await p;
- }
- return resolve;
- };
- return {
- lock,
- };
- };
- /**
- * This query string selects elements that
- * are eligible to receive focus. We select
- * interactive elements that meet the following
- * criteria:
- * 1. Element does not have a negative tabindex
- * 2. Element does not have `hidden`
- * 3. Element does not have `disabled` for non-Ionic components.
- * 4. Element does not have `disabled` or `disabled="true"` for Ionic components.
- * Note: We need this distinction because `disabled="false"` is
- * valid usage for the disabled property on ion-button.
- */
- const focusableQueryString = '[tabindex]:not([tabindex^="-"]):not([hidden]):not([disabled]), input:not([type=hidden]):not([tabindex^="-"]):not([hidden]):not([disabled]), textarea:not([tabindex^="-"]):not([hidden]):not([disabled]), button:not([tabindex^="-"]):not([hidden]):not([disabled]), select:not([tabindex^="-"]):not([hidden]):not([disabled]), ion-checkbox:not([tabindex^="-"]):not([hidden]):not([disabled]), ion-radio:not([tabindex^="-"]):not([hidden]):not([disabled]), .ion-focusable:not([tabindex^="-"]):not([hidden]):not([disabled]), .ion-focusable[disabled="false"]:not([tabindex^="-"]):not([hidden])';
- /**
- * Focuses the first descendant in a context
- * that can receive focus. If none exists,
- * a fallback element will be focused.
- * This fallback is typically an ancestor
- * container such as a menu or overlay so focus does not
- * leave the container we are trying to trap focus in.
- *
- * If no fallback is specified then we focus the container itself.
- */
- const focusFirstDescendant = (ref, fallbackElement) => {
- const firstInput = ref.querySelector(focusableQueryString);
- focusElementInContext(firstInput, fallbackElement !== null && fallbackElement !== void 0 ? fallbackElement : ref);
- };
- /**
- * Focuses the last descendant in a context
- * that can receive focus. If none exists,
- * a fallback element will be focused.
- * This fallback is typically an ancestor
- * container such as a menu or overlay so focus does not
- * leave the container we are trying to trap focus in.
- *
- * If no fallback is specified then we focus the container itself.
- */
- const focusLastDescendant = (ref, fallbackElement) => {
- const inputs = Array.from(ref.querySelectorAll(focusableQueryString));
- const lastInput = inputs.length > 0 ? inputs[inputs.length - 1] : null;
- focusElementInContext(lastInput, fallbackElement !== null && fallbackElement !== void 0 ? fallbackElement : ref);
- };
- /**
- * Focuses a particular element in a context. If the element
- * doesn't have anything focusable associated with it then
- * a fallback element will be focused.
- *
- * This fallback is typically an ancestor
- * container such as a menu or overlay so focus does not
- * leave the container we are trying to trap focus in.
- * This should be used instead of the focus() method
- * on most elements because the focusable element
- * may not be the host element.
- *
- * For example, if an ion-button should be focused
- * then we should actually focus the native <button>
- * element inside of ion-button's shadow root, not
- * the host element itself.
- */
- const focusElementInContext = (hostToFocus, fallbackElement) => {
- let elementToFocus = hostToFocus;
- const shadowRoot = hostToFocus === null || hostToFocus === void 0 ? void 0 : hostToFocus.shadowRoot;
- if (shadowRoot) {
- // If there are no inner focusable elements, just focus the host element.
- elementToFocus = shadowRoot.querySelector(focusableQueryString) || hostToFocus;
- }
- if (elementToFocus) {
- const radioGroup = elementToFocus.closest('ion-radio-group');
- if (radioGroup) {
- radioGroup.setFocus();
- }
- else {
- focusVisibleElement(elementToFocus);
- }
- }
- else {
- // Focus fallback element instead of letting focus escape
- fallbackElement.focus();
- }
- };
- /**
- * CloseWatcher is a newer API that lets
- * use detect the hardware back button event
- * in a web browser: https://caniuse.com/?search=closewatcher
- * However, not every browser supports it yet.
- *
- * This needs to be a function so that we can
- * check the config once it has been set.
- * Otherwise, this code would be evaluated the
- * moment this file is evaluated which could be
- * before the config is set.
- */
- const shouldUseCloseWatcher = () => config.get('experimentalCloseWatcher', false) && win$1 !== undefined && 'CloseWatcher' in win$1;
- const OVERLAY_BACK_BUTTON_PRIORITY = 100;
- const MENU_BACK_BUTTON_PRIORITY = 99; // 1 less than overlay priority since menu is displayed behind overlays
- // TODO(FW-2832): types
- const attachComponent = async (delegate, container, component, cssClasses, componentProps, inline) => {
- var _a;
- if (delegate) {
- return delegate.attachViewToDom(container, component, componentProps, cssClasses);
- }
- if (!inline && typeof component !== 'string' && !(component instanceof HTMLElement)) {
- throw new Error('framework delegate is missing');
- }
- const el = typeof component === 'string' ? (_a = container.ownerDocument) === null || _a === void 0 ? void 0 : _a.createElement(component) : component;
- if (cssClasses) {
- cssClasses.forEach((c) => el.classList.add(c));
- }
- if (componentProps) {
- Object.assign(el, componentProps);
- }
- container.appendChild(el);
- await new Promise((resolve) => componentOnReady(el, resolve));
- return el;
- };
- const detachComponent = (delegate, element) => {
- if (element) {
- if (delegate) {
- const container = element.parentElement;
- return delegate.removeViewFromDom(container, element);
- }
- element.remove();
- }
- return Promise.resolve();
- };
- const CoreDelegate = () => {
- let BaseComponent;
- let Reference;
- const attachViewToDom = async (parentElement, userComponent, userComponentProps = {}, cssClasses = []) => {
- var _a, _b;
- BaseComponent = parentElement;
- let ChildComponent;
- /**
- * If passing in a component via the `component` props
- * we need to append it inside of our overlay component.
- */
- if (userComponent) {
- /**
- * If passing in the tag name, create
- * the element otherwise just get a reference
- * to the component.
- */
- const el = typeof userComponent === 'string' ? (_a = BaseComponent.ownerDocument) === null || _a === void 0 ? void 0 : _a.createElement(userComponent) : userComponent;
- /**
- * Add any css classes passed in
- * via the cssClasses prop on the overlay.
- */
- cssClasses.forEach((c) => el.classList.add(c));
- /**
- * Add any props passed in
- * via the componentProps prop on the overlay.
- */
- Object.assign(el, userComponentProps);
- /**
- * Finally, append the component
- * inside of the overlay component.
- */
- BaseComponent.appendChild(el);
- ChildComponent = el;
- await new Promise((resolve) => componentOnReady(el, resolve));
- }
- else if (BaseComponent.children.length > 0 &&
- (BaseComponent.tagName === 'ION-MODAL' || BaseComponent.tagName === 'ION-POPOVER')) {
- /**
- * The delegate host wrapper el is only needed for modals and popovers
- * because they allow the dev to provide custom content to the overlay.
- */
- const root = (ChildComponent = BaseComponent.children[0]);
- if (!root.classList.contains('ion-delegate-host')) {
- /**
- * If the root element is not a delegate host, it means
- * that the overlay has not been presented yet and we need
- * to create the containing element with the specified classes.
- */
- const el = (_b = BaseComponent.ownerDocument) === null || _b === void 0 ? void 0 : _b.createElement('div');
- // Add a class to track if the root element was created by the delegate.
- el.classList.add('ion-delegate-host');
- cssClasses.forEach((c) => el.classList.add(c));
- // Move each child from the original template to the new parent element.
- el.append(...BaseComponent.children);
- // Append the new parent element to the original parent element.
- BaseComponent.appendChild(el);
- /**
- * Update the ChildComponent to be the
- * newly created div in the event that one
- * does not already exist.
- */
- ChildComponent = el;
- }
- }
- /**
- * Get the root of the app and
- * add the overlay there.
- */
- const app = document.querySelector('ion-app') || document.body;
- /**
- * Create a placeholder comment so that
- * we can return this component to where
- * it was previously.
- */
- Reference = document.createComment('ionic teleport');
- BaseComponent.parentNode.insertBefore(Reference, BaseComponent);
- app.appendChild(BaseComponent);
- /**
- * We return the child component rather than the overlay
- * reference itself since modal and popover will
- * use this to wait for any Ionic components in the child view
- * to be ready (i.e. componentOnReady) when using the
- * lazy loaded component bundle.
- *
- * However, we fall back to returning BaseComponent
- * in the event that a modal or popover is presented
- * with no child content.
- */
- return ChildComponent !== null && ChildComponent !== void 0 ? ChildComponent : BaseComponent;
- };
- const removeViewFromDom = () => {
- /**
- * Return component to where it was previously in the DOM.
- */
- if (BaseComponent && Reference) {
- Reference.parentNode.insertBefore(BaseComponent, Reference);
- Reference.remove();
- }
- return Promise.resolve();
- };
- return { attachViewToDom, removeViewFromDom };
- };
- let lastOverlayIndex = 0;
- let lastId = 0;
- const activeAnimations = new WeakMap();
- const createController = (tagName) => {
- return {
- create(options) {
- return createOverlay(tagName, options);
- },
- dismiss(data, role, id) {
- return dismissOverlay(document, data, role, tagName, id);
- },
- async getTop() {
- return getPresentedOverlay(document, tagName);
- },
- };
- };
- const alertController = /*@__PURE__*/ createController('ion-alert');
- const actionSheetController = /*@__PURE__*/ createController('ion-action-sheet');
- const modalController = /*@__PURE__*/ createController('ion-modal');
- const popoverController = /*@__PURE__*/ createController('ion-popover');
- /**
- * Prepares the overlay element to be presented.
- */
- const prepareOverlay = (el) => {
- if (typeof document !== 'undefined') {
- /**
- * Adds a single instance of event listeners for application behaviors:
- *
- * - Escape Key behavior to dismiss an overlay
- * - Trapping focus within an overlay
- * - Back button behavior to dismiss an overlay
- *
- * This only occurs when the first overlay is created.
- */
- connectListeners(document);
- }
- const overlayIndex = lastOverlayIndex++;
- /**
- * overlayIndex is used in the overlay components to set a zIndex.
- * This ensures that the most recently presented overlay will be
- * on top.
- */
- el.overlayIndex = overlayIndex;
- };
- /**
- * Assigns an incrementing id to an overlay element, that does not
- * already have an id assigned to it.
- *
- * Used to track unique instances of an overlay element.
- */
- const setOverlayId = (el) => {
- if (!el.hasAttribute('id')) {
- el.id = `ion-overlay-${++lastId}`;
- }
- return el.id;
- };
- const createOverlay = (tagName, opts) => {
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined') {
- return window.customElements.whenDefined(tagName).then(() => {
- const element = document.createElement(tagName);
- element.classList.add('overlay-hidden');
- /**
- * Convert the passed in overlay options into props
- * that get passed down into the new overlay.
- */
- Object.assign(element, Object.assign(Object.assign({}, opts), { hasController: true }));
- // append the overlay element to the document body
- getAppRoot(document).appendChild(element);
- return new Promise((resolve) => componentOnReady(element, resolve));
- });
- }
- return Promise.resolve();
- };
- const isOverlayHidden = (overlay) => overlay.classList.contains('overlay-hidden');
- /**
- * Focuses a particular element in an overlay. If the element
- * doesn't have anything focusable associated with it then
- * the overlay itself will be focused.
- * This should be used instead of the focus() method
- * on most elements because the focusable element
- * may not be the host element.
- *
- * For example, if an ion-button should be focused
- * then we should actually focus the native <button>
- * element inside of ion-button's shadow root, not
- * the host element itself.
- */
- const focusElementInOverlay = (hostToFocus, overlay) => {
- let elementToFocus = hostToFocus;
- const shadowRoot = hostToFocus === null || hostToFocus === void 0 ? void 0 : hostToFocus.shadowRoot;
- if (shadowRoot) {
- // If there are no inner focusable elements, just focus the host element.
- elementToFocus = shadowRoot.querySelector(focusableQueryString) || hostToFocus;
- }
- if (elementToFocus) {
- focusVisibleElement(elementToFocus);
- }
- else {
- // Focus overlay instead of letting focus escape
- overlay.focus();
- }
- };
- /**
- * Traps keyboard focus inside of overlay components.
- * Based on https://w3c.github.io/aria-practices/examples/dialog-modal/alertdialog.html
- * This includes the following components: Action Sheet, Alert, Loading, Modal,
- * Picker, and Popover.
- * Should NOT include: Toast
- */
- const trapKeyboardFocus = (ev, doc) => {
- const lastOverlay = getPresentedOverlay(doc, 'ion-alert,ion-action-sheet,ion-loading,ion-modal,ion-picker-legacy,ion-popover');
- const target = ev.target;
- /**
- * If no active overlay, ignore this event.
- *
- * If this component uses the shadow dom,
- * this global listener is pointless
- * since it will not catch the focus
- * traps as they are inside the shadow root.
- * We need to add a listener to the shadow root
- * itself to ensure the focus trap works.
- */
- if (!lastOverlay || !target) {
- return;
- }
- /**
- * If the ion-disable-focus-trap class
- * is present on an overlay, then this component
- * instance has opted out of focus trapping.
- * An example of this is when the sheet modal
- * has a backdrop that is disabled. The content
- * behind the sheet should be focusable until
- * the backdrop is enabled.
- */
- if (lastOverlay.classList.contains(FOCUS_TRAP_DISABLE_CLASS)) {
- return;
- }
- const trapScopedFocus = () => {
- /**
- * If we are focusing the overlay, clear
- * the last focused element so that hitting
- * tab activates the first focusable element
- * in the overlay wrapper.
- */
- if (lastOverlay === target) {
- lastOverlay.lastFocus = undefined;
- /**
- * Toasts can be presented from an overlay.
- * However, focus should still be returned to
- * the overlay when clicking a toast. Normally,
- * focus would be returned to the last focusable
- * descendant in the overlay which may not always be
- * the button that the toast was presented from. In this case,
- * the focus may be returned to an unexpected element.
- * To account for this, we make sure to return focus to the
- * last focused element in the overlay if focus is
- * moved to the toast.
- */
- }
- else if (target.tagName === 'ION-TOAST') {
- focusElementInOverlay(lastOverlay.lastFocus, lastOverlay);
- /**
- * Otherwise, we must be focusing an element
- * inside of the overlay. The two possible options
- * here are an input/button/etc or the ion-focus-trap
- * element. The focus trap element is used to prevent
- * the keyboard focus from leaving the overlay when
- * using Tab or screen assistants.
- */
- }
- else {
- /**
- * We do not want to focus the traps, so get the overlay
- * wrapper element as the traps live outside of the wrapper.
- */
- const overlayRoot = getElementRoot(lastOverlay);
- if (!overlayRoot.contains(target)) {
- return;
- }
- const overlayWrapper = overlayRoot.querySelector('.ion-overlay-wrapper');
- if (!overlayWrapper) {
- return;
- }
- /**
- * If the target is inside the wrapper, let the browser
- * focus as normal and keep a log of the last focused element.
- * Additionally, if the backdrop was tapped we should not
- * move focus back inside the wrapper as that could cause
- * an interactive elements focus state to activate.
- */
- if (overlayWrapper.contains(target) || target === overlayRoot.querySelector('ion-backdrop')) {
- lastOverlay.lastFocus = target;
- }
- else {
- /**
- * Otherwise, we must have focused one of the focus traps.
- * We need to wrap the focus to either the first element
- * or the last element.
- */
- /**
- * Once we call `focusFirstDescendant` and focus the first
- * descendant, another focus event will fire which will
- * cause `lastOverlay.lastFocus` to be updated before
- * we can run the code after that. We will cache the value
- * here to avoid that.
- */
- const lastFocus = lastOverlay.lastFocus;
- // Focus the first element in the overlay wrapper
- focusFirstDescendant(overlayWrapper, lastOverlay);
- /**
- * If the cached last focused element is the
- * same as the active element, then we need
- * to wrap focus to the last descendant. This happens
- * when the first descendant is focused, and the user
- * presses Shift + Tab. The previous line will focus
- * the same descendant again (the first one), causing
- * last focus to equal the active element.
- */
- if (lastFocus === doc.activeElement) {
- focusLastDescendant(overlayWrapper, lastOverlay);
- }
- lastOverlay.lastFocus = doc.activeElement;
- }
- }
- };
- const trapShadowFocus = () => {
- /**
- * If the target is inside the wrapper, let the browser
- * focus as normal and keep a log of the last focused element.
- */
- if (lastOverlay.contains(target)) {
- lastOverlay.lastFocus = target;
- /**
- * Toasts can be presented from an overlay.
- * However, focus should still be returned to
- * the overlay when clicking a toast. Normally,
- * focus would be returned to the last focusable
- * descendant in the overlay which may not always be
- * the button that the toast was presented from. In this case,
- * the focus may be returned to an unexpected element.
- * To account for this, we make sure to return focus to the
- * last focused element in the overlay if focus is
- * moved to the toast.
- */
- }
- else if (target.tagName === 'ION-TOAST') {
- focusElementInOverlay(lastOverlay.lastFocus, lastOverlay);
- }
- else {
- /**
- * Otherwise, we are about to have focus
- * go out of the overlay. We need to wrap
- * the focus to either the first element
- * or the last element.
- */
- /**
- * Once we call `focusFirstDescendant` and focus the first
- * descendant, another focus event will fire which will
- * cause `lastOverlay.lastFocus` to be updated before
- * we can run the code after that. We will cache the value
- * here to avoid that.
- */
- const lastFocus = lastOverlay.lastFocus;
- // Focus the first element in the overlay wrapper
- focusFirstDescendant(lastOverlay);
- /**
- * If the cached last focused element is the
- * same as the active element, then we need
- * to wrap focus to the last descendant. This happens
- * when the first descendant is focused, and the user
- * presses Shift + Tab. The previous line will focus
- * the same descendant again (the first one), causing
- * last focus to equal the active element.
- */
- if (lastFocus === doc.activeElement) {
- focusLastDescendant(lastOverlay);
- }
- lastOverlay.lastFocus = doc.activeElement;
- }
- };
- if (lastOverlay.shadowRoot) {
- trapShadowFocus();
- }
- else {
- trapScopedFocus();
- }
- };
- const connectListeners = (doc) => {
- if (lastOverlayIndex === 0) {
- lastOverlayIndex = 1;
- doc.addEventListener('focus', (ev) => {
- trapKeyboardFocus(ev, doc);
- }, true);
- // handle back-button click
- doc.addEventListener('ionBackButton', (ev) => {
- const lastOverlay = getPresentedOverlay(doc);
- if (lastOverlay === null || lastOverlay === void 0 ? void 0 : lastOverlay.backdropDismiss) {
- ev.detail.register(OVERLAY_BACK_BUTTON_PRIORITY, () => {
- /**
- * Do not return this promise otherwise
- * the hardware back button utility will
- * be blocked until the overlay dismisses.
- * This is important for a modal with canDismiss.
- * If the application presents a confirmation alert
- * in the "canDismiss" callback, then it will be impossible
- * to use the hardware back button to dismiss the alert
- * dialog because the hardware back button utility
- * is blocked on waiting for the modal to dismiss.
- */
- lastOverlay.dismiss(undefined, BACKDROP);
- });
- }
- });
- /**
- * Handle ESC to close overlay.
- * CloseWatcher also handles pressing the Esc
- * key, so if a browser supports CloseWatcher then
- * this behavior will be handled via the ionBackButton
- * event.
- */
- if (!shouldUseCloseWatcher()) {
- doc.addEventListener('keydown', (ev) => {
- if (ev.key === 'Escape') {
- const lastOverlay = getPresentedOverlay(doc);
- if (lastOverlay === null || lastOverlay === void 0 ? void 0 : lastOverlay.backdropDismiss) {
- lastOverlay.dismiss(undefined, BACKDROP);
- }
- }
- });
- }
- }
- };
- const dismissOverlay = (doc, data, role, overlayTag, id) => {
- const overlay = getPresentedOverlay(doc, overlayTag, id);
- if (!overlay) {
- return Promise.reject('overlay does not exist');
- }
- return overlay.dismiss(data, role);
- };
- /**
- * Returns a list of all overlays in the DOM even if they are not presented.
- */
- const getOverlays = (doc, selector) => {
- if (selector === undefined) {
- selector = 'ion-alert,ion-action-sheet,ion-loading,ion-modal,ion-picker-legacy,ion-popover,ion-toast';
- }
- return Array.from(doc.querySelectorAll(selector)).filter((c) => c.overlayIndex > 0);
- };
- /**
- * Returns a list of all presented overlays.
- * Inline overlays can exist in the DOM but not be presented,
- * so there are times when we want to exclude those.
- * @param doc The document to find the element within.
- * @param overlayTag The selector for the overlay, defaults to Ionic overlay components.
- */
- const getPresentedOverlays = (doc, overlayTag) => {
- return getOverlays(doc, overlayTag).filter((o) => !isOverlayHidden(o));
- };
- /**
- * Returns a presented overlay element.
- * @param doc The document to find the element within.
- * @param overlayTag The selector for the overlay, defaults to Ionic overlay components.
- * @param id The unique identifier for the overlay instance.
- * @returns The overlay element or `undefined` if no overlay element is found.
- */
- const getPresentedOverlay = (doc, overlayTag, id) => {
- const overlays = getPresentedOverlays(doc, overlayTag);
- return id === undefined ? overlays[overlays.length - 1] : overlays.find((o) => o.id === id);
- };
- /**
- * When an overlay is presented, the main
- * focus is the overlay not the page content.
- * We need to remove the page content from the
- * accessibility tree otherwise when
- * users use "read screen from top" gestures with
- * TalkBack and VoiceOver, the screen reader will begin
- * to read the content underneath the overlay.
- *
- * We need a container where all page components
- * exist that is separate from where the overlays
- * are added in the DOM. For most apps, this element
- * is the top most ion-router-outlet. In the event
- * that devs are not using a router,
- * they will need to add the "ion-view-container-root"
- * id to the element that contains all of their views.
- *
- * TODO: If Framework supports having multiple top
- * level router outlets we would need to update this.
- * Example: One outlet for side menu and one outlet
- * for main content.
- */
- const setRootAriaHidden = (hidden = false) => {
- const root = getAppRoot(document);
- const viewContainer = root.querySelector('ion-router-outlet, ion-nav, #ion-view-container-root');
- if (!viewContainer) {
- return;
- }
- if (hidden) {
- viewContainer.setAttribute('aria-hidden', 'true');
- }
- else {
- viewContainer.removeAttribute('aria-hidden');
- }
- };
- const present = async (overlay, name, iosEnterAnimation, mdEnterAnimation, opts) => {
- var _a, _b;
- if (overlay.presented) {
- return;
- }
- /**
- * Due to accessibility guidelines, toasts do not have
- * focus traps.
- *
- * All other overlays should have focus traps to prevent
- * the keyboard focus from leaving the overlay.
- */
- if (overlay.el.tagName !== 'ION-TOAST') {
- setRootAriaHidden(true);
- document.body.classList.add(BACKDROP_NO_SCROLL);
- }
- hideUnderlyingOverlaysFromScreenReaders(overlay.el);
- hideAnimatingOverlayFromScreenReaders(overlay.el);
- overlay.presented = true;
- overlay.willPresent.emit();
- (_a = overlay.willPresentShorthand) === null || _a === void 0 ? void 0 : _a.emit();
- const mode = getIonMode$1(overlay);
- // get the user's animation fn if one was provided
- const animationBuilder = overlay.enterAnimation
- ? overlay.enterAnimation
- : config.get(name, mode === 'ios' ? iosEnterAnimation : mdEnterAnimation);
- const completed = await overlayAnimation(overlay, animationBuilder, overlay.el, opts);
- if (completed) {
- overlay.didPresent.emit();
- (_b = overlay.didPresentShorthand) === null || _b === void 0 ? void 0 : _b.emit();
- }
- /**
- * When an overlay that steals focus
- * is dismissed, focus should be returned
- * to the element that was focused
- * prior to the overlay opening. Toast
- * does not steal focus and is excluded
- * from returning focus as a result.
- */
- if (overlay.el.tagName !== 'ION-TOAST') {
- restoreElementFocus(overlay.el);
- }
- /**
- * If the focused element is already
- * inside the overlay component then
- * focus should not be moved from that
- * to the overlay container.
- */
- if (overlay.keyboardClose && (document.activeElement === null || !overlay.el.contains(document.activeElement))) {
- overlay.el.focus();
- }
- /**
- * If this overlay was previously dismissed without being
- * the topmost one (such as by manually calling dismiss()),
- * it would still have aria-hidden on being presented again.
- * Removing it here ensures the overlay is visible to screen
- * readers.
- *
- * If this overlay was being presented, then it was hidden
- * from screen readers during the animation. Now that the
- * animation is complete, we can reveal the overlay to
- * screen readers.
- */
- overlay.el.removeAttribute('aria-hidden');
- };
- /**
- * When an overlay component is dismissed,
- * focus should be returned to the element
- * that presented the overlay. Otherwise
- * focus will be set on the body which
- * means that people using screen readers
- * or tabbing will need to re-navigate
- * to where they were before they
- * opened the overlay.
- */
- const restoreElementFocus = async (overlayEl) => {
- let previousElement = document.activeElement;
- if (!previousElement) {
- return;
- }
- const shadowRoot = previousElement === null || previousElement === void 0 ? void 0 : previousElement.shadowRoot;
- if (shadowRoot) {
- // If there are no inner focusable elements, just focus the host element.
- previousElement = shadowRoot.querySelector(focusableQueryString) || previousElement;
- }
- await overlayEl.onDidDismiss();
- /**
- * After onDidDismiss, the overlay loses focus
- * because it is removed from the document
- *
- * > An element will also lose focus [...]
- * > if the element is removed from the document)
- *
- * https://developer.mozilla.org/en-US/docs/Web/API/Element/blur_event
- *
- * Additionally, `document.activeElement` returns:
- *
- * > The Element which currently has focus,
- * > `<body>` or null if there is
- * > no focused element.
- *
- * https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement#value
- *
- * However, if the user has already focused
- * an element sometime between onWillDismiss
- * and onDidDismiss (for example, focusing a
- * text box after tapping a button in an
- * action sheet) then don't restore focus to
- * previous element
- */
- if (document.activeElement === null || document.activeElement === document.body) {
- previousElement.focus();
- }
- };
- const dismiss = async (overlay, data, role, name, iosLeaveAnimation, mdLeaveAnimation, opts) => {
- var _a, _b;
- if (!overlay.presented) {
- return false;
- }
- const presentedOverlays = doc !== undefined ? getPresentedOverlays(doc) : [];
- /**
- * For accessibility, toasts lack focus traps and don't receive
- * `aria-hidden` on the root element when presented.
- *
- * All other overlays use focus traps to keep keyboard focus
- * within the overlay, setting `aria-hidden` on the root element
- * to enhance accessibility.
- *
- * Therefore, we must remove `aria-hidden` from the root element
- * when the last non-toast overlay is dismissed.
- */
- const overlaysNotToast = presentedOverlays.filter((o) => o.tagName !== 'ION-TOAST');
- const lastOverlayNotToast = overlaysNotToast.length === 1 && overlaysNotToast[0].id === overlay.el.id;
- /**
- * If this is the last visible overlay that is not a toast
- * then we want to re-add the root to the accessibility tree.
- */
- if (lastOverlayNotToast) {
- setRootAriaHidden(false);
- document.body.classList.remove(BACKDROP_NO_SCROLL);
- }
- overlay.presented = false;
- try {
- /**
- * There is no need to show the overlay to screen readers during
- * the dismiss animation. This is because the overlay will be removed
- * from the DOM after the animation is complete.
- */
- hideAnimatingOverlayFromScreenReaders(overlay.el);
- // Overlay contents should not be clickable during dismiss
- overlay.el.style.setProperty('pointer-events', 'none');
- overlay.willDismiss.emit({ data, role });
- (_a = overlay.willDismissShorthand) === null || _a === void 0 ? void 0 : _a.emit({ data, role });
- const mode = getIonMode$1(overlay);
- const animationBuilder = overlay.leaveAnimation
- ? overlay.leaveAnimation
- : config.get(name, mode === 'ios' ? iosLeaveAnimation : mdLeaveAnimation);
- // If dismissed via gesture, no need to play leaving animation again
- if (role !== GESTURE) {
- await overlayAnimation(overlay, animationBuilder, overlay.el, opts);
- }
- overlay.didDismiss.emit({ data, role });
- (_b = overlay.didDismissShorthand) === null || _b === void 0 ? void 0 : _b.emit({ data, role });
- // Get a reference to all animations currently assigned to this overlay
- // Then tear them down to return the overlay to its initial visual state
- const animations = activeAnimations.get(overlay) || [];
- animations.forEach((ani) => ani.destroy());
- activeAnimations.delete(overlay);
- /**
- * Make overlay hidden again in case it is being reused.
- * We can safely remove pointer-events: none as
- * overlay-hidden will set display: none.
- */
- overlay.el.classList.add('overlay-hidden');
- overlay.el.style.removeProperty('pointer-events');
- /**
- * Clear any focus trapping references
- * when the overlay is dismissed.
- */
- if (overlay.el.lastFocus !== undefined) {
- overlay.el.lastFocus = undefined;
- }
- }
- catch (err) {
- printIonError(`[${overlay.el.tagName.toLowerCase()}] - `, err);
- }
- overlay.el.remove();
- revealOverlaysToScreenReaders();
- return true;
- };
- const getAppRoot = (doc) => {
- return doc.querySelector('ion-app') || doc.body;
- };
- const overlayAnimation = async (overlay, animationBuilder, baseEl, opts) => {
- // Make overlay visible in case it's hidden
- baseEl.classList.remove('overlay-hidden');
- const aniRoot = overlay.el;
- const animation = animationBuilder(aniRoot, opts);
- if (!overlay.animated || !config.getBoolean('animated', true)) {
- animation.duration(0);
- }
- if (overlay.keyboardClose) {
- animation.beforeAddWrite(() => {
- const activeElement = baseEl.ownerDocument.activeElement;
- if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.matches('input,ion-input, ion-textarea')) {
- activeElement.blur();
- }
- });
- }
- const activeAni = activeAnimations.get(overlay) || [];
- activeAnimations.set(overlay, [...activeAni, animation]);
- await animation.play();
- return true;
- };
- const eventMethod = (element, eventName) => {
- let resolve;
- const promise = new Promise((r) => (resolve = r));
- onceEvent(element, eventName, (event) => {
- resolve(event.detail);
- });
- return promise;
- };
- const onceEvent = (element, eventName, callback) => {
- const handler = (ev) => {
- removeEventListener(element, eventName, handler);
- callback(ev);
- };
- addEventListener$1(element, eventName, handler);
- };
- const isCancel = (role) => {
- return role === 'cancel' || role === BACKDROP;
- };
- const defaultGate = (h) => h();
- /**
- * Calls a developer provided method while avoiding
- * Angular Zones. Since the handler is provided by
- * the developer, we should throw any errors
- * received so that developer-provided bug
- * tracking software can log it.
- */
- const safeCall = (handler, arg) => {
- if (typeof handler === 'function') {
- const jmp = config.get('_zoneGate', defaultGate);
- return jmp(() => {
- try {
- return handler(arg);
- }
- catch (e) {
- throw e;
- }
- });
- }
- return undefined;
- };
- const BACKDROP = 'backdrop';
- const GESTURE = 'gesture';
- const OVERLAY_GESTURE_PRIORITY = 39;
- /**
- * Creates a delegate controller.
- *
- * Requires that the component has the following properties:
- * - `el: HTMLElement`
- * - `hasController: boolean`
- * - `delegate?: FrameworkDelegate`
- *
- * @param ref The component class instance.
- */
- const createDelegateController = (ref) => {
- let inline = false;
- let workingDelegate;
- const coreDelegate = CoreDelegate();
- /**
- * Determines whether or not an overlay is being used
- * inline or via a controller/JS and returns the correct delegate.
- * By default, subsequent calls to getDelegate will use
- * a cached version of the delegate.
- * This is useful for calling dismiss after present,
- * so that the correct delegate is given.
- * @param force `true` to force the non-cached version of the delegate.
- * @returns The delegate to use and whether or not the overlay is inline.
- */
- const getDelegate = (force = false) => {
- if (workingDelegate && !force) {
- return {
- delegate: workingDelegate,
- inline,
- };
- }
- const { el, hasController, delegate } = ref;
- /**
- * If using overlay inline
- * we potentially need to use the coreDelegate
- * so that this works in vanilla JS apps.
- * If a developer has presented this component
- * via a controller, then we can assume
- * the component is already in the
- * correct place.
- */
- const parentEl = el.parentNode;
- inline = parentEl !== null && !hasController;
- workingDelegate = inline ? delegate || coreDelegate : delegate;
- return { inline, delegate: workingDelegate };
- };
- /**
- * Attaches a component in the DOM. Teleports the component
- * to the root of the app.
- * @param component The component to optionally construct and append to the element.
- */
- const attachViewToDom = async (component) => {
- const { delegate } = getDelegate(true);
- if (delegate) {
- return await delegate.attachViewToDom(ref.el, component);
- }
- const { hasController } = ref;
- if (hasController && component !== undefined) {
- throw new Error('framework delegate is missing');
- }
- return null;
- };
- /**
- * Moves a component back to its original location in the DOM.
- */
- const removeViewFromDom = () => {
- const { delegate } = getDelegate();
- if (delegate && ref.el !== undefined) {
- delegate.removeViewFromDom(ref.el.parentElement, ref.el);
- }
- };
- return {
- attachViewToDom,
- removeViewFromDom,
- };
- };
- /**
- * Constructs a trigger interaction for an overlay.
- * Presents an overlay when the trigger is clicked.
- *
- * Usage:
- * ```ts
- * triggerController = createTriggerController();
- * triggerController.addClickListener(el, trigger);
- * ```
- */
- const createTriggerController = () => {
- let destroyTriggerInteraction;
- /**
- * Removes the click listener from the trigger element.
- */
- const removeClickListener = () => {
- if (destroyTriggerInteraction) {
- destroyTriggerInteraction();
- destroyTriggerInteraction = undefined;
- }
- };
- /**
- * Adds a click listener to the trigger element.
- * Presents the overlay when the trigger is clicked.
- * @param el The overlay element.
- * @param trigger The ID of the element to add a click listener to.
- */
- const addClickListener = (el, trigger) => {
- removeClickListener();
- const triggerEl = trigger !== undefined ? document.getElementById(trigger) : null;
- if (!triggerEl) {
- printIonWarning(`[${el.tagName.toLowerCase()}] - A trigger element with the ID "${trigger}" was not found in the DOM. The trigger element must be in the DOM when the "trigger" property is set on an overlay component.`, el);
- return;
- }
- const configureTriggerInteraction = (targetEl, overlayEl) => {
- const openOverlay = () => {
- overlayEl.present();
- };
- targetEl.addEventListener('click', openOverlay);
- return () => {
- targetEl.removeEventListener('click', openOverlay);
- };
- };
- destroyTriggerInteraction = configureTriggerInteraction(triggerEl, el);
- };
- return {
- addClickListener,
- removeClickListener,
- };
- };
- /**
- * The overlay that is being animated also needs to hide from screen
- * readers during its animation. This ensures that assistive technologies
- * like TalkBack do not announce or interact with the content until the
- * animation is complete, avoiding confusion for users.
- *
- * When the overlay is presented on an Android device, TalkBack's focus rings
- * may appear in the wrong position due to the transition (specifically
- * `transform` styles). This occurs because the focus rings are initially
- * displayed at the starting position of the elements before the transition
- * begins. This workaround ensures the focus rings do not appear in the
- * incorrect location.
- *
- * If this solution is applied to iOS devices, then it leads to a bug where
- * the overlays cannot be accessed by screen readers. This is due to
- * VoiceOver not being able to update the accessibility tree when the
- * `aria-hidden` is removed.
- *
- * @param overlay - The overlay that is being animated.
- */
- const hideAnimatingOverlayFromScreenReaders = (overlay) => {
- if (doc === undefined)
- return;
- if (isPlatform('android')) {
- /**
- * Once the animation is complete, this attribute will be removed.
- * This is done at the end of the `present` method.
- */
- overlay.setAttribute('aria-hidden', 'true');
- }
- };
- /**
- * Ensure that underlying overlays have aria-hidden if necessary so that screen readers
- * cannot move focus to these elements. Note that we cannot rely on focus/focusin/focusout
- * events here because those events do not fire when the screen readers moves to a non-focusable
- * element such as text.
- * Without this logic screen readers would be able to move focus outside of the top focus-trapped overlay.
- *
- * @param newTopMostOverlay - The overlay that is being presented. Since the overlay has not been
- * fully presented yet at the time this function is called it will not be included in the getPresentedOverlays result.
- */
- const hideUnderlyingOverlaysFromScreenReaders = (newTopMostOverlay) => {
- var _a;
- if (doc === undefined)
- return;
- const overlays = getPresentedOverlays(doc);
- for (let i = overlays.length - 1; i >= 0; i--) {
- const presentedOverlay = overlays[i];
- const nextPresentedOverlay = (_a = overlays[i + 1]) !== null && _a !== void 0 ? _a : newTopMostOverlay;
- /**
- * If next overlay has aria-hidden then all remaining overlays will have it too.
- * Or, if the next overlay is a Toast that does not have aria-hidden then current overlay
- * should not have aria-hidden either so focus can remain in the current overlay.
- */
- if (nextPresentedOverlay.hasAttribute('aria-hidden') || nextPresentedOverlay.tagName !== 'ION-TOAST') {
- presentedOverlay.setAttribute('aria-hidden', 'true');
- }
- }
- };
- /**
- * When dismissing an overlay we need to reveal the new top-most overlay to screen readers.
- * If the top-most overlay is a Toast we potentially need to reveal more overlays since
- * focus is never automatically moved to the Toast.
- */
- const revealOverlaysToScreenReaders = () => {
- if (doc === undefined)
- return;
- const overlays = getPresentedOverlays(doc);
- for (let i = overlays.length - 1; i >= 0; i--) {
- const currentOverlay = overlays[i];
- /**
- * If the current we are looking at is a Toast then we can remove aria-hidden.
- * However, we potentially need to keep looking at the overlay stack because there
- * could be more Toasts underneath. Additionally, we need to unhide the closest non-Toast
- * overlay too so focus can move there since focus is never automatically moved to the Toast.
- */
- currentOverlay.removeAttribute('aria-hidden');
- /**
- * If we found a non-Toast element then we can just remove aria-hidden and stop searching entirely
- * since this overlay should always receive focus. As a result, all underlying overlays should still
- * be hidden from screen readers.
- */
- if (currentOverlay.tagName !== 'ION-TOAST') {
- break;
- }
- }
- };
- const FOCUS_TRAP_DISABLE_CLASS = 'ion-disable-focus-trap';
- const hostContext = (selector, el) => {
- return el.closest(selector) !== null;
- };
- /**
- * Create the mode and color classes for the component based on the classes passed in
- */
- const createColorClasses$1 = (color, cssClassMap) => {
- return typeof color === 'string' && color.length > 0
- ? Object.assign({ 'ion-color': true, [`ion-color-${color}`]: true }, cssClassMap) : cssClassMap;
- };
- const getClassList = (classes) => {
- if (classes !== undefined) {
- const array = Array.isArray(classes) ? classes : classes.split(' ');
- return array
- .filter((c) => c != null)
- .map((c) => c.trim())
- .filter((c) => c !== '');
- }
- return [];
- };
- const getClassMap = (classes) => {
- const map = {};
- getClassList(classes).forEach((c) => (map[c] = true));
- return map;
- };
- const SCHEME = /^[a-z][a-z0-9+\-.]*:/;
- const openURL = async (url, ev, direction, animation) => {
- if (url != null && url[0] !== '#' && !SCHEME.test(url)) {
- const router = document.querySelector('ion-router');
- if (router) {
- if (ev != null) {
- ev.preventDefault();
- }
- return router.push(url, direction, animation);
- }
- }
- return false;
- };
- let animationPrefix;
- const getAnimationPrefix = (el) => {
- if (animationPrefix === undefined) {
- const supportsUnprefixed = el.style.animationName !== undefined;
- const supportsWebkitPrefix = el.style.webkitAnimationName !== undefined;
- animationPrefix = !supportsUnprefixed && supportsWebkitPrefix ? '-webkit-' : '';
- }
- return animationPrefix;
- };
- const setStyleProperty = (element, propertyName, value) => {
- const prefix = propertyName.startsWith('animation') ? getAnimationPrefix(element) : '';
- element.style.setProperty(prefix + propertyName, value);
- };
- const addClassToArray = (classes = [], className) => {
- if (className !== undefined) {
- const classNameToAppend = Array.isArray(className) ? className : [className];
- return [...classes, ...classNameToAppend];
- }
- return classes;
- };
- const createAnimation = (animationId) => {
- let _delay;
- let _duration;
- let _easing;
- let _iterations;
- let _fill;
- let _direction;
- let _keyframes = [];
- let beforeAddClasses = [];
- let beforeRemoveClasses = [];
- let initialized = false;
- let parentAnimation;
- let beforeStylesValue = {};
- let afterAddClasses = [];
- let afterRemoveClasses = [];
- let afterStylesValue = {};
- let numAnimationsRunning = 0;
- let shouldForceLinearEasing = false;
- let shouldForceSyncPlayback = false;
- let forceDirectionValue;
- let forceDurationValue;
- let forceDelayValue;
- let willComplete = true;
- let finished = false;
- let shouldCalculateNumAnimations = true;
- let ani;
- let paused = false;
- const id = animationId;
- const onFinishCallbacks = [];
- const onFinishOneTimeCallbacks = [];
- const onStopOneTimeCallbacks = [];
- const elements = [];
- const childAnimations = [];
- const stylesheets = [];
- const _beforeAddReadFunctions = [];
- const _beforeAddWriteFunctions = [];
- const _afterAddReadFunctions = [];
- const _afterAddWriteFunctions = [];
- const webAnimations = [];
- const supportsAnimationEffect = typeof AnimationEffect === 'function' ||
- (win$1 !== undefined && typeof win$1.AnimationEffect === 'function');
- /**
- * This is a feature detection for Web Animations.
- *
- * Certain environments such as emulated browser environments for testing,
- * do not support Web Animations. As a result, we need to check for support
- * and provide a fallback to test certain functionality related to Web Animations.
- */
- const supportsWebAnimations = typeof Element === 'function' &&
- typeof Element.prototype.animate === 'function' &&
- supportsAnimationEffect;
- const getWebAnimations = () => {
- return webAnimations;
- };
- const destroy = (clearStyleSheets) => {
- childAnimations.forEach((childAnimation) => {
- childAnimation.destroy(clearStyleSheets);
- });
- cleanUp(clearStyleSheets);
- elements.length = 0;
- childAnimations.length = 0;
- _keyframes.length = 0;
- clearOnFinish();
- initialized = false;
- shouldCalculateNumAnimations = true;
- return ani;
- };
- /**
- * Cancels any Web Animations, removes
- * any animation properties from the
- * animation's elements, and removes the
- * animation's stylesheets from the DOM.
- */
- const cleanUp = (clearStyleSheets) => {
- cleanUpElements();
- if (clearStyleSheets) {
- cleanUpStyleSheets();
- }
- };
- const resetFlags = () => {
- shouldForceLinearEasing = false;
- shouldForceSyncPlayback = false;
- shouldCalculateNumAnimations = true;
- forceDirectionValue = undefined;
- forceDurationValue = undefined;
- forceDelayValue = undefined;
- numAnimationsRunning = 0;
- finished = false;
- willComplete = true;
- paused = false;
- };
- const isRunning = () => {
- return numAnimationsRunning !== 0 && !paused;
- };
- /**
- * @internal
- * Remove a callback from a chosen callback array
- * @param callbackToRemove: A reference to the callback that should be removed
- * @param callbackObjects: An array of callbacks that callbackToRemove should be removed from.
- */
- const clearCallback = (callbackToRemove, callbackObjects) => {
- const index = callbackObjects.findIndex((callbackObject) => callbackObject.c === callbackToRemove);
- if (index > -1) {
- callbackObjects.splice(index, 1);
- }
- };
- /**
- * @internal
- * Add a callback to be fired when an animation is stopped/cancelled.
- * @param callback: A reference to the callback that should be fired
- * @param opts: Any options associated with this particular callback
- */
- const onStop = (callback, opts) => {
- onStopOneTimeCallbacks.push({ c: callback, o: opts });
- return ani;
- };
- const onFinish = (callback, opts) => {
- const callbacks = (opts === null || opts === void 0 ? void 0 : opts.oneTimeCallback) ? onFinishOneTimeCallbacks : onFinishCallbacks;
- callbacks.push({ c: callback, o: opts });
- return ani;
- };
- const clearOnFinish = () => {
- onFinishCallbacks.length = 0;
- onFinishOneTimeCallbacks.length = 0;
- return ani;
- };
- /**
- * Cancels any Web Animations and removes
- * any animation properties from the
- * the animation's elements.
- */
- const cleanUpElements = () => {
- if (supportsWebAnimations) {
- webAnimations.forEach((animation) => {
- animation.cancel();
- });
- webAnimations.length = 0;
- }
- };
- /**
- * Removes the animation's stylesheets
- * from the DOM.
- */
- const cleanUpStyleSheets = () => {
- stylesheets.forEach((stylesheet) => {
- /**
- * When sharing stylesheets, it's possible
- * for another animation to have already
- * cleaned up a particular stylesheet
- */
- if (stylesheet === null || stylesheet === void 0 ? void 0 : stylesheet.parentNode) {
- stylesheet.parentNode.removeChild(stylesheet);
- }
- });
- stylesheets.length = 0;
- };
- const beforeAddRead = (readFn) => {
- _beforeAddReadFunctions.push(readFn);
- return ani;
- };
- const beforeAddWrite = (writeFn) => {
- _beforeAddWriteFunctions.push(writeFn);
- return ani;
- };
- const afterAddRead = (readFn) => {
- _afterAddReadFunctions.push(readFn);
- return ani;
- };
- const afterAddWrite = (writeFn) => {
- _afterAddWriteFunctions.push(writeFn);
- return ani;
- };
- const beforeAddClass = (className) => {
- beforeAddClasses = addClassToArray(beforeAddClasses, className);
- return ani;
- };
- const beforeRemoveClass = (className) => {
- beforeRemoveClasses = addClassToArray(beforeRemoveClasses, className);
- return ani;
- };
- /**
- * Set CSS inline styles to the animation's
- * elements before the animation begins.
- */
- const beforeStyles = (styles = {}) => {
- beforeStylesValue = styles;
- return ani;
- };
- /**
- * Clear CSS inline styles from the animation's
- * elements before the animation begins.
- */
- const beforeClearStyles = (propertyNames = []) => {
- for (const property of propertyNames) {
- beforeStylesValue[property] = '';
- }
- return ani;
- };
- const afterAddClass = (className) => {
- afterAddClasses = addClassToArray(afterAddClasses, className);
- return ani;
- };
- const afterRemoveClass = (className) => {
- afterRemoveClasses = addClassToArray(afterRemoveClasses, className);
- return ani;
- };
- const afterStyles = (styles = {}) => {
- afterStylesValue = styles;
- return ani;
- };
- const afterClearStyles = (propertyNames = []) => {
- for (const property of propertyNames) {
- afterStylesValue[property] = '';
- }
- return ani;
- };
- const getFill = () => {
- if (_fill !== undefined) {
- return _fill;
- }
- if (parentAnimation) {
- return parentAnimation.getFill();
- }
- return 'both';
- };
- const getDirection = () => {
- if (forceDirectionValue !== undefined) {
- return forceDirectionValue;
- }
- if (_direction !== undefined) {
- return _direction;
- }
- if (parentAnimation) {
- return parentAnimation.getDirection();
- }
- return 'normal';
- };
- const getEasing = () => {
- if (shouldForceLinearEasing) {
- return 'linear';
- }
- if (_easing !== undefined) {
- return _easing;
- }
- if (parentAnimation) {
- return parentAnimation.getEasing();
- }
- return 'linear';
- };
- const getDuration = () => {
- if (shouldForceSyncPlayback) {
- return 0;
- }
- if (forceDurationValue !== undefined) {
- return forceDurationValue;
- }
- if (_duration !== undefined) {
- return _duration;
- }
- if (parentAnimation) {
- return parentAnimation.getDuration();
- }
- return 0;
- };
- const getIterations = () => {
- if (_iterations !== undefined) {
- return _iterations;
- }
- if (parentAnimation) {
- return parentAnimation.getIterations();
- }
- return 1;
- };
- const getDelay = () => {
- if (forceDelayValue !== undefined) {
- return forceDelayValue;
- }
- if (_delay !== undefined) {
- return _delay;
- }
- if (parentAnimation) {
- return parentAnimation.getDelay();
- }
- return 0;
- };
- const getKeyframes = () => {
- return _keyframes;
- };
- const direction = (animationDirection) => {
- _direction = animationDirection;
- update(true);
- return ani;
- };
- const fill = (animationFill) => {
- _fill = animationFill;
- update(true);
- return ani;
- };
- const delay = (animationDelay) => {
- _delay = animationDelay;
- update(true);
- return ani;
- };
- const easing = (animationEasing) => {
- _easing = animationEasing;
- update(true);
- return ani;
- };
- const duration = (animationDuration) => {
- /**
- * CSS Animation Durations of 0ms work fine on Chrome
- * but do not run on Safari, so force it to 1ms to
- * get it to run on both platforms.
- */
- if (!supportsWebAnimations && animationDuration === 0) {
- animationDuration = 1;
- }
- _duration = animationDuration;
- update(true);
- return ani;
- };
- const iterations = (animationIterations) => {
- _iterations = animationIterations;
- update(true);
- return ani;
- };
- const parent = (animation) => {
- parentAnimation = animation;
- return ani;
- };
- const addElement = (el) => {
- if (el != null) {
- if (el.nodeType === 1) {
- elements.push(el);
- }
- else if (el.length >= 0) {
- for (let i = 0; i < el.length; i++) {
- elements.push(el[i]);
- }
- }
- else {
- printIonError('createAnimation - Invalid addElement value.');
- }
- }
- return ani;
- };
- const addAnimation = (animationToAdd) => {
- if (animationToAdd != null) {
- if (Array.isArray(animationToAdd)) {
- for (const animation of animationToAdd) {
- animation.parent(ani);
- childAnimations.push(animation);
- }
- }
- else {
- animationToAdd.parent(ani);
- childAnimations.push(animationToAdd);
- }
- }
- return ani;
- };
- const keyframes = (keyframeValues) => {
- const different = _keyframes !== keyframeValues;
- _keyframes = keyframeValues;
- if (different) {
- updateKeyframes(_keyframes);
- }
- return ani;
- };
- const updateKeyframes = (keyframeValues) => {
- if (supportsWebAnimations) {
- getWebAnimations().forEach((animation) => {
- /**
- * animation.effect's type is AnimationEffect.
- * However, in this case we have a more specific
- * type of AnimationEffect called KeyframeEffect which
- * inherits from AnimationEffect. As a result,
- * we cast animation.effect to KeyframeEffect.
- */
- const keyframeEffect = animation.effect;
- /**
- * setKeyframes is not supported in all browser
- * versions that Ionic supports, so we need to
- * check for support before using it.
- */
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
- if (keyframeEffect.setKeyframes) {
- keyframeEffect.setKeyframes(keyframeValues);
- }
- else {
- const newEffect = new KeyframeEffect(keyframeEffect.target, keyframeValues, keyframeEffect.getTiming());
- animation.effect = newEffect;
- }
- });
- }
- };
- /**
- * Run all "before" animation hooks.
- */
- const beforeAnimation = () => {
- // Runs all before read callbacks
- _beforeAddReadFunctions.forEach((callback) => callback());
- // Runs all before write callbacks
- _beforeAddWriteFunctions.forEach((callback) => callback());
- // Updates styles and classes before animation runs
- const addClasses = beforeAddClasses;
- const removeClasses = beforeRemoveClasses;
- const styles = beforeStylesValue;
- elements.forEach((el) => {
- const elementClassList = el.classList;
- addClasses.forEach((c) => elementClassList.add(c));
- removeClasses.forEach((c) => elementClassList.remove(c));
- for (const property in styles) {
- // eslint-disable-next-line no-prototype-builtins
- if (styles.hasOwnProperty(property)) {
- setStyleProperty(el, property, styles[property]);
- }
- }
- });
- };
- /**
- * Run all "after" animation hooks.
- */
- const afterAnimation = () => {
- // Runs all after read callbacks
- _afterAddReadFunctions.forEach((callback) => callback());
- // Runs all after write callbacks
- _afterAddWriteFunctions.forEach((callback) => callback());
- // Updates styles and classes before animation ends
- const currentStep = willComplete ? 1 : 0;
- const addClasses = afterAddClasses;
- const removeClasses = afterRemoveClasses;
- const styles = afterStylesValue;
- elements.forEach((el) => {
- const elementClassList = el.classList;
- addClasses.forEach((c) => elementClassList.add(c));
- removeClasses.forEach((c) => elementClassList.remove(c));
- for (const property in styles) {
- // eslint-disable-next-line no-prototype-builtins
- if (styles.hasOwnProperty(property)) {
- setStyleProperty(el, property, styles[property]);
- }
- }
- });
- /**
- * Clean up any value coercion before
- * the user callbacks fire otherwise
- * they may get stale values. For example,
- * if someone calls progressStart(0) the
- * animation may still be reversed.
- */
- forceDurationValue = undefined;
- forceDirectionValue = undefined;
- forceDelayValue = undefined;
- onFinishCallbacks.forEach((onFinishCallback) => {
- return onFinishCallback.c(currentStep, ani);
- });
- onFinishOneTimeCallbacks.forEach((onFinishCallback) => {
- return onFinishCallback.c(currentStep, ani);
- });
- onFinishOneTimeCallbacks.length = 0;
- shouldCalculateNumAnimations = true;
- if (willComplete) {
- finished = true;
- }
- willComplete = true;
- };
- const animationFinish = () => {
- if (numAnimationsRunning === 0) {
- return;
- }
- numAnimationsRunning--;
- if (numAnimationsRunning === 0) {
- afterAnimation();
- if (parentAnimation) {
- parentAnimation.animationFinish();
- }
- }
- };
- const initializeWebAnimation = () => {
- elements.forEach((element) => {
- const animation = element.animate(_keyframes, {
- id,
- delay: getDelay(),
- duration: getDuration(),
- easing: getEasing(),
- iterations: getIterations(),
- fill: getFill(),
- direction: getDirection(),
- });
- animation.pause();
- webAnimations.push(animation);
- });
- if (webAnimations.length > 0) {
- webAnimations[0].onfinish = () => {
- animationFinish();
- };
- }
- };
- const initializeAnimation = () => {
- beforeAnimation();
- if (_keyframes.length > 0) {
- if (supportsWebAnimations) {
- initializeWebAnimation();
- }
- }
- initialized = true;
- };
- const setAnimationStep = (step) => {
- step = Math.min(Math.max(step, 0), 0.9999);
- if (supportsWebAnimations) {
- webAnimations.forEach((animation) => {
- // When creating the animation the delay is guaranteed to be set to a number.
- animation.currentTime = animation.effect.getComputedTiming().delay + getDuration() * step;
- animation.pause();
- });
- }
- };
- const updateWebAnimation = (step) => {
- webAnimations.forEach((animation) => {
- animation.effect.updateTiming({
- delay: getDelay(),
- duration: getDuration(),
- easing: getEasing(),
- iterations: getIterations(),
- fill: getFill(),
- direction: getDirection(),
- });
- });
- if (step !== undefined) {
- setAnimationStep(step);
- }
- };
- const update = (deep = false, toggleAnimationName = true, step) => {
- if (deep) {
- childAnimations.forEach((animation) => {
- animation.update(deep, toggleAnimationName, step);
- });
- }
- if (supportsWebAnimations) {
- updateWebAnimation(step);
- }
- return ani;
- };
- const progressStart = (forceLinearEasing = false, step) => {
- childAnimations.forEach((animation) => {
- animation.progressStart(forceLinearEasing, step);
- });
- pauseAnimation();
- shouldForceLinearEasing = forceLinearEasing;
- if (!initialized) {
- initializeAnimation();
- }
- update(false, true, step);
- return ani;
- };
- const progressStep = (step) => {
- childAnimations.forEach((animation) => {
- animation.progressStep(step);
- });
- setAnimationStep(step);
- return ani;
- };
- const progressEnd = (playTo, step, dur) => {
- shouldForceLinearEasing = false;
- childAnimations.forEach((animation) => {
- animation.progressEnd(playTo, step, dur);
- });
- if (dur !== undefined) {
- forceDurationValue = dur;
- }
- finished = false;
- willComplete = true;
- if (playTo === 0) {
- forceDirectionValue = getDirection() === 'reverse' ? 'normal' : 'reverse';
- if (forceDirectionValue === 'reverse') {
- willComplete = false;
- }
- if (supportsWebAnimations) {
- update();
- setAnimationStep(1 - step);
- }
- else {
- forceDelayValue = (1 - step) * getDuration() * -1;
- update(false, false);
- }
- }
- else if (playTo === 1) {
- if (supportsWebAnimations) {
- update();
- setAnimationStep(step);
- }
- else {
- forceDelayValue = step * getDuration() * -1;
- update(false, false);
- }
- }
- if (playTo !== undefined && !parentAnimation) {
- play();
- }
- return ani;
- };
- const pauseAnimation = () => {
- if (initialized) {
- if (supportsWebAnimations) {
- webAnimations.forEach((animation) => {
- animation.pause();
- });
- }
- else {
- elements.forEach((element) => {
- setStyleProperty(element, 'animation-play-state', 'paused');
- });
- }
- paused = true;
- }
- };
- const pause = () => {
- childAnimations.forEach((animation) => {
- animation.pause();
- });
- pauseAnimation();
- return ani;
- };
- const playCSSAnimations = () => {
- animationFinish();
- };
- const playWebAnimations = () => {
- webAnimations.forEach((animation) => {
- animation.play();
- });
- if (_keyframes.length === 0 || elements.length === 0) {
- animationFinish();
- }
- };
- const resetAnimation = () => {
- if (supportsWebAnimations) {
- setAnimationStep(0);
- updateWebAnimation();
- }
- };
- const play = (opts) => {
- return new Promise((resolve) => {
- if (opts === null || opts === void 0 ? void 0 : opts.sync) {
- shouldForceSyncPlayback = true;
- onFinish(() => (shouldForceSyncPlayback = false), { oneTimeCallback: true });
- }
- if (!initialized) {
- initializeAnimation();
- }
- if (finished) {
- resetAnimation();
- finished = false;
- }
- if (shouldCalculateNumAnimations) {
- numAnimationsRunning = childAnimations.length + 1;
- shouldCalculateNumAnimations = false;
- }
- /**
- * When one of these callbacks fires we
- * need to clear the other's callback otherwise
- * you can potentially get these callbacks
- * firing multiple times if the play method
- * is subsequently called.
- * Example:
- * animation.play() (onStop and onFinish callbacks are registered)
- * animation.stop() (onStop callback is fired, onFinish is not)
- * animation.play() (onStop and onFinish callbacks are registered)
- * Total onStop callbacks: 1
- * Total onFinish callbacks: 2
- */
- const onStopCallback = () => {
- clearCallback(onFinishCallback, onFinishOneTimeCallbacks);
- resolve();
- };
- const onFinishCallback = () => {
- clearCallback(onStopCallback, onStopOneTimeCallbacks);
- resolve();
- };
- /**
- * The play method resolves when an animation
- * run either finishes or is cancelled.
- */
- onFinish(onFinishCallback, { oneTimeCallback: true });
- onStop(onStopCallback, { oneTimeCallback: true });
- childAnimations.forEach((animation) => {
- animation.play();
- });
- if (supportsWebAnimations) {
- playWebAnimations();
- }
- else {
- playCSSAnimations();
- }
- paused = false;
- });
- };
- /**
- * Stops an animation and resets it state to the
- * beginning. This does not fire any onFinish
- * callbacks because the animation did not finish.
- * However, since the animation was not destroyed
- * (i.e. the animation could run again) we do not
- * clear the onFinish callbacks.
- */
- const stop = () => {
- childAnimations.forEach((animation) => {
- animation.stop();
- });
- if (initialized) {
- cleanUpElements();
- initialized = false;
- }
- resetFlags();
- onStopOneTimeCallbacks.forEach((onStopCallback) => onStopCallback.c(0, ani));
- onStopOneTimeCallbacks.length = 0;
- };
- const from = (property, value) => {
- const firstFrame = _keyframes[0];
- if (firstFrame !== undefined && (firstFrame.offset === undefined || firstFrame.offset === 0)) {
- firstFrame[property] = value;
- }
- else {
- _keyframes = [{ offset: 0, [property]: value }, ..._keyframes];
- }
- return ani;
- };
- const to = (property, value) => {
- const lastFrame = _keyframes[_keyframes.length - 1];
- if (lastFrame !== undefined && (lastFrame.offset === undefined || lastFrame.offset === 1)) {
- lastFrame[property] = value;
- }
- else {
- _keyframes = [..._keyframes, { offset: 1, [property]: value }];
- }
- return ani;
- };
- const fromTo = (property, fromValue, toValue) => {
- return from(property, fromValue).to(property, toValue);
- };
- return (ani = {
- parentAnimation,
- elements,
- childAnimations,
- id,
- animationFinish,
- from,
- to,
- fromTo,
- parent,
- play,
- pause,
- stop,
- destroy,
- keyframes,
- addAnimation,
- addElement,
- update,
- fill,
- direction,
- iterations,
- duration,
- easing,
- delay,
- getWebAnimations,
- getKeyframes,
- getFill,
- getDirection,
- getDelay,
- getIterations,
- getEasing,
- getDuration,
- afterAddRead,
- afterAddWrite,
- afterClearStyles,
- afterStyles,
- afterRemoveClass,
- afterAddClass,
- beforeAddRead,
- beforeAddWrite,
- beforeClearStyles,
- beforeStyles,
- beforeRemoveClass,
- beforeAddClass,
- onFinish,
- isRunning,
- progressStart,
- progressStep,
- progressEnd,
- });
- };
- /**
- * iOS Action Sheet Enter Animation
- */
- const iosEnterAnimation$6 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation
- .addElement(baseEl.querySelector('.action-sheet-wrapper'))
- .fromTo('transform', 'translateY(100%)', 'translateY(0%)');
- return baseAnimation
- .addElement(baseEl)
- .easing('cubic-bezier(.36,.66,.04,1)')
- .duration(400)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * iOS Action Sheet Leave Animation
- */
- const iosLeaveAnimation$6 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- wrapperAnimation
- .addElement(baseEl.querySelector('.action-sheet-wrapper'))
- .fromTo('transform', 'translateY(0%)', 'translateY(100%)');
- return baseAnimation
- .addElement(baseEl)
- .easing('cubic-bezier(.36,.66,.04,1)')
- .duration(450)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * MD Action Sheet Enter Animation
- */
- const mdEnterAnimation$5 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation
- .addElement(baseEl.querySelector('.action-sheet-wrapper'))
- .fromTo('transform', 'translateY(100%)', 'translateY(0%)');
- return baseAnimation
- .addElement(baseEl)
- .easing('cubic-bezier(.36,.66,.04,1)')
- .duration(400)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * MD Action Sheet Leave Animation
- */
- const mdLeaveAnimation$5 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- wrapperAnimation
- .addElement(baseEl.querySelector('.action-sheet-wrapper'))
- .fromTo('transform', 'translateY(0%)', 'translateY(100%)');
- return baseAnimation
- .addElement(baseEl)
- .easing('cubic-bezier(.36,.66,.04,1)')
- .duration(450)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- const actionSheetIosCss = ".sc-ion-action-sheet-ios-h{--color:initial;--button-color-activated:var(--button-color);--button-color-focused:var(--button-color);--button-color-hover:var(--button-color);--button-color-selected:var(--button-color);--min-width:auto;--width:100%;--max-width:500px;--min-height:auto;--height:auto;--max-height:calc(100% - (var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:block;position:fixed;outline:none;font-family:var(--ion-font-family, inherit);-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-action-sheet-ios-h{display:none}.action-sheet-wrapper.sc-ion-action-sheet-ios{left:0;right:0;bottom:0;-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);display:block;position:absolute;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);z-index:10;pointer-events:none}.action-sheet-button.sc-ion-action-sheet-ios{display:block;position:relative;width:100%;border:0;outline:none;background:var(--button-background);color:var(--button-color);font-family:inherit;overflow:hidden}.action-sheet-button.sc-ion-action-sheet-ios:disabled{color:var(--button-color-disabled);opacity:0.4}.action-sheet-button-inner.sc-ion-action-sheet-ios{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;pointer-events:none;width:100%;height:100%;z-index:1}.action-sheet-container.sc-ion-action-sheet-ios{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;-ms-flex-pack:end;justify-content:flex-end;height:100%;max-height:calc(100vh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0)));max-height:calc(100dvh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0)))}.action-sheet-group.sc-ion-action-sheet-ios{-ms-flex-negative:2;flex-shrink:2;overscroll-behavior-y:contain;overflow-y:auto;-webkit-overflow-scrolling:touch;pointer-events:all;background:var(--background)}@media (any-pointer: coarse){.action-sheet-group.sc-ion-action-sheet-ios::-webkit-scrollbar{display:none}}.action-sheet-group-cancel.sc-ion-action-sheet-ios{-ms-flex-negative:0;flex-shrink:0;overflow:hidden}.action-sheet-button.sc-ion-action-sheet-ios::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.action-sheet-selected.sc-ion-action-sheet-ios{color:var(--button-color-selected)}.action-sheet-selected.sc-ion-action-sheet-ios::after{background:var(--button-background-selected);opacity:var(--button-background-selected-opacity)}.action-sheet-button.ion-activated.sc-ion-action-sheet-ios{color:var(--button-color-activated)}.action-sheet-button.ion-activated.sc-ion-action-sheet-ios::after{background:var(--button-background-activated);opacity:var(--button-background-activated-opacity)}.action-sheet-button.ion-focused.sc-ion-action-sheet-ios{color:var(--button-color-focused)}.action-sheet-button.ion-focused.sc-ion-action-sheet-ios::after{background:var(--button-background-focused);opacity:var(--button-background-focused-opacity)}@media (any-hover: hover){.action-sheet-button.sc-ion-action-sheet-ios:not(:disabled):hover{color:var(--button-color-hover)}.action-sheet-button.sc-ion-action-sheet-ios:not(:disabled):hover::after{background:var(--button-background-hover);opacity:var(--button-background-hover-opacity)}}.sc-ion-action-sheet-ios-h{--background:var(--ion-overlay-background-color, var(--ion-color-step-100, var(--ion-background-color-step-100, #f9f9f9)));--backdrop-opacity:var(--ion-backdrop-opacity, 0.4);--button-background:linear-gradient(0deg, rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08), rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08) 50%, transparent 50%) bottom/100% 1px no-repeat transparent;--button-background-activated:var(--ion-text-color, #000);--button-background-activated-opacity:.08;--button-background-hover:currentColor;--button-background-hover-opacity:.04;--button-background-focused:currentColor;--button-background-focused-opacity:.12;--button-background-selected:var(--ion-color-step-150, var(--ion-background-color-step-150, var(--ion-background-color, #fff)));--button-background-selected-opacity:1;--button-color:var(--ion-color-primary, #0054e9);--button-color-disabled:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));--color:var(--ion-color-step-400, var(--ion-text-color-step-600, #999999));text-align:center}.action-sheet-wrapper.sc-ion-action-sheet-ios{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:var(--ion-safe-area-top, 0);padding-bottom:var(--ion-safe-area-bottom, 0);-webkit-box-sizing:content-box;box-sizing:content-box}.action-sheet-container.sc-ion-action-sheet-ios{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0}.action-sheet-group.sc-ion-action-sheet-ios{border-radius:13px;margin-bottom:8px}.action-sheet-group.sc-ion-action-sheet-ios:first-child{margin-top:10px}.action-sheet-group.sc-ion-action-sheet-ios:last-child{margin-bottom:10px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.action-sheet-translucent.sc-ion-action-sheet-ios-h .action-sheet-group.sc-ion-action-sheet-ios{background-color:transparent;-webkit-backdrop-filter:saturate(280%) blur(20px);backdrop-filter:saturate(280%) blur(20px)}.action-sheet-translucent.sc-ion-action-sheet-ios-h .action-sheet-title.sc-ion-action-sheet-ios,.action-sheet-translucent.sc-ion-action-sheet-ios-h .action-sheet-button.sc-ion-action-sheet-ios{background-color:transparent;background-image:-webkit-gradient(linear, left bottom, left top, from(rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8)), to(rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8))), -webkit-gradient(linear, left bottom, left top, from(rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.4)), color-stop(50%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.4)), color-stop(50%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8)));background-image:linear-gradient(0deg, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8), rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 100%), linear-gradient(0deg, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.4), rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.4) 50%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 50%);background-repeat:no-repeat;background-position:top, bottom;background-size:100% calc(100% - 1px), 100% 1px;-webkit-backdrop-filter:saturate(120%);backdrop-filter:saturate(120%)}.action-sheet-translucent.sc-ion-action-sheet-ios-h .action-sheet-button.ion-activated.sc-ion-action-sheet-ios{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.7);background-image:none}.action-sheet-translucent.sc-ion-action-sheet-ios-h .action-sheet-cancel.sc-ion-action-sheet-ios{background:var(--button-background-selected)}}.action-sheet-title.sc-ion-action-sheet-ios{background:-webkit-gradient(linear, left bottom, left top, from(rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08)), color-stop(50%, rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08)), color-stop(50%, transparent)) bottom/100% 1px no-repeat transparent;background:linear-gradient(0deg, rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08), rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08) 50%, transparent 50%) bottom/100% 1px no-repeat transparent}.action-sheet-title.sc-ion-action-sheet-ios{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:14px;padding-bottom:13px;color:var(--color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-size:max(13px, 0.8125rem);font-weight:400;text-align:center}.action-sheet-title.action-sheet-has-sub-title.sc-ion-action-sheet-ios{font-weight:600}.action-sheet-sub-title.sc-ion-action-sheet-ios{padding-left:0;padding-right:0;padding-top:6px;padding-bottom:0;font-size:max(13px, 0.8125rem);font-weight:400}.action-sheet-button.sc-ion-action-sheet-ios{-webkit-padding-start:14px;padding-inline-start:14px;-webkit-padding-end:14px;padding-inline-end:14px;padding-top:14px;padding-bottom:14px;min-height:56px;font-size:max(20px, 1.25rem);contain:content}.action-sheet-button.sc-ion-action-sheet-ios .action-sheet-icon.sc-ion-action-sheet-ios{-webkit-margin-end:0.3em;margin-inline-end:0.3em;font-size:max(28px, 1.75rem);pointer-events:none}.action-sheet-button.sc-ion-action-sheet-ios:last-child{background-image:none}.action-sheet-selected.sc-ion-action-sheet-ios{font-weight:bold}.action-sheet-cancel.sc-ion-action-sheet-ios{font-weight:600}.action-sheet-cancel.sc-ion-action-sheet-ios::after{background:var(--button-background-selected);opacity:var(--button-background-selected-opacity)}.action-sheet-destructive.sc-ion-action-sheet-ios,.action-sheet-destructive.ion-activated.sc-ion-action-sheet-ios,.action-sheet-destructive.ion-focused.sc-ion-action-sheet-ios{color:var(--ion-color-danger, #c5000f)}@media (any-hover: hover){.action-sheet-destructive.sc-ion-action-sheet-ios:hover{color:var(--ion-color-danger, #c5000f)}}";
- var IonActionSheetIosStyle0 = actionSheetIosCss;
- const actionSheetMdCss = ".sc-ion-action-sheet-md-h{--color:initial;--button-color-activated:var(--button-color);--button-color-focused:var(--button-color);--button-color-hover:var(--button-color);--button-color-selected:var(--button-color);--min-width:auto;--width:100%;--max-width:500px;--min-height:auto;--height:auto;--max-height:calc(100% - (var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:block;position:fixed;outline:none;font-family:var(--ion-font-family, inherit);-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-action-sheet-md-h{display:none}.action-sheet-wrapper.sc-ion-action-sheet-md{left:0;right:0;bottom:0;-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);display:block;position:absolute;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);z-index:10;pointer-events:none}.action-sheet-button.sc-ion-action-sheet-md{display:block;position:relative;width:100%;border:0;outline:none;background:var(--button-background);color:var(--button-color);font-family:inherit;overflow:hidden}.action-sheet-button.sc-ion-action-sheet-md:disabled{color:var(--button-color-disabled);opacity:0.4}.action-sheet-button-inner.sc-ion-action-sheet-md{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;pointer-events:none;width:100%;height:100%;z-index:1}.action-sheet-container.sc-ion-action-sheet-md{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;-ms-flex-pack:end;justify-content:flex-end;height:100%;max-height:calc(100vh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0)));max-height:calc(100dvh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0)))}.action-sheet-group.sc-ion-action-sheet-md{-ms-flex-negative:2;flex-shrink:2;overscroll-behavior-y:contain;overflow-y:auto;-webkit-overflow-scrolling:touch;pointer-events:all;background:var(--background)}@media (any-pointer: coarse){.action-sheet-group.sc-ion-action-sheet-md::-webkit-scrollbar{display:none}}.action-sheet-group-cancel.sc-ion-action-sheet-md{-ms-flex-negative:0;flex-shrink:0;overflow:hidden}.action-sheet-button.sc-ion-action-sheet-md::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.action-sheet-selected.sc-ion-action-sheet-md{color:var(--button-color-selected)}.action-sheet-selected.sc-ion-action-sheet-md::after{background:var(--button-background-selected);opacity:var(--button-background-selected-opacity)}.action-sheet-button.ion-activated.sc-ion-action-sheet-md{color:var(--button-color-activated)}.action-sheet-button.ion-activated.sc-ion-action-sheet-md::after{background:var(--button-background-activated);opacity:var(--button-background-activated-opacity)}.action-sheet-button.ion-focused.sc-ion-action-sheet-md{color:var(--button-color-focused)}.action-sheet-button.ion-focused.sc-ion-action-sheet-md::after{background:var(--button-background-focused);opacity:var(--button-background-focused-opacity)}@media (any-hover: hover){.action-sheet-button.sc-ion-action-sheet-md:not(:disabled):hover{color:var(--button-color-hover)}.action-sheet-button.sc-ion-action-sheet-md:not(:disabled):hover::after{background:var(--button-background-hover);opacity:var(--button-background-hover-opacity)}}.sc-ion-action-sheet-md-h{--background:var(--ion-overlay-background-color, var(--ion-background-color, #fff));--backdrop-opacity:var(--ion-backdrop-opacity, 0.32);--button-background:transparent;--button-background-selected:currentColor;--button-background-selected-opacity:0;--button-background-activated:transparent;--button-background-activated-opacity:0;--button-background-hover:currentColor;--button-background-hover-opacity:.04;--button-background-focused:currentColor;--button-background-focused-opacity:.12;--button-color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));--button-color-disabled:var(--button-color);--color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54)}.action-sheet-wrapper.sc-ion-action-sheet-md{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:var(--ion-safe-area-top, 0);margin-bottom:0}.action-sheet-title.sc-ion-action-sheet-md{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:20px;padding-bottom:17px;min-height:60px;color:var(--color, rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54));font-size:1rem;text-align:start}.action-sheet-sub-title.sc-ion-action-sheet-md{padding-left:0;padding-right:0;padding-top:16px;padding-bottom:0;font-size:0.875rem}.action-sheet-group.sc-ion-action-sheet-md:first-child{padding-top:0}.action-sheet-group.sc-ion-action-sheet-md:last-child{padding-bottom:var(--ion-safe-area-bottom)}.action-sheet-button.sc-ion-action-sheet-md{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:12px;padding-bottom:12px;position:relative;min-height:52px;font-size:1rem;text-align:start;contain:content;overflow:hidden}.action-sheet-icon.sc-ion-action-sheet-md{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:32px;margin-inline-end:32px;margin-top:0;margin-bottom:0;color:var(--color);font-size:1.5rem}.action-sheet-button-inner.sc-ion-action-sheet-md{-ms-flex-pack:start;justify-content:flex-start}.action-sheet-selected.sc-ion-action-sheet-md{font-weight:bold}";
- var IonActionSheetMdStyle0 = actionSheetMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class ActionSheet {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.didPresent = createEvent(this, "ionActionSheetDidPresent", 7);
- this.willPresent = createEvent(this, "ionActionSheetWillPresent", 7);
- this.willDismiss = createEvent(this, "ionActionSheetWillDismiss", 7);
- this.didDismiss = createEvent(this, "ionActionSheetDidDismiss", 7);
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
- this.delegateController = createDelegateController(this);
- this.lockController = createLockController();
- this.triggerController = createTriggerController();
- this.presented = false;
- this.onBackdropTap = () => {
- this.dismiss(undefined, BACKDROP);
- };
- this.dispatchCancelHandler = (ev) => {
- const role = ev.detail.role;
- if (isCancel(role)) {
- const cancelButton = this.getButtons().find((b) => b.role === 'cancel');
- this.callButtonHandler(cancelButton);
- }
- };
- this.overlayIndex = undefined;
- this.delegate = undefined;
- this.hasController = false;
- this.keyboardClose = true;
- this.enterAnimation = undefined;
- this.leaveAnimation = undefined;
- this.buttons = [];
- this.cssClass = undefined;
- this.backdropDismiss = true;
- this.header = undefined;
- this.subHeader = undefined;
- this.translucent = false;
- this.animated = true;
- this.htmlAttributes = undefined;
- this.isOpen = false;
- this.trigger = undefined;
- }
- onIsOpenChange(newValue, oldValue) {
- if (newValue === true && oldValue === false) {
- this.present();
- }
- else if (newValue === false && oldValue === true) {
- this.dismiss();
- }
- }
- triggerChanged() {
- const { trigger, el, triggerController } = this;
- if (trigger) {
- triggerController.addClickListener(el, trigger);
- }
- }
- /**
- * Present the action sheet overlay after it has been created.
- */
- async present() {
- const unlock = await this.lockController.lock();
- await this.delegateController.attachViewToDom();
- await present(this, 'actionSheetEnter', iosEnterAnimation$6, mdEnterAnimation$5);
- unlock();
- }
- /**
- * Dismiss the action sheet overlay after it has been presented.
- *
- * @param data Any data to emit in the dismiss events.
- * @param role The role of the element that is dismissing the action sheet.
- * This can be useful in a button handler for determining which button was
- * clicked to dismiss the action sheet.
- * Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
- *
- * This is a no-op if the overlay has not been presented yet. If you want
- * to remove an overlay from the DOM that was never presented, use the
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
- */
- async dismiss(data, role) {
- const unlock = await this.lockController.lock();
- const dismissed = await dismiss(this, data, role, 'actionSheetLeave', iosLeaveAnimation$6, mdLeaveAnimation$5);
- if (dismissed) {
- this.delegateController.removeViewFromDom();
- }
- unlock();
- return dismissed;
- }
- /**
- * Returns a promise that resolves when the action sheet did dismiss.
- */
- onDidDismiss() {
- return eventMethod(this.el, 'ionActionSheetDidDismiss');
- }
- /**
- * Returns a promise that resolves when the action sheet will dismiss.
- *
- */
- onWillDismiss() {
- return eventMethod(this.el, 'ionActionSheetWillDismiss');
- }
- async buttonClick(button) {
- const role = button.role;
- if (isCancel(role)) {
- return this.dismiss(button.data, role);
- }
- const shouldDismiss = await this.callButtonHandler(button);
- if (shouldDismiss) {
- return this.dismiss(button.data, button.role);
- }
- return Promise.resolve();
- }
- async callButtonHandler(button) {
- if (button) {
- // a handler has been provided, execute it
- // pass the handler the values from the inputs
- const rtn = await safeCall(button.handler);
- if (rtn === false) {
- // if the return value of the handler is false then do not dismiss
- return false;
- }
- }
- return true;
- }
- getButtons() {
- return this.buttons.map((b) => {
- return typeof b === 'string' ? { text: b } : b;
- });
- }
- connectedCallback() {
- prepareOverlay(this.el);
- this.triggerChanged();
- }
- disconnectedCallback() {
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- this.triggerController.removeClickListener();
- }
- componentWillLoad() {
- var _a;
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
- setOverlayId(this.el);
- }
- }
- componentDidLoad() {
- /**
- * Only create gesture if:
- * 1. A gesture does not already exist
- * 2. App is running in iOS mode
- * 3. A wrapper ref exists
- * 4. A group ref exists
- */
- const { groupEl, wrapperEl } = this;
- if (!this.gesture && getIonMode$1(this) === 'ios' && wrapperEl && groupEl) {
- readTask(() => {
- const isScrollable = groupEl.scrollHeight > groupEl.clientHeight;
- if (!isScrollable) {
- this.gesture = createButtonActiveGesture(wrapperEl, (refEl) => refEl.classList.contains('action-sheet-button'));
- this.gesture.enable(true);
- }
- });
- }
- /**
- * If action sheet was rendered with isOpen="true"
- * then we should open action sheet immediately.
- */
- if (this.isOpen === true) {
- raf(() => this.present());
- }
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.triggerChanged();
- }
- render() {
- const { header, htmlAttributes, overlayIndex } = this;
- const mode = getIonMode$1(this);
- const allButtons = this.getButtons();
- const cancelButton = allButtons.find((b) => b.role === 'cancel');
- const buttons = allButtons.filter((b) => b.role !== 'cancel');
- const headerID = `action-sheet-${overlayIndex}-header`;
- return (hAsync(Host, Object.assign({ key: '7bbd202ca9e19727e7514abbe073687d982f80c3', role: "dialog", "aria-modal": "true", "aria-labelledby": header !== undefined ? headerID : null, tabindex: "-1" }, htmlAttributes, { style: {
- zIndex: `${20000 + this.overlayIndex}`,
- }, class: Object.assign(Object.assign({ [mode]: true }, getClassMap(this.cssClass)), { 'overlay-hidden': true, 'action-sheet-translucent': this.translucent }), onIonActionSheetWillDismiss: this.dispatchCancelHandler, onIonBackdropTap: this.onBackdropTap }), hAsync("ion-backdrop", { key: '23344a9221a2e6720d7b9de5249dc37256cafa7b', tappable: this.backdropDismiss }), hAsync("div", { key: 'fbc2ba15549c2ab04e759e82df6e177fd80cc0a6', tabindex: "0", "aria-hidden": "true" }), hAsync("div", { key: '748ee5235d0b4cb26d6f1b7589f77af2e37ad28a', class: "action-sheet-wrapper ion-overlay-wrapper", ref: (el) => (this.wrapperEl = el) }, hAsync("div", { key: '7ce5fa236cf75e9b1e49c4725c9a811078706554', class: "action-sheet-container" }, hAsync("div", { key: 'dc2251f3bcee4a93e3449f09621cbd2b65d329e9', class: "action-sheet-group", ref: (el) => (this.groupEl = el) }, header !== undefined && (hAsync("div", { key: '48d325c8a852f56ed57a9ada1a6709d05ba32ee2', id: headerID, class: {
- 'action-sheet-title': true,
- 'action-sheet-has-sub-title': this.subHeader !== undefined,
- } }, header, this.subHeader && hAsync("div", { key: '66093728052eb67f37a35f3232761ce4a08896f3', class: "action-sheet-sub-title" }, this.subHeader))), buttons.map((b) => (hAsync("button", Object.assign({}, b.htmlAttributes, { type: "button", id: b.id, class: buttonClass$3(b), onClick: () => this.buttonClick(b), disabled: b.disabled }), hAsync("span", { class: "action-sheet-button-inner" }, b.icon && hAsync("ion-icon", { icon: b.icon, "aria-hidden": "true", lazy: false, class: "action-sheet-icon" }), b.text), mode === 'md' && hAsync("ion-ripple-effect", null))))), cancelButton && (hAsync("div", { key: 'f4eb8e3e2885b85af5080df18d0de0bdd1d719de', class: "action-sheet-group action-sheet-group-cancel" }, hAsync("button", Object.assign({ key: '169f4eb09255aba85062baad49ceb151239fbfb7' }, cancelButton.htmlAttributes, { type: "button", class: buttonClass$3(cancelButton), onClick: () => this.buttonClick(cancelButton) }), hAsync("span", { key: '25fb8a466dd67ea94c79cfb4f9965527e1ce6d42', class: "action-sheet-button-inner" }, cancelButton.icon && (hAsync("ion-icon", { key: 'eb5b071e120a2c86afdf967af6a763a43044d1ca', icon: cancelButton.icon, "aria-hidden": "true", lazy: false, class: "action-sheet-icon" })), cancelButton.text), mode === 'md' && hAsync("ion-ripple-effect", { key: '452ad7e1052b2c681e2d98de8193949755ad4d54' })))))), hAsync("div", { key: 'e1cecf280c987c050d9445e2c458b903f153089b', tabindex: "0", "aria-hidden": "true" })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "isOpen": ["onIsOpenChange"],
- "trigger": ["triggerChanged"]
- }; }
- static get style() { return {
- ios: IonActionSheetIosStyle0,
- md: IonActionSheetMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 34,
- "$tagName$": "ion-action-sheet",
- "$members$": {
- "overlayIndex": [2, "overlay-index"],
- "delegate": [16],
- "hasController": [4, "has-controller"],
- "keyboardClose": [4, "keyboard-close"],
- "enterAnimation": [16],
- "leaveAnimation": [16],
- "buttons": [16],
- "cssClass": [1, "css-class"],
- "backdropDismiss": [4, "backdrop-dismiss"],
- "header": [1],
- "subHeader": [1, "sub-header"],
- "translucent": [4],
- "animated": [4],
- "htmlAttributes": [16],
- "isOpen": [4, "is-open"],
- "trigger": [1],
- "present": [64],
- "dismiss": [64],
- "onDidDismiss": [64],
- "onWillDismiss": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const buttonClass$3 = (button) => {
- return Object.assign({ 'action-sheet-button': true, 'ion-activatable': !button.disabled, 'ion-focusable': !button.disabled, [`action-sheet-${button.role}`]: button.role !== undefined }, getClassMap(button.cssClass));
- };
- const ENABLE_HTML_CONTENT_DEFAULT = false;
- /**
- * Does a simple sanitization of all elements
- * in an untrusted string
- */
- const sanitizeDOMString = (untrustedString) => {
- try {
- if (untrustedString instanceof IonicSafeString) {
- return untrustedString.value;
- }
- if (!isSanitizerEnabled() || typeof untrustedString !== 'string' || untrustedString === '') {
- return untrustedString;
- }
- /**
- * onload is fired when appending to a document
- * fragment in Chrome. If a string
- * contains onload then we should not
- * attempt to add this to the fragment.
- */
- if (untrustedString.includes('onload=')) {
- return '';
- }
- /**
- * Create a document fragment
- * separate from the main DOM,
- * create a div to do our work in
- */
- const documentFragment = document.createDocumentFragment();
- const workingDiv = document.createElement('div');
- documentFragment.appendChild(workingDiv);
- workingDiv.innerHTML = untrustedString;
- /**
- * Remove any elements
- * that are blocked
- */
- blockedTags.forEach((blockedTag) => {
- const getElementsToRemove = documentFragment.querySelectorAll(blockedTag);
- for (let elementIndex = getElementsToRemove.length - 1; elementIndex >= 0; elementIndex--) {
- const element = getElementsToRemove[elementIndex];
- if (element.parentNode) {
- element.parentNode.removeChild(element);
- }
- else {
- documentFragment.removeChild(element);
- }
- /**
- * We still need to sanitize
- * the children of this element
- * as they are left behind
- */
- const childElements = getElementChildren(element);
- /* eslint-disable-next-line */
- for (let childIndex = 0; childIndex < childElements.length; childIndex++) {
- sanitizeElement(childElements[childIndex]);
- }
- }
- });
- /**
- * Go through remaining elements and remove
- * non-allowed attribs
- */
- // IE does not support .children on document fragments, only .childNodes
- const dfChildren = getElementChildren(documentFragment);
- /* eslint-disable-next-line */
- for (let childIndex = 0; childIndex < dfChildren.length; childIndex++) {
- sanitizeElement(dfChildren[childIndex]);
- }
- // Append document fragment to div
- const fragmentDiv = document.createElement('div');
- fragmentDiv.appendChild(documentFragment);
- // First child is always the div we did our work in
- const getInnerDiv = fragmentDiv.querySelector('div');
- return getInnerDiv !== null ? getInnerDiv.innerHTML : fragmentDiv.innerHTML;
- }
- catch (err) {
- printIonError('sanitizeDOMString', err);
- return '';
- }
- };
- /**
- * Clean up current element based on allowed attributes
- * and then recursively dig down into any child elements to
- * clean those up as well
- */
- // TODO(FW-2832): type (using Element triggers other type errors as well)
- const sanitizeElement = (element) => {
- // IE uses childNodes, so ignore nodes that are not elements
- if (element.nodeType && element.nodeType !== 1) {
- return;
- }
- /**
- * If attributes is not a NamedNodeMap
- * then we should remove the element entirely.
- * This helps avoid DOM Clobbering attacks where
- * attributes is overridden.
- */
- if (typeof NamedNodeMap !== 'undefined' && !(element.attributes instanceof NamedNodeMap)) {
- element.remove();
- return;
- }
- for (let i = element.attributes.length - 1; i >= 0; i--) {
- const attribute = element.attributes.item(i);
- const attributeName = attribute.name;
- // remove non-allowed attribs
- if (!allowedAttributes.includes(attributeName.toLowerCase())) {
- element.removeAttribute(attributeName);
- continue;
- }
- // clean up any allowed attribs
- // that attempt to do any JS funny-business
- const attributeValue = attribute.value;
- /**
- * We also need to check the property value
- * as javascript: can allow special characters
- * such as 	 and still be valid (i.e. java	script)
- */
- const propertyValue = element[attributeName];
- /* eslint-disable */
- if ((attributeValue != null && attributeValue.toLowerCase().includes('javascript:')) ||
- (propertyValue != null && propertyValue.toLowerCase().includes('javascript:'))) {
- element.removeAttribute(attributeName);
- }
- /* eslint-enable */
- }
- /**
- * Sanitize any nested children
- */
- const childElements = getElementChildren(element);
- /* eslint-disable-next-line */
- for (let i = 0; i < childElements.length; i++) {
- sanitizeElement(childElements[i]);
- }
- };
- /**
- * IE doesn't always support .children
- * so we revert to .childNodes instead
- */
- // TODO(FW-2832): type
- const getElementChildren = (el) => {
- return el.children != null ? el.children : el.childNodes;
- };
- const isSanitizerEnabled = () => {
- var _a;
- const win = window;
- const config = (_a = win === null || win === void 0 ? void 0 : win.Ionic) === null || _a === void 0 ? void 0 : _a.config;
- if (config) {
- if (config.get) {
- return config.get('sanitizerEnabled', true);
- }
- else {
- return config.sanitizerEnabled === true || config.sanitizerEnabled === undefined;
- }
- }
- return true;
- };
- const allowedAttributes = ['class', 'id', 'href', 'src', 'name', 'slot'];
- const blockedTags = ['script', 'style', 'iframe', 'meta', 'link', 'object', 'embed'];
- class IonicSafeString {
- constructor(value) {
- this.value = value;
- }
- }
- /**
- * iOS Alert Enter Animation
- */
- const iosEnterAnimation$5 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation.addElement(baseEl.querySelector('.alert-wrapper')).keyframes([
- { offset: 0, opacity: '0.01', transform: 'scale(1.1)' },
- { offset: 1, opacity: '1', transform: 'scale(1)' },
- ]);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(200)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * iOS Alert Leave Animation
- */
- const iosLeaveAnimation$5 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- wrapperAnimation.addElement(baseEl.querySelector('.alert-wrapper')).keyframes([
- { offset: 0, opacity: 0.99, transform: 'scale(1)' },
- { offset: 1, opacity: 0, transform: 'scale(0.9)' },
- ]);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(200)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * Md Alert Enter Animation
- */
- const mdEnterAnimation$4 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation.addElement(baseEl.querySelector('.alert-wrapper')).keyframes([
- { offset: 0, opacity: '0.01', transform: 'scale(0.9)' },
- { offset: 1, opacity: '1', transform: 'scale(1)' },
- ]);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(150)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * Md Alert Leave Animation
- */
- const mdLeaveAnimation$4 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- wrapperAnimation.addElement(baseEl.querySelector('.alert-wrapper')).fromTo('opacity', 0.99, 0);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(150)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- const alertIosCss = ".sc-ion-alert-ios-h{--min-width:250px;--width:auto;--min-height:auto;--height:auto;--max-height:90%;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-alert-ios-h{display:none}.alert-top.sc-ion-alert-ios-h{padding-top:50px;-ms-flex-align:start;align-items:flex-start}.alert-wrapper.sc-ion-alert-ios{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:content;opacity:0;z-index:10}.alert-title.sc-ion-alert-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}.alert-sub-title.sc-ion-alert-ios{margin-left:0;margin-right:0;margin-top:5px;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-weight:normal}.alert-message.sc-ion-alert-ios,.alert-input-group.sc-ion-alert-ios{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-overflow-scrolling:touch;overflow-y:auto;overscroll-behavior-y:contain}.alert-checkbox-label.sc-ion-alert-ios,.alert-radio-label.sc-ion-alert-ios{overflow-wrap:anywhere}@media (any-pointer: coarse){.alert-checkbox-group.sc-ion-alert-ios::-webkit-scrollbar,.alert-radio-group.sc-ion-alert-ios::-webkit-scrollbar,.alert-message.sc-ion-alert-ios::-webkit-scrollbar{display:none}}.alert-input.sc-ion-alert-ios{padding-left:0;padding-right:0;padding-top:10px;padding-bottom:10px;width:100%;border:0;background:inherit;font:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}.alert-button-group.sc-ion-alert-ios{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}.alert-button-group-vertical.sc-ion-alert-ios{-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.alert-button.sc-ion-alert-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;border:0;font-size:0.875rem;line-height:1.25rem;z-index:0}.alert-button.ion-focused.sc-ion-alert-ios,.alert-tappable.ion-focused.sc-ion-alert-ios{background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}.alert-button-inner.sc-ion-alert-ios{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;min-height:inherit}.alert-input-disabled.sc-ion-alert-ios,.alert-checkbox-button-disabled.sc-ion-alert-ios .alert-button-inner.sc-ion-alert-ios,.alert-radio-button-disabled.sc-ion-alert-ios .alert-button-inner.sc-ion-alert-ios{cursor:default;opacity:0.5;pointer-events:none}.alert-tappable.sc-ion-alert-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:-ms-flexbox;display:flex;width:100%;border:0;background:transparent;font-size:inherit;line-height:initial;text-align:start;-webkit-appearance:none;-moz-appearance:none;appearance:none;contain:content}.alert-button.sc-ion-alert-ios,.alert-checkbox.sc-ion-alert-ios,.alert-input.sc-ion-alert-ios,.alert-radio.sc-ion-alert-ios{outline:none}.alert-radio-icon.sc-ion-alert-ios,.alert-checkbox-icon.sc-ion-alert-ios,.alert-checkbox-inner.sc-ion-alert-ios{-webkit-box-sizing:border-box;box-sizing:border-box}textarea.alert-input.sc-ion-alert-ios{min-height:37px;resize:none}.sc-ion-alert-ios-h{--background:var(--ion-overlay-background-color, var(--ion-color-step-100, var(--ion-background-color-step-100, #f9f9f9)));--max-width:clamp(270px, 16.875rem, 324px);--backdrop-opacity:var(--ion-backdrop-opacity, 0.3);font-size:max(14px, 0.875rem)}.alert-wrapper.sc-ion-alert-ios{border-radius:13px;-webkit-box-shadow:none;box-shadow:none;overflow:hidden}.alert-button.sc-ion-alert-ios .alert-button-inner.sc-ion-alert-ios{pointer-events:none}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.alert-translucent.sc-ion-alert-ios-h .alert-wrapper.sc-ion-alert-ios{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.9);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}.alert-head.sc-ion-alert-ios{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:12px;padding-bottom:7px;text-align:center}.alert-title.sc-ion-alert-ios{margin-top:8px;color:var(--ion-text-color, #000);font-size:max(17px, 1.0625rem);font-weight:600}.alert-sub-title.sc-ion-alert-ios{color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));font-size:max(14px, 0.875rem)}.alert-message.sc-ion-alert-ios,.alert-input-group.sc-ion-alert-ios{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0;padding-bottom:21px;color:var(--ion-text-color, #000);font-size:max(13px, 0.8125rem);text-align:center}.alert-message.sc-ion-alert-ios{max-height:240px}.alert-message.sc-ion-alert-ios:empty{padding-left:0;padding-right:0;padding-top:0;padding-bottom:12px}.alert-input.sc-ion-alert-ios{border-radius:7px;margin-top:10px;-webkit-padding-start:7px;padding-inline-start:7px;-webkit-padding-end:7px;padding-inline-end:7px;padding-top:7px;padding-bottom:7px;border:0.55px solid var(--ion-color-step-250, var(--ion-background-color-step-250, #bfbfbf));background-color:var(--ion-background-color, #fff);-webkit-appearance:none;-moz-appearance:none;appearance:none;font-size:1rem}.alert-input.sc-ion-alert-ios::-webkit-input-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::-moz-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios:-ms-input-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::-ms-input-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::-ms-clear{display:none}.alert-input.sc-ion-alert-ios::-webkit-date-and-time-value{height:18px}.alert-radio-group.sc-ion-alert-ios,.alert-checkbox-group.sc-ion-alert-ios{-ms-scroll-chaining:none;overscroll-behavior:contain;max-height:240px;border-top:0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2);overflow-y:auto;-webkit-overflow-scrolling:touch}.alert-tappable.sc-ion-alert-ios{min-height:44px}.alert-radio-label.sc-ion-alert-ios{-webkit-padding-start:13px;padding-inline-start:13px;-webkit-padding-end:13px;padding-inline-end:13px;padding-top:13px;padding-bottom:13px;-ms-flex:1;flex:1;-ms-flex-order:0;order:0;color:var(--ion-text-color, #000)}[aria-checked=true].sc-ion-alert-ios .alert-radio-label.sc-ion-alert-ios{color:var(--ion-color-primary, #0054e9)}.alert-radio-icon.sc-ion-alert-ios{position:relative;-ms-flex-order:1;order:1;min-width:30px}[aria-checked=true].sc-ion-alert-ios .alert-radio-inner.sc-ion-alert-ios{top:-7px;position:absolute;width:6px;height:12px;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-width:2px;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--ion-color-primary, #0054e9)}[aria-checked=true].sc-ion-alert-ios .alert-radio-inner.sc-ion-alert-ios{inset-inline-start:7px}.alert-checkbox-label.sc-ion-alert-ios{-webkit-padding-start:13px;padding-inline-start:13px;-webkit-padding-end:13px;padding-inline-end:13px;padding-top:13px;padding-bottom:13px;-ms-flex:1;flex:1;color:var(--ion-text-color, #000)}.alert-checkbox-icon.sc-ion-alert-ios{border-radius:50%;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:6px;margin-inline-end:6px;margin-top:10px;margin-bottom:10px;position:relative;width:min(1.375rem, 55.836px);height:min(1.375rem, 55.836px);border-width:0.125rem;border-style:solid;border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));background-color:var(--ion-item-background, var(--ion-background-color, #fff));contain:strict}[aria-checked=true].sc-ion-alert-ios .alert-checkbox-icon.sc-ion-alert-ios{border-color:var(--ion-color-primary, #0054e9);background-color:var(--ion-color-primary, #0054e9)}[aria-checked=true].sc-ion-alert-ios .alert-checkbox-inner.sc-ion-alert-ios{top:calc(min(1.375rem, 55.836px) / 8);position:absolute;width:calc(min(1.375rem, 55.836px) / 6 + 1px);height:calc(min(1.375rem, 55.836px) * 0.5);-webkit-transform:rotate(45deg);transform:rotate(45deg);border-width:0.125rem;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--ion-background-color, #fff)}[aria-checked=true].sc-ion-alert-ios .alert-checkbox-inner.sc-ion-alert-ios{inset-inline-start:calc(min(1.375rem, 55.836px) / 3)}.alert-button-group.sc-ion-alert-ios{-webkit-margin-end:-0.55px;margin-inline-end:-0.55px;-ms-flex-wrap:wrap;flex-wrap:wrap}.alert-button-group-vertical.sc-ion-alert-ios .alert-button.sc-ion-alert-ios{border-right:none}[dir=rtl].sc-ion-alert-ios-h .alert-button-group-vertical.sc-ion-alert-ios .alert-button.sc-ion-alert-ios:last-child,[dir=rtl] .sc-ion-alert-ios-h .alert-button-group-vertical.sc-ion-alert-ios .alert-button.sc-ion-alert-ios:last-child{border-right:none}[dir=rtl].sc-ion-alert-ios .alert-button-group-vertical.sc-ion-alert-ios .alert-button.sc-ion-alert-ios:last-child{border-right:none}@supports selector(:dir(rtl)){.alert-button-group-vertical.sc-ion-alert-ios .alert-button.sc-ion-alert-ios:last-child:dir(rtl){border-right:none}}.alert-button.sc-ion-alert-ios{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:0;-ms-flex:1 1 auto;flex:1 1 auto;min-width:50%;height:max(44px, 2.75rem);border-top:0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2);border-right:0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2);background-color:transparent;color:var(--ion-color-primary, #0054e9);font-size:max(17px, 1.0625rem);overflow:hidden}[dir=rtl].sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:first-child,[dir=rtl] .sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:first-child{border-right:0}[dir=rtl].sc-ion-alert-ios .alert-button.sc-ion-alert-ios:first-child{border-right:0}@supports selector(:dir(rtl)){.alert-button.sc-ion-alert-ios:first-child:dir(rtl){border-right:0}}.alert-button.sc-ion-alert-ios:last-child{border-right:0;font-weight:bold}[dir=rtl].sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:last-child,[dir=rtl] .sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:last-child{border-right:0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2)}[dir=rtl].sc-ion-alert-ios .alert-button.sc-ion-alert-ios:last-child{border-right:0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2)}@supports selector(:dir(rtl)){.alert-button.sc-ion-alert-ios:last-child:dir(rtl){border-right:0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2)}}.alert-button.ion-activated.sc-ion-alert-ios{background-color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.1)}.alert-button-role-destructive.sc-ion-alert-ios,.alert-button-role-destructive.ion-activated.sc-ion-alert-ios,.alert-button-role-destructive.ion-focused.sc-ion-alert-ios{color:var(--ion-color-danger, #c5000f)}";
- var IonAlertIosStyle0 = alertIosCss;
- const alertMdCss = ".sc-ion-alert-md-h{--min-width:250px;--width:auto;--min-height:auto;--height:auto;--max-height:90%;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-alert-md-h{display:none}.alert-top.sc-ion-alert-md-h{padding-top:50px;-ms-flex-align:start;align-items:flex-start}.alert-wrapper.sc-ion-alert-md{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:content;opacity:0;z-index:10}.alert-title.sc-ion-alert-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}.alert-sub-title.sc-ion-alert-md{margin-left:0;margin-right:0;margin-top:5px;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-weight:normal}.alert-message.sc-ion-alert-md,.alert-input-group.sc-ion-alert-md{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-overflow-scrolling:touch;overflow-y:auto;overscroll-behavior-y:contain}.alert-checkbox-label.sc-ion-alert-md,.alert-radio-label.sc-ion-alert-md{overflow-wrap:anywhere}@media (any-pointer: coarse){.alert-checkbox-group.sc-ion-alert-md::-webkit-scrollbar,.alert-radio-group.sc-ion-alert-md::-webkit-scrollbar,.alert-message.sc-ion-alert-md::-webkit-scrollbar{display:none}}.alert-input.sc-ion-alert-md{padding-left:0;padding-right:0;padding-top:10px;padding-bottom:10px;width:100%;border:0;background:inherit;font:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}.alert-button-group.sc-ion-alert-md{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}.alert-button-group-vertical.sc-ion-alert-md{-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.alert-button.sc-ion-alert-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;border:0;font-size:0.875rem;line-height:1.25rem;z-index:0}.alert-button.ion-focused.sc-ion-alert-md,.alert-tappable.ion-focused.sc-ion-alert-md{background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}.alert-button-inner.sc-ion-alert-md{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;min-height:inherit}.alert-input-disabled.sc-ion-alert-md,.alert-checkbox-button-disabled.sc-ion-alert-md .alert-button-inner.sc-ion-alert-md,.alert-radio-button-disabled.sc-ion-alert-md .alert-button-inner.sc-ion-alert-md{cursor:default;opacity:0.5;pointer-events:none}.alert-tappable.sc-ion-alert-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:-ms-flexbox;display:flex;width:100%;border:0;background:transparent;font-size:inherit;line-height:initial;text-align:start;-webkit-appearance:none;-moz-appearance:none;appearance:none;contain:content}.alert-button.sc-ion-alert-md,.alert-checkbox.sc-ion-alert-md,.alert-input.sc-ion-alert-md,.alert-radio.sc-ion-alert-md{outline:none}.alert-radio-icon.sc-ion-alert-md,.alert-checkbox-icon.sc-ion-alert-md,.alert-checkbox-inner.sc-ion-alert-md{-webkit-box-sizing:border-box;box-sizing:border-box}textarea.alert-input.sc-ion-alert-md{min-height:37px;resize:none}.sc-ion-alert-md-h{--background:var(--ion-overlay-background-color, var(--ion-background-color, #fff));--max-width:280px;--backdrop-opacity:var(--ion-backdrop-opacity, 0.32);font-size:0.875rem}.alert-wrapper.sc-ion-alert-md{border-radius:4px;-webkit-box-shadow:0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12);box-shadow:0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12)}.alert-head.sc-ion-alert-md{-webkit-padding-start:23px;padding-inline-start:23px;-webkit-padding-end:23px;padding-inline-end:23px;padding-top:20px;padding-bottom:15px;text-align:start}.alert-title.sc-ion-alert-md{color:var(--ion-text-color, #000);font-size:1.25rem;font-weight:500}.alert-sub-title.sc-ion-alert-md{color:var(--ion-text-color, #000);font-size:1rem}.alert-message.sc-ion-alert-md,.alert-input-group.sc-ion-alert-md{-webkit-padding-start:24px;padding-inline-start:24px;-webkit-padding-end:24px;padding-inline-end:24px;padding-top:20px;padding-bottom:20px;color:var(--ion-color-step-550, var(--ion-text-color-step-450, #737373))}.alert-message.sc-ion-alert-md{font-size:1rem}@media screen and (max-width: 767px){.alert-message.sc-ion-alert-md{max-height:266px}}.alert-message.sc-ion-alert-md:empty{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}.alert-head.sc-ion-alert-md+.alert-message.sc-ion-alert-md{padding-top:0}.alert-input.sc-ion-alert-md{margin-left:0;margin-right:0;margin-top:5px;margin-bottom:5px;border-bottom:1px solid var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));color:var(--ion-text-color, #000)}.alert-input.sc-ion-alert-md::-webkit-input-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-md::-moz-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-md:-ms-input-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-md::-ms-input-placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-md::placeholder{color:var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-md::-ms-clear{display:none}.alert-input.sc-ion-alert-md:focus{margin-bottom:4px;border-bottom:2px solid var(--ion-color-primary, #0054e9)}.alert-radio-group.sc-ion-alert-md,.alert-checkbox-group.sc-ion-alert-md{position:relative;border-top:1px solid var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));border-bottom:1px solid var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));overflow:auto}@media screen and (max-width: 767px){.alert-radio-group.sc-ion-alert-md,.alert-checkbox-group.sc-ion-alert-md{max-height:266px}}.alert-tappable.sc-ion-alert-md{position:relative;min-height:48px}.alert-radio-label.sc-ion-alert-md{-webkit-padding-start:52px;padding-inline-start:52px;-webkit-padding-end:26px;padding-inline-end:26px;padding-top:13px;padding-bottom:13px;-ms-flex:1;flex:1;color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));font-size:1rem}.alert-radio-icon.sc-ion-alert-md{top:0;border-radius:50%;display:block;position:relative;width:20px;height:20px;border-width:2px;border-style:solid;border-color:var(--ion-color-step-550, var(--ion-background-color-step-550, #737373))}.alert-radio-icon.sc-ion-alert-md{inset-inline-start:26px}.alert-radio-inner.sc-ion-alert-md{top:3px;border-radius:50%;position:absolute;width:10px;height:10px;-webkit-transform:scale3d(0, 0, 0);transform:scale3d(0, 0, 0);-webkit-transition:-webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:var(--ion-color-primary, #0054e9)}.alert-radio-inner.sc-ion-alert-md{inset-inline-start:3px}[aria-checked=true].sc-ion-alert-md .alert-radio-label.sc-ion-alert-md{color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626))}[aria-checked=true].sc-ion-alert-md .alert-radio-icon.sc-ion-alert-md{border-color:var(--ion-color-primary, #0054e9)}[aria-checked=true].sc-ion-alert-md .alert-radio-inner.sc-ion-alert-md{-webkit-transform:scale3d(1, 1, 1);transform:scale3d(1, 1, 1)}.alert-checkbox-label.sc-ion-alert-md{-webkit-padding-start:53px;padding-inline-start:53px;-webkit-padding-end:26px;padding-inline-end:26px;padding-top:13px;padding-bottom:13px;-ms-flex:1;flex:1;width:calc(100% - 53px);color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));font-size:1rem}.alert-checkbox-icon.sc-ion-alert-md{top:0;border-radius:2px;position:relative;width:16px;height:16px;border-width:2px;border-style:solid;border-color:var(--ion-color-step-550, var(--ion-background-color-step-550, #737373));contain:strict}.alert-checkbox-icon.sc-ion-alert-md{inset-inline-start:26px}[aria-checked=true].sc-ion-alert-md .alert-checkbox-icon.sc-ion-alert-md{border-color:var(--ion-color-primary, #0054e9);background-color:var(--ion-color-primary, #0054e9)}[aria-checked=true].sc-ion-alert-md .alert-checkbox-inner.sc-ion-alert-md{top:0;position:absolute;width:6px;height:10px;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-width:2px;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--ion-color-primary-contrast, #fff)}[aria-checked=true].sc-ion-alert-md .alert-checkbox-inner.sc-ion-alert-md{inset-inline-start:3px}.alert-button-group.sc-ion-alert-md{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse;-ms-flex-pack:end;justify-content:flex-end}.alert-button.sc-ion-alert-md{border-radius:2px;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:0;margin-bottom:0;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:10px;padding-bottom:10px;position:relative;background-color:transparent;color:var(--ion-color-primary, #0054e9);font-weight:500;text-align:end;text-transform:uppercase;overflow:hidden}.alert-button-inner.sc-ion-alert-md{-ms-flex-pack:end;justify-content:flex-end}@media screen and (min-width: 768px){.sc-ion-alert-md-h{--max-width:min(100vw - 96px, 560px);--max-height:min(100vh - 96px, 560px)}}";
- var IonAlertMdStyle0 = alertMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Alert {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.didPresent = createEvent(this, "ionAlertDidPresent", 7);
- this.willPresent = createEvent(this, "ionAlertWillPresent", 7);
- this.willDismiss = createEvent(this, "ionAlertWillDismiss", 7);
- this.didDismiss = createEvent(this, "ionAlertDidDismiss", 7);
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
- this.delegateController = createDelegateController(this);
- this.lockController = createLockController();
- this.triggerController = createTriggerController();
- this.customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
- this.processedInputs = [];
- this.processedButtons = [];
- this.presented = false;
- this.onBackdropTap = () => {
- this.dismiss(undefined, BACKDROP);
- };
- this.dispatchCancelHandler = (ev) => {
- const role = ev.detail.role;
- if (isCancel(role)) {
- const cancelButton = this.processedButtons.find((b) => b.role === 'cancel');
- this.callButtonHandler(cancelButton);
- }
- };
- this.overlayIndex = undefined;
- this.delegate = undefined;
- this.hasController = false;
- this.keyboardClose = true;
- this.enterAnimation = undefined;
- this.leaveAnimation = undefined;
- this.cssClass = undefined;
- this.header = undefined;
- this.subHeader = undefined;
- this.message = undefined;
- this.buttons = [];
- this.inputs = [];
- this.backdropDismiss = true;
- this.translucent = false;
- this.animated = true;
- this.htmlAttributes = undefined;
- this.isOpen = false;
- this.trigger = undefined;
- }
- onIsOpenChange(newValue, oldValue) {
- if (newValue === true && oldValue === false) {
- this.present();
- }
- else if (newValue === false && oldValue === true) {
- this.dismiss();
- }
- }
- triggerChanged() {
- const { trigger, el, triggerController } = this;
- if (trigger) {
- triggerController.addClickListener(el, trigger);
- }
- }
- onKeydown(ev) {
- var _a;
- const inputTypes = new Set(this.processedInputs.map((i) => i.type));
- /**
- * Based on keyboard navigation requirements, the
- * checkbox should not respond to the enter keydown event.
- */
- if (inputTypes.has('checkbox') && ev.key === 'Enter') {
- ev.preventDefault();
- return;
- }
- /**
- * Ensure when alert container is being focused, and the user presses the tab + shift keys, the focus will be set to the last alert button.
- */
- if (ev.target.classList.contains('alert-wrapper')) {
- if (ev.key === 'Tab' && ev.shiftKey) {
- ev.preventDefault();
- const lastChildBtn = (_a = this.wrapperEl) === null || _a === void 0 ? void 0 : _a.querySelector('.alert-button:last-child');
- lastChildBtn.focus();
- return;
- }
- }
- // The only inputs we want to navigate between using arrow keys are the radios
- // ignore the keydown event if it is not on a radio button
- if (!inputTypes.has('radio') ||
- (ev.target && !this.el.contains(ev.target)) ||
- ev.target.classList.contains('alert-button')) {
- return;
- }
- // Get all radios inside of the radio group and then
- // filter out disabled radios since we need to skip those
- const query = this.el.querySelectorAll('.alert-radio');
- const radios = Array.from(query).filter((radio) => !radio.disabled);
- // The focused radio is the one that shares the same id as
- // the event target
- const index = radios.findIndex((radio) => radio.id === ev.target.id);
- // We need to know what the next radio element should
- // be in order to change the focus
- let nextEl;
- // If hitting arrow down or arrow right, move to the next radio
- // If we're on the last radio, move to the first radio
- if (['ArrowDown', 'ArrowRight'].includes(ev.key)) {
- nextEl = index === radios.length - 1 ? radios[0] : radios[index + 1];
- }
- // If hitting arrow up or arrow left, move to the previous radio
- // If we're on the first radio, move to the last radio
- if (['ArrowUp', 'ArrowLeft'].includes(ev.key)) {
- nextEl = index === 0 ? radios[radios.length - 1] : radios[index - 1];
- }
- if (nextEl && radios.includes(nextEl)) {
- const nextProcessed = this.processedInputs.find((input) => input.id === (nextEl === null || nextEl === void 0 ? void 0 : nextEl.id));
- if (nextProcessed) {
- this.rbClick(nextProcessed);
- nextEl.focus();
- }
- }
- }
- buttonsChanged() {
- const buttons = this.buttons;
- this.processedButtons = buttons.map((btn) => {
- return typeof btn === 'string' ? { text: btn, role: btn.toLowerCase() === 'cancel' ? 'cancel' : undefined } : btn;
- });
- }
- inputsChanged() {
- const inputs = this.inputs;
- // Get the first input that is not disabled and the checked one
- // If an enabled checked input exists, set it to be the focusable input
- // otherwise we default to focus the first input
- // This will only be used when the input is type radio
- const first = inputs.find((input) => !input.disabled);
- const checked = inputs.find((input) => input.checked && !input.disabled);
- const focusable = checked || first;
- // An alert can be created with several different inputs. Radios,
- // checkboxes and inputs are all accepted, but they cannot be mixed.
- const inputTypes = new Set(inputs.map((i) => i.type));
- if (inputTypes.has('checkbox') && inputTypes.has('radio')) {
- printIonWarning(`[ion-alert] - Alert cannot mix input types: ${Array.from(inputTypes.values()).join('/')}. Please see alert docs for more info.`);
- }
- this.inputType = inputTypes.values().next().value;
- this.processedInputs = inputs.map((i, index) => {
- var _a;
- return ({
- type: i.type || 'text',
- name: i.name || `${index}`,
- placeholder: i.placeholder || '',
- value: i.value,
- label: i.label,
- checked: !!i.checked,
- disabled: !!i.disabled,
- id: i.id || `alert-input-${this.overlayIndex}-${index}`,
- handler: i.handler,
- min: i.min,
- max: i.max,
- cssClass: (_a = i.cssClass) !== null && _a !== void 0 ? _a : '',
- attributes: i.attributes || {},
- tabindex: i.type === 'radio' && i !== focusable ? -1 : 0,
- });
- });
- }
- connectedCallback() {
- prepareOverlay(this.el);
- this.triggerChanged();
- }
- componentWillLoad() {
- var _a;
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
- setOverlayId(this.el);
- }
- this.inputsChanged();
- this.buttonsChanged();
- }
- disconnectedCallback() {
- this.triggerController.removeClickListener();
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- }
- componentDidLoad() {
- /**
- * Only create gesture if:
- * 1. A gesture does not already exist
- * 2. App is running in iOS mode
- * 3. A wrapper ref exists
- */
- if (!this.gesture && getIonMode$1(this) === 'ios' && this.wrapperEl) {
- this.gesture = createButtonActiveGesture(this.wrapperEl, (refEl) => refEl.classList.contains('alert-button'));
- this.gesture.enable(true);
- }
- /**
- * If alert was rendered with isOpen="true"
- * then we should open alert immediately.
- */
- if (this.isOpen === true) {
- raf(() => this.present());
- }
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.triggerChanged();
- }
- /**
- * Present the alert overlay after it has been created.
- */
- async present() {
- const unlock = await this.lockController.lock();
- await this.delegateController.attachViewToDom();
- await present(this, 'alertEnter', iosEnterAnimation$5, mdEnterAnimation$4).then(() => {
- var _a, _b;
- /**
- * Check if alert has only one button and no inputs.
- * If so, then focus on the button. Otherwise, focus the alert wrapper.
- * This will map to the default native alert behavior.
- */
- if (this.buttons.length === 1 && this.inputs.length === 0) {
- const queryBtn = (_a = this.wrapperEl) === null || _a === void 0 ? void 0 : _a.querySelector('.alert-button');
- queryBtn.focus();
- }
- else {
- (_b = this.wrapperEl) === null || _b === void 0 ? void 0 : _b.focus();
- }
- });
- unlock();
- }
- /**
- * Dismiss the alert overlay after it has been presented.
- *
- * @param data Any data to emit in the dismiss events.
- * @param role The role of the element that is dismissing the alert.
- * This can be useful in a button handler for determining which button was
- * clicked to dismiss the alert.
- * Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
- *
- * This is a no-op if the overlay has not been presented yet. If you want
- * to remove an overlay from the DOM that was never presented, use the
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
- */
- async dismiss(data, role) {
- const unlock = await this.lockController.lock();
- const dismissed = await dismiss(this, data, role, 'alertLeave', iosLeaveAnimation$5, mdLeaveAnimation$4);
- if (dismissed) {
- this.delegateController.removeViewFromDom();
- }
- unlock();
- return dismissed;
- }
- /**
- * Returns a promise that resolves when the alert did dismiss.
- */
- onDidDismiss() {
- return eventMethod(this.el, 'ionAlertDidDismiss');
- }
- /**
- * Returns a promise that resolves when the alert will dismiss.
- */
- onWillDismiss() {
- return eventMethod(this.el, 'ionAlertWillDismiss');
- }
- rbClick(selectedInput) {
- for (const input of this.processedInputs) {
- input.checked = input === selectedInput;
- input.tabindex = input === selectedInput ? 0 : -1;
- }
- this.activeId = selectedInput.id;
- safeCall(selectedInput.handler, selectedInput);
- }
- cbClick(selectedInput) {
- selectedInput.checked = !selectedInput.checked;
- safeCall(selectedInput.handler, selectedInput);
- }
- async buttonClick(button) {
- const role = button.role;
- const values = this.getValues();
- if (isCancel(role)) {
- return this.dismiss({ values }, role);
- }
- const returnData = await this.callButtonHandler(button, values);
- if (returnData !== false) {
- return this.dismiss(Object.assign({ values }, returnData), button.role);
- }
- return false;
- }
- async callButtonHandler(button, data) {
- if (button === null || button === void 0 ? void 0 : button.handler) {
- // a handler has been provided, execute it
- // pass the handler the values from the inputs
- const returnData = await safeCall(button.handler, data);
- if (returnData === false) {
- // if the return value of the handler is false then do not dismiss
- return false;
- }
- if (typeof returnData === 'object') {
- return returnData;
- }
- }
- return {};
- }
- getValues() {
- if (this.processedInputs.length === 0) {
- // this is an alert without any options/inputs at all
- return undefined;
- }
- if (this.inputType === 'radio') {
- // this is an alert with radio buttons (single value select)
- // return the one value which is checked, otherwise undefined
- const checkedInput = this.processedInputs.find((i) => !!i.checked);
- return checkedInput ? checkedInput.value : undefined;
- }
- if (this.inputType === 'checkbox') {
- // this is an alert with checkboxes (multiple value select)
- // return an array of all the checked values
- return this.processedInputs.filter((i) => i.checked).map((i) => i.value);
- }
- // this is an alert with text inputs
- // return an object of all the values with the input name as the key
- const values = {};
- this.processedInputs.forEach((i) => {
- values[i.name] = i.value || '';
- });
- return values;
- }
- renderAlertInputs() {
- switch (this.inputType) {
- case 'checkbox':
- return this.renderCheckbox();
- case 'radio':
- return this.renderRadio();
- default:
- return this.renderInput();
- }
- }
- renderCheckbox() {
- const inputs = this.processedInputs;
- const mode = getIonMode$1(this);
- if (inputs.length === 0) {
- return null;
- }
- return (hAsync("div", { class: "alert-checkbox-group" }, inputs.map((i) => (hAsync("button", { type: "button", onClick: () => this.cbClick(i), "aria-checked": `${i.checked}`, id: i.id, disabled: i.disabled, tabIndex: i.tabindex, role: "checkbox", class: Object.assign(Object.assign({}, getClassMap(i.cssClass)), { 'alert-tappable': true, 'alert-checkbox': true, 'alert-checkbox-button': true, 'ion-focusable': true, 'alert-checkbox-button-disabled': i.disabled || false }) }, hAsync("div", { class: "alert-button-inner" }, hAsync("div", { class: "alert-checkbox-icon" }, hAsync("div", { class: "alert-checkbox-inner" })), hAsync("div", { class: "alert-checkbox-label" }, i.label)), mode === 'md' && hAsync("ion-ripple-effect", null))))));
- }
- renderRadio() {
- const inputs = this.processedInputs;
- if (inputs.length === 0) {
- return null;
- }
- return (hAsync("div", { class: "alert-radio-group", role: "radiogroup", "aria-activedescendant": this.activeId }, inputs.map((i) => (hAsync("button", { type: "button", onClick: () => this.rbClick(i), "aria-checked": `${i.checked}`, disabled: i.disabled, id: i.id, tabIndex: i.tabindex, class: Object.assign(Object.assign({}, getClassMap(i.cssClass)), { 'alert-radio-button': true, 'alert-tappable': true, 'alert-radio': true, 'ion-focusable': true, 'alert-radio-button-disabled': i.disabled || false }), role: "radio" }, hAsync("div", { class: "alert-button-inner" }, hAsync("div", { class: "alert-radio-icon" }, hAsync("div", { class: "alert-radio-inner" })), hAsync("div", { class: "alert-radio-label" }, i.label)))))));
- }
- renderInput() {
- const inputs = this.processedInputs;
- if (inputs.length === 0) {
- return null;
- }
- return (hAsync("div", { class: "alert-input-group" }, inputs.map((i) => {
- var _a, _b, _c, _d;
- if (i.type === 'textarea') {
- return (hAsync("div", { class: "alert-input-wrapper" }, hAsync("textarea", Object.assign({ placeholder: i.placeholder, value: i.value, id: i.id, tabIndex: i.tabindex }, i.attributes, { disabled: (_b = (_a = i.attributes) === null || _a === void 0 ? void 0 : _a.disabled) !== null && _b !== void 0 ? _b : i.disabled, class: inputClass(i), onInput: (e) => {
- var _a;
- i.value = e.target.value;
- if ((_a = i.attributes) === null || _a === void 0 ? void 0 : _a.onInput) {
- i.attributes.onInput(e);
- }
- } }))));
- }
- else {
- return (hAsync("div", { class: "alert-input-wrapper" }, hAsync("input", Object.assign({ placeholder: i.placeholder, type: i.type, min: i.min, max: i.max, value: i.value, id: i.id, tabIndex: i.tabindex }, i.attributes, { disabled: (_d = (_c = i.attributes) === null || _c === void 0 ? void 0 : _c.disabled) !== null && _d !== void 0 ? _d : i.disabled, class: inputClass(i), onInput: (e) => {
- var _a;
- i.value = e.target.value;
- if ((_a = i.attributes) === null || _a === void 0 ? void 0 : _a.onInput) {
- i.attributes.onInput(e);
- }
- } }))));
- }
- })));
- }
- renderAlertButtons() {
- const buttons = this.processedButtons;
- const mode = getIonMode$1(this);
- const alertButtonGroupClass = {
- 'alert-button-group': true,
- 'alert-button-group-vertical': buttons.length > 2,
- };
- return (hAsync("div", { class: alertButtonGroupClass }, buttons.map((button) => (hAsync("button", Object.assign({}, button.htmlAttributes, { type: "button", id: button.id, class: buttonClass$2(button), tabIndex: 0, onClick: () => this.buttonClick(button) }), hAsync("span", { class: "alert-button-inner" }, button.text), mode === 'md' && hAsync("ion-ripple-effect", null))))));
- }
- renderAlertMessage(msgId) {
- const { customHTMLEnabled, message } = this;
- if (customHTMLEnabled) {
- return hAsync("div", { id: msgId, class: "alert-message", innerHTML: sanitizeDOMString(message) });
- }
- return (hAsync("div", { id: msgId, class: "alert-message" }, message));
- }
- render() {
- const { overlayIndex, header, subHeader, message, htmlAttributes } = this;
- const mode = getIonMode$1(this);
- const hdrId = `alert-${overlayIndex}-hdr`;
- const msgId = `alert-${overlayIndex}-msg`;
- const subHdrId = `alert-${overlayIndex}-sub-hdr`;
- const role = this.inputs.length > 0 || this.buttons.length > 0 ? 'alertdialog' : 'alert';
- /**
- * Use both the header and subHeader ids if they are defined.
- * If only the header is defined, use the header id.
- * If only the subHeader is defined, use the subHeader id.
- * If neither are defined, do not set aria-labelledby.
- */
- const ariaLabelledBy = header && subHeader ? `${hdrId} ${subHdrId}` : header ? hdrId : subHeader ? subHdrId : null;
- return (hAsync(Host, { key: 'f8ee04fe6a97a2585b302c8e1a9eea3b122e3479', tabindex: "-1", style: {
- zIndex: `${20000 + overlayIndex}`,
- }, class: Object.assign(Object.assign({}, getClassMap(this.cssClass)), { [mode]: true, 'overlay-hidden': true, 'alert-translucent': this.translucent }), onIonAlertWillDismiss: this.dispatchCancelHandler, onIonBackdropTap: this.onBackdropTap }, hAsync("ion-backdrop", { key: 'e9592e879f51c27ef20016beec12c986be632cf3', tappable: this.backdropDismiss }), hAsync("div", { key: '5e9425c3c8acdea6f8006389689c73220e2ce423', tabindex: "0", "aria-hidden": "true" }), hAsync("div", Object.assign({ key: '615465703e357619681fc36ed7276591a6fe3787', class: "alert-wrapper ion-overlay-wrapper", role: role, "aria-modal": "true", "aria-labelledby": ariaLabelledBy, "aria-describedby": message !== undefined ? msgId : null, tabindex: "0", ref: (el) => (this.wrapperEl = el) }, htmlAttributes), hAsync("div", { key: '934eba3759456cd4660e10f274edc7859f908461', class: "alert-head" }, header && (hAsync("h2", { key: '7d5d98d71f81f59a2cba227121b6fa01e6cc53b6', id: hdrId, class: "alert-title" }, header)), subHeader && !header && (hAsync("h2", { key: 'e5f5d35748c58a98ee933eb15cb1dcaf8113e9a7', id: subHdrId, class: "alert-sub-title" }, subHeader)), subHeader && header && (hAsync("h3", { key: 'a5cb89ca02bfa9c4828e694cb0835493a9088b05', id: subHdrId, class: "alert-sub-title" }, subHeader))), this.renderAlertMessage(msgId), this.renderAlertInputs(), this.renderAlertButtons()), hAsync("div", { key: 'cacffc31c911882df73e6845d15c8bb2d4acab56', tabindex: "0", "aria-hidden": "true" })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "isOpen": ["onIsOpenChange"],
- "trigger": ["triggerChanged"],
- "buttons": ["buttonsChanged"],
- "inputs": ["inputsChanged"]
- }; }
- static get style() { return {
- ios: IonAlertIosStyle0,
- md: IonAlertMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 34,
- "$tagName$": "ion-alert",
- "$members$": {
- "overlayIndex": [2, "overlay-index"],
- "delegate": [16],
- "hasController": [4, "has-controller"],
- "keyboardClose": [4, "keyboard-close"],
- "enterAnimation": [16],
- "leaveAnimation": [16],
- "cssClass": [1, "css-class"],
- "header": [1],
- "subHeader": [1, "sub-header"],
- "message": [1],
- "buttons": [16],
- "inputs": [1040],
- "backdropDismiss": [4, "backdrop-dismiss"],
- "translucent": [4],
- "animated": [4],
- "htmlAttributes": [16],
- "isOpen": [4, "is-open"],
- "trigger": [1],
- "present": [64],
- "dismiss": [64],
- "onDidDismiss": [64],
- "onWillDismiss": [64]
- },
- "$listeners$": [[4, "keydown", "onKeydown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const inputClass = (input) => {
- var _a, _b, _c;
- return Object.assign(Object.assign({ 'alert-input': true, 'alert-input-disabled': ((_b = (_a = input.attributes) === null || _a === void 0 ? void 0 : _a.disabled) !== null && _b !== void 0 ? _b : input.disabled) || false }, getClassMap(input.cssClass)), getClassMap(input.attributes ? (_c = input.attributes.class) === null || _c === void 0 ? void 0 : _c.toString() : ''));
- };
- const buttonClass$2 = (button) => {
- return Object.assign({ 'alert-button': true, 'ion-focusable': true, 'ion-activatable': true, [`alert-button-role-${button.role}`]: button.role !== undefined }, getClassMap(button.cssClass));
- };
- const appCss = "html.plt-mobile ion-app{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}html.plt-mobile ion-app [contenteditable]{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}ion-app.force-statusbar-padding{--ion-safe-area-top:20px}";
- var IonAppStyle0 = appCss;
- class App {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- componentDidLoad() {
- }
- /**
- * Used to set focus on an element that uses `ion-focusable`.
- * Do not use this if focusing the element as a result of a keyboard
- * event as the focus utility should handle this for us. This method
- * should be used when we want to programmatically focus an element as
- * a result of another user action. (Ex: We focus the first element
- * inside of a popover when the user presents it, but the popover is not always
- * presented as a result of keyboard action.)
- */
- async setFocus(elements) {
- if (this.focusVisible) {
- this.focusVisible.setFocus(elements);
- }
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '03aa892f986330078d112b1e8b010df98fa7e39e', class: {
- [mode]: true,
- 'ion-page': true,
- 'force-statusbar-padding': config.getBoolean('_forceStatusbarPadding'),
- } }));
- }
- get el() { return getElement(this); }
- static get style() { return IonAppStyle0; }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-app",
- "$members$": {
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const avatarIosCss = ":host{border-radius:var(--border-radius);display:block}::slotted(ion-img),::slotted(img){border-radius:var(--border-radius);width:100%;height:100%;-o-object-fit:cover;object-fit:cover;overflow:hidden}:host{--border-radius:50%;width:48px;height:48px}";
- var IonAvatarIosStyle0 = avatarIosCss;
- const avatarMdCss = ":host{border-radius:var(--border-radius);display:block}::slotted(ion-img),::slotted(img){border-radius:var(--border-radius);width:100%;height:100%;-o-object-fit:cover;object-fit:cover;overflow:hidden}:host{--border-radius:50%;width:64px;height:64px}";
- var IonAvatarMdStyle0 = avatarMdCss;
- class Avatar {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- render() {
- return (hAsync(Host, { key: '998217066084f966bf5d356fed85bcbd451f675a', class: getIonMode$1(this) }, hAsync("slot", { key: '1a6f7c9d4dc6a875f86b5b3cda6d59cb39587f22' })));
- }
- static get style() { return {
- ios: IonAvatarIosStyle0,
- md: IonAvatarMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-avatar",
- "$members$": undefined,
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const backButtonIosCss = ":host{--background:transparent;--color-focused:currentColor;--color-hover:currentColor;--icon-margin-top:0;--icon-margin-bottom:0;--icon-padding-top:0;--icon-padding-end:0;--icon-padding-bottom:0;--icon-padding-start:0;--margin-top:0;--margin-end:0;--margin-bottom:0;--margin-start:0;--min-width:auto;--min-height:auto;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;--opacity:1;--ripple-color:currentColor;--transition:background-color, opacity 100ms linear;display:none;min-width:var(--min-width);min-height:var(--min-height);color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;text-transform:none;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-font-kerning:none;font-kerning:none}ion-ripple-effect{color:var(--ripple-color)}:host(.ion-color) .button-native{color:var(--ion-color-base)}:host(.show-back-button){display:block}:host(.back-button-disabled){cursor:default;opacity:0.5;pointer-events:none}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-margin-start:var(--margin-start);margin-inline-start:var(--margin-start);-webkit-margin-end:var(--margin-end);margin-inline-end:var(--margin-end);margin-top:var(--margin-top);margin-bottom:var(--margin-bottom);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;min-height:inherit;-webkit-transition:var(--transition);transition:var(--transition);border:0;outline:none;background:var(--background);line-height:1;cursor:pointer;opacity:var(--opacity);overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}ion-icon{-webkit-padding-start:var(--icon-padding-start);padding-inline-start:var(--icon-padding-start);-webkit-padding-end:var(--icon-padding-end);padding-inline-end:var(--icon-padding-end);padding-top:var(--icon-padding-top);padding-bottom:var(--icon-padding-bottom);-webkit-margin-start:var(--icon-margin-start);margin-inline-start:var(--icon-margin-start);-webkit-margin-end:var(--icon-margin-end);margin-inline-end:var(--icon-margin-end);margin-top:var(--icon-margin-top);margin-bottom:var(--icon-margin-bottom);display:inherit;font-size:var(--icon-font-size);font-weight:var(--icon-font-weight);pointer-events:none}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-color.ion-focused) .button-native{color:var(--ion-color-base)}@media (any-hover: hover){:host(.ion-color:hover) .button-native{color:var(--ion-color-base)}}:host(.in-toolbar:not(.in-toolbar-color)){color:var(--ion-toolbar-color, var(--color))}:host{--background-hover:transparent;--background-hover-opacity:1;--background-focused:currentColor;--background-focused-opacity:.1;--border-radius:4px;--color:var(--ion-color-primary, #0054e9);--icon-margin-end:1px;--icon-margin-start:-4px;--icon-font-size:1.6em;--min-height:32px;font-size:clamp(17px, 1.0625rem, 21.998px)}.button-native{-webkit-transform:translateZ(0);transform:translateZ(0);overflow:visible;z-index:99}:host(.ion-activated) .button-native{opacity:0.4}@media (any-hover: hover){:host(:hover){opacity:0.6}}";
- var IonBackButtonIosStyle0 = backButtonIosCss;
- const backButtonMdCss = ":host{--background:transparent;--color-focused:currentColor;--color-hover:currentColor;--icon-margin-top:0;--icon-margin-bottom:0;--icon-padding-top:0;--icon-padding-end:0;--icon-padding-bottom:0;--icon-padding-start:0;--margin-top:0;--margin-end:0;--margin-bottom:0;--margin-start:0;--min-width:auto;--min-height:auto;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;--opacity:1;--ripple-color:currentColor;--transition:background-color, opacity 100ms linear;display:none;min-width:var(--min-width);min-height:var(--min-height);color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;text-transform:none;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-font-kerning:none;font-kerning:none}ion-ripple-effect{color:var(--ripple-color)}:host(.ion-color) .button-native{color:var(--ion-color-base)}:host(.show-back-button){display:block}:host(.back-button-disabled){cursor:default;opacity:0.5;pointer-events:none}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-margin-start:var(--margin-start);margin-inline-start:var(--margin-start);-webkit-margin-end:var(--margin-end);margin-inline-end:var(--margin-end);margin-top:var(--margin-top);margin-bottom:var(--margin-bottom);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;min-height:inherit;-webkit-transition:var(--transition);transition:var(--transition);border:0;outline:none;background:var(--background);line-height:1;cursor:pointer;opacity:var(--opacity);overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}ion-icon{-webkit-padding-start:var(--icon-padding-start);padding-inline-start:var(--icon-padding-start);-webkit-padding-end:var(--icon-padding-end);padding-inline-end:var(--icon-padding-end);padding-top:var(--icon-padding-top);padding-bottom:var(--icon-padding-bottom);-webkit-margin-start:var(--icon-margin-start);margin-inline-start:var(--icon-margin-start);-webkit-margin-end:var(--icon-margin-end);margin-inline-end:var(--icon-margin-end);margin-top:var(--icon-margin-top);margin-bottom:var(--icon-margin-bottom);display:inherit;font-size:var(--icon-font-size);font-weight:var(--icon-font-weight);pointer-events:none}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-color.ion-focused) .button-native{color:var(--ion-color-base)}@media (any-hover: hover){:host(.ion-color:hover) .button-native{color:var(--ion-color-base)}}:host(.in-toolbar:not(.in-toolbar-color)){color:var(--ion-toolbar-color, var(--color))}:host{--border-radius:4px;--background-focused:currentColor;--background-focused-opacity:.12;--background-hover:currentColor;--background-hover-opacity:0.04;--color:currentColor;--icon-margin-end:0;--icon-margin-start:0;--icon-font-size:1.5rem;--icon-font-weight:normal;--min-height:32px;--min-width:44px;--padding-start:12px;--padding-end:12px;font-size:0.875rem;font-weight:500;text-transform:uppercase}:host(.back-button-has-icon-only){--border-radius:50%;min-width:48px;min-height:48px;aspect-ratio:1/1}.button-native{-webkit-box-shadow:none;box-shadow:none}.button-text{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:0;padding-bottom:0}ion-icon{line-height:0.67;text-align:start}@media (any-hover: hover){:host(.ion-color:hover) .button-native::after{background:var(--ion-color-base)}}:host(.ion-color.ion-focused) .button-native::after{background:var(--ion-color-base)}";
- var IonBackButtonMdStyle0 = backButtonMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part native - The native HTML button element that wraps all child elements.
- * @part icon - The back button icon (uses ion-icon).
- * @part text - The back button text.
- */
- class BackButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.inheritedAttributes = {};
- this.onClick = async (ev) => {
- const nav = this.el.closest('ion-nav');
- ev.preventDefault();
- if (nav && (await nav.canGoBack())) {
- return nav.pop({ animationBuilder: this.routerAnimation, skipIfBusy: true });
- }
- return openURL(this.defaultHref, ev, 'back', this.routerAnimation);
- };
- this.color = undefined;
- this.defaultHref = undefined;
- this.disabled = false;
- this.icon = undefined;
- this.text = undefined;
- this.type = 'button';
- this.routerAnimation = undefined;
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- if (this.defaultHref === undefined) {
- this.defaultHref = config.get('backButtonDefaultHref');
- }
- }
- get backButtonIcon() {
- const icon = this.icon;
- if (icon != null) {
- // icon is set on the component or by the config
- return icon;
- }
- if (getIonMode$1(this) === 'ios') {
- // default ios back button icon
- return config.get('backButtonIcon', chevronBack);
- }
- // default md back button icon
- return config.get('backButtonIcon', arrowBackSharp);
- }
- get backButtonText() {
- const defaultBackButtonText = getIonMode$1(this) === 'ios' ? 'Back' : null;
- return this.text != null ? this.text : config.get('backButtonText', defaultBackButtonText);
- }
- get hasIconOnly() {
- return this.backButtonIcon && !this.backButtonText;
- }
- get rippleType() {
- // If the button only has an icon we use the unbounded
- // "circular" ripple effect
- if (this.hasIconOnly) {
- return 'unbounded';
- }
- return 'bounded';
- }
- render() {
- const { color, defaultHref, disabled, type, hasIconOnly, backButtonIcon, backButtonText, icon, inheritedAttributes, } = this;
- const showBackButton = defaultHref !== undefined;
- const mode = getIonMode$1(this);
- const ariaLabel = inheritedAttributes['aria-label'] || backButtonText || 'back';
- return (hAsync(Host, { key: '5466624a10f1ab56f5469e6dc07080303880f2fe', onClick: this.onClick, class: createColorClasses$1(color, {
- [mode]: true,
- button: true, // ion-buttons target .button
- 'back-button-disabled': disabled,
- 'back-button-has-icon-only': hasIconOnly,
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- 'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
- 'ion-activatable': true,
- 'ion-focusable': true,
- 'show-back-button': showBackButton,
- }) }, hAsync("button", { key: '63bc75ef0ad7cc9fb79e58217a3314b20acd73e3', type: type, disabled: disabled, class: "button-native", part: "native", "aria-label": ariaLabel }, hAsync("span", { key: '5d3eacbd11af2245c6e1151cab446a0d96559ad8', class: "button-inner" }, backButtonIcon && (hAsync("ion-icon", { key: '6439af0ae463764174e7d3207f02267811df666d', part: "icon", icon: backButtonIcon, "aria-hidden": "true", lazy: false, "flip-rtl": icon === undefined })), backButtonText && (hAsync("span", { key: '8ee89fb18dfdb5b75948a8b197ff4cdbc008742f', part: "text", "aria-hidden": "true", class: "button-text" }, backButtonText))), mode === 'md' && hAsync("ion-ripple-effect", { key: '63803a884998bc73bea5afe0b2a0a14e3fa4d6bf', type: this.rippleType }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonBackButtonIosStyle0,
- md: IonBackButtonMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-back-button",
- "$members$": {
- "color": [513],
- "defaultHref": [1025, "default-href"],
- "disabled": [516],
- "icon": [1],
- "text": [1],
- "type": [1],
- "routerAnimation": [16]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"], ["disabled", "disabled"]]
- }; }
- }
- const backdropIosCss = ":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;-ms-touch-action:none;touch-action:none;z-index:2}:host(.backdrop-hide){background:transparent}:host(.backdrop-no-tappable){cursor:auto}:host{background-color:var(--ion-backdrop-color, #000)}";
- var IonBackdropIosStyle0 = backdropIosCss;
- const backdropMdCss = ":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;-ms-touch-action:none;touch-action:none;z-index:2}:host(.backdrop-hide){background:transparent}:host(.backdrop-no-tappable){cursor:auto}:host{background-color:var(--ion-backdrop-color, #000)}";
- var IonBackdropMdStyle0 = backdropMdCss;
- class Backdrop {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionBackdropTap = createEvent(this, "ionBackdropTap", 7);
- this.visible = true;
- this.tappable = true;
- this.stopPropagation = true;
- }
- onMouseDown(ev) {
- this.emitTap(ev);
- }
- emitTap(ev) {
- if (this.stopPropagation) {
- ev.preventDefault();
- ev.stopPropagation();
- }
- if (this.tappable) {
- this.ionBackdropTap.emit();
- }
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '7abaf2c310aa399607451b14063265e8a5846938', "aria-hidden": "true", class: {
- [mode]: true,
- 'backdrop-hide': !this.visible,
- 'backdrop-no-tappable': !this.tappable,
- } }));
- }
- static get style() { return {
- ios: IonBackdropIosStyle0,
- md: IonBackdropMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-backdrop",
- "$members$": {
- "visible": [4],
- "tappable": [4],
- "stopPropagation": [4, "stop-propagation"]
- },
- "$listeners$": [[2, "click", "onMouseDown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const badgeIosCss = ":host{--background:var(--ion-color-primary, #0054e9);--color:var(--ion-color-primary-contrast, #fff);--padding-top:3px;--padding-end:8px;--padding-bottom:3px;--padding-start:8px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:inline-block;min-width:10px;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);font-size:0.8125rem;font-weight:bold;line-height:1;text-align:center;white-space:nowrap;contain:content;vertical-align:baseline}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(:empty){display:none}:host{border-radius:10px;font-size:max(13px, 0.8125rem)}";
- var IonBadgeIosStyle0 = badgeIosCss;
- const badgeMdCss = ":host{--background:var(--ion-color-primary, #0054e9);--color:var(--ion-color-primary-contrast, #fff);--padding-top:3px;--padding-end:8px;--padding-bottom:3px;--padding-start:8px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:inline-block;min-width:10px;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);font-size:0.8125rem;font-weight:bold;line-height:1;text-align:center;white-space:nowrap;contain:content;vertical-align:baseline}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(:empty){display:none}:host{--padding-top:3px;--padding-end:4px;--padding-bottom:4px;--padding-start:4px;border-radius:4px}";
- var IonBadgeMdStyle0 = badgeMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Badge {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '1a2d39c5deec771a2f2196447627b62a7d4c8389', class: createColorClasses$1(this.color, {
- [mode]: true,
- }) }, hAsync("slot", { key: 'fc1b6587f1ed24715748eb6785e7fb7a57cdd5cd' })));
- }
- static get style() { return {
- ios: IonBadgeIosStyle0,
- md: IonBadgeMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-badge",
- "$members$": {
- "color": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const breadcrumbIosCss = ":host{display:-ms-flexbox;display:flex;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-align:center;align-items:center;color:var(--color);font-size:1rem;font-weight:400;line-height:1.5}.breadcrumb-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%;outline:none;background:inherit}:host(.breadcrumb-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.breadcrumb-active){color:var(--color-active)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .breadcrumb-native{background:var(--background-focused)}@media (any-hover: hover){:host(.ion-activatable:hover){color:var(--color-hover)}:host(.ion-activatable.in-breadcrumbs-color:hover),:host(.ion-activatable.ion-color:hover){color:var(--ion-color-shade)}}.breadcrumb-separator{display:-ms-inline-flexbox;display:inline-flex}:host(.breadcrumb-collapsed) .breadcrumb-native{display:none}:host(.in-breadcrumbs-color),:host(.in-breadcrumbs-color.breadcrumb-active){color:var(--ion-color-base)}:host(.in-breadcrumbs-color) .breadcrumb-separator{color:var(--ion-color-base)}:host(.ion-color){color:var(--ion-color-base)}:host(.in-toolbar-color),:host(.in-toolbar-color) .breadcrumb-separator{color:rgba(var(--ion-color-contrast-rgb), 0.8)}:host(.in-toolbar-color.breadcrumb-active){color:var(--ion-color-contrast)}.breadcrumbs-collapsed-indicator{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;-webkit-margin-start:14px;margin-inline-start:14px;-webkit-margin-end:14px;margin-inline-end:14px;margin-top:0;margin-bottom:0;display:-ms-flexbox;display:flex;-ms-flex:1 1 100%;flex:1 1 100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:32px;height:18px;border:0;outline:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.breadcrumbs-collapsed-indicator ion-icon{margin-top:1px;font-size:1.375rem}:host{--color:var(--ion-color-step-850, var(--ion-text-color-step-150, #2d4665));--color-active:var(--ion-text-color, #03060b);--color-hover:var(--ion-text-color, #03060b);--color-focused:var(--color-active);--background-focused:var(--ion-color-step-50, var(--ion-background-color-step-50, rgba(233, 237, 243, 0.7)));font-size:clamp(16px, 1rem, 22px)}:host(.breadcrumb-active){font-weight:600}.breadcrumb-native{border-radius:4px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:5px;padding-bottom:5px;border:1px solid transparent}:host(.ion-focused) .breadcrumb-native{border-radius:8px}:host(.in-breadcrumbs-color.ion-focused) .breadcrumb-native,:host(.ion-color.ion-focused) .breadcrumb-native{background:rgba(var(--ion-color-base-rgb), 0.1);color:var(--ion-color-base)}:host(.ion-focused) ::slotted(ion-icon),:host(.in-breadcrumbs-color.ion-focused) ::slotted(ion-icon),:host(.ion-color.ion-focused) ::slotted(ion-icon){color:var(--ion-color-step-750, var(--ion-text-color-step-250, #445b78))}.breadcrumb-separator{color:var(--ion-color-step-550, var(--ion-text-color-step-450, #73849a))}::slotted(ion-icon){color:var(--ion-color-step-400, var(--ion-text-color-step-600, #92a0b3));font-size:min(1.125rem, 21.6px)}::slotted(ion-icon[slot=start]){-webkit-margin-end:8px;margin-inline-end:8px}::slotted(ion-icon[slot=end]){-webkit-margin-start:8px;margin-inline-start:8px}:host(.breadcrumb-active) ::slotted(ion-icon){color:var(--ion-color-step-850, var(--ion-text-color-step-150, #242d39))}.breadcrumbs-collapsed-indicator{border-radius:4px;background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e9edf3));color:var(--ion-color-step-550, var(--ion-text-color-step-450, #73849a))}.breadcrumbs-collapsed-indicator:hover{opacity:0.45}.breadcrumbs-collapsed-indicator:focus{background:var(--ion-color-step-150, var(--ion-background-color-step-150, #d9e0ea))}.breadcrumbs-collapsed-indicator ion-icon{font-size:min(1.375rem, 22px)}";
- var IonBreadcrumbIosStyle0 = breadcrumbIosCss;
- const breadcrumbMdCss = ":host{display:-ms-flexbox;display:flex;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-align:center;align-items:center;color:var(--color);font-size:1rem;font-weight:400;line-height:1.5}.breadcrumb-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%;outline:none;background:inherit}:host(.breadcrumb-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.breadcrumb-active){color:var(--color-active)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .breadcrumb-native{background:var(--background-focused)}@media (any-hover: hover){:host(.ion-activatable:hover){color:var(--color-hover)}:host(.ion-activatable.in-breadcrumbs-color:hover),:host(.ion-activatable.ion-color:hover){color:var(--ion-color-shade)}}.breadcrumb-separator{display:-ms-inline-flexbox;display:inline-flex}:host(.breadcrumb-collapsed) .breadcrumb-native{display:none}:host(.in-breadcrumbs-color),:host(.in-breadcrumbs-color.breadcrumb-active){color:var(--ion-color-base)}:host(.in-breadcrumbs-color) .breadcrumb-separator{color:var(--ion-color-base)}:host(.ion-color){color:var(--ion-color-base)}:host(.in-toolbar-color),:host(.in-toolbar-color) .breadcrumb-separator{color:rgba(var(--ion-color-contrast-rgb), 0.8)}:host(.in-toolbar-color.breadcrumb-active){color:var(--ion-color-contrast)}.breadcrumbs-collapsed-indicator{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;-webkit-margin-start:14px;margin-inline-start:14px;-webkit-margin-end:14px;margin-inline-end:14px;margin-top:0;margin-bottom:0;display:-ms-flexbox;display:flex;-ms-flex:1 1 100%;flex:1 1 100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:32px;height:18px;border:0;outline:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.breadcrumbs-collapsed-indicator ion-icon{margin-top:1px;font-size:1.375rem}:host{--color:var(--ion-color-step-600, var(--ion-text-color-step-400, #677483));--color-active:var(--ion-text-color, #03060b);--color-hover:var(--ion-text-color, #03060b);--color-focused:var(--ion-color-step-800, var(--ion-text-color-step-200, #35404e));--background-focused:var(--ion-color-step-50, var(--ion-background-color-step-50, #fff))}:host(.breadcrumb-active){font-weight:500}.breadcrumb-native{-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px}.breadcrumb-separator{-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px;margin-top:-1px}:host(.ion-focused) .breadcrumb-native{border-radius:4px;-webkit-box-shadow:0px 1px 2px rgba(0, 0, 0, 0.2), 0px 2px 8px rgba(0, 0, 0, 0.12);box-shadow:0px 1px 2px rgba(0, 0, 0, 0.2), 0px 2px 8px rgba(0, 0, 0, 0.12)}.breadcrumb-separator{color:var(--ion-color-step-550, var(--ion-text-color-step-450, #73849a))}::slotted(ion-icon){color:var(--ion-color-step-550, var(--ion-text-color-step-450, #7d8894));font-size:1.125rem}::slotted(ion-icon[slot=start]){-webkit-margin-end:8px;margin-inline-end:8px}::slotted(ion-icon[slot=end]){-webkit-margin-start:8px;margin-inline-start:8px}:host(.breadcrumb-active) ::slotted(ion-icon){color:var(--ion-color-step-850, var(--ion-text-color-step-150, #222d3a))}.breadcrumbs-collapsed-indicator{border-radius:2px;background:var(--ion-color-step-100, var(--ion-background-color-step-100, #eef1f3));color:var(--ion-color-step-550, var(--ion-text-color-step-450, #73849a))}.breadcrumbs-collapsed-indicator:hover{opacity:0.7}.breadcrumbs-collapsed-indicator:focus{background:var(--ion-color-step-150, var(--ion-background-color-step-150, #dfe5e8))}";
- var IonBreadcrumbMdStyle0 = breadcrumbMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part native - The native HTML anchor or div element that wraps all child elements.
- * @part separator - The separator element between each breadcrumb.
- * @part collapsed-indicator - The indicator element that shows the breadcrumbs are collapsed.
- */
- class Breadcrumb {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.collapsedClick = createEvent(this, "collapsedClick", 7);
- this.inheritedAttributes = {};
- this.onFocus = () => {
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.ionBlur.emit();
- };
- this.collapsedIndicatorClick = () => {
- this.collapsedClick.emit({ ionShadowTarget: this.collapsedRef });
- };
- this.collapsed = false;
- this.last = undefined;
- this.showCollapsedIndicator = undefined;
- this.color = undefined;
- this.active = false;
- this.disabled = false;
- this.download = undefined;
- this.href = undefined;
- this.rel = undefined;
- this.separator = undefined;
- this.target = undefined;
- this.routerDirection = 'forward';
- this.routerAnimation = undefined;
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- }
- isClickable() {
- return this.href !== undefined;
- }
- render() {
- const { color, active, collapsed, disabled, download, el, inheritedAttributes, last, routerAnimation, routerDirection, separator, showCollapsedIndicator, target, } = this;
- const clickable = this.isClickable();
- const TagType = this.href === undefined ? 'span' : 'a';
- // Links can still be tabbed to when set to disabled if they have an href
- // in order to truly disable them we can keep it as an anchor but remove the href
- const href = disabled ? undefined : this.href;
- const mode = getIonMode$1(this);
- const attrs = TagType === 'span'
- ? {}
- : {
- download,
- href,
- target,
- };
- // If the breadcrumb is collapsed, check if it contains the collapsed indicator
- // to show the separator as long as it isn't also the last breadcrumb
- // otherwise if not collapsed use the value in separator
- const showSeparator = last ? false : collapsed ? (showCollapsedIndicator && !last ? true : false) : separator;
- return (hAsync(Host, { key: '32ca61c83721dff52b5e97171ed449dce3584a55', onClick: (ev) => openURL(href, ev, routerDirection, routerAnimation), "aria-disabled": disabled ? 'true' : null, class: createColorClasses$1(color, {
- [mode]: true,
- 'breadcrumb-active': active,
- 'breadcrumb-collapsed': collapsed,
- 'breadcrumb-disabled': disabled,
- 'in-breadcrumbs-color': hostContext('ion-breadcrumbs[color]', el),
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- 'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
- 'ion-activatable': clickable,
- 'ion-focusable': clickable,
- }) }, hAsync(TagType, Object.assign({ key: '479feb845f4a6d8009d5422b33eb423730b9722b' }, attrs, { class: "breadcrumb-native", part: "native", disabled: disabled, onFocus: this.onFocus, onBlur: this.onBlur }, inheritedAttributes), hAsync("slot", { key: '3c5dcaeb0d258235d1b7707868026ff1d1404099', name: "start" }), hAsync("slot", { key: 'f1cfb934443cd97dc220882c5e3596ea879d66cf' }), hAsync("slot", { key: '539710121b5b1f3ee8d4c24a9651b67c2ae08add', name: "end" })), showCollapsedIndicator && (hAsync("button", { key: 'ed53a95ccd89022c8b7bee0658a221ec62a5c73b', part: "collapsed-indicator", "aria-label": "Show more breadcrumbs", onClick: () => this.collapsedIndicatorClick(), ref: (collapsedEl) => (this.collapsedRef = collapsedEl), class: {
- 'breadcrumbs-collapsed-indicator': true,
- } }, hAsync("ion-icon", { key: 'a849e1142a86f06f207cf11662fa2a560ab7fc6a', "aria-hidden": "true", icon: ellipsisHorizontal, lazy: false }))), showSeparator && (
- /**
- * Separators should not be announced by narrators.
- * We add aria-hidden on the span so that this applies
- * to any custom separators too.
- */
- hAsync("span", { key: 'fc3c741cb01fafef8b26046c7ee5b190efc69a7c', class: "breadcrumb-separator", part: "separator", "aria-hidden": "true" }, hAsync("slot", { key: '4871932ae1dae520767e0713e7cee2d11b0bba6d', name: "separator" }, mode === 'ios' ? (hAsync("ion-icon", { icon: chevronForwardOutline, lazy: false, "flip-rtl": true })) : (hAsync("span", null, "/")))))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonBreadcrumbIosStyle0,
- md: IonBreadcrumbMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-breadcrumb",
- "$members$": {
- "collapsed": [4],
- "last": [4],
- "showCollapsedIndicator": [4, "show-collapsed-indicator"],
- "color": [1],
- "active": [4],
- "disabled": [4],
- "download": [1],
- "href": [1],
- "rel": [1],
- "separator": [4],
- "target": [1],
- "routerDirection": [1, "router-direction"],
- "routerAnimation": [16]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const breadcrumbsIosCss = ":host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center}:host(.in-toolbar-color),:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator ion-icon{color:var(--ion-color-contrast)}:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator{background:rgba(var(--ion-color-contrast-rgb), 0.11)}:host(.in-toolbar){-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:0;padding-bottom:0;-ms-flex-pack:center;justify-content:center}";
- var IonBreadcrumbsIosStyle0 = breadcrumbsIosCss;
- const breadcrumbsMdCss = ":host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center}:host(.in-toolbar-color),:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator ion-icon{color:var(--ion-color-contrast)}:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator{background:rgba(var(--ion-color-contrast-rgb), 0.11)}:host(.in-toolbar){-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0}";
- var IonBreadcrumbsMdStyle0 = breadcrumbsMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- */
- class Breadcrumbs {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionCollapsedClick = createEvent(this, "ionCollapsedClick", 7);
- this.breadcrumbsInit = () => {
- this.setBreadcrumbSeparator();
- this.setMaxItems();
- };
- this.resetActiveBreadcrumb = () => {
- const breadcrumbs = this.getBreadcrumbs();
- // Only reset the active breadcrumb if we were the ones to change it
- // otherwise use the one set on the component
- const activeBreadcrumb = breadcrumbs.find((breadcrumb) => breadcrumb.active);
- if (activeBreadcrumb && this.activeChanged) {
- activeBreadcrumb.active = false;
- }
- };
- this.setMaxItems = () => {
- const { itemsAfterCollapse, itemsBeforeCollapse, maxItems } = this;
- const breadcrumbs = this.getBreadcrumbs();
- for (const breadcrumb of breadcrumbs) {
- breadcrumb.showCollapsedIndicator = false;
- breadcrumb.collapsed = false;
- }
- // If the number of breadcrumbs exceeds the maximum number of items
- // that should show and the items before / after collapse do not
- // exceed the maximum items then we need to collapse the breadcrumbs
- const shouldCollapse = maxItems !== undefined && breadcrumbs.length > maxItems && itemsBeforeCollapse + itemsAfterCollapse <= maxItems;
- if (shouldCollapse) {
- // Show the collapsed indicator in the first breadcrumb that collapses
- breadcrumbs.forEach((breadcrumb, index) => {
- if (index === itemsBeforeCollapse) {
- breadcrumb.showCollapsedIndicator = true;
- }
- // Collapse all breadcrumbs that have an index greater than or equal to
- // the number before collapse and an index less than the total number
- // of breadcrumbs minus the items that should show after the collapse
- if (index >= itemsBeforeCollapse && index < breadcrumbs.length - itemsAfterCollapse) {
- breadcrumb.collapsed = true;
- }
- });
- }
- };
- this.setBreadcrumbSeparator = () => {
- const { itemsAfterCollapse, itemsBeforeCollapse, maxItems } = this;
- const breadcrumbs = this.getBreadcrumbs();
- // Check if an active breadcrumb exists already
- const active = breadcrumbs.find((breadcrumb) => breadcrumb.active);
- // Set the separator on all but the last breadcrumb
- for (const breadcrumb of breadcrumbs) {
- // The only time the last breadcrumb changes is when
- // itemsAfterCollapse is set to 0, in this case the
- // last breadcrumb will be the collapsed indicator
- const last = maxItems !== undefined && itemsAfterCollapse === 0
- ? breadcrumb === breadcrumbs[itemsBeforeCollapse]
- : breadcrumb === breadcrumbs[breadcrumbs.length - 1];
- breadcrumb.last = last;
- // If the breadcrumb has defined whether or not to show the
- // separator then use that value, otherwise check if it's the
- // last breadcrumb
- const separator = breadcrumb.separator !== undefined ? breadcrumb.separator : last ? undefined : true;
- breadcrumb.separator = separator;
- // If there is not an active breadcrumb already
- // set the last one to active
- if (!active && last) {
- breadcrumb.active = true;
- this.activeChanged = true;
- }
- }
- };
- this.getBreadcrumbs = () => {
- return Array.from(this.el.querySelectorAll('ion-breadcrumb'));
- };
- this.slotChanged = () => {
- this.resetActiveBreadcrumb();
- this.breadcrumbsInit();
- };
- this.collapsed = undefined;
- this.activeChanged = undefined;
- this.color = undefined;
- this.maxItems = undefined;
- this.itemsBeforeCollapse = 1;
- this.itemsAfterCollapse = 1;
- }
- onCollapsedClick(ev) {
- const breadcrumbs = this.getBreadcrumbs();
- const collapsedBreadcrumbs = breadcrumbs.filter((breadcrumb) => breadcrumb.collapsed);
- this.ionCollapsedClick.emit(Object.assign(Object.assign({}, ev.detail), { collapsedBreadcrumbs }));
- }
- maxItemsChanged() {
- this.resetActiveBreadcrumb();
- this.breadcrumbsInit();
- }
- componentWillLoad() {
- this.breadcrumbsInit();
- }
- render() {
- const { color, collapsed } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'fe64e9cdf597ede2db140bf5fa05a0359d82db57', class: createColorClasses$1(color, {
- [mode]: true,
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- 'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
- 'breadcrumbs-collapsed': collapsed,
- }) }, hAsync("slot", { key: 'a2c99b579e339055c50a613d5c6b61032f5ddffe', onSlotchange: this.slotChanged })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "maxItems": ["maxItemsChanged"],
- "itemsBeforeCollapse": ["maxItemsChanged"],
- "itemsAfterCollapse": ["maxItemsChanged"]
- }; }
- static get style() { return {
- ios: IonBreadcrumbsIosStyle0,
- md: IonBreadcrumbsMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-breadcrumbs",
- "$members$": {
- "color": [513],
- "maxItems": [2, "max-items"],
- "itemsBeforeCollapse": [2, "items-before-collapse"],
- "itemsAfterCollapse": [2, "items-after-collapse"],
- "collapsed": [32],
- "activeChanged": [32]
- },
- "$listeners$": [[0, "collapsedClick", "onCollapsedClick"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const buttonIosCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;white-space:normal;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;-webkit-font-kerning:none;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #0054e9);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #0054e9);--background:transparent;--color:var(--ion-color-primary, #0054e9)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #0054e9)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;height:100%;min-height:inherit;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}.button-native::-moz-focus-inner{border:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted([slot=start]),::slotted([slot=end]){-ms-flex-negative:0;flex-shrink:0}::slotted(ion-icon){font-size:1.35em;pointer-events:none}::slotted(ion-icon[slot=start]){-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em;margin-top:0;margin-bottom:0}::slotted(ion-icon[slot=end]){-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em;margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:14px;--padding-top:13px;--padding-bottom:13px;--padding-start:1em;--padding-end:1em;--transition:background-color, opacity 100ms linear;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:4px;margin-bottom:4px;min-height:3.1em;font-size:min(1rem, 48px);font-weight:500;letter-spacing:0}:host(.button-solid){--background-activated:var(--ion-color-primary-shade, #004acd);--background-focused:var(--ion-color-primary-shade, #004acd);--background-hover:var(--ion-color-primary-tint, #1a65eb);--background-activated-opacity:1;--background-focused-opacity:1;--background-hover-opacity:1}:host(.button-outline){--border-radius:14px;--border-width:1px;--border-style:solid;--background-activated:var(--ion-color-primary, #0054e9);--background-focused:var(--ion-color-primary, #0054e9);--background-hover:transparent;--background-focused-opacity:.1;--color-activated:var(--ion-color-primary-contrast, #fff)}:host(.button-clear){--background-activated:transparent;--background-activated-opacity:0;--background-focused:var(--ion-color-primary, #0054e9);--background-hover:transparent;--background-focused-opacity:.1;font-size:min(1.0625rem, 51px);font-weight:normal}:host(.in-buttons){font-size:clamp(17px, 1.0625rem, 21.08px);font-weight:400}:host(.button-large){--border-radius:16px;--padding-top:17px;--padding-start:1em;--padding-end:1em;--padding-bottom:17px;min-height:3.1em;font-size:min(1.25rem, 60px)}:host(.button-small){--border-radius:6px;--padding-top:4px;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:4px;min-height:2.1em;font-size:min(0.8125rem, 39px)}:host(.button-round){--border-radius:999px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-strong){font-weight:600}:host(.button-has-icon-only){--padding-top:0;--padding-bottom:var(--padding-top);--padding-end:var(--padding-top);--padding-start:var(--padding-end);min-width:clamp(30px, 2.125em, 60px);min-height:clamp(30px, 2.125em, 60px)}::slotted(ion-icon[slot=icon-only]){font-size:clamp(15.12px, 1.125em, 43.02px)}:host(.button-small.button-has-icon-only){min-width:clamp(23px, 2.16em, 54px);min-height:clamp(23px, 2.16em, 54px)}:host(.button-small) ::slotted(ion-icon[slot=icon-only]){font-size:clamp(12.1394px, 1.308125em, 40.1856px)}:host(.button-large.button-has-icon-only){min-width:clamp(46px, 2.5em, 78px);min-height:clamp(46px, 2.5em, 78px)}:host(.button-large) ::slotted(ion-icon[slot=icon-only]){font-size:clamp(15.12px, 0.9em, 43.056px)}:host(.button-outline.ion-focused.ion-color) .button-native,:host(.button-clear.ion-focused.ion-color) .button-native{color:var(--ion-color-base)}:host(.button-outline.ion-focused.ion-color) .button-native::after,:host(.button-clear.ion-focused.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-shade)}@media (any-hover: hover){:host(.button-clear:not(.ion-activated):hover),:host(.button-outline:not(.ion-activated):hover){opacity:0.6}:host(.button-clear.ion-color:hover) .button-native,:host(.button-outline.ion-color:hover) .button-native{color:var(--ion-color-base)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:transparent}:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-tint)}:host(:hover.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color):not(.ion-activated)) .button-native::after{background:#fff;opacity:0.1}}:host(.button-clear.ion-activated){opacity:0.4}:host(.button-outline.ion-activated.ion-color) .button-native{color:var(--ion-color-contrast)}:host(.button-outline.ion-activated.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-activated) .button-native::after{background:var(--ion-color-shade)}:host(.button-outline.ion-activated.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--color));color:var(--ion-toolbar-background, var(--background), var(--ion-color-primary-contrast, #fff))}";
- var IonButtonIosStyle0 = buttonIosCss;
- const buttonMdCss = ":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;white-space:normal;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;-webkit-font-kerning:none;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #0054e9);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #0054e9);--background:transparent;--color:var(--ion-color-primary, #0054e9)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #0054e9)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;height:100%;min-height:inherit;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}.button-native::-moz-focus-inner{border:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted([slot=start]),::slotted([slot=end]){-ms-flex-negative:0;flex-shrink:0}::slotted(ion-icon){font-size:1.35em;pointer-events:none}::slotted(ion-icon[slot=start]){-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em;margin-top:0;margin-bottom:0}::slotted(ion-icon[slot=end]){-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em;margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:4px;--padding-top:8px;--padding-bottom:8px;--padding-start:1.1em;--padding-end:1.1em;--transition:box-shadow 280ms cubic-bezier(.4, 0, .2, 1),\n background-color 15ms linear,\n color 15ms linear;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:4px;margin-bottom:4px;min-height:36px;font-size:0.875rem;font-weight:500;letter-spacing:0.06em;text-transform:uppercase}:host(.button-solid){--background-activated:transparent;--background-hover:var(--ion-color-primary-contrast, #fff);--background-focused:var(--ion-color-primary-contrast, #fff);--background-activated-opacity:0;--background-focused-opacity:.24;--background-hover-opacity:.08;--box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}:host(.button-solid.ion-activated){--box-shadow:0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12)}:host(.button-outline){--border-width:2px;--border-style:solid;--box-shadow:none;--background-activated:transparent;--background-focused:var(--ion-color-primary, #0054e9);--background-hover:var(--ion-color-primary, #0054e9);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-outline.ion-activated.ion-color) .button-native{background:transparent}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #0054e9);--background-hover:var(--ion-color-primary, #0054e9);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-round){--border-radius:999px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-large){--padding-top:14px;--padding-start:1em;--padding-end:1em;--padding-bottom:14px;min-height:2.8em;font-size:1.25rem}:host(.button-small){--padding-top:4px;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:4px;min-height:2.1em;font-size:0.8125rem}:host(.button-strong){font-weight:bold}:host(.button-has-icon-only){--padding-top:0;--padding-bottom:var(--padding-top);--padding-end:var(--padding-top);--padding-start:var(--padding-end);min-width:clamp(30px, 2.86em, 60px);min-height:clamp(30px, 2.86em, 60px)}::slotted(ion-icon[slot=icon-only]){font-size:clamp(15.104px, 1.6em, 43.008px)}:host(.button-small.button-has-icon-only){min-width:clamp(23px, 2.16em, 54px);min-height:clamp(23px, 2.16em, 54px)}:host(.button-small) ::slotted(ion-icon[slot=icon-only]){font-size:clamp(13.002px, 1.23125em, 40.385px)}:host(.button-large.button-has-icon-only){min-width:clamp(46px, 2.5em, 78px);min-height:clamp(46px, 2.5em, 78px)}:host(.button-large) ::slotted(ion-icon[slot=icon-only]){font-size:clamp(15.008px, 1.4em, 43.008px)}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color.ion-focused) .button-native::after,:host(.button-outline.ion-color.ion-focused) .button-native::after{background:var(--ion-color-base)}@media (any-hover: hover){:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:var(--ion-color-base)}}:host(.button-outline.ion-activated.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-background, var(--color));color:var(--ion-toolbar-color, var(--background), var(--ion-color-primary-contrast, #fff))}";
- var IonButtonMdStyle0 = buttonMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - Content is placed between the named slots if provided without a slot.
- * @slot icon-only - Should be used on an icon in a button that has no text.
- * @slot start - Content is placed to the left of the button text in LTR, and to the right in RTL.
- * @slot end - Content is placed to the right of the button text in LTR, and to the left in RTL.
- *
- * @part native - The native HTML button or anchor element that wraps all child elements.
- */
- class Button {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.inItem = false;
- this.inListHeader = false;
- this.inToolbar = false;
- this.formButtonEl = null;
- this.formEl = null;
- this.inheritedAttributes = {};
- this.handleClick = (ev) => {
- const { el } = this;
- if (this.type === 'button') {
- openURL(this.href, ev, this.routerDirection, this.routerAnimation);
- }
- else if (hasShadowDom(el)) {
- this.submitForm(ev);
- }
- };
- this.onFocus = () => {
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.ionBlur.emit();
- };
- this.slotChanged = () => {
- /**
- * Ensures that the 'has-icon-only' class is properly added
- * or removed from `ion-button` when manipulating the
- * `icon-only` slot.
- *
- * Without this, the 'has-icon-only' class is only checked
- * or added when `ion-button` component first renders.
- */
- this.isCircle = this.hasIconOnly;
- };
- this.isCircle = false;
- this.color = undefined;
- this.buttonType = 'button';
- this.disabled = false;
- this.expand = undefined;
- this.fill = undefined;
- this.routerDirection = 'forward';
- this.routerAnimation = undefined;
- this.download = undefined;
- this.href = undefined;
- this.rel = undefined;
- this.shape = undefined;
- this.size = undefined;
- this.strong = false;
- this.target = undefined;
- this.type = 'button';
- this.form = undefined;
- }
- disabledChanged() {
- const { disabled } = this;
- if (this.formButtonEl) {
- this.formButtonEl.disabled = disabled;
- }
- }
- /**
- * This is responsible for rendering a hidden native
- * button element inside the associated form. This allows
- * users to submit a form by pressing "Enter" when a text
- * field inside of the form is focused. The native button
- * rendered inside of `ion-button` is in the Shadow DOM
- * and therefore does not participate in form submission
- * which is why the following code is necessary.
- */
- renderHiddenButton() {
- const formEl = (this.formEl = this.findForm());
- if (formEl) {
- const { formButtonEl } = this;
- /**
- * If the form already has a rendered form button
- * then do not append a new one again.
- */
- if (formButtonEl !== null && formEl.contains(formButtonEl)) {
- return;
- }
- // Create a hidden native button inside of the form
- const newFormButtonEl = (this.formButtonEl = document.createElement('button'));
- newFormButtonEl.type = this.type;
- newFormButtonEl.style.display = 'none';
- // Only submit if the button is not disabled.
- newFormButtonEl.disabled = this.disabled;
- formEl.appendChild(newFormButtonEl);
- }
- }
- componentWillLoad() {
- this.inToolbar = !!this.el.closest('ion-buttons');
- this.inListHeader = !!this.el.closest('ion-list-header');
- this.inItem = !!this.el.closest('ion-item') || !!this.el.closest('ion-item-divider');
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- }
- get hasIconOnly() {
- return !!this.el.querySelector('[slot="icon-only"]');
- }
- get rippleType() {
- const hasClearFill = this.fill === undefined || this.fill === 'clear';
- // If the button is in a toolbar, has a clear fill (which is the default)
- // and only has an icon we use the unbounded "circular" ripple effect
- if (hasClearFill && this.hasIconOnly && this.inToolbar) {
- return 'unbounded';
- }
- return 'bounded';
- }
- /**
- * Finds the form element based on the provided `form` selector
- * or element reference provided.
- */
- findForm() {
- const { form } = this;
- if (form instanceof HTMLFormElement) {
- return form;
- }
- if (typeof form === 'string') {
- // Check if the string provided is a form id.
- const el = document.getElementById(form);
- if (el) {
- if (el instanceof HTMLFormElement) {
- return el;
- }
- else {
- /**
- * The developer specified a string for the form attribute, but the
- * element with that id is not a form element.
- */
- printIonWarning(`[ion-button] - Form with selector: "#${form}" could not be found. Verify that the id is attached to a <form> element.`, this.el);
- return null;
- }
- }
- else {
- /**
- * The developer specified a string for the form attribute, but the
- * element with that id could not be found in the DOM.
- */
- printIonWarning(`[ion-button] - Form with selector: "#${form}" could not be found. Verify that the id is correct and the form is rendered in the DOM.`, this.el);
- return null;
- }
- }
- if (form !== undefined) {
- /**
- * The developer specified a HTMLElement for the form attribute,
- * but the element is not a HTMLFormElement.
- * This will also catch if the developer tries to pass in null
- * as the form attribute.
- */
- printIonWarning(`[ion-button] - The provided "form" element is invalid. Verify that the form is a HTMLFormElement and rendered in the DOM.`, this.el);
- return null;
- }
- /**
- * If the form element is not set, the button may be inside
- * of a form element. Query the closest form element to the button.
- */
- return this.el.closest('form');
- }
- submitForm(ev) {
- // this button wants to specifically submit a form
- // climb up the dom to see if we're in a <form>
- // and if so, then use JS to submit it
- if (this.formEl && this.formButtonEl) {
- ev.preventDefault();
- this.formButtonEl.click();
- }
- }
- render() {
- const mode = getIonMode$1(this);
- const { buttonType, type, disabled, rel, target, size, href, color, expand, hasIconOnly, shape, strong, inheritedAttributes, } = this;
- const finalSize = size === undefined && this.inItem ? 'small' : size;
- const TagType = href === undefined ? 'button' : 'a';
- const attrs = TagType === 'button'
- ? { type }
- : {
- download: this.download,
- href,
- rel,
- target,
- };
- let fill = this.fill;
- /**
- * We check both undefined and null to
- * work around https://github.com/ionic-team/stencil/issues/3586.
- */
- if (fill == null) {
- fill = this.inToolbar || this.inListHeader ? 'clear' : 'solid';
- }
- /**
- * We call renderHiddenButton in the render function to account
- * for any properties being set async. For example, changing the
- * "type" prop from "button" to "submit" after the component has
- * loaded would warrant the hidden button being added to the
- * associated form.
- */
- {
- type !== 'button' && this.renderHiddenButton();
- }
- return (hAsync(Host, { key: 'e213b0bb76b3f90f883b1a0ea463bb86c2df69c3', onClick: this.handleClick, "aria-disabled": disabled ? 'true' : null, class: createColorClasses$1(color, {
- [mode]: true,
- [buttonType]: true,
- [`${buttonType}-${expand}`]: expand !== undefined,
- [`${buttonType}-${finalSize}`]: finalSize !== undefined,
- [`${buttonType}-${shape}`]: shape !== undefined,
- [`${buttonType}-${fill}`]: true,
- [`${buttonType}-strong`]: strong,
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- 'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
- 'in-buttons': hostContext('ion-buttons', this.el),
- 'button-has-icon-only': hasIconOnly,
- 'button-disabled': disabled,
- 'ion-activatable': true,
- 'ion-focusable': true,
- }) }, hAsync(TagType, Object.assign({ key: 'b7c2a46fb994024841219316f4089335fa463d84' }, attrs, { class: "button-native", part: "native", disabled: disabled, onFocus: this.onFocus, onBlur: this.onBlur }, inheritedAttributes), hAsync("span", { key: '3e07a5c9f86836f9fbaefc6c617bdde6eb6f70cd', class: "button-inner" }, hAsync("slot", { key: '41c08ae09aed16faaa57707d229ff75d97f0731c', name: "icon-only", onSlotchange: this.slotChanged }), hAsync("slot", { key: 'ab8b749e4572884cc04970a7594466b4a24c886e', name: "start" }), hAsync("slot", { key: '397f7ff48ea45e82029414be95d29ae86e12c3a9' }), hAsync("slot", { key: '9a5627713002e8be3738d392b616f6e951b70e12', name: "end" })), mode === 'md' && hAsync("ion-ripple-effect", { key: '105566543ceda102474edab7ca8a44c7e71af589', type: this.rippleType }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledChanged"]
- }; }
- static get style() { return {
- ios: IonButtonIosStyle0,
- md: IonButtonMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-button",
- "$members$": {
- "color": [513],
- "buttonType": [1025, "button-type"],
- "disabled": [516],
- "expand": [513],
- "fill": [1537],
- "routerDirection": [1, "router-direction"],
- "routerAnimation": [16],
- "download": [1],
- "href": [1],
- "rel": [1],
- "shape": [513],
- "size": [513],
- "strong": [4],
- "target": [1],
- "type": [1],
- "form": [1],
- "isCircle": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"], ["disabled", "disabled"], ["expand", "expand"], ["fill", "fill"], ["shape", "shape"], ["size", "size"]]
- }; }
- }
- const buttonsIosCss = ".sc-ion-buttons-ios-h{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:99}.sc-ion-buttons-ios-s ion-button{--padding-top:0;--padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-buttons-ios-s ion-button{--padding-top:3px;--padding-bottom:3px;--padding-start:5px;--padding-end:5px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;min-height:32px}.sc-ion-buttons-ios-s .button-has-icon-only{--padding-top:0;--padding-bottom:0}.sc-ion-buttons-ios-s ion-button:not(.button-round){--border-radius:4px}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button{--color:initial;--border-color:initial;--background-focused:var(--ion-color-contrast)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-solid,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-solid{--background:var(--ion-color-contrast);--background-focused:#000;--background-focused-opacity:.12;--background-activated:#000;--background-activated-opacity:.12;--background-hover:var(--ion-color-base);--background-hover-opacity:0.45;--color:var(--ion-color-base);--color-focused:var(--ion-color-base)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-clear,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-clear{--color-activated:var(--ion-color-contrast);--color-focused:var(--ion-color-contrast)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-outline,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-outline{--color-activated:var(--ion-color-base);--color-focused:var(--ion-color-contrast);--background-activated:var(--ion-color-contrast)}.sc-ion-buttons-ios-s .button-clear,.sc-ion-buttons-ios-s .button-outline{--background-activated:transparent;--background-focused:currentColor;--background-hover:transparent}.sc-ion-buttons-ios-s .button-solid:not(.ion-color){--background-focused:#000;--background-focused-opacity:.12;--background-activated:#000;--background-activated-opacity:.12}.sc-ion-buttons-ios-s ion-icon[slot=start]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-end:0.3em;margin-inline-end:0.3em;font-size:1.41em;line-height:0.67}.sc-ion-buttons-ios-s ion-icon[slot=end]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-start:0.4em;margin-inline-start:0.4em;font-size:1.41em;line-height:0.67}.sc-ion-buttons-ios-s ion-icon[slot=icon-only]{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;font-size:1.65em;line-height:0.67}";
- var IonButtonsIosStyle0 = buttonsIosCss;
- const buttonsMdCss = ".sc-ion-buttons-md-h{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:99}.sc-ion-buttons-md-s ion-button{--padding-top:0;--padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-buttons-md-s ion-button{--padding-top:3px;--padding-bottom:3px;--padding-start:8px;--padding-end:8px;--box-shadow:none;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;min-height:32px}.sc-ion-buttons-md-s .button-has-icon-only{--padding-top:0;--padding-bottom:0}.sc-ion-buttons-md-s ion-button:not(.button-round){--border-radius:2px}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button{--color:initial;--color-focused:var(--ion-color-contrast);--color-hover:var(--ion-color-contrast);--background-activated:transparent;--background-focused:var(--ion-color-contrast);--background-hover:var(--ion-color-contrast)}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button-solid,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button-solid{--background:var(--ion-color-contrast);--background-activated:transparent;--background-focused:var(--ion-color-shade);--background-hover:var(--ion-color-base);--color:var(--ion-color-base);--color-focused:var(--ion-color-base);--color-hover:var(--ion-color-base)}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button-outline,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button-outline{--border-color:var(--ion-color-contrast)}.sc-ion-buttons-md-s .button-has-icon-only.button-clear{--padding-top:12px;--padding-end:12px;--padding-bottom:12px;--padding-start:12px;--border-radius:50%;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;width:3rem;height:3rem}.sc-ion-buttons-md-s .button{--background-hover:currentColor}.sc-ion-buttons-md-s .button-solid{--color:var(--ion-toolbar-background, var(--ion-background-color, #fff));--background:var(--ion-toolbar-color, var(--ion-text-color, #424242));--background-activated:transparent;--background-focused:currentColor}.sc-ion-buttons-md-s .button-outline{--color:initial;--background:transparent;--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--border-color:currentColor}.sc-ion-buttons-md-s .button-clear{--color:initial;--background:transparent;--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor}.sc-ion-buttons-md-s ion-icon[slot=start]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-end:0.3em;margin-inline-end:0.3em;font-size:1.4em}.sc-ion-buttons-md-s ion-icon[slot=end]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-start:0.4em;margin-inline-start:0.4em;font-size:1.4em}.sc-ion-buttons-md-s ion-icon[slot=icon-only]{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;font-size:1.8em}";
- var IonButtonsMdStyle0 = buttonsMdCss;
- class Buttons {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.collapse = false;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '58c1fc5eb867d0731c63549b1ccb3ec3bbbe6e1b', class: {
- [mode]: true,
- ['buttons-collapse']: this.collapse,
- } }, hAsync("slot", { key: '0c8f95b9840c8fa0c4e50be84c5159620a3eb5c8' })));
- }
- static get style() { return {
- ios: IonButtonsIosStyle0,
- md: IonButtonsMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 38,
- "$tagName$": "ion-buttons",
- "$members$": {
- "collapse": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const cardIosCss = ":host{--ion-safe-area-left:0px;--ion-safe-area-right:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.card-disabled){cursor:default;opacity:0.3;pointer-events:none}.card-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;min-height:var(--min-height);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:inherit}.card-native::-moz-focus-inner{border:0}button,a{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-drag:none}ion-ripple-effect{color:var(--ripple-color)}:host{--background:var(--ion-card-background, var(--ion-item-background, var(--ion-background-color, #fff)));--color:var(--ion-card-color, var(--ion-item-color, var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))));-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:24px;margin-bottom:24px;border-radius:8px;-webkit-transition:-webkit-transform 500ms cubic-bezier(0.12, 0.72, 0.29, 1);transition:-webkit-transform 500ms cubic-bezier(0.12, 0.72, 0.29, 1);transition:transform 500ms cubic-bezier(0.12, 0.72, 0.29, 1);transition:transform 500ms cubic-bezier(0.12, 0.72, 0.29, 1), -webkit-transform 500ms cubic-bezier(0.12, 0.72, 0.29, 1);font-size:0.875rem;-webkit-box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}:host(.ion-activated){-webkit-transform:scale3d(0.97, 0.97, 1);transform:scale3d(0.97, 0.97, 1)}";
- var IonCardIosStyle0 = cardIosCss;
- const cardMdCss = ":host{--ion-safe-area-left:0px;--ion-safe-area-right:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.card-disabled){cursor:default;opacity:0.3;pointer-events:none}.card-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;min-height:var(--min-height);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:inherit}.card-native::-moz-focus-inner{border:0}button,a{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-drag:none}ion-ripple-effect{color:var(--ripple-color)}:host{--background:var(--ion-card-background, var(--ion-item-background, var(--ion-background-color, #fff)));--color:var(--ion-card-color, var(--ion-item-color, var(--ion-color-step-550, var(--ion-text-color-step-450, #737373))));-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px;margin-top:10px;margin-bottom:10px;border-radius:4px;font-size:0.875rem;-webkit-box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}";
- var IonCardMdStyle0 = cardMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part native - The native HTML button, anchor, or div element that wraps all child elements.
- */
- class Card {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.inheritedAriaAttributes = {};
- this.color = undefined;
- this.button = false;
- this.type = 'button';
- this.disabled = false;
- this.download = undefined;
- this.href = undefined;
- this.rel = undefined;
- this.routerDirection = 'forward';
- this.routerAnimation = undefined;
- this.target = undefined;
- }
- componentWillLoad() {
- this.inheritedAriaAttributes = inheritAttributes$1(this.el, ['aria-label']);
- }
- isClickable() {
- return this.href !== undefined || this.button;
- }
- renderCard(mode) {
- const clickable = this.isClickable();
- if (!clickable) {
- return [hAsync("slot", null)];
- }
- const { href, routerAnimation, routerDirection, inheritedAriaAttributes } = this;
- const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
- const attrs = TagType === 'button'
- ? { type: this.type }
- : {
- download: this.download,
- href: this.href,
- rel: this.rel,
- target: this.target,
- };
- return (hAsync(TagType, Object.assign({}, attrs, inheritedAriaAttributes, { class: "card-native", part: "native", disabled: this.disabled, onClick: (ev) => openURL(href, ev, routerDirection, routerAnimation) }), hAsync("slot", null), clickable && mode === 'md' && hAsync("ion-ripple-effect", null)));
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '85e9b30bd81e79a0c7ac75cb3664bdcf9e4afc4d', class: createColorClasses$1(this.color, {
- [mode]: true,
- 'card-disabled': this.disabled,
- 'ion-activatable': this.isClickable(),
- }) }, this.renderCard(mode)));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonCardIosStyle0,
- md: IonCardMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-card",
- "$members$": {
- "color": [513],
- "button": [4],
- "type": [1],
- "disabled": [4],
- "download": [1],
- "href": [1],
- "rel": [1],
- "routerDirection": [1, "router-direction"],
- "routerAnimation": [16],
- "target": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const cardContentIosCss = "ion-card-content{display:block;position:relative}.card-content-ios{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:20px;padding-bottom:20px;font-size:1rem;line-height:1.4}.card-content-ios h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:1.5rem;font-weight:normal}.card-content-ios h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:1rem;font-weight:normal}.card-content-ios h3,.card-content-ios h4,.card-content-ios h5,.card-content-ios h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:0.875rem;font-weight:normal}.card-content-ios p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:0.875rem}ion-card-header+.card-content-ios{padding-top:0}";
- var IonCardContentIosStyle0 = cardContentIosCss;
- const cardContentMdCss = "ion-card-content{display:block;position:relative}.card-content-md{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:13px;padding-bottom:13px;font-size:0.875rem;line-height:1.5}.card-content-md h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:1.5rem;font-weight:normal}.card-content-md h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:1rem;font-weight:normal}.card-content-md h3,.card-content-md h4,.card-content-md h5,.card-content-md h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:0.875rem;font-weight:normal}.card-content-md p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:0.875rem;font-weight:normal;line-height:1.5}ion-card-header+.card-content-md{padding-top:0}";
- var IonCardContentMdStyle0 = cardContentMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class CardContent {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'd98e4d1fc6ad3237549f9bc17e4c67ec5059b1b3', class: {
- [mode]: true,
- // Used internally for styling
- [`card-content-${mode}`]: true,
- } }));
- }
- static get style() { return {
- ios: IonCardContentIosStyle0,
- md: IonCardContentMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 32,
- "$tagName$": "ion-card-content",
- "$members$": undefined,
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const cardHeaderIosCss = ":host{--background:transparent;--color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:column;flex-direction:column;background:var(--background);color:var(--color)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:20px;padding-bottom:16px;-ms-flex-direction:column-reverse;flex-direction:column-reverse}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.card-header-translucent){background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.9);-webkit-backdrop-filter:saturate(180%) blur(30px);backdrop-filter:saturate(180%) blur(30px)}}";
- var IonCardHeaderIosStyle0 = cardHeaderIosCss;
- const cardHeaderMdCss = ":host{--background:transparent;--color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:column;flex-direction:column;background:var(--background);color:var(--color)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px}::slotted(ion-card-title:not(:first-child)),::slotted(ion-card-subtitle:not(:first-child)){margin-top:8px}";
- var IonCardHeaderMdStyle0 = cardHeaderMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class CardHeader {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- this.translucent = false;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '64246b81931203a64d553c788cd736f41e23f37b', class: createColorClasses$1(this.color, {
- 'card-header-translucent': this.translucent,
- 'ion-inherit-color': true,
- [mode]: true,
- }) }, hAsync("slot", { key: 'af2da2dfe266889afeb57fac25c6a730558dbba4' })));
- }
- static get style() { return {
- ios: IonCardHeaderIosStyle0,
- md: IonCardHeaderMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-card-header",
- "$members$": {
- "color": [513],
- "translucent": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const cardSubtitleIosCss = ":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));margin-left:0;margin-right:0;margin-top:0;margin-bottom:4px;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:0.75rem;font-weight:700;letter-spacing:0.4px;text-transform:uppercase}";
- var IonCardSubtitleIosStyle0 = cardSubtitleIosCss;
- const cardSubtitleMdCss = ":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-550, var(--ion-text-color-step-450, #737373));margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:0.875rem;font-weight:500}";
- var IonCardSubtitleMdStyle0 = cardSubtitleMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class CardSubtitle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '84d820a19d9074f9c8bc61ccba1ca40062a60b73', role: "heading", "aria-level": "3", class: createColorClasses$1(this.color, {
- 'ion-inherit-color': true,
- [mode]: true,
- }) }, hAsync("slot", { key: 'e4d07d395a1f4469a90847636083101b32b776a1' })));
- }
- static get style() { return {
- ios: IonCardSubtitleIosStyle0,
- md: IonCardSubtitleMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-card-subtitle",
- "$members$": {
- "color": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const cardTitleIosCss = ":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-text-color, #000);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:1.75rem;font-weight:700;line-height:1.2}";
- var IonCardTitleIosStyle0 = cardTitleIosCss;
- const cardTitleMdCss = ":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:1.25rem;font-weight:500;line-height:1.2}";
- var IonCardTitleMdStyle0 = cardTitleMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class CardTitle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'fca001a86396e83718d5211cd71912fdf40dea2f', role: "heading", "aria-level": "2", class: createColorClasses$1(this.color, {
- 'ion-inherit-color': true,
- [mode]: true,
- }) }, hAsync("slot", { key: '2ba416aed488b2ff462fa75fb3b70373a6dd7da6' })));
- }
- static get style() { return {
- ios: IonCardTitleIosStyle0,
- md: IonCardTitleMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-card-title",
- "$members$": {
- "color": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const checkboxIosCss = ":host{--checkbox-background-checked:var(--ion-color-primary, #0054e9);--border-color-checked:var(--ion-color-primary, #0054e9);--checkmark-color:var(--ion-color-primary-contrast, #fff);--transition:none;display:inline-block;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0;width:100%;height:100%}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}:host(.ion-color){--checkbox-background-checked:var(--ion-color-base);--border-color-checked:var(--ion-color-base);--checkmark-color:var(--ion-color-contrast)}.checkbox-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item) .label-text-wrapper,:host(.in-item:not(.checkbox-label-placement-stacked):not([slot])) .native-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.checkbox-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}input{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.checkbox-icon{border-radius:var(--border-radius);position:relative;width:var(--size);height:var(--size);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--checkbox-background);-webkit-box-sizing:border-box;box-sizing:border-box}.checkbox-icon path{fill:none;stroke:var(--checkmark-color);stroke-width:var(--checkmark-width);opacity:0}.checkbox-bottom{padding-top:4px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75rem;white-space:normal}:host(.checkbox-label-placement-stacked) .checkbox-bottom{font-size:1rem}.checkbox-bottom .error-text{display:none;color:var(--ion-color-danger, #c5000f)}.checkbox-bottom .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}:host(.ion-touched.ion-invalid) .checkbox-bottom .error-text{display:block}:host(.ion-touched.ion-invalid) .checkbox-bottom .helper-text{display:none}:host(.checkbox-label-placement-start) .checkbox-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.checkbox-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-end) .checkbox-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse;-ms-flex-pack:start;justify-content:start}:host(.checkbox-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.checkbox-label-placement-stacked) .checkbox-wrapper{-ms-flex-direction:column;flex-direction:column;text-align:center}:host(.checkbox-label-placement-stacked) .label-text-wrapper{-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.checkbox-justify-space-between) .checkbox-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.checkbox-justify-start) .checkbox-wrapper{-ms-flex-pack:start;justify-content:start}:host(.checkbox-justify-end) .checkbox-wrapper{-ms-flex-pack:end;justify-content:end}:host(.checkbox-alignment-start) .checkbox-wrapper{-ms-flex-align:start;align-items:start}:host(.checkbox-alignment-center) .checkbox-wrapper{-ms-flex-align:center;align-items:center}:host(.checkbox-justify-space-between),:host(.checkbox-justify-start),:host(.checkbox-justify-end),:host(.checkbox-alignment-start),:host(.checkbox-alignment-center){display:block}:host(.checkbox-checked) .checkbox-icon,:host(.checkbox-indeterminate) .checkbox-icon{border-color:var(--border-color-checked);background:var(--checkbox-background-checked)}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{opacity:1}:host(.checkbox-disabled){pointer-events:none}:host{--border-radius:50%;--border-width:0.125rem;--border-style:solid;--border-color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.23);--checkbox-background:var(--ion-item-background, var(--ion-background-color, #fff));--size:min(1.375rem, 55.836px);--checkmark-width:1.5px}:host(.checkbox-disabled){opacity:0.3}";
- var IonCheckboxIosStyle0 = checkboxIosCss;
- const checkboxMdCss = ":host{--checkbox-background-checked:var(--ion-color-primary, #0054e9);--border-color-checked:var(--ion-color-primary, #0054e9);--checkmark-color:var(--ion-color-primary-contrast, #fff);--transition:none;display:inline-block;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0;width:100%;height:100%}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}:host(.ion-color){--checkbox-background-checked:var(--ion-color-base);--border-color-checked:var(--ion-color-base);--checkmark-color:var(--ion-color-contrast)}.checkbox-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item) .label-text-wrapper,:host(.in-item:not(.checkbox-label-placement-stacked):not([slot])) .native-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.checkbox-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}input{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.checkbox-icon{border-radius:var(--border-radius);position:relative;width:var(--size);height:var(--size);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--checkbox-background);-webkit-box-sizing:border-box;box-sizing:border-box}.checkbox-icon path{fill:none;stroke:var(--checkmark-color);stroke-width:var(--checkmark-width);opacity:0}.checkbox-bottom{padding-top:4px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75rem;white-space:normal}:host(.checkbox-label-placement-stacked) .checkbox-bottom{font-size:1rem}.checkbox-bottom .error-text{display:none;color:var(--ion-color-danger, #c5000f)}.checkbox-bottom .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}:host(.ion-touched.ion-invalid) .checkbox-bottom .error-text{display:block}:host(.ion-touched.ion-invalid) .checkbox-bottom .helper-text{display:none}:host(.checkbox-label-placement-start) .checkbox-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.checkbox-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-end) .checkbox-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse;-ms-flex-pack:start;justify-content:start}:host(.checkbox-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.checkbox-label-placement-stacked) .checkbox-wrapper{-ms-flex-direction:column;flex-direction:column;text-align:center}:host(.checkbox-label-placement-stacked) .label-text-wrapper{-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.checkbox-justify-space-between) .checkbox-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.checkbox-justify-start) .checkbox-wrapper{-ms-flex-pack:start;justify-content:start}:host(.checkbox-justify-end) .checkbox-wrapper{-ms-flex-pack:end;justify-content:end}:host(.checkbox-alignment-start) .checkbox-wrapper{-ms-flex-align:start;align-items:start}:host(.checkbox-alignment-center) .checkbox-wrapper{-ms-flex-align:center;align-items:center}:host(.checkbox-justify-space-between),:host(.checkbox-justify-start),:host(.checkbox-justify-end),:host(.checkbox-alignment-start),:host(.checkbox-alignment-center){display:block}:host(.checkbox-checked) .checkbox-icon,:host(.checkbox-indeterminate) .checkbox-icon{border-color:var(--border-color-checked);background:var(--checkbox-background-checked)}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{opacity:1}:host(.checkbox-disabled){pointer-events:none}:host{--border-radius:calc(var(--size) * .125);--border-width:2px;--border-style:solid;--border-color:rgb(var(--ion-text-color-rgb, 0, 0, 0), 0.6);--checkmark-width:3;--checkbox-background:var(--ion-item-background, var(--ion-background-color, #fff));--transition:background 180ms cubic-bezier(0.4, 0, 0.2, 1);--size:18px}.checkbox-icon path{stroke-dasharray:30;stroke-dashoffset:30}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{stroke-dashoffset:0;-webkit-transition:stroke-dashoffset 90ms linear 90ms;transition:stroke-dashoffset 90ms linear 90ms}:host(.checkbox-disabled) .label-text-wrapper{opacity:0.38}:host(.checkbox-disabled) .native-wrapper{opacity:0.63}";
- var IonCheckboxMdStyle0 = checkboxMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - The label text to associate with the checkbox. Use the "labelPlacement" property to control where the label is placed relative to the checkbox.
- *
- * @part container - The container for the checkbox mark.
- * @part label - The label text describing the checkbox.
- * @part mark - The checkmark used to indicate the checked state.
- * @part supporting-text - Supporting text displayed beneath the checkbox label.
- * @part helper-text - Supporting text displayed beneath the checkbox label when the checkbox is valid.
- * @part error-text - Supporting text displayed beneath the checkbox label when the checkbox is invalid and touched.
- */
- class Checkbox {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.inputId = `ion-cb-${checkboxIds++}`;
- this.inputLabelId = `${this.inputId}-lbl`;
- this.helperTextId = `${this.inputId}-helper-text`;
- this.errorTextId = `${this.inputId}-error-text`;
- this.inheritedAttributes = {};
- /**
- * Sets the checked property and emits
- * the ionChange event. Use this to update the
- * checked state in response to user-generated
- * actions such as a click.
- */
- this.setChecked = (state) => {
- const isChecked = (this.checked = state);
- this.ionChange.emit({
- checked: isChecked,
- value: this.value,
- });
- };
- this.toggleChecked = (ev) => {
- ev.preventDefault();
- this.setFocus();
- this.setChecked(!this.checked);
- this.indeterminate = false;
- };
- this.onFocus = () => {
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.ionBlur.emit();
- };
- this.onKeyDown = (ev) => {
- if (ev.key === ' ') {
- ev.preventDefault();
- if (!this.disabled) {
- this.toggleChecked(ev);
- }
- }
- };
- this.onClick = (ev) => {
- if (this.disabled) {
- return;
- }
- this.toggleChecked(ev);
- };
- /**
- * Stops propagation when the display label is clicked,
- * otherwise, two clicks will be triggered.
- */
- this.onDivLabelClick = (ev) => {
- ev.stopPropagation();
- };
- this.color = undefined;
- this.name = this.inputId;
- this.checked = false;
- this.indeterminate = false;
- this.disabled = false;
- this.errorText = undefined;
- this.helperText = undefined;
- this.value = 'on';
- this.labelPlacement = 'start';
- this.justify = undefined;
- this.alignment = undefined;
- this.required = false;
- }
- componentWillLoad() {
- this.inheritedAttributes = Object.assign({}, inheritAriaAttributes(this.el));
- }
- /** @internal */
- async setFocus() {
- if (this.focusEl) {
- this.focusEl.focus();
- }
- }
- getHintTextID() {
- const { el, helperText, errorText, helperTextId, errorTextId } = this;
- if (el.classList.contains('ion-touched') && el.classList.contains('ion-invalid') && errorText) {
- return errorTextId;
- }
- if (helperText) {
- return helperTextId;
- }
- return undefined;
- }
- /**
- * Responsible for rendering helper text and error text.
- * This element should only be rendered if hint text is set.
- */
- renderHintText() {
- const { helperText, errorText, helperTextId, errorTextId } = this;
- /**
- * undefined and empty string values should
- * be treated as not having helper/error text.
- */
- const hasHintText = !!helperText || !!errorText;
- if (!hasHintText) {
- return;
- }
- return (hAsync("div", { class: "checkbox-bottom" }, hAsync("div", { id: helperTextId, class: "helper-text", part: "supporting-text helper-text" }, helperText), hAsync("div", { id: errorTextId, class: "error-text", part: "supporting-text error-text" }, errorText)));
- }
- render() {
- const { color, checked, disabled, el, getSVGPath, indeterminate, inheritedAttributes, inputId, justify, labelPlacement, name, value, alignment, required, } = this;
- const mode = getIonMode$1(this);
- const path = getSVGPath(mode, indeterminate);
- const hasLabelContent = el.textContent !== '';
- renderHiddenInput(true, el, name, checked ? value : '', disabled);
- // The host element must have a checkbox role to ensure proper VoiceOver
- // support in Safari for accessibility.
- return (hAsync(Host, { key: '26cbe7220e555107200e9b5deeae754aa534a80b', role: "checkbox", "aria-checked": indeterminate ? 'mixed' : `${checked}`, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === this.errorTextId, "aria-labelledby": hasLabelContent ? this.inputLabelId : null, "aria-label": inheritedAttributes['aria-label'] || null, "aria-disabled": disabled ? 'true' : null, tabindex: disabled ? undefined : 0, onKeyDown: this.onKeyDown, class: createColorClasses$1(color, {
- [mode]: true,
- 'in-item': hostContext('ion-item', el),
- 'checkbox-checked': checked,
- 'checkbox-disabled': disabled,
- 'checkbox-indeterminate': indeterminate,
- interactive: true,
- [`checkbox-justify-${justify}`]: justify !== undefined,
- [`checkbox-alignment-${alignment}`]: alignment !== undefined,
- [`checkbox-label-placement-${labelPlacement}`]: true,
- }), onClick: this.onClick }, hAsync("label", { key: 'f025cec5ff08e8be4487b9cc0324616ca5dfae2a', class: "checkbox-wrapper", htmlFor: inputId }, hAsync("input", Object.assign({ key: 'dc53f7e4e240dc2e18556e6350df2b5c3169f553', type: "checkbox", checked: checked ? true : undefined, disabled: disabled, id: inputId, onChange: this.toggleChecked, onFocus: () => this.onFocus(), onBlur: () => this.onBlur(), ref: (focusEl) => (this.focusEl = focusEl), required: required }, inheritedAttributes)), hAsync("div", { key: 'a625e9b50c3b617de8bbbfd624d772454fecaf2d', class: {
- 'label-text-wrapper': true,
- 'label-text-wrapper-hidden': !hasLabelContent,
- }, part: "label", id: this.inputLabelId, onClick: this.onDivLabelClick }, hAsync("slot", { key: '87d1a90691327945f4343406706e4ab27f453844' }), this.renderHintText()), hAsync("div", { key: 'b57fed8cdecee4df1ef0d57f157267ee77fac653', class: "native-wrapper" }, hAsync("svg", { key: 'd472a06ec6c8b74dfb651415d2236db8080f6805', class: "checkbox-icon", viewBox: "0 0 24 24", part: "container" }, path)))));
- }
- getSVGPath(mode, indeterminate) {
- let path = indeterminate ? (hAsync("path", { d: "M6 12L18 12", part: "mark" })) : (hAsync("path", { d: "M5.9,12.5l3.8,3.8l8.8-8.8", part: "mark" }));
- if (mode === 'md') {
- path = indeterminate ? (hAsync("path", { d: "M2 12H22", part: "mark" })) : (hAsync("path", { d: "M1.73,12.91 8.1,19.28 22.79,4.59", part: "mark" }));
- }
- return path;
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonCheckboxIosStyle0,
- md: IonCheckboxMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-checkbox",
- "$members$": {
- "color": [513],
- "name": [1],
- "checked": [1028],
- "indeterminate": [1028],
- "disabled": [4],
- "errorText": [1, "error-text"],
- "helperText": [1, "helper-text"],
- "value": [8],
- "labelPlacement": [1, "label-placement"],
- "justify": [1],
- "alignment": [1],
- "required": [4],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- let checkboxIds = 0;
- const chipIosCss = ":host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.12);--color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.87);border-radius:16px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:4px;margin-inline-end:4px;margin-top:4px;margin-bottom:4px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-inline-flexbox;display:inline-flex;position:relative;-ms-flex-align:center;align-items:center;min-height:32px;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);cursor:pointer;overflow:hidden;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.chip-disabled){cursor:default;opacity:0.4;pointer-events:none}:host(.ion-color){background:rgba(var(--ion-color-base-rgb), 0.08);color:var(--ion-color-shade)}:host(.ion-color:focus){background:rgba(var(--ion-color-base-rgb), 0.12)}:host(.ion-color.ion-activated){background:rgba(var(--ion-color-base-rgb), 0.16)}:host(.chip-outline){border-width:1px;border-style:solid}:host(.chip-outline){border-color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.32);background:transparent}:host(.chip-outline.ion-color){border-color:rgba(var(--ion-color-base-rgb), 0.32)}:host(.chip-outline:not(.ion-color):focus){background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.04)}:host(.chip-outline.ion-activated:not(.ion-color)){background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08)}::slotted(ion-icon){font-size:1.4285714286em}:host(:not(.ion-color)) ::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54)}::slotted(ion-icon:first-child){-webkit-margin-start:-4px;margin-inline-start:-4px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:-4px;margin-bottom:-4px}::slotted(ion-icon:last-child){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:-4px;margin-inline-end:-4px;margin-top:-4px;margin-bottom:-4px}::slotted(ion-avatar){-ms-flex-negative:0;flex-shrink:0;width:1.7142857143em;height:1.7142857143em}::slotted(ion-avatar:first-child){-webkit-margin-start:-8px;margin-inline-start:-8px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:-4px;margin-bottom:-4px}::slotted(ion-avatar:last-child){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:-8px;margin-inline-end:-8px;margin-top:-4px;margin-bottom:-4px}:host(:focus){outline:none}:host(:focus){--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.16)}:host(.ion-activated){--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2)}@media (any-hover: hover){:host(:hover){--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.16)}:host(.ion-color:hover){background:rgba(var(--ion-color-base-rgb), 0.12)}:host(.chip-outline:not(.ion-color):hover){background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.04)}}:host{font-size:clamp(13px, 0.875rem, 22px)}";
- var IonChipIosStyle0 = chipIosCss;
- const chipMdCss = ":host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.12);--color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.87);border-radius:16px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:4px;margin-inline-end:4px;margin-top:4px;margin-bottom:4px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-inline-flexbox;display:inline-flex;position:relative;-ms-flex-align:center;align-items:center;min-height:32px;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);cursor:pointer;overflow:hidden;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.chip-disabled){cursor:default;opacity:0.4;pointer-events:none}:host(.ion-color){background:rgba(var(--ion-color-base-rgb), 0.08);color:var(--ion-color-shade)}:host(.ion-color:focus){background:rgba(var(--ion-color-base-rgb), 0.12)}:host(.ion-color.ion-activated){background:rgba(var(--ion-color-base-rgb), 0.16)}:host(.chip-outline){border-width:1px;border-style:solid}:host(.chip-outline){border-color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.32);background:transparent}:host(.chip-outline.ion-color){border-color:rgba(var(--ion-color-base-rgb), 0.32)}:host(.chip-outline:not(.ion-color):focus){background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.04)}:host(.chip-outline.ion-activated:not(.ion-color)){background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08)}::slotted(ion-icon){font-size:1.4285714286em}:host(:not(.ion-color)) ::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54)}::slotted(ion-icon:first-child){-webkit-margin-start:-4px;margin-inline-start:-4px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:-4px;margin-bottom:-4px}::slotted(ion-icon:last-child){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:-4px;margin-inline-end:-4px;margin-top:-4px;margin-bottom:-4px}::slotted(ion-avatar){-ms-flex-negative:0;flex-shrink:0;width:1.7142857143em;height:1.7142857143em}::slotted(ion-avatar:first-child){-webkit-margin-start:-8px;margin-inline-start:-8px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:-4px;margin-bottom:-4px}::slotted(ion-avatar:last-child){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:-8px;margin-inline-end:-8px;margin-top:-4px;margin-bottom:-4px}:host(:focus){outline:none}:host(:focus){--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.16)}:host(.ion-activated){--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2)}@media (any-hover: hover){:host(:hover){--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.16)}:host(.ion-color:hover){background:rgba(var(--ion-color-base-rgb), 0.12)}:host(.chip-outline:not(.ion-color):hover){background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.04)}}:host{font-size:0.875rem}";
- var IonChipMdStyle0 = chipMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Chip {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- this.outline = false;
- this.disabled = false;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'fa2e9a4837ef87a17ef10f388e8caa7f604d9145', "aria-disabled": this.disabled ? 'true' : null, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'chip-outline': this.outline,
- 'chip-disabled': this.disabled,
- 'ion-activatable': true,
- }) }, hAsync("slot", { key: '3793fbd9d915cef7241fb101e2bc64c08b9ba482' }), mode === 'md' && hAsync("ion-ripple-effect", { key: 'd3b95b53918611dec095a50f2aaaab65617947a4' })));
- }
- static get style() { return {
- ios: IonChipIosStyle0,
- md: IonChipMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-chip",
- "$members$": {
- "color": [513],
- "outline": [4],
- "disabled": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const SIZE_TO_MEDIA = {
- xs: '(min-width: 0px)',
- sm: '(min-width: 576px)',
- md: '(min-width: 768px)',
- lg: '(min-width: 992px)',
- xl: '(min-width: 1200px)',
- };
- // Check if the window matches the media query
- // at the breakpoint passed
- // e.g. matchBreakpoint('sm') => true if screen width exceeds 576px
- const matchBreakpoint = (breakpoint) => {
- if (breakpoint === undefined || breakpoint === '') {
- return true;
- }
- if (window.matchMedia) {
- const mediaQuery = SIZE_TO_MEDIA[breakpoint];
- return window.matchMedia(mediaQuery).matches;
- }
- return false;
- };
- const colCss = ":host{-webkit-padding-start:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;width:100%;max-width:100%;min-height:1px}@media (min-width: 576px){:host{-webkit-padding-start:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px))}}@media (min-width: 768px){:host{-webkit-padding-start:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px))}}@media (min-width: 992px){:host{-webkit-padding-start:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px))}}@media (min-width: 1200px){:host{-webkit-padding-start:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px))}}";
- var IonColStyle0 = colCss;
- const win = typeof window !== 'undefined' ? window : undefined;
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- const SUPPORTS_VARS = win && !!(win.CSS && win.CSS.supports && win.CSS.supports('--a: 0'));
- const BREAKPOINTS = ['', 'xs', 'sm', 'md', 'lg', 'xl'];
- class Col {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.offset = undefined;
- this.offsetXs = undefined;
- this.offsetSm = undefined;
- this.offsetMd = undefined;
- this.offsetLg = undefined;
- this.offsetXl = undefined;
- this.pull = undefined;
- this.pullXs = undefined;
- this.pullSm = undefined;
- this.pullMd = undefined;
- this.pullLg = undefined;
- this.pullXl = undefined;
- this.push = undefined;
- this.pushXs = undefined;
- this.pushSm = undefined;
- this.pushMd = undefined;
- this.pushLg = undefined;
- this.pushXl = undefined;
- this.size = undefined;
- this.sizeXs = undefined;
- this.sizeSm = undefined;
- this.sizeMd = undefined;
- this.sizeLg = undefined;
- this.sizeXl = undefined;
- }
- onResize() {
- }
- // Loop through all of the breakpoints to see if the media query
- // matches and grab the column value from the relevant prop if so
- getColumns(property) {
- let matched;
- for (const breakpoint of BREAKPOINTS) {
- const matches = matchBreakpoint(breakpoint);
- // Grab the value of the property, if it exists and our
- // media query matches we return the value
- const columns = this[property + breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1)];
- if (matches && columns !== undefined) {
- matched = columns;
- }
- }
- // Return the last matched columns since the breakpoints
- // increase in size and we want to return the largest match
- return matched;
- }
- calculateSize() {
- const columns = this.getColumns('size');
- // If size wasn't set for any breakpoint
- // or if the user set the size without a value
- // it means we need to stick with the default and return
- // e.g. <ion-col size-md>
- if (!columns || columns === '') {
- return;
- }
- // If the size is set to auto then don't calculate a size
- const colSize = columns === 'auto'
- ? 'auto'
- : // If CSS supports variables we should use the grid columns var
- SUPPORTS_VARS
- ? `calc(calc(${columns} / var(--ion-grid-columns, 12)) * 100%)`
- : // Convert the columns to a percentage by dividing by the total number
- // of columns (12) and then multiplying by 100
- (columns / 12) * 100 + '%';
- return {
- flex: `0 0 ${colSize}`,
- width: `${colSize}`,
- 'max-width': `${colSize}`,
- };
- }
- // Called by push, pull, and offset since they use the same calculations
- calculatePosition(property, modifier) {
- const columns = this.getColumns(property);
- if (!columns) {
- return;
- }
- // If the number of columns passed are greater than 0 and less than
- // 12 we can position the column, else default to auto
- const amount = SUPPORTS_VARS
- ? // If CSS supports variables we should use the grid columns var
- `calc(calc(${columns} / var(--ion-grid-columns, 12)) * 100%)`
- : // Convert the columns to a percentage by dividing by the total number
- // of columns (12) and then multiplying by 100
- columns > 0 && columns < 12
- ? (columns / 12) * 100 + '%'
- : 'auto';
- return {
- [modifier]: amount,
- };
- }
- calculateOffset(isRTL) {
- return this.calculatePosition('offset', isRTL ? 'margin-right' : 'margin-left');
- }
- calculatePull(isRTL) {
- return this.calculatePosition('pull', isRTL ? 'left' : 'right');
- }
- calculatePush(isRTL) {
- return this.calculatePosition('push', isRTL ? 'right' : 'left');
- }
- render() {
- const isRTL = document.dir === 'rtl';
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '32ed75d81dd09d9bc8999f6d42e5b3cb99c84d91', class: {
- [mode]: true,
- }, style: Object.assign(Object.assign(Object.assign(Object.assign({}, this.calculateOffset(isRTL)), this.calculatePull(isRTL)), this.calculatePush(isRTL)), this.calculateSize()) }, hAsync("slot", { key: '38f8d0440c20cc6d1b1d6a654d07f16de61d8134' })));
- }
- static get style() { return IonColStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-col",
- "$members$": {
- "offset": [1],
- "offsetXs": [1, "offset-xs"],
- "offsetSm": [1, "offset-sm"],
- "offsetMd": [1, "offset-md"],
- "offsetLg": [1, "offset-lg"],
- "offsetXl": [1, "offset-xl"],
- "pull": [1],
- "pullXs": [1, "pull-xs"],
- "pullSm": [1, "pull-sm"],
- "pullMd": [1, "pull-md"],
- "pullLg": [1, "pull-lg"],
- "pullXl": [1, "pull-xl"],
- "push": [1],
- "pushXs": [1, "push-xs"],
- "pushSm": [1, "push-sm"],
- "pushMd": [1, "push-md"],
- "pushLg": [1, "push-lg"],
- "pushXl": [1, "push-xl"],
- "size": [1],
- "sizeXs": [1, "size-xs"],
- "sizeSm": [1, "size-sm"],
- "sizeMd": [1, "size-md"],
- "sizeLg": [1, "size-lg"],
- "sizeXl": [1, "size-xl"]
- },
- "$listeners$": [[9, "resize", "onResize"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- /**
- * Returns `true` if the document or host element
- * has a `dir` set to `rtl`. The host value will always
- * take priority over the root document value.
- */
- const isRTL$1 = (hostEl) => {
- if (hostEl) {
- if (hostEl.dir !== '') {
- return hostEl.dir.toLowerCase() === 'rtl';
- }
- }
- return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';
- };
- const contentCss = ":host{--background:var(--ion-background-color, #fff);--color:var(--ion-text-color, #000);--padding-top:0px;--padding-bottom:0px;--padding-start:0px;--padding-end:0px;--keyboard-offset:0px;--offset-top:0px;--offset-bottom:0px;--overflow:auto;display:block;position:relative;-ms-flex:1;flex:1;width:100%;height:100%;margin:0 !important;padding:0 !important;font-family:var(--ion-font-family, inherit);contain:size style}:host(.ion-color) .inner-scroll{background:var(--ion-color-base);color:var(--ion-color-contrast)}#background-content{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);position:absolute;background:var(--background)}.inner-scroll{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:calc(var(--padding-top) + var(--offset-top));padding-bottom:calc(var(--padding-bottom) + var(--keyboard-offset) + var(--offset-bottom));position:absolute;color:var(--color);-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;-ms-touch-action:pan-x pan-y pinch-zoom;touch-action:pan-x pan-y pinch-zoom}.scroll-y,.scroll-x{-webkit-overflow-scrolling:touch;z-index:0;will-change:scroll-position}.scroll-y{overflow-y:var(--overflow);overscroll-behavior-y:contain}.scroll-x{overflow-x:var(--overflow);overscroll-behavior-x:contain}.overscroll::before,.overscroll::after{position:absolute;width:1px;height:1px;content:\"\"}.overscroll::before{bottom:-1px}.overscroll::after{top:-1px}:host(.content-sizing){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:0;contain:none}:host(.content-sizing) .inner-scroll{position:relative;top:0;bottom:0;margin-top:calc(var(--offset-top) * -1);margin-bottom:calc(var(--offset-bottom) * -1)}.transition-effect{display:none;position:absolute;width:100%;height:100vh;opacity:0;pointer-events:none}:host(.content-ltr) .transition-effect{left:-100%;}:host(.content-rtl) .transition-effect{right:-100%;}.transition-cover{position:absolute;right:0;width:100%;height:100%;background:black;opacity:0.1}.transition-shadow{display:block;position:absolute;width:100%;height:100%;-webkit-box-shadow:inset -9px 0 9px 0 rgba(0, 0, 100, 0.03);box-shadow:inset -9px 0 9px 0 rgba(0, 0, 100, 0.03)}:host(.content-ltr) .transition-shadow{right:0;}:host(.content-rtl) .transition-shadow{left:0;-webkit-transform:scaleX(-1);transform:scaleX(-1)}::slotted([slot=fixed]){position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0)}";
- var IonContentStyle0 = contentCss;
- /**
- * @slot - Content is placed in the scrollable area if provided without a slot.
- * @slot fixed - Should be used for fixed content that should not scroll.
- *
- * @part background - The background of the content.
- * @part scroll - The scrollable container of the content.
- */
- class Content {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionScrollStart = createEvent(this, "ionScrollStart", 7);
- this.ionScroll = createEvent(this, "ionScroll", 7);
- this.ionScrollEnd = createEvent(this, "ionScrollEnd", 7);
- this.watchDog = null;
- this.isScrolling = false;
- this.lastScroll = 0;
- this.queued = false;
- this.cTop = -1;
- this.cBottom = -1;
- this.isMainContent = true;
- this.resizeTimeout = null;
- this.inheritedAttributes = {};
- this.tabsElement = null;
- // Detail is used in a hot loop in the scroll event, by allocating it here
- // V8 will be able to inline any read/write to it since it's a monomorphic class.
- // https://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism.html
- this.detail = {
- scrollTop: 0,
- scrollLeft: 0,
- type: 'scroll',
- event: undefined,
- startX: 0,
- startY: 0,
- startTime: 0,
- currentX: 0,
- currentY: 0,
- velocityX: 0,
- velocityY: 0,
- deltaX: 0,
- deltaY: 0,
- currentTime: 0,
- data: undefined,
- isScrolling: true,
- };
- this.color = undefined;
- this.fullscreen = false;
- this.fixedSlotPlacement = 'after';
- this.forceOverscroll = undefined;
- this.scrollX = false;
- this.scrollY = true;
- this.scrollEvents = false;
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- }
- connectedCallback() {
- this.isMainContent = this.el.closest('ion-menu, ion-popover, ion-modal') === null;
- /**
- * The fullscreen content offsets need to be
- * computed after the tab bar has loaded. Since
- * lazy evaluation means components are not hydrated
- * at the same time, we need to wait for the ionTabBarLoaded
- * event to fire. This does not impact dist-custom-elements
- * because there is no hydration there.
- */
- if (hasLazyBuild(this.el)) {
- /**
- * We need to cache the reference to the tabs.
- * If just the content is unmounted then we won't
- * be able to query for the closest tabs on disconnectedCallback
- * since the content has been removed from the DOM tree.
- */
- const closestTabs = (this.tabsElement = this.el.closest('ion-tabs'));
- if (closestTabs !== null) {
- /**
- * When adding and removing the event listener
- * we need to make sure we pass the same function reference
- * otherwise the event listener will not be removed properly.
- * We can't only pass `this.resize` because "this" in the function
- * context becomes a reference to IonTabs instead of IonContent.
- *
- * Additionally, we listen for ionTabBarLoaded on the IonTabs
- * instance rather than the IonTabBar instance. It's possible for
- * a tab bar to be conditionally rendered/mounted. Since ionTabBarLoaded
- * bubbles, we can catch any instances of child tab bars loading by listening
- * on IonTabs.
- */
- this.tabsLoadCallback = () => this.resize();
- closestTabs.addEventListener('ionTabBarLoaded', this.tabsLoadCallback);
- }
- }
- }
- disconnectedCallback() {
- this.onScrollEnd();
- if (hasLazyBuild(this.el)) {
- /**
- * The event listener and tabs caches need to
- * be cleared otherwise this will create a memory
- * leak where the IonTabs instance can never be
- * garbage collected.
- */
- const { tabsElement, tabsLoadCallback } = this;
- if (tabsElement !== null && tabsLoadCallback !== undefined) {
- tabsElement.removeEventListener('ionTabBarLoaded', tabsLoadCallback);
- }
- this.tabsElement = null;
- this.tabsLoadCallback = undefined;
- }
- }
- /**
- * Rotating certain devices can update
- * the safe area insets. As a result,
- * the fullscreen feature on ion-content
- * needs to be recalculated.
- *
- * We listen for "resize" because we
- * do not care what the orientation of
- * the device is. Other APIs
- * such as ScreenOrientation or
- * the deviceorientation event must have
- * permission from the user first whereas
- * the "resize" event does not.
- *
- * We also throttle the callback to minimize
- * thrashing when quickly resizing a window.
- */
- onResize() {
- if (this.resizeTimeout) {
- clearTimeout(this.resizeTimeout);
- this.resizeTimeout = null;
- }
- this.resizeTimeout = setTimeout(() => {
- /**
- * Resize should only happen
- * if the content is visible.
- * When the content is hidden
- * then offsetParent will be null.
- */
- if (this.el.offsetParent === null) {
- return;
- }
- this.resize();
- }, 100);
- }
- shouldForceOverscroll() {
- const { forceOverscroll } = this;
- const mode = getIonMode$1(this);
- return forceOverscroll === undefined ? mode === 'ios' && isPlatform('ios') : forceOverscroll;
- }
- resize() {
- }
- readDimensions() {
- const page = getPageElement(this.el);
- const top = Math.max(this.el.offsetTop, 0);
- const bottom = Math.max(page.offsetHeight - top - this.el.offsetHeight, 0);
- const dirty = top !== this.cTop || bottom !== this.cBottom;
- if (dirty) {
- this.cTop = top;
- this.cBottom = bottom;
- }
- }
- onScroll(ev) {
- const timeStamp = Date.now();
- const shouldStart = !this.isScrolling;
- this.lastScroll = timeStamp;
- if (shouldStart) {
- this.onScrollStart();
- }
- if (!this.queued && this.scrollEvents) {
- this.queued = true;
- readTask((ts) => {
- this.queued = false;
- this.detail.event = ev;
- updateScrollDetail(this.detail, this.scrollEl, ts, shouldStart);
- this.ionScroll.emit(this.detail);
- });
- }
- }
- /**
- * Get the element where the actual scrolling takes place.
- * This element can be used to subscribe to `scroll` events or manually modify
- * `scrollTop`. However, it's recommended to use the API provided by `ion-content`:
- *
- * i.e. Using `ionScroll`, `ionScrollStart`, `ionScrollEnd` for scrolling events
- * and `scrollToPoint()` to scroll the content into a certain point.
- */
- async getScrollElement() {
- /**
- * If this gets called in certain early lifecycle hooks (ex: Vue onMounted),
- * scrollEl won't be defined yet with the custom elements build, so wait for it to load in.
- */
- if (!this.scrollEl) {
- await new Promise((resolve) => componentOnReady(this.el, resolve));
- }
- return Promise.resolve(this.scrollEl);
- }
- /**
- * Returns the background content element.
- * @internal
- */
- async getBackgroundElement() {
- if (!this.backgroundContentEl) {
- await new Promise((resolve) => componentOnReady(this.el, resolve));
- }
- return Promise.resolve(this.backgroundContentEl);
- }
- /**
- * Scroll to the top of the component.
- *
- * @param duration The amount of time to take scrolling to the top. Defaults to `0`.
- */
- scrollToTop(duration = 0) {
- return this.scrollToPoint(undefined, 0, duration);
- }
- /**
- * Scroll to the bottom of the component.
- *
- * @param duration The amount of time to take scrolling to the bottom. Defaults to `0`.
- */
- async scrollToBottom(duration = 0) {
- const scrollEl = await this.getScrollElement();
- const y = scrollEl.scrollHeight - scrollEl.clientHeight;
- return this.scrollToPoint(undefined, y, duration);
- }
- /**
- * Scroll by a specified X/Y distance in the component.
- *
- * @param x The amount to scroll by on the horizontal axis.
- * @param y The amount to scroll by on the vertical axis.
- * @param duration The amount of time to take scrolling by that amount.
- */
- async scrollByPoint(x, y, duration) {
- const scrollEl = await this.getScrollElement();
- return this.scrollToPoint(x + scrollEl.scrollLeft, y + scrollEl.scrollTop, duration);
- }
- /**
- * Scroll to a specified X/Y location in the component.
- *
- * @param x The point to scroll to on the horizontal axis.
- * @param y The point to scroll to on the vertical axis.
- * @param duration The amount of time to take scrolling to that point. Defaults to `0`.
- */
- async scrollToPoint(x, y, duration = 0) {
- const el = await this.getScrollElement();
- if (duration < 32) {
- if (y != null) {
- el.scrollTop = y;
- }
- if (x != null) {
- el.scrollLeft = x;
- }
- return;
- }
- let resolve;
- let startTime = 0;
- const promise = new Promise((r) => (resolve = r));
- const fromY = el.scrollTop;
- const fromX = el.scrollLeft;
- const deltaY = y != null ? y - fromY : 0;
- const deltaX = x != null ? x - fromX : 0;
- // scroll loop
- const step = (timeStamp) => {
- const linearTime = Math.min(1, (timeStamp - startTime) / duration) - 1;
- const easedT = Math.pow(linearTime, 3) + 1;
- if (deltaY !== 0) {
- el.scrollTop = Math.floor(easedT * deltaY + fromY);
- }
- if (deltaX !== 0) {
- el.scrollLeft = Math.floor(easedT * deltaX + fromX);
- }
- if (easedT < 1) {
- // do not use DomController here
- // must use nativeRaf in order to fire in the next frame
- requestAnimationFrame(step);
- }
- else {
- resolve();
- }
- };
- // chill out for a frame first
- requestAnimationFrame((ts) => {
- startTime = ts;
- step(ts);
- });
- return promise;
- }
- onScrollStart() {
- this.isScrolling = true;
- this.ionScrollStart.emit({
- isScrolling: true,
- });
- if (this.watchDog) {
- clearInterval(this.watchDog);
- }
- // watchdog
- this.watchDog = setInterval(() => {
- if (this.lastScroll < Date.now() - 120) {
- this.onScrollEnd();
- }
- }, 100);
- }
- onScrollEnd() {
- if (this.watchDog)
- clearInterval(this.watchDog);
- this.watchDog = null;
- if (this.isScrolling) {
- this.isScrolling = false;
- this.ionScrollEnd.emit({
- isScrolling: false,
- });
- }
- }
- render() {
- const { fixedSlotPlacement, inheritedAttributes, isMainContent, scrollX, scrollY, el } = this;
- const rtl = isRTL$1(el) ? 'rtl' : 'ltr';
- const mode = getIonMode$1(this);
- const forceOverscroll = this.shouldForceOverscroll();
- const transitionShadow = mode === 'ios';
- this.resize();
- return (hAsync(Host, Object.assign({ key: 'f2a24aa66dbf5c76f9d4b06f708eb73cadc239df', role: isMainContent ? 'main' : undefined, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'content-sizing': hostContext('ion-popover', this.el),
- overscroll: forceOverscroll,
- [`content-${rtl}`]: true,
- }), style: {
- '--offset-top': `${this.cTop}px`,
- '--offset-bottom': `${this.cBottom}px`,
- } }, inheritedAttributes), hAsync("div", { key: '6480ca7648b278abb36477b3838bccbcd4995e2a', ref: (el) => (this.backgroundContentEl = el), id: "background-content", part: "background" }), fixedSlotPlacement === 'before' ? hAsync("slot", { name: "fixed" }) : null, hAsync("div", { key: '29a23b663f5f0215bb000820c01e1814c0d55985', class: {
- 'inner-scroll': true,
- 'scroll-x': scrollX,
- 'scroll-y': scrollY,
- overscroll: (scrollX || scrollY) && forceOverscroll,
- }, ref: (scrollEl) => (this.scrollEl = scrollEl), onScroll: this.scrollEvents ? (ev) => this.onScroll(ev) : undefined, part: "scroll" }, hAsync("slot", { key: '0fe1bd05609a4b88ae2ce9addf5d5dc5dc1806f0' })), transitionShadow ? (hAsync("div", { class: "transition-effect" }, hAsync("div", { class: "transition-cover" }), hAsync("div", { class: "transition-shadow" }))) : null, fixedSlotPlacement === 'after' ? hAsync("slot", { name: "fixed" }) : null));
- }
- get el() { return getElement(this); }
- static get style() { return IonContentStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-content",
- "$members$": {
- "color": [513],
- "fullscreen": [4],
- "fixedSlotPlacement": [1, "fixed-slot-placement"],
- "forceOverscroll": [1028, "force-overscroll"],
- "scrollX": [4, "scroll-x"],
- "scrollY": [4, "scroll-y"],
- "scrollEvents": [4, "scroll-events"],
- "getScrollElement": [64],
- "getBackgroundElement": [64],
- "scrollToTop": [64],
- "scrollToBottom": [64],
- "scrollByPoint": [64],
- "scrollToPoint": [64]
- },
- "$listeners$": [[9, "resize", "onResize"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const getParentElement = (el) => {
- var _a;
- if (el.parentElement) {
- // normal element with a parent element
- return el.parentElement;
- }
- if ((_a = el.parentNode) === null || _a === void 0 ? void 0 : _a.host) {
- // shadow dom's document fragment
- return el.parentNode.host;
- }
- return null;
- };
- const getPageElement = (el) => {
- const tabs = el.closest('ion-tabs');
- if (tabs) {
- return tabs;
- }
- /**
- * If we're in a popover, we need to use its wrapper so we can account for space
- * between the popover and the edges of the screen. But if the popover contains
- * its own page element, we should use that instead.
- */
- const page = el.closest('ion-app, ion-page, .ion-page, page-inner, .popover-content');
- if (page) {
- return page;
- }
- return getParentElement(el);
- };
- // ******** DOM READ ****************
- const updateScrollDetail = (detail, el, timestamp, shouldStart) => {
- const prevX = detail.currentX;
- const prevY = detail.currentY;
- const prevT = detail.currentTime;
- const currentX = el.scrollLeft;
- const currentY = el.scrollTop;
- const timeDelta = timestamp - prevT;
- if (shouldStart) {
- // remember the start positions
- detail.startTime = timestamp;
- detail.startX = currentX;
- detail.startY = currentY;
- detail.velocityX = detail.velocityY = 0;
- }
- detail.currentTime = timestamp;
- detail.currentX = detail.scrollLeft = currentX;
- detail.currentY = detail.scrollTop = currentY;
- detail.deltaX = currentX - detail.startX;
- detail.deltaY = currentY - detail.startY;
- if (timeDelta > 0 && timeDelta < 100) {
- const velocityX = (currentX - prevX) / timeDelta;
- const velocityY = (currentY - prevY) / timeDelta;
- detail.velocityX = velocityX * 0.7 + detail.velocityX * 0.3;
- detail.velocityY = velocityY * 0.7 + detail.velocityY * 0.3;
- }
- };
- const ION_FOCUSED = 'ion-focused';
- const ION_FOCUSABLE = 'ion-focusable';
- const FOCUS_KEYS = [
- 'Tab',
- 'ArrowDown',
- 'Space',
- 'Escape',
- ' ',
- 'Shift',
- 'Enter',
- 'ArrowLeft',
- 'ArrowRight',
- 'ArrowUp',
- 'Home',
- 'End',
- ];
- const startFocusVisible = (rootEl) => {
- let currentFocus = [];
- let keyboardMode = true;
- const ref = rootEl ? rootEl.shadowRoot : document;
- const root = rootEl ? rootEl : document.body;
- const setFocus = (elements) => {
- currentFocus.forEach((el) => el.classList.remove(ION_FOCUSED));
- elements.forEach((el) => el.classList.add(ION_FOCUSED));
- currentFocus = elements;
- };
- const pointerDown = () => {
- keyboardMode = false;
- setFocus([]);
- };
- const onKeydown = (ev) => {
- keyboardMode = FOCUS_KEYS.includes(ev.key);
- if (!keyboardMode) {
- setFocus([]);
- }
- };
- const onFocusin = (ev) => {
- if (keyboardMode && ev.composedPath !== undefined) {
- const toFocus = ev.composedPath().filter((el) => {
- // TODO(FW-2832): type
- if (el.classList) {
- return el.classList.contains(ION_FOCUSABLE);
- }
- return false;
- });
- setFocus(toFocus);
- }
- };
- const onFocusout = () => {
- if (ref.activeElement === root) {
- setFocus([]);
- }
- };
- ref.addEventListener('keydown', onKeydown);
- ref.addEventListener('focusin', onFocusin);
- ref.addEventListener('focusout', onFocusout);
- ref.addEventListener('touchstart', pointerDown, { passive: true });
- ref.addEventListener('mousedown', pointerDown);
- const destroy = () => {
- ref.removeEventListener('keydown', onKeydown);
- ref.removeEventListener('focusin', onFocusin);
- ref.removeEventListener('focusout', onFocusout);
- ref.removeEventListener('touchstart', pointerDown);
- ref.removeEventListener('mousedown', pointerDown);
- };
- return {
- destroy,
- setFocus,
- };
- };
- /**
- * Returns true if the selected day is equal to the reference day
- */
- const isSameDay = (baseParts, compareParts) => {
- return (baseParts.month === compareParts.month && baseParts.day === compareParts.day && baseParts.year === compareParts.year);
- };
- /**
- * Returns true is the selected day is before the reference day.
- */
- const isBefore = (baseParts, compareParts) => {
- return !!(baseParts.year < compareParts.year ||
- (baseParts.year === compareParts.year && baseParts.month < compareParts.month) ||
- (baseParts.year === compareParts.year &&
- baseParts.month === compareParts.month &&
- baseParts.day !== null &&
- baseParts.day < compareParts.day));
- };
- /**
- * Returns true is the selected day is after the reference day.
- */
- const isAfter = (baseParts, compareParts) => {
- return !!(baseParts.year > compareParts.year ||
- (baseParts.year === compareParts.year && baseParts.month > compareParts.month) ||
- (baseParts.year === compareParts.year &&
- baseParts.month === compareParts.month &&
- baseParts.day !== null &&
- baseParts.day > compareParts.day));
- };
- const warnIfValueOutOfBounds = (value, min, max) => {
- const valueArray = Array.isArray(value) ? value : [value];
- for (const val of valueArray) {
- if ((min !== undefined && isBefore(val, min)) || (max !== undefined && isAfter(val, max))) {
- printIonWarning('[ion-datetime] - The value provided to ion-datetime is out of bounds.\n\n' +
- `Min: ${JSON.stringify(min)}\n` +
- `Max: ${JSON.stringify(max)}\n` +
- `Value: ${JSON.stringify(value)}`);
- break;
- }
- }
- };
- /**
- * Determines if given year is a
- * leap year. Returns `true` if year
- * is a leap year. Returns `false`
- * otherwise.
- */
- const isLeapYear = (year) => {
- return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
- };
- /**
- * Determines the hour cycle for a user.
- * If the hour cycle is explicitly defined, just use that.
- * Otherwise, we try to derive it from either the specified
- * locale extension tags or from Intl.DateTimeFormat directly.
- */
- const getHourCycle = (locale, hourCycle) => {
- /**
- * If developer has explicitly enabled 24-hour time
- * then return early and do not look at the system default.
- */
- if (hourCycle !== undefined) {
- return hourCycle;
- }
- /**
- * If hourCycle was not specified, check the locale
- * that is set on the user's device. We first check the
- * Intl.DateTimeFormat hourCycle option as developers can encode this
- * option into the locale string. Example: `en-US-u-hc-h23`
- */
- const formatted = new Intl.DateTimeFormat(locale, { hour: 'numeric' });
- const options = formatted.resolvedOptions();
- if (options.hourCycle !== undefined) {
- return options.hourCycle;
- }
- /**
- * If hourCycle is not specified (either through lack
- * of browser support or locale information) then fall
- * back to this slower hourCycle check.
- */
- const date = new Date('5/18/2021 00:00');
- const parts = formatted.formatToParts(date);
- const hour = parts.find((p) => p.type === 'hour');
- if (!hour) {
- throw new Error('Hour value not found from DateTimeFormat');
- }
- /**
- * Midnight for h11 starts at 0:00am
- * Midnight for h12 starts at 12:00am
- * Midnight for h23 starts at 00:00
- * Midnight for h24 starts at 24:00
- */
- switch (hour.value) {
- case '0':
- return 'h11';
- case '12':
- return 'h12';
- case '00':
- return 'h23';
- case '24':
- return 'h24';
- default:
- throw new Error(`Invalid hour cycle "${hourCycle}"`);
- }
- };
- /**
- * Determine if the hour cycle uses a 24-hour format.
- * Returns true for h23 and h24. Returns false otherwise.
- * If you don't know the hourCycle, use getHourCycle above
- * and pass the result into this function.
- */
- const is24Hour = (hourCycle) => {
- return hourCycle === 'h23' || hourCycle === 'h24';
- };
- /**
- * Given a date object, returns the number
- * of days in that month.
- * Month value begin at 1, not 0.
- * i.e. January = month 1.
- */
- const getNumDaysInMonth = (month, year) => {
- return month === 4 || month === 6 || month === 9 || month === 11
- ? 30
- : month === 2
- ? isLeapYear(year)
- ? 29
- : 28
- : 31;
- };
- /**
- * Certain locales display month then year while
- * others display year then month.
- * We can use Intl.DateTimeFormat to determine
- * the ordering for each locale.
- * The formatOptions param can be used to customize
- * which pieces of a date to compare against the month
- * with. For example, some locales render dd/mm/yyyy
- * while others render mm/dd/yyyy. This function can be
- * used for variations of the same "month first" check.
- */
- const isMonthFirstLocale = (locale, formatOptions = {
- month: 'numeric',
- year: 'numeric',
- }) => {
- /**
- * By setting month and year we guarantee that only
- * month, year, and literal (slashes '/', for example)
- * values are included in the formatToParts results.
- *
- * The ordering of the parts will be determined by
- * the locale. So if the month is the first value,
- * then we know month should be shown first. If the
- * year is the first value, then we know year should be shown first.
- *
- * This ordering can be controlled by customizing the locale property.
- */
- const parts = new Intl.DateTimeFormat(locale, formatOptions).formatToParts(new Date());
- return parts[0].type === 'month';
- };
- /**
- * Determines if the given locale formats the day period (am/pm) to the
- * left or right of the hour.
- * @param locale The locale to check.
- * @returns `true` if the locale formats the day period to the left of the hour.
- */
- const isLocaleDayPeriodRTL = (locale) => {
- const parts = new Intl.DateTimeFormat(locale, { hour: 'numeric' }).formatToParts(new Date());
- return parts[0].type === 'dayPeriod';
- };
- const ISO_8601_REGEXP =
- // eslint-disable-next-line no-useless-escape
- /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
- // eslint-disable-next-line no-useless-escape
- const TIME_REGEXP = /^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
- /**
- * Use to convert a string of comma separated numbers or
- * an array of numbers, and clean up any user input
- */
- const convertToArrayOfNumbers = (input) => {
- if (input === undefined) {
- return;
- }
- let processedInput = input;
- if (typeof input === 'string') {
- // convert the string to an array of strings
- // auto remove any whitespace and [] characters
- processedInput = input.replace(/\[|\]|\s/g, '').split(',');
- }
- let values;
- if (Array.isArray(processedInput)) {
- // ensure each value is an actual number in the returned array
- values = processedInput.map((num) => parseInt(num, 10)).filter(isFinite);
- }
- else {
- values = [processedInput];
- }
- return values;
- };
- /**
- * Extracts date information
- * from a .calendar-day element
- * into DatetimeParts.
- */
- const getPartsFromCalendarDay = (el) => {
- return {
- month: parseInt(el.getAttribute('data-month'), 10),
- day: parseInt(el.getAttribute('data-day'), 10),
- year: parseInt(el.getAttribute('data-year'), 10),
- dayOfWeek: parseInt(el.getAttribute('data-day-of-week'), 10),
- };
- };
- function parseDate(val) {
- if (Array.isArray(val)) {
- const parsedArray = [];
- for (const valStr of val) {
- const parsedVal = parseDate(valStr);
- /**
- * If any of the values weren't parsed correctly, consider
- * the entire batch incorrect. This simplifies the type
- * signatures by having "undefined" be a general error case
- * instead of returning (Datetime | undefined)[], which is
- * harder for TS to perform type narrowing on.
- */
- if (!parsedVal) {
- return undefined;
- }
- parsedArray.push(parsedVal);
- }
- return parsedArray;
- }
- // manually parse IS0 cuz Date.parse cannot be trusted
- // ISO 8601 format: 1994-12-15T13:47:20Z
- let parse = null;
- if (val != null && val !== '') {
- // try parsing for just time first, HH:MM
- parse = TIME_REGEXP.exec(val);
- if (parse) {
- // adjust the array so it fits nicely with the datetime parse
- parse.unshift(undefined, undefined);
- parse[2] = parse[3] = undefined;
- }
- else {
- // try parsing for full ISO datetime
- parse = ISO_8601_REGEXP.exec(val);
- }
- }
- if (parse === null) {
- // wasn't able to parse the ISO datetime
- printIonWarning(`[ion-datetime] - Unable to parse date string: ${val}. Please provide a valid ISO 8601 datetime string.`);
- return undefined;
- }
- // ensure all the parse values exist with at least 0
- for (let i = 1; i < 8; i++) {
- parse[i] = parse[i] !== undefined ? parseInt(parse[i], 10) : undefined;
- }
- // can also get second and millisecond from parse[6] and parse[7] if needed
- return {
- year: parse[1],
- month: parse[2],
- day: parse[3],
- hour: parse[4],
- minute: parse[5],
- ampm: parse[4] < 12 ? 'am' : 'pm',
- };
- }
- const clampDate = (dateParts, minParts, maxParts) => {
- if (minParts && isBefore(dateParts, minParts)) {
- return minParts;
- }
- else if (maxParts && isAfter(dateParts, maxParts)) {
- return maxParts;
- }
- return dateParts;
- };
- /**
- * Parses an hour and returns if the value is in the morning (am) or afternoon (pm).
- * @param hour The hour to format, should be 0-23
- * @returns `pm` if the hour is greater than or equal to 12, `am` if less than 12.
- */
- const parseAmPm = (hour) => {
- return hour >= 12 ? 'pm' : 'am';
- };
- /**
- * Takes a max date string and creates a DatetimeParts
- * object, filling in any missing information.
- * For example, max="2012" would fill in the missing
- * month, day, hour, and minute information.
- */
- const parseMaxParts = (max, todayParts) => {
- const result = parseDate(max);
- /**
- * If min was not a valid date then return undefined.
- */
- if (result === undefined) {
- return;
- }
- const { month, day, year, hour, minute } = result;
- /**
- * When passing in `max` or `min`, developers
- * can pass in any ISO-8601 string. This means
- * that not all of the date/time fields are defined.
- * For example, passing max="2012" is valid even though
- * there is no month, day, hour, or minute data.
- * However, all of this data is required when clamping the date
- * so that the correct initial value can be selected. As a result,
- * we need to fill in any omitted data with the min or max values.
- */
- const yearValue = year !== null && year !== void 0 ? year : todayParts.year;
- const monthValue = month !== null && month !== void 0 ? month : 12;
- return {
- month: monthValue,
- day: day !== null && day !== void 0 ? day : getNumDaysInMonth(monthValue, yearValue),
- /**
- * Passing in "HH:mm" is a valid ISO-8601
- * string, so we just default to the current year
- * in this case.
- */
- year: yearValue,
- hour: hour !== null && hour !== void 0 ? hour : 23,
- minute: minute !== null && minute !== void 0 ? minute : 59,
- };
- };
- /**
- * Takes a min date string and creates a DatetimeParts
- * object, filling in any missing information.
- * For example, min="2012" would fill in the missing
- * month, day, hour, and minute information.
- */
- const parseMinParts = (min, todayParts) => {
- const result = parseDate(min);
- /**
- * If min was not a valid date then return undefined.
- */
- if (result === undefined) {
- return;
- }
- const { month, day, year, hour, minute } = result;
- /**
- * When passing in `max` or `min`, developers
- * can pass in any ISO-8601 string. This means
- * that not all of the date/time fields are defined.
- * For example, passing max="2012" is valid even though
- * there is no month, day, hour, or minute data.
- * However, all of this data is required when clamping the date
- * so that the correct initial value can be selected. As a result,
- * we need to fill in any omitted data with the min or max values.
- */
- return {
- month: month !== null && month !== void 0 ? month : 1,
- day: day !== null && day !== void 0 ? day : 1,
- /**
- * Passing in "HH:mm" is a valid ISO-8601
- * string, so we just default to the current year
- * in this case.
- */
- year: year !== null && year !== void 0 ? year : todayParts.year,
- hour: hour !== null && hour !== void 0 ? hour : 0,
- minute: minute !== null && minute !== void 0 ? minute : 0,
- };
- };
- const twoDigit = (val) => {
- return ('0' + (val !== undefined ? Math.abs(val) : '0')).slice(-2);
- };
- const fourDigit = (val) => {
- return ('000' + (val !== undefined ? Math.abs(val) : '0')).slice(-4);
- };
- function convertDataToISO(data) {
- if (Array.isArray(data)) {
- return data.map((parts) => convertDataToISO(parts));
- }
- // https://www.w3.org/TR/NOTE-datetime
- let rtn = '';
- if (data.year !== undefined) {
- // YYYY
- rtn = fourDigit(data.year);
- if (data.month !== undefined) {
- // YYYY-MM
- rtn += '-' + twoDigit(data.month);
- if (data.day !== undefined) {
- // YYYY-MM-DD
- rtn += '-' + twoDigit(data.day);
- if (data.hour !== undefined) {
- // YYYY-MM-DDTHH:mm:SS
- rtn += `T${twoDigit(data.hour)}:${twoDigit(data.minute)}:00`;
- }
- }
- }
- }
- else if (data.hour !== undefined) {
- // HH:mm
- rtn = twoDigit(data.hour) + ':' + twoDigit(data.minute);
- }
- return rtn;
- }
- /**
- * Converts an 12 hour value to 24 hours.
- */
- const convert12HourTo24Hour = (hour, ampm) => {
- if (ampm === undefined) {
- return hour;
- }
- /**
- * If AM and 12am
- * then return 00:00.
- * Otherwise just return
- * the hour since it is
- * already in 24 hour format.
- */
- if (ampm === 'am') {
- if (hour === 12) {
- return 0;
- }
- return hour;
- }
- /**
- * If PM and 12pm
- * just return 12:00
- * since it is already
- * in 24 hour format.
- * Otherwise add 12 hours
- * to the time.
- */
- if (hour === 12) {
- return 12;
- }
- return hour + 12;
- };
- const getStartOfWeek = (refParts) => {
- const { dayOfWeek } = refParts;
- if (dayOfWeek === null || dayOfWeek === undefined) {
- throw new Error('No day of week provided');
- }
- return subtractDays(refParts, dayOfWeek);
- };
- const getEndOfWeek = (refParts) => {
- const { dayOfWeek } = refParts;
- if (dayOfWeek === null || dayOfWeek === undefined) {
- throw new Error('No day of week provided');
- }
- return addDays(refParts, 6 - dayOfWeek);
- };
- const getNextDay = (refParts) => {
- return addDays(refParts, 1);
- };
- const getPreviousDay = (refParts) => {
- return subtractDays(refParts, 1);
- };
- const getPreviousWeek = (refParts) => {
- return subtractDays(refParts, 7);
- };
- const getNextWeek = (refParts) => {
- return addDays(refParts, 7);
- };
- /**
- * Given datetime parts, subtract
- * numDays from the date.
- * Returns a new DatetimeParts object
- * Currently can only go backward at most 1 month.
- */
- const subtractDays = (refParts, numDays) => {
- const { month, day, year } = refParts;
- if (day === null) {
- throw new Error('No day provided');
- }
- const workingParts = {
- month,
- day,
- year,
- };
- workingParts.day = day - numDays;
- /**
- * If wrapping to previous month
- * update days and decrement month
- */
- if (workingParts.day < 1) {
- workingParts.month -= 1;
- }
- /**
- * If moving to previous year, reset
- * month to December and decrement year
- */
- if (workingParts.month < 1) {
- workingParts.month = 12;
- workingParts.year -= 1;
- }
- /**
- * Determine how many days are in the current
- * month
- */
- if (workingParts.day < 1) {
- const daysInMonth = getNumDaysInMonth(workingParts.month, workingParts.year);
- /**
- * Take num days in month and add the
- * number of underflow days. This number will
- * be negative.
- * Example: 1 week before Jan 2, 2021 is
- * December 26, 2021 so:
- * 2 - 7 = -5
- * 31 + (-5) = 26
- */
- workingParts.day = daysInMonth + workingParts.day;
- }
- return workingParts;
- };
- /**
- * Given datetime parts, add
- * numDays to the date.
- * Returns a new DatetimeParts object
- * Currently can only go forward at most 1 month.
- */
- const addDays = (refParts, numDays) => {
- const { month, day, year } = refParts;
- if (day === null) {
- throw new Error('No day provided');
- }
- const workingParts = {
- month,
- day,
- year,
- };
- const daysInMonth = getNumDaysInMonth(month, year);
- workingParts.day = day + numDays;
- /**
- * If wrapping to next month
- * update days and increment month
- */
- if (workingParts.day > daysInMonth) {
- workingParts.day -= daysInMonth;
- workingParts.month += 1;
- }
- /**
- * If moving to next year, reset
- * month to January and increment year
- */
- if (workingParts.month > 12) {
- workingParts.month = 1;
- workingParts.year += 1;
- }
- return workingParts;
- };
- /**
- * Given DatetimeParts, generate the previous month.
- */
- const getPreviousMonth = (refParts) => {
- /**
- * If current month is January, wrap backwards
- * to December of the previous year.
- */
- const month = refParts.month === 1 ? 12 : refParts.month - 1;
- const year = refParts.month === 1 ? refParts.year - 1 : refParts.year;
- const numDaysInMonth = getNumDaysInMonth(month, year);
- const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
- return { month, year, day };
- };
- /**
- * Given DatetimeParts, generate the next month.
- */
- const getNextMonth = (refParts) => {
- /**
- * If current month is December, wrap forwards
- * to January of the next year.
- */
- const month = refParts.month === 12 ? 1 : refParts.month + 1;
- const year = refParts.month === 12 ? refParts.year + 1 : refParts.year;
- const numDaysInMonth = getNumDaysInMonth(month, year);
- const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
- return { month, year, day };
- };
- const changeYear = (refParts, yearDelta) => {
- const month = refParts.month;
- const year = refParts.year + yearDelta;
- const numDaysInMonth = getNumDaysInMonth(month, year);
- const day = numDaysInMonth < refParts.day ? numDaysInMonth : refParts.day;
- return { month, year, day };
- };
- /**
- * Given DatetimeParts, generate the previous year.
- */
- const getPreviousYear = (refParts) => {
- return changeYear(refParts, -1);
- };
- /**
- * Given DatetimeParts, generate the next year.
- */
- const getNextYear = (refParts) => {
- return changeYear(refParts, 1);
- };
- /**
- * If PM, then internal value should
- * be converted to 24-hr time.
- * Does not apply when public
- * values are already 24-hr time.
- */
- const getInternalHourValue = (hour, use24Hour, ampm) => {
- if (use24Hour) {
- return hour;
- }
- return convert12HourTo24Hour(hour, ampm);
- };
- /**
- * Unless otherwise stated, all month values are
- * 1 indexed instead of the typical 0 index in JS Date.
- * Example:
- * January = Month 0 when using JS Date
- * January = Month 1 when using this datetime util
- */
- /**
- * Given the current datetime parts and a new AM/PM value
- * calculate what the hour should be in 24-hour time format.
- * Used when toggling the AM/PM segment since we store our hours
- * in 24-hour time format internally.
- */
- const calculateHourFromAMPM = (currentParts, newAMPM) => {
- const { ampm: currentAMPM, hour } = currentParts;
- let newHour = hour;
- /**
- * If going from AM --> PM, need to update the
- *
- */
- if (currentAMPM === 'am' && newAMPM === 'pm') {
- newHour = convert12HourTo24Hour(newHour, 'pm');
- /**
- * If going from PM --> AM
- */
- }
- else if (currentAMPM === 'pm' && newAMPM === 'am') {
- newHour = Math.abs(newHour - 12);
- }
- return newHour;
- };
- /**
- * Updates parts to ensure that month and day
- * values are valid. For days that do not exist,
- * or are outside the min/max bounds, the closest
- * valid day is used.
- */
- const validateParts = (parts, minParts, maxParts) => {
- const { month, day, year } = parts;
- const partsCopy = clampDate(Object.assign({}, parts), minParts, maxParts);
- const numDays = getNumDaysInMonth(month, year);
- /**
- * If the max number of days
- * is greater than the day we want
- * to set, update the DatetimeParts
- * day field to be the max days.
- */
- if (day !== null && numDays < day) {
- partsCopy.day = numDays;
- }
- /**
- * If value is same day as min day,
- * make sure the time value is in bounds.
- */
- if (minParts !== undefined && isSameDay(partsCopy, minParts)) {
- /**
- * If the hour is out of bounds,
- * update both the hour and minute.
- * This is done so that the new time
- * is closest to what the user selected.
- */
- if (partsCopy.hour !== undefined && minParts.hour !== undefined) {
- if (partsCopy.hour < minParts.hour) {
- partsCopy.hour = minParts.hour;
- partsCopy.minute = minParts.minute;
- /**
- * If only the minute is out of bounds,
- * set it to the min minute.
- */
- }
- else if (partsCopy.hour === minParts.hour &&
- partsCopy.minute !== undefined &&
- minParts.minute !== undefined &&
- partsCopy.minute < minParts.minute) {
- partsCopy.minute = minParts.minute;
- }
- }
- }
- /**
- * If value is same day as max day,
- * make sure the time value is in bounds.
- */
- if (maxParts !== undefined && isSameDay(parts, maxParts)) {
- /**
- * If the hour is out of bounds,
- * update both the hour and minute.
- * This is done so that the new time
- * is closest to what the user selected.
- */
- if (partsCopy.hour !== undefined && maxParts.hour !== undefined) {
- if (partsCopy.hour > maxParts.hour) {
- partsCopy.hour = maxParts.hour;
- partsCopy.minute = maxParts.minute;
- /**
- * If only the minute is out of bounds,
- * set it to the max minute.
- */
- }
- else if (partsCopy.hour === maxParts.hour &&
- partsCopy.minute !== undefined &&
- maxParts.minute !== undefined &&
- partsCopy.minute > maxParts.minute) {
- partsCopy.minute = maxParts.minute;
- }
- }
- }
- return partsCopy;
- };
- /**
- * Returns the closest date to refParts
- * that also meets the constraints of
- * the *Values params.
- */
- const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
- const { hour, minute, day, month, year } = refParts;
- const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
- if (yearValues !== undefined) {
- // Filters out years that are out of the min/max bounds
- const filteredYears = yearValues.filter((year) => {
- if (minParts !== undefined && year < minParts.year) {
- return false;
- }
- if (maxParts !== undefined && year > maxParts.year) {
- return false;
- }
- return true;
- });
- copyParts.year = findClosestValue(year, filteredYears);
- }
- if (monthValues !== undefined) {
- // Filters out months that are out of the min/max bounds
- const filteredMonths = monthValues.filter((month) => {
- if (minParts !== undefined && copyParts.year === minParts.year && month < minParts.month) {
- return false;
- }
- if (maxParts !== undefined && copyParts.year === maxParts.year && month > maxParts.month) {
- return false;
- }
- return true;
- });
- copyParts.month = findClosestValue(month, filteredMonths);
- }
- // Day is nullable but cannot be undefined
- if (day !== null && dayValues !== undefined) {
- // Filters out days that are out of the min/max bounds
- const filteredDays = dayValues.filter((day) => {
- if (minParts !== undefined && isBefore(Object.assign(Object.assign({}, copyParts), { day }), minParts)) {
- return false;
- }
- if (maxParts !== undefined && isAfter(Object.assign(Object.assign({}, copyParts), { day }), maxParts)) {
- return false;
- }
- return true;
- });
- copyParts.day = findClosestValue(day, filteredDays);
- }
- if (hour !== undefined && hourValues !== undefined) {
- // Filters out hours that are out of the min/max bounds
- const filteredHours = hourValues.filter((hour) => {
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.hour) !== undefined && isSameDay(copyParts, minParts) && hour < minParts.hour) {
- return false;
- }
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.hour) !== undefined && isSameDay(copyParts, maxParts) && hour > maxParts.hour) {
- return false;
- }
- return true;
- });
- copyParts.hour = findClosestValue(hour, filteredHours);
- copyParts.ampm = parseAmPm(copyParts.hour);
- }
- if (minute !== undefined && minuteValues !== undefined) {
- // Filters out minutes that are out of the min/max bounds
- const filteredMinutes = minuteValues.filter((minute) => {
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.minute) !== undefined &&
- isSameDay(copyParts, minParts) &&
- copyParts.hour === minParts.hour &&
- minute < minParts.minute) {
- return false;
- }
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.minute) !== undefined &&
- isSameDay(copyParts, maxParts) &&
- copyParts.hour === maxParts.hour &&
- minute > maxParts.minute) {
- return false;
- }
- return true;
- });
- copyParts.minute = findClosestValue(minute, filteredMinutes);
- }
- return copyParts;
- };
- /**
- * Finds the value in "values" that is
- * numerically closest to "reference".
- * This function assumes that "values" is
- * already sorted in ascending order.
- * @param reference The reference number to use
- * when finding the closest value
- * @param values The allowed values that will be
- * searched to find the closest value to "reference"
- */
- const findClosestValue = (reference, values) => {
- let closestValue = values[0];
- let rank = Math.abs(closestValue - reference);
- for (let i = 1; i < values.length; i++) {
- const value = values[i];
- /**
- * This code prioritizes the first
- * closest result. Given two values
- * with the same distance from reference,
- * this code will prioritize the smaller of
- * the two values.
- */
- const valueRank = Math.abs(value - reference);
- if (valueRank < rank) {
- closestValue = value;
- rank = valueRank;
- }
- }
- return closestValue;
- };
- const getFormattedDayPeriod = (dayPeriod) => {
- if (dayPeriod === undefined) {
- return '';
- }
- return dayPeriod.toUpperCase();
- };
- /**
- * Including time zone options may lead to the rendered text showing a
- * different time from what was selected in the Datetime, which could cause
- * confusion.
- */
- const stripTimeZone = (formatOptions) => {
- return Object.assign(Object.assign({}, formatOptions), {
- /**
- * Setting the time zone to UTC ensures that the value shown is always the
- * same as what was selected and safeguards against older Safari bugs with
- * Intl.DateTimeFormat.
- */
- timeZone: 'UTC',
- /**
- * We do not want to display the time zone name
- */
- timeZoneName: undefined });
- };
- const getLocalizedTime = (locale, refParts, hourCycle, formatOptions = { hour: 'numeric', minute: 'numeric' }) => {
- const timeParts = {
- hour: refParts.hour,
- minute: refParts.minute,
- };
- if (timeParts.hour === undefined || timeParts.minute === undefined) {
- return 'Invalid Time';
- }
- return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, stripTimeZone(formatOptions)), {
- /**
- * We use hourCycle here instead of hour12 due to:
- * https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
- */
- hourCycle })).format(new Date(convertDataToISO(Object.assign({
- /**
- * JS uses a simplified ISO 8601 format which allows for
- * date-only formats and date-time formats, but not
- * time-only formats: https://tc39.es/ecma262/#sec-date-time-string-format
- * As a result, developers who only pass a time will get
- * an "Invalid Date" error. To account for this, we make sure that
- * year/day/month values are set when passing to new Date().
- * The Intl.DateTimeFormat call above only uses the hour/minute
- * values, so passing these date values should have no impact
- * on the time output.
- */
- year: 2023, day: 1, month: 1 }, timeParts)) + 'Z'));
- };
- /**
- * Adds padding to a time value so
- * that it is always 2 digits.
- */
- const addTimePadding = (value) => {
- const valueToString = value.toString();
- if (valueToString.length > 1) {
- return valueToString;
- }
- return `0${valueToString}`;
- };
- /**
- * Formats 24 hour times so that
- * it always has 2 digits. For
- * 12 hour times it ensures that
- * hour 0 is formatted as '12'.
- */
- const getFormattedHour = (hour, hourCycle) => {
- /**
- * Midnight for h11 starts at 0:00am
- * Midnight for h12 starts at 12:00am
- * Midnight for h23 starts at 00:00
- * Midnight for h24 starts at 24:00
- */
- if (hour === 0) {
- switch (hourCycle) {
- case 'h11':
- return '0';
- case 'h12':
- return '12';
- case 'h23':
- return '00';
- case 'h24':
- return '24';
- default:
- throw new Error(`Invalid hour cycle "${hourCycle}"`);
- }
- }
- const use24Hour = is24Hour(hourCycle);
- /**
- * h23 and h24 use 24 hour times.
- */
- if (use24Hour) {
- return addTimePadding(hour);
- }
- return hour.toString();
- };
- /**
- * Generates an aria-label to be read by screen readers
- * given a local, a date, and whether or not that date is
- * today's date.
- */
- const generateDayAriaLabel = (locale, today, refParts) => {
- if (refParts.day === null) {
- return null;
- }
- /**
- * MM/DD/YYYY will return midnight in the user's timezone.
- */
- const date = getNormalizedDate(refParts);
- const labelString = new Intl.DateTimeFormat(locale, {
- weekday: 'long',
- month: 'long',
- day: 'numeric',
- timeZone: 'UTC',
- }).format(date);
- /**
- * If date is today, prepend "Today" so screen readers indicate
- * that the date is today.
- */
- return today ? `Today, ${labelString}` : labelString;
- };
- /**
- * Given a locale and a date object,
- * return a formatted string that includes
- * the month name and full year.
- * Example: May 2021
- */
- const getMonthAndYear = (locale, refParts) => {
- const date = getNormalizedDate(refParts);
- return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(date);
- };
- /**
- * Given a locale and a date object,
- * return a formatted string that includes
- * the numeric day.
- * Note: Some languages will add literal characters
- * to the end. This function removes those literals.
- * Example: 29
- */
- const getDay = (locale, refParts) => {
- return getLocalizedDateTimeParts(locale, refParts, { day: 'numeric' }).find((obj) => obj.type === 'day').value;
- };
- /**
- * Given a locale and a date object,
- * return a formatted string that includes
- * the numeric year.
- * Example: 2022
- */
- const getYear = (locale, refParts) => {
- return getLocalizedDateTime(locale, refParts, { year: 'numeric' });
- };
- /**
- * Given reference parts, return a JS Date object
- * with a normalized time.
- */
- const getNormalizedDate = (refParts) => {
- var _a, _b, _c;
- const timeString = refParts.hour !== undefined && refParts.minute !== undefined ? ` ${refParts.hour}:${refParts.minute}` : '';
- /**
- * We use / notation here for the date
- * so we do not need to do extra work and pad values with zeroes.
- * Values such as YYYY-MM are still valid, so
- * we add fallback values so we still get
- * a valid date otherwise we will pass in a string
- * like "//2023". Some browsers, such as Chrome, will
- * account for this and still return a valid date. However,
- * this is not a consistent behavior across all browsers.
- */
- return new Date(`${(_a = refParts.month) !== null && _a !== void 0 ? _a : 1}/${(_b = refParts.day) !== null && _b !== void 0 ? _b : 1}/${(_c = refParts.year) !== null && _c !== void 0 ? _c : 2023}${timeString} GMT+0000`);
- };
- /**
- * Given a locale, DatetimeParts, and options
- * format the DatetimeParts according to the options
- * and locale combination. This returns a string. If
- * you want an array of the individual pieces
- * that make up the localized date string, use
- * getLocalizedDateTimeParts.
- */
- const getLocalizedDateTime = (locale, refParts, options) => {
- const date = getNormalizedDate(refParts);
- return getDateTimeFormat(locale, stripTimeZone(options)).format(date);
- };
- /**
- * Given a locale, DatetimeParts, and options
- * format the DatetimeParts according to the options
- * and locale combination. This returns an array of
- * each piece of the date.
- */
- const getLocalizedDateTimeParts = (locale, refParts, options) => {
- const date = getNormalizedDate(refParts);
- return getDateTimeFormat(locale, options).formatToParts(date);
- };
- /**
- * Wrapper function for Intl.DateTimeFormat.
- * Allows developers to apply an allowed format to DatetimeParts.
- * This function also has built in safeguards for older browser bugs
- * with Intl.DateTimeFormat.
- */
- const getDateTimeFormat = (locale, options) => {
- return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, options), { timeZone: 'UTC' }));
- };
- /**
- * Gets a localized version of "Today"
- * Falls back to "Today" in English for
- * browsers that do not support RelativeTimeFormat.
- */
- const getTodayLabel = (locale) => {
- if ('RelativeTimeFormat' in Intl) {
- const label = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }).format(0, 'day');
- return label.charAt(0).toUpperCase() + label.slice(1);
- }
- else {
- return 'Today';
- }
- };
- /**
- * When calling toISOString(), the browser
- * will convert the date to UTC time by either adding
- * or subtracting the time zone offset.
- * To work around this, we need to either add
- * or subtract the time zone offset to the Date
- * object prior to calling toISOString().
- * This allows us to get an ISO string
- * that is in the user's time zone.
- *
- * Example:
- * Time zone offset is 240
- * Meaning: The browser needs to add 240 minutes
- * to the Date object to get UTC time.
- * What Ionic does: We subtract 240 minutes
- * from the Date object. The browser then adds
- * 240 minutes in toISOString(). The result
- * is a time that is in the user's time zone
- * and not UTC.
- *
- * Note: Some timezones include minute adjustments
- * such as 30 or 45 minutes. This is why we use setMinutes
- * instead of setHours.
- * Example: India Standard Time
- * Timezone offset: -330 = -5.5 hours.
- *
- * List of timezones with 30 and 45 minute timezones:
- * https://www.timeanddate.com/time/time-zones-interesting.html
- */
- const removeDateTzOffset = (date) => {
- const tzOffset = date.getTimezoneOffset();
- date.setMinutes(date.getMinutes() - tzOffset);
- return date;
- };
- const DATE_AM = removeDateTzOffset(new Date('2022T01:00'));
- const DATE_PM = removeDateTzOffset(new Date('2022T13:00'));
- /**
- * Formats the locale's string representation of the day period (am/pm) for a given
- * ref parts day period.
- *
- * @param locale The locale to format the day period in.
- * @param value The date string, in ISO format.
- * @returns The localized day period (am/pm) representation of the given value.
- */
- const getLocalizedDayPeriod = (locale, dayPeriod) => {
- const date = dayPeriod === 'am' ? DATE_AM : DATE_PM;
- const localizedDayPeriod = new Intl.DateTimeFormat(locale, {
- hour: 'numeric',
- timeZone: 'UTC',
- })
- .formatToParts(date)
- .find((part) => part.type === 'dayPeriod');
- if (localizedDayPeriod) {
- return localizedDayPeriod.value;
- }
- return getFormattedDayPeriod(dayPeriod);
- };
- /**
- * Formats the datetime's value to a string, for use in the native input.
- *
- * @param value The value to format, either an ISO string or an array thereof.
- */
- const formatValue = (value) => {
- return Array.isArray(value) ? value.join(',') : value;
- };
- /**
- * Returns the current date as
- * an ISO string in the user's
- * time zone.
- */
- const getToday = () => {
- /**
- * ion-datetime intentionally does not
- * parse time zones/do automatic time zone
- * conversion when accepting user input.
- * However when we get today's date string,
- * we want it formatted relative to the user's
- * time zone.
- *
- * When calling toISOString(), the browser
- * will convert the date to UTC time by either adding
- * or subtracting the time zone offset.
- * To work around this, we need to either add
- * or subtract the time zone offset to the Date
- * object prior to calling toISOString().
- * This allows us to get an ISO string
- * that is in the user's time zone.
- */
- return removeDateTzOffset(new Date()).toISOString();
- };
- const minutes = [
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- ];
- // h11 hour system uses 0-11. Midnight starts at 0:00am.
- const hour11 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
- // h12 hour system uses 0-12. Midnight starts at 12:00am.
- const hour12 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
- // h23 hour system uses 0-23. Midnight starts at 0:00.
- const hour23 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
- // h24 hour system uses 1-24. Midnight starts at 24:00.
- const hour24 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0];
- /**
- * Given a locale and a mode,
- * return an array with formatted days
- * of the week. iOS should display days
- * such as "Mon" or "Tue".
- * MD should display days such as "M"
- * or "T".
- */
- const getDaysOfWeek = (locale, mode, firstDayOfWeek = 0) => {
- /**
- * Nov 1st, 2020 starts on a Sunday.
- * ion-datetime assumes weeks start on Sunday,
- * but is configurable via `firstDayOfWeek`.
- */
- const weekdayFormat = mode === 'ios' ? 'short' : 'narrow';
- const intl = new Intl.DateTimeFormat(locale, { weekday: weekdayFormat });
- const startDate = new Date('11/01/2020');
- const daysOfWeek = [];
- /**
- * For each day of the week,
- * get the day name.
- */
- for (let i = firstDayOfWeek; i < firstDayOfWeek + 7; i++) {
- const currentDate = new Date(startDate);
- currentDate.setDate(currentDate.getDate() + i);
- daysOfWeek.push(intl.format(currentDate));
- }
- return daysOfWeek;
- };
- /**
- * Returns an array containing all of the
- * days in a month for a given year. Values are
- * aligned with a week calendar starting on
- * the firstDayOfWeek value (Sunday by default)
- * using null values.
- */
- const getDaysOfMonth = (month, year, firstDayOfWeek) => {
- const numDays = getNumDaysInMonth(month, year);
- const firstOfMonth = new Date(`${month}/1/${year}`).getDay();
- /**
- * To get the first day of the month aligned on the correct
- * day of the week, we need to determine how many "filler" days
- * to generate. These filler days as empty/disabled buttons
- * that fill the space of the days of the week before the first
- * of the month.
- *
- * There are two cases here:
- *
- * 1. If firstOfMonth = 4, firstDayOfWeek = 0 then the offset
- * is (4 - (0 + 1)) = 3. Since the offset loop goes from 0 to 3 inclusive,
- * this will generate 4 filler days (0, 1, 2, 3), and then day of week 4 will have
- * the first day of the month.
- *
- * 2. If firstOfMonth = 2, firstDayOfWeek = 4 then the offset
- * is (6 - (4 - 2)) = 4. Since the offset loop goes from 0 to 4 inclusive,
- * this will generate 5 filler days (0, 1, 2, 3, 4), and then day of week 5 will have
- * the first day of the month.
- */
- const offset = firstOfMonth >= firstDayOfWeek ? firstOfMonth - (firstDayOfWeek + 1) : 6 - (firstDayOfWeek - firstOfMonth);
- let days = [];
- for (let i = 1; i <= numDays; i++) {
- days.push({ day: i, dayOfWeek: (offset + i) % 7 });
- }
- for (let i = 0; i <= offset; i++) {
- days = [{ day: null, dayOfWeek: null }, ...days];
- }
- return days;
- };
- /**
- * Returns an array of pre-defined hour
- * values based on the provided hourCycle.
- */
- const getHourData = (hourCycle) => {
- switch (hourCycle) {
- case 'h11':
- return hour11;
- case 'h12':
- return hour12;
- case 'h23':
- return hour23;
- case 'h24':
- return hour24;
- default:
- throw new Error(`Invalid hour cycle "${hourCycle}"`);
- }
- };
- /**
- * Given a local, reference datetime parts and option
- * max/min bound datetime parts, calculate the acceptable
- * hour and minute values according to the bounds and locale.
- */
- const generateTime = (locale, refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
- const computedHourCycle = getHourCycle(locale, hourCycle);
- const use24Hour = is24Hour(computedHourCycle);
- let processedHours = getHourData(computedHourCycle);
- let processedMinutes = minutes;
- let isAMAllowed = true;
- let isPMAllowed = true;
- if (hourValues) {
- processedHours = processedHours.filter((hour) => hourValues.includes(hour));
- }
- if (minuteValues) {
- processedMinutes = processedMinutes.filter((minute) => minuteValues.includes(minute));
- }
- if (minParts) {
- /**
- * If ref day is the same as the
- * minimum allowed day, filter hour/minute
- * values according to min hour and minute.
- */
- if (isSameDay(refParts, minParts)) {
- /**
- * Users may not always set the hour/minute for
- * min value (i.e. 2021-06-02) so we should allow
- * all hours/minutes in that case.
- */
- if (minParts.hour !== undefined) {
- processedHours = processedHours.filter((hour) => {
- const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
- return (use24Hour ? hour : convertedHour) >= minParts.hour;
- });
- isAMAllowed = minParts.hour < 13;
- }
- if (minParts.minute !== undefined) {
- /**
- * The minimum minute range should not be enforced when
- * the hour is greater than the min hour.
- *
- * For example with a minimum range of 09:30, users
- * should be able to select 10:00-10:29 and beyond.
- */
- let isPastMinHour = false;
- if (minParts.hour !== undefined && refParts.hour !== undefined) {
- if (refParts.hour > minParts.hour) {
- isPastMinHour = true;
- }
- }
- processedMinutes = processedMinutes.filter((minute) => {
- if (isPastMinHour) {
- return true;
- }
- return minute >= minParts.minute;
- });
- }
- /**
- * If ref day is before minimum
- * day do not render any hours/minute values
- */
- }
- else if (isBefore(refParts, minParts)) {
- processedHours = [];
- processedMinutes = [];
- isAMAllowed = isPMAllowed = false;
- }
- }
- if (maxParts) {
- /**
- * If ref day is the same as the
- * maximum allowed day, filter hour/minute
- * values according to max hour and minute.
- */
- if (isSameDay(refParts, maxParts)) {
- /**
- * Users may not always set the hour/minute for
- * max value (i.e. 2021-06-02) so we should allow
- * all hours/minutes in that case.
- */
- if (maxParts.hour !== undefined) {
- processedHours = processedHours.filter((hour) => {
- const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
- return (use24Hour ? hour : convertedHour) <= maxParts.hour;
- });
- isPMAllowed = maxParts.hour >= 12;
- }
- if (maxParts.minute !== undefined && refParts.hour === maxParts.hour) {
- // The available minutes should only be filtered when the hour is the same as the max hour.
- // For example if the max hour is 10:30 and the current hour is 10:00,
- // users should be able to select 00-30 minutes.
- // If the current hour is 09:00, users should be able to select 00-60 minutes.
- processedMinutes = processedMinutes.filter((minute) => minute <= maxParts.minute);
- }
- /**
- * If ref day is after minimum
- * day do not render any hours/minute values
- */
- }
- else if (isAfter(refParts, maxParts)) {
- processedHours = [];
- processedMinutes = [];
- isAMAllowed = isPMAllowed = false;
- }
- }
- return {
- hours: processedHours,
- minutes: processedMinutes,
- am: isAMAllowed,
- pm: isPMAllowed,
- };
- };
- /**
- * Given DatetimeParts, generate the previous,
- * current, and and next months.
- */
- const generateMonths = (refParts, forcedDate) => {
- const current = { month: refParts.month, year: refParts.year, day: refParts.day };
- /**
- * If we're forcing a month to appear, and it's different from the current month,
- * ensure it appears by replacing the next or previous month as appropriate.
- */
- if (forcedDate !== undefined && (refParts.month !== forcedDate.month || refParts.year !== forcedDate.year)) {
- const forced = { month: forcedDate.month, year: forcedDate.year, day: forcedDate.day };
- const forcedMonthIsBefore = isBefore(forced, current);
- return forcedMonthIsBefore
- ? [forced, current, getNextMonth(refParts)]
- : [getPreviousMonth(refParts), current, forced];
- }
- return [getPreviousMonth(refParts), current, getNextMonth(refParts)];
- };
- const getMonthColumnData = (locale, refParts, minParts, maxParts, monthValues, formatOptions = {
- month: 'long',
- }) => {
- const { year } = refParts;
- const months = [];
- if (monthValues !== undefined) {
- let processedMonths = monthValues;
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.month) !== undefined) {
- processedMonths = processedMonths.filter((month) => month <= maxParts.month);
- }
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.month) !== undefined) {
- processedMonths = processedMonths.filter((month) => month >= minParts.month);
- }
- processedMonths.forEach((processedMonth) => {
- const date = new Date(`${processedMonth}/1/${year} GMT+0000`);
- const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
- months.push({ text: monthString, value: processedMonth });
- });
- }
- else {
- const maxMonth = maxParts && maxParts.year === year ? maxParts.month : 12;
- const minMonth = minParts && minParts.year === year ? minParts.month : 1;
- for (let i = minMonth; i <= maxMonth; i++) {
- /**
- *
- * There is a bug on iOS 14 where
- * Intl.DateTimeFormat takes into account
- * the local timezone offset when formatting dates.
- *
- * Forcing the timezone to 'UTC' fixes the issue. However,
- * we should keep this workaround as it is safer. In the event
- * this breaks in another browser, we will not be impacted
- * because all dates will be interpreted in UTC.
- *
- * Example:
- * new Intl.DateTimeFormat('en-US', { month: 'long' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "March"
- * new Intl.DateTimeFormat('en-US', { month: 'long', timeZone: 'UTC' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "April"
- *
- * In certain timezones, iOS 14 shows the wrong
- * date for .toUTCString(). To combat this, we
- * force all of the timezones to GMT+0000 (UTC).
- *
- * Example:
- * Time Zone: Central European Standard Time
- * new Date('1/1/1992').toUTCString() // "Tue, 31 Dec 1991 23:00:00 GMT"
- * new Date('1/1/1992 GMT+0000').toUTCString() // "Wed, 01 Jan 1992 00:00:00 GMT"
- */
- const date = new Date(`${i}/1/${year} GMT+0000`);
- const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
- months.push({ text: monthString, value: i });
- }
- }
- return months;
- };
- /**
- * Returns information regarding
- * selectable dates (i.e 1st, 2nd, 3rd, etc)
- * within a reference month.
- * @param locale The locale to format the date with
- * @param refParts The reference month/year to generate dates for
- * @param minParts The minimum bound on the date that can be returned
- * @param maxParts The maximum bound on the date that can be returned
- * @param dayValues The allowed date values
- * @returns Date data to be used in ion-picker-column
- */
- const getDayColumnData = (locale, refParts, minParts, maxParts, dayValues, formatOptions = {
- day: 'numeric',
- }) => {
- const { month, year } = refParts;
- const days = [];
- /**
- * If we have max/min bounds that in the same
- * month/year as the refParts, we should
- * use the define day as the max/min day.
- * Otherwise, fallback to the max/min days in a month.
- */
- const numDaysInMonth = getNumDaysInMonth(month, year);
- const maxDay = (maxParts === null || maxParts === void 0 ? void 0 : maxParts.day) !== null && (maxParts === null || maxParts === void 0 ? void 0 : maxParts.day) !== undefined && maxParts.year === year && maxParts.month === month
- ? maxParts.day
- : numDaysInMonth;
- const minDay = (minParts === null || minParts === void 0 ? void 0 : minParts.day) !== null && (minParts === null || minParts === void 0 ? void 0 : minParts.day) !== undefined && minParts.year === year && minParts.month === month
- ? minParts.day
- : 1;
- if (dayValues !== undefined) {
- let processedDays = dayValues;
- processedDays = processedDays.filter((day) => day >= minDay && day <= maxDay);
- processedDays.forEach((processedDay) => {
- const date = new Date(`${month}/${processedDay}/${year} GMT+0000`);
- const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
- days.push({ text: dayString, value: processedDay });
- });
- }
- else {
- for (let i = minDay; i <= maxDay; i++) {
- const date = new Date(`${month}/${i}/${year} GMT+0000`);
- const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
- days.push({ text: dayString, value: i });
- }
- }
- return days;
- };
- const getYearColumnData = (locale, refParts, minParts, maxParts, yearValues) => {
- var _a, _b;
- let processedYears = [];
- if (yearValues !== undefined) {
- processedYears = yearValues;
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== undefined) {
- processedYears = processedYears.filter((year) => year <= maxParts.year);
- }
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.year) !== undefined) {
- processedYears = processedYears.filter((year) => year >= minParts.year);
- }
- }
- else {
- const { year } = refParts;
- const maxYear = (_a = maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== null && _a !== void 0 ? _a : year;
- const minYear = (_b = minParts === null || minParts === void 0 ? void 0 : minParts.year) !== null && _b !== void 0 ? _b : year - 100;
- for (let i = minYear; i <= maxYear; i++) {
- processedYears.push(i);
- }
- }
- return processedYears.map((year) => ({
- text: getYear(locale, { year, month: refParts.month, day: refParts.day }),
- value: year,
- }));
- };
- /**
- * Given a starting date and an upper bound,
- * this functions returns an array of all
- * month objects in that range.
- */
- const getAllMonthsInRange = (currentParts, maxParts) => {
- if (currentParts.month === maxParts.month && currentParts.year === maxParts.year) {
- return [currentParts];
- }
- return [currentParts, ...getAllMonthsInRange(getNextMonth(currentParts), maxParts)];
- };
- /**
- * Creates and returns picker items
- * that represent the days in a month.
- * Example: "Thu, Jun 2"
- */
- const getCombinedDateColumnData = (locale, todayParts, minParts, maxParts, dayValues, monthValues) => {
- let items = [];
- let parts = [];
- /**
- * Get all month objects from the min date
- * to the max date. Note: Do not use getMonthColumnData
- * as that function only generates dates within a
- * single year.
- */
- let months = getAllMonthsInRange(minParts, maxParts);
- /**
- * Filter out any disallowed month values.
- */
- if (monthValues) {
- months = months.filter(({ month }) => monthValues.includes(month));
- }
- /**
- * Get all of the days in the month.
- * From there, generate an array where
- * each item has the month, date, and day
- * of work as the text.
- */
- months.forEach((monthObject) => {
- const referenceMonth = { month: monthObject.month, day: null, year: monthObject.year };
- const monthDays = getDayColumnData(locale, referenceMonth, minParts, maxParts, dayValues, {
- month: 'short',
- day: 'numeric',
- weekday: 'short',
- });
- const dateParts = [];
- const dateColumnItems = [];
- monthDays.forEach((dayObject) => {
- const isToday = isSameDay(Object.assign(Object.assign({}, referenceMonth), { day: dayObject.value }), todayParts);
- /**
- * Today's date should read as "Today" (localized)
- * not the actual date string
- */
- dateColumnItems.push({
- text: isToday ? getTodayLabel(locale) : dayObject.text,
- value: `${referenceMonth.year}-${referenceMonth.month}-${dayObject.value}`,
- });
- /**
- * When selecting a date in the wheel picker
- * we need access to the raw datetime parts data.
- * The picker column only accepts values of
- * type string or number, so we need to return
- * two sets of data: A data set to be passed
- * to the picker column, and a data set to
- * be used to reference the raw data when
- * updating the picker column value.
- */
- dateParts.push({
- month: referenceMonth.month,
- year: referenceMonth.year,
- day: dayObject.value,
- });
- });
- parts = [...parts, ...dateParts];
- items = [...items, ...dateColumnItems];
- });
- return {
- parts,
- items,
- };
- };
- const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues) => {
- const computedHourCycle = getHourCycle(locale, hourCycle);
- const use24Hour = is24Hour(computedHourCycle);
- const { hours, minutes, am, pm } = generateTime(locale, refParts, computedHourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues);
- const hoursItems = hours.map((hour) => {
- return {
- text: getFormattedHour(hour, computedHourCycle),
- value: getInternalHourValue(hour, use24Hour, refParts.ampm),
- };
- });
- const minutesItems = minutes.map((minute) => {
- return {
- text: addTimePadding(minute),
- value: minute,
- };
- });
- const dayPeriodItems = [];
- if (am && !use24Hour) {
- dayPeriodItems.push({
- text: getLocalizedDayPeriod(locale, 'am'),
- value: 'am',
- });
- }
- if (pm && !use24Hour) {
- dayPeriodItems.push({
- text: getLocalizedDayPeriod(locale, 'pm'),
- value: 'pm',
- });
- }
- return {
- minutesData: minutesItems,
- hoursData: hoursItems,
- dayPeriodData: dayPeriodItems,
- };
- };
- const isYearDisabled = (refYear, minParts, maxParts) => {
- if (minParts && minParts.year > refYear) {
- return true;
- }
- if (maxParts && maxParts.year < refYear) {
- return true;
- }
- return false;
- };
- /**
- * Returns true if a given day should
- * not be interactive according to its value,
- * or the max/min dates.
- */
- const isDayDisabled = (refParts, minParts, maxParts, dayValues) => {
- /**
- * If this is a filler date (i.e. padding)
- * then the date is disabled.
- */
- if (refParts.day === null) {
- return true;
- }
- /**
- * If user passed in a list of acceptable day values
- * check to make sure that the date we are looking
- * at is in this array.
- */
- if (dayValues !== undefined && !dayValues.includes(refParts.day)) {
- return true;
- }
- /**
- * Given a min date, perform the following
- * checks. If any of them are true, then the
- * day should be disabled:
- * 1. Is the current year < the min allowed year?
- * 2. Is the current year === min allowed year,
- * but the current month < the min allowed month?
- * 3. Is the current year === min allowed year, the
- * current month === min allow month, but the current
- * day < the min allowed day?
- */
- if (minParts && isBefore(refParts, minParts)) {
- return true;
- }
- /**
- * Given a max date, perform the following
- * checks. If any of them are true, then the
- * day should be disabled:
- * 1. Is the current year > the max allowed year?
- * 2. Is the current year === max allowed year,
- * but the current month > the max allowed month?
- * 3. Is the current year === max allowed year, the
- * current month === max allow month, but the current
- * day > the max allowed day?
- */
- if (maxParts && isAfter(refParts, maxParts)) {
- return true;
- }
- /**
- * If none of these checks
- * passed then the date should
- * be interactive.
- */
- return false;
- };
- /**
- * Given a locale, a date, the selected date(s), and today's date,
- * generate the state for a given calendar day button.
- */
- const getCalendarDayState = (locale, refParts, activeParts, todayParts, minParts, maxParts, dayValues) => {
- /**
- * activeParts signals what day(s) are currently selected in the datetime.
- * If multiple="true", this will be an array, but the logic in this util
- * is the same whether we have one selected day or many because we're only
- * calculating the state for one button. So, we treat a single activeParts value
- * the same as an array of length one.
- */
- const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
- /**
- * The day button is active if it is selected, or in other words, if refParts
- * matches at least one selected date.
- */
- const isActive = activePartsArray.find((parts) => isSameDay(refParts, parts)) !== undefined;
- const isToday = isSameDay(refParts, todayParts);
- const disabled = isDayDisabled(refParts, minParts, maxParts, dayValues);
- /**
- * Note that we always return one object regardless of whether activeParts
- * was an array, since we pare down to one value for isActive.
- */
- return {
- disabled,
- isActive,
- isToday,
- ariaSelected: isActive ? 'true' : null,
- ariaLabel: generateDayAriaLabel(locale, isToday, refParts),
- text: refParts.day != null ? getDay(locale, refParts) : null,
- };
- };
- /**
- * Returns `true` if the month is disabled given the
- * current date value and min/max date constraints.
- */
- const isMonthDisabled = (refParts, { minParts, maxParts, }) => {
- // If the year is disabled then the month is disabled.
- if (isYearDisabled(refParts.year, minParts, maxParts)) {
- return true;
- }
- // If the date value is before the min date, then the month is disabled.
- // If the date value is after the max date, then the month is disabled.
- if ((minParts && isBefore(refParts, minParts)) || (maxParts && isAfter(refParts, maxParts))) {
- return true;
- }
- return false;
- };
- /**
- * Given a working date, an optional minimum date range,
- * and an optional maximum date range; determine if the
- * previous navigation button is disabled.
- */
- const isPrevMonthDisabled = (refParts, minParts, maxParts) => {
- const prevMonth = Object.assign(Object.assign({}, getPreviousMonth(refParts)), { day: null });
- return isMonthDisabled(prevMonth, {
- minParts,
- maxParts,
- });
- };
- /**
- * Given a working date and a maximum date range,
- * determine if the next navigation button is disabled.
- */
- const isNextMonthDisabled = (refParts, maxParts) => {
- const nextMonth = Object.assign(Object.assign({}, getNextMonth(refParts)), { day: null });
- return isMonthDisabled(nextMonth, {
- maxParts,
- });
- };
- /**
- * Given the value of the highlightedDates property
- * and an ISO string, return the styles to use for
- * that date, or undefined if none are found.
- */
- const getHighlightStyles = (highlightedDates, dateIsoString, el) => {
- if (Array.isArray(highlightedDates)) {
- const dateStringWithoutTime = dateIsoString.split('T')[0];
- const matchingHighlight = highlightedDates.find((hd) => hd.date === dateStringWithoutTime);
- if (matchingHighlight) {
- return {
- textColor: matchingHighlight.textColor,
- backgroundColor: matchingHighlight.backgroundColor,
- };
- }
- }
- else {
- /**
- * Wrap in a try-catch to prevent exceptions in the user's function
- * from interrupting the calendar's rendering.
- */
- try {
- return highlightedDates(dateIsoString);
- }
- catch (e) {
- printIonError('[ion-datetime] - Exception thrown from provided `highlightedDates` callback. Please check your function and try again.', el, e);
- }
- }
- return undefined;
- };
- /**
- * If a time zone is provided in the format options, the rendered text could
- * differ from what was selected in the Datetime, which could cause
- * confusion.
- */
- const warnIfTimeZoneProvided = (el, formatOptions) => {
- var _a, _b, _c, _d;
- if (((_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _a === void 0 ? void 0 : _a.timeZone) ||
- ((_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _b === void 0 ? void 0 : _b.timeZoneName) ||
- ((_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _c === void 0 ? void 0 : _c.timeZone) ||
- ((_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _d === void 0 ? void 0 : _d.timeZoneName)) {
- printIonWarning('[ion-datetime] - "timeZone" and "timeZoneName" are not supported in "formatOptions".', el);
- }
- };
- const checkForPresentationFormatMismatch = (el, presentation, formatOptions) => {
- // formatOptions is not required
- if (!formatOptions)
- return;
- // If formatOptions is provided, the date and/or time objects are required, depending on the presentation
- switch (presentation) {
- case 'date':
- case 'month-year':
- case 'month':
- case 'year':
- if (formatOptions.date === undefined) {
- printIonWarning(`[ion-datetime] - The '${presentation}' presentation requires a date object in formatOptions.`, el);
- }
- break;
- case 'time':
- if (formatOptions.time === undefined) {
- printIonWarning(`[ion-datetime] - The 'time' presentation requires a time object in formatOptions.`, el);
- }
- break;
- case 'date-time':
- case 'time-date':
- if (formatOptions.date === undefined && formatOptions.time === undefined) {
- printIonWarning(`[ion-datetime] - The '${presentation}' presentation requires either a date or time object (or both) in formatOptions.`, el);
- }
- break;
- }
- };
- const datetimeIosCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{-ms-flex-order:3;order:3;text-align:end}:host .wheel-order-year-first .month-column{-ms-flex-order:2;order:2;text-align:end}:host .wheel-order-year-first .year-column{-ms-flex-order:1;order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-flow:column;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:-ms-flexbox;display:flex}:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}.datetime-action-buttons .datetime-action-buttons-container{display:-ms-flexbox;display:flex}:host .calendar-action-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .calendar-action-buttons ion-button{--background:transparent}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-flexbox;display:flex;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-base)}.calendar-month-year{min-width:0}.calendar-month-year-toggle{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;position:relative;border:0;outline:none;background:transparent;cursor:pointer;z-index:1}.calendar-month-year-toggle::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;-webkit-transition:opacity 15ms linear, background-color 15ms linear;transition:opacity 15ms linear, background-color 15ms linear;z-index:-1}.calendar-month-year-toggle.ion-focused::after{background:currentColor}.calendar-month-year-toggle:disabled{opacity:0.3;pointer-events:none}.calendar-month-year-toggle ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;-ms-flex-negative:0;flex-shrink:0}.calendar-month-year-toggle #toggle-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center}ion-picker{--highlight-background:var(--wheel-highlight-background);--highlight-border-radius:var(--wheel-highlight-border-radius);--fade-background-rgb:var(--wheel-fade-background-rgb)}:host{--background:var(--ion-color-light, #f4f5f8);--background-rgb:var(--ion-color-light-rgb, 244, 245, 248);--title-color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),:host(.datetime-presentation-date:not(.datetime-prefer-wheel)){min-height:350px}:host .datetime-header{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, var(--ion-background-color-step-200, #cccccc));font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}.calendar-month-year-toggle{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;min-height:44px;font-size:min(1rem, 25.6px);font-weight:600}.calendar-month-year-toggle.ion-focused::after{opacity:0.15}.calendar-month-year-toggle #toggle-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:10px;margin-bottom:10px}:host .calendar-action-buttons .calendar-month-year-toggle ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:0}:host .calendar-action-buttons ion-buttons ion-button{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host .calendar-days-of-week{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, var(--ion-text-color-step-700, #b3b3b3));font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;-ms-flex-align:center;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2);font-size:min(1.375rem, 35.2px)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-base);font-weight:600}:host .calendar-day.calendar-day-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, var(--ion-background-color-step-200, #cccccc))}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}:host .datetime-action-buttons{width:100%}";
- var IonDatetimeIosStyle0 = datetimeIosCss;
- const datetimeMdCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{-ms-flex-order:3;order:3;text-align:end}:host .wheel-order-year-first .month-column{-ms-flex-order:2;order:2;text-align:end}:host .wheel-order-year-first .year-column{-ms-flex-order:1;order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-flow:column;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:-ms-flexbox;display:flex}:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}.datetime-action-buttons .datetime-action-buttons-container{display:-ms-flexbox;display:flex}:host .calendar-action-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .calendar-action-buttons ion-button{--background:transparent}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-flexbox;display:flex;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-base)}.calendar-month-year{min-width:0}.calendar-month-year-toggle{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;position:relative;border:0;outline:none;background:transparent;cursor:pointer;z-index:1}.calendar-month-year-toggle::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;-webkit-transition:opacity 15ms linear, background-color 15ms linear;transition:opacity 15ms linear, background-color 15ms linear;z-index:-1}.calendar-month-year-toggle.ion-focused::after{background:currentColor}.calendar-month-year-toggle:disabled{opacity:0.3;pointer-events:none}.calendar-month-year-toggle ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;-ms-flex-negative:0;flex-shrink:0}.calendar-month-year-toggle #toggle-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center}ion-picker{--highlight-background:var(--wheel-highlight-background);--highlight-border-radius:var(--wheel-highlight-border-radius);--fade-background-rgb:var(--wheel-fade-background-rgb)}:host{--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #ffffff));--title-color:var(--ion-color-contrast)}:host .datetime-header{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:20px;padding-bottom:20px;background:var(--ion-color-base);color:var(--title-color)}:host .datetime-header .datetime-title{font-size:0.75rem;text-transform:uppercase}:host .datetime-header .datetime-selected-date{margin-top:30px;font-size:2.125rem}:host .calendar-action-buttons ion-button{--color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959))}.calendar-month-year-toggle{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:12px;padding-bottom:12px;min-height:48px;background:transparent;color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959));z-index:1}.calendar-month-year-toggle.ion-focused::after{opacity:0.04}.calendar-month-year-toggle ion-ripple-effect{color:currentColor}@media (any-hover: hover){.calendar-month-year-toggle.ion-activatable:not(.ion-focused):hover::after{background:currentColor;opacity:0.04}}:host .calendar-days-of-week{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:0px;padding-bottom:0px;color:var(--ion-color-step-500, var(--ion-text-color-step-500, gray));font-size:0.875rem;line-height:36px}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:4px;padding-bottom:4px;grid-template-rows:repeat(6, 1fr)}:host .calendar-day{width:42px;min-width:42px;height:42px;font-size:0.875rem}:host .calendar-day.calendar-day-today{border:1px solid var(--ion-color-base);color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-contrast)}.calendar-day.calendar-day-active{border:1px solid var(--ion-color-base);background:var(--ion-color-base)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:8px}:host .time-header{color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959))}:host(.datetime-presentation-month) .datetime-year,:host(.datetime-presentation-year) .datetime-year,:host(.datetime-presentation-month-year) .datetime-year{margin-top:20px;margin-bottom:20px}:host .datetime-buttons{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:10px;padding-bottom:10px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}";
- var IonDatetimeMdStyle0 = datetimeMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot title - The title of the datetime.
- * @slot buttons - The buttons in the datetime.
- * @slot time-label - The label for the time selector in the datetime.
- *
- * @part wheel-item - The individual items when using a wheel style layout, or in the
- * month/year picker when using a grid style layout.
- * @part wheel-item active - The currently selected wheel-item.
- *
- * @part time-button - The button that opens the time picker when using a grid style
- * layout with `presentation="date-time"` or `"time-date"`.
- * @part time-button active - The time picker button when the picker is open.
- *
- * @part month-year-button - The button that opens the month/year picker when
- * using a grid style layout.
- *
- * @part calendar-day - The individual buttons that display a day inside of the datetime
- * calendar.
- * @part calendar-day active - The currently selected calendar day.
- * @part calendar-day today - The calendar day that contains the current day.
- * @part calendar-day disabled - The calendar day that is disabled.
- */
- class Datetime {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionCancel = createEvent(this, "ionCancel", 7);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionValueChange = createEvent(this, "ionValueChange", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.ionStyle = createEvent(this, "ionStyle", 7);
- this.ionRender = createEvent(this, "ionRender", 7);
- this.inputId = `ion-dt-${datetimeIds++}`;
- this.prevPresentation = null;
- this.warnIfIncorrectValueUsage = () => {
- const { multiple, value } = this;
- if (!multiple && Array.isArray(value)) {
- /**
- * We do some processing on the `value` array so
- * that it looks more like an array when logged to
- * the console.
- * Example given ['a', 'b']
- * Default toString() behavior: a,b
- * Custom behavior: ['a', 'b']
- */
- printIonWarning(`[ion-datetime] - An array of values was passed, but multiple is "false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
- Value Passed: [${value.map((v) => `'${v}'`).join(', ')}]
- `, this.el);
- }
- };
- this.setValue = (value) => {
- this.value = value;
- this.ionChange.emit({ value });
- };
- /**
- * Returns the DatetimePart interface
- * to use when rendering an initial set of
- * data. This should be used when rendering an
- * interface in an environment where the `value`
- * may not be set. This function works
- * by returning the first selected date and then
- * falling back to defaultParts if no active date
- * is selected.
- */
- this.getActivePartsWithFallback = () => {
- var _a;
- const { defaultParts } = this;
- return (_a = this.getActivePart()) !== null && _a !== void 0 ? _a : defaultParts;
- };
- this.getActivePart = () => {
- const { activeParts } = this;
- return Array.isArray(activeParts) ? activeParts[0] : activeParts;
- };
- this.closeParentOverlay = (role) => {
- const popoverOrModal = this.el.closest('ion-modal, ion-popover');
- if (popoverOrModal) {
- popoverOrModal.dismiss(undefined, role);
- }
- };
- this.setWorkingParts = (parts) => {
- this.workingParts = Object.assign({}, parts);
- };
- this.setActiveParts = (parts, removeDate = false) => {
- /** if the datetime component is in readonly mode,
- * allow browsing of the calendar without changing
- * the set value
- */
- if (this.readonly) {
- return;
- }
- const { multiple, minParts, maxParts, activeParts } = this;
- /**
- * When setting the active parts, it is possible
- * to set invalid data. For example,
- * when updating January 31 to February,
- * February 31 does not exist. As a result
- * we need to validate the active parts and
- * ensure that we are only setting valid dates.
- * Additionally, we need to update the working parts
- * too in the event that the validated parts are different.
- */
- const validatedParts = validateParts(parts, minParts, maxParts);
- this.setWorkingParts(validatedParts);
- if (multiple) {
- const activePartsArray = Array.isArray(activeParts) ? activeParts : [activeParts];
- if (removeDate) {
- this.activeParts = activePartsArray.filter((p) => !isSameDay(p, validatedParts));
- }
- else {
- this.activeParts = [...activePartsArray, validatedParts];
- }
- }
- else {
- this.activeParts = Object.assign({}, validatedParts);
- }
- const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
- if (hasSlottedButtons || this.showDefaultButtons) {
- return;
- }
- this.confirm();
- };
- this.initializeKeyboardListeners = () => {
- const calendarBodyRef = this.calendarBodyRef;
- if (!calendarBodyRef) {
- return;
- }
- const root = this.el.shadowRoot;
- /**
- * Get a reference to the month
- * element we are currently viewing.
- */
- const currentMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(2)');
- /**
- * When focusing the calendar body, we want to pass focus
- * to the working day, but other days should
- * only be accessible using the arrow keys. Pressing
- * Tab should jump between bodies of selectable content.
- */
- const checkCalendarBodyFocus = (ev) => {
- var _a;
- const record = ev[0];
- /**
- * If calendar body was already focused
- * when this fired or if the calendar body
- * if not currently focused, we should not re-focus
- * the inner day.
- */
- if (((_a = record.oldValue) === null || _a === void 0 ? void 0 : _a.includes('ion-focused')) || !calendarBodyRef.classList.contains('ion-focused')) {
- return;
- }
- this.focusWorkingDay(currentMonth);
- };
- const mo = new MutationObserver(checkCalendarBodyFocus);
- mo.observe(calendarBodyRef, { attributeFilter: ['class'], attributeOldValue: true });
- this.destroyKeyboardMO = () => {
- mo === null || mo === void 0 ? void 0 : mo.disconnect();
- };
- /**
- * We must use keydown not keyup as we want
- * to prevent scrolling when using the arrow keys.
- */
- calendarBodyRef.addEventListener('keydown', (ev) => {
- const activeElement = root.activeElement;
- if (!activeElement || !activeElement.classList.contains('calendar-day')) {
- return;
- }
- const parts = getPartsFromCalendarDay(activeElement);
- let partsToFocus;
- switch (ev.key) {
- case 'ArrowDown':
- ev.preventDefault();
- partsToFocus = getNextWeek(parts);
- break;
- case 'ArrowUp':
- ev.preventDefault();
- partsToFocus = getPreviousWeek(parts);
- break;
- case 'ArrowRight':
- ev.preventDefault();
- partsToFocus = getNextDay(parts);
- break;
- case 'ArrowLeft':
- ev.preventDefault();
- partsToFocus = getPreviousDay(parts);
- break;
- case 'Home':
- ev.preventDefault();
- partsToFocus = getStartOfWeek(parts);
- break;
- case 'End':
- ev.preventDefault();
- partsToFocus = getEndOfWeek(parts);
- break;
- case 'PageUp':
- ev.preventDefault();
- partsToFocus = ev.shiftKey ? getPreviousYear(parts) : getPreviousMonth(parts);
- break;
- case 'PageDown':
- ev.preventDefault();
- partsToFocus = ev.shiftKey ? getNextYear(parts) : getNextMonth(parts);
- break;
- /**
- * Do not preventDefault here
- * as we do not want to override other
- * browser defaults such as pressing Enter/Space
- * to select a day.
- */
- default:
- return;
- }
- /**
- * If the day we want to move focus to is
- * disabled, do not do anything.
- */
- if (isDayDisabled(partsToFocus, this.minParts, this.maxParts)) {
- return;
- }
- this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), partsToFocus));
- /**
- * Give view a chance to re-render
- * then move focus to the new working day
- */
- requestAnimationFrame(() => this.focusWorkingDay(currentMonth));
- });
- };
- this.focusWorkingDay = (currentMonth) => {
- /**
- * Get the number of padding days so
- * we know how much to offset our next selector by
- * to grab the correct calendar-day element.
- */
- const padding = currentMonth.querySelectorAll('.calendar-day-padding');
- const { day } = this.workingParts;
- if (day === null) {
- return;
- }
- /**
- * Get the calendar day element
- * and focus it.
- */
- const dayEl = currentMonth.querySelector(`.calendar-day-wrapper:nth-of-type(${padding.length + day}) .calendar-day`);
- if (dayEl) {
- dayEl.focus();
- }
- };
- this.processMinParts = () => {
- const { min, defaultParts } = this;
- if (min === undefined) {
- this.minParts = undefined;
- return;
- }
- this.minParts = parseMinParts(min, defaultParts);
- };
- this.processMaxParts = () => {
- const { max, defaultParts } = this;
- if (max === undefined) {
- this.maxParts = undefined;
- return;
- }
- this.maxParts = parseMaxParts(max, defaultParts);
- };
- this.initializeCalendarListener = () => {
- const calendarBodyRef = this.calendarBodyRef;
- if (!calendarBodyRef) {
- return;
- }
- /**
- * For performance reasons, we only render 3
- * months at a time: The current month, the previous
- * month, and the next month. We have a scroll listener
- * on the calendar body to append/prepend new months.
- *
- * We can do this because Stencil is smart enough to not
- * re-create the .calendar-month containers, but rather
- * update the content within those containers.
- *
- * As an added bonus, WebKit has some troubles with
- * scroll-snap-stop: always, so not rendering all of
- * the months in a row allows us to mostly sidestep
- * that issue.
- */
- const months = calendarBodyRef.querySelectorAll('.calendar-month');
- const startMonth = months[0];
- const workingMonth = months[1];
- const endMonth = months[2];
- const mode = getIonMode$1(this);
- const needsiOSRubberBandFix = mode === 'ios' && typeof navigator !== 'undefined' && navigator.maxTouchPoints > 1;
- /**
- * Before setting up the scroll listener,
- * scroll the middle month into view.
- * scrollIntoView() will scroll entire page
- * if element is not in viewport. Use scrollLeft instead.
- */
- writeTask(() => {
- calendarBodyRef.scrollLeft = startMonth.clientWidth * (isRTL$1(this.el) ? -1 : 1);
- const getChangedMonth = (parts) => {
- const box = calendarBodyRef.getBoundingClientRect();
- /**
- * If the current scroll position is all the way to the left
- * then we have scrolled to the previous month.
- * Otherwise, assume that we have scrolled to the next
- * month. We have a tolerance of 2px to account for
- * sub pixel rendering.
- *
- * Check below the next line ensures that we did not
- * swipe and abort (i.e. we swiped but we are still on the current month).
- */
- const condition = isRTL$1(this.el) ? calendarBodyRef.scrollLeft >= -2 : calendarBodyRef.scrollLeft <= 2;
- const month = condition ? startMonth : endMonth;
- /**
- * The edge of the month must be lined up with
- * the edge of the calendar body in order for
- * the component to update. Otherwise, it
- * may be the case that the user has paused their
- * swipe or the browser has not finished snapping yet.
- * Rather than check if the x values are equal,
- * we give it a tolerance of 2px to account for
- * sub pixel rendering.
- */
- const monthBox = month.getBoundingClientRect();
- if (Math.abs(monthBox.x - box.x) > 2)
- return;
- /**
- * If we're force-rendering a month, assume we've
- * scrolled to that and return it.
- *
- * If forceRenderDate is ever used in a context where the
- * forced month is not immediately auto-scrolled to, this
- * should be updated to also check whether `month` has the
- * same month and year as the forced date.
- */
- const { forceRenderDate } = this;
- if (forceRenderDate !== undefined) {
- return { month: forceRenderDate.month, year: forceRenderDate.year, day: forceRenderDate.day };
- }
- /**
- * From here, we can determine if the start
- * month or the end month was scrolled into view.
- * If no month was changed, then we can return from
- * the scroll callback early.
- */
- if (month === startMonth) {
- return getPreviousMonth(parts);
- }
- else if (month === endMonth) {
- return getNextMonth(parts);
- }
- else {
- return;
- }
- };
- const updateActiveMonth = () => {
- if (needsiOSRubberBandFix) {
- calendarBodyRef.style.removeProperty('pointer-events');
- appliediOSRubberBandFix = false;
- }
- /**
- * If the month did not change
- * then we can return early.
- */
- const newDate = getChangedMonth(this.workingParts);
- if (!newDate)
- return;
- const { month, day, year } = newDate;
- if (isMonthDisabled({ month, year, day: null }, {
- minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
- maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
- })) {
- return;
- }
- /**
- * Prevent scrolling for other browsers
- * to give the DOM time to update and the container
- * time to properly snap.
- */
- calendarBodyRef.style.setProperty('overflow', 'hidden');
- /**
- * Use a writeTask here to ensure
- * that the state is updated and the
- * correct month is scrolled into view
- * in the same frame. This is not
- * typically a problem on newer devices
- * but older/slower device may have a flicker
- * if we did not do this.
- */
- writeTask(() => {
- this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month, day: day, year }));
- calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL$1(this.el) ? -1 : 1);
- calendarBodyRef.style.removeProperty('overflow');
- if (this.resolveForceDateScrolling) {
- this.resolveForceDateScrolling();
- }
- });
- };
- /**
- * When the container finishes scrolling we
- * need to update the DOM with the selected month.
- */
- let scrollTimeout;
- /**
- * We do not want to attempt to set pointer-events
- * multiple times within a single swipe gesture as
- * that adds unnecessary work to the main thread.
- */
- let appliediOSRubberBandFix = false;
- const scrollCallback = () => {
- if (scrollTimeout) {
- clearTimeout(scrollTimeout);
- }
- /**
- * On iOS it is possible to quickly rubber band
- * the scroll area before the scroll timeout has fired.
- * This results in users reaching the end of the scrollable
- * container before the DOM has updated.
- * By setting `pointer-events: none` we can ensure that
- * subsequent swipes do not happen while the container
- * is snapping.
- */
- if (!appliediOSRubberBandFix && needsiOSRubberBandFix) {
- calendarBodyRef.style.setProperty('pointer-events', 'none');
- appliediOSRubberBandFix = true;
- }
- // Wait ~3 frames
- scrollTimeout = setTimeout(updateActiveMonth, 50);
- };
- calendarBodyRef.addEventListener('scroll', scrollCallback);
- this.destroyCalendarListener = () => {
- calendarBodyRef.removeEventListener('scroll', scrollCallback);
- };
- });
- };
- /**
- * Clean up all listeners except for the overlay
- * listener. This is so that we can re-create the listeners
- * if the datetime has been hidden/presented by a modal or popover.
- */
- this.destroyInteractionListeners = () => {
- const { destroyCalendarListener, destroyKeyboardMO } = this;
- if (destroyCalendarListener !== undefined) {
- destroyCalendarListener();
- }
- if (destroyKeyboardMO !== undefined) {
- destroyKeyboardMO();
- }
- };
- this.processValue = (value) => {
- const hasValue = value !== null && value !== undefined && value !== '' && (!Array.isArray(value) || value.length > 0);
- const valueToProcess = hasValue ? parseDate(value) : this.defaultParts;
- const { minParts, maxParts, workingParts, el } = this;
- this.warnIfIncorrectValueUsage();
- /**
- * Return early if the value wasn't parsed correctly, such as
- * if an improperly formatted date string was provided.
- */
- if (!valueToProcess) {
- return;
- }
- /**
- * Datetime should only warn of out of bounds values
- * if set by the user. If the `value` is undefined,
- * we will default to today's date which may be out
- * of bounds. In this case, the warning makes it look
- * like the developer did something wrong which is
- * not true.
- */
- if (hasValue) {
- warnIfValueOutOfBounds(valueToProcess, minParts, maxParts);
- }
- /**
- * If there are multiple values, pick an arbitrary one to clamp to. This way,
- * if the values are across months, we always show at least one of them. Note
- * that the values don't necessarily have to be in order.
- */
- const singleValue = Array.isArray(valueToProcess) ? valueToProcess[0] : valueToProcess;
- const targetValue = clampDate(singleValue, minParts, maxParts);
- const { month, day, year, hour, minute } = targetValue;
- const ampm = parseAmPm(hour);
- /**
- * Since `activeParts` indicates a value that
- * been explicitly selected either by the
- * user or the app, only update `activeParts`
- * if the `value` property is set.
- */
- if (hasValue) {
- if (Array.isArray(valueToProcess)) {
- this.activeParts = [...valueToProcess];
- }
- else {
- this.activeParts = {
- month,
- day,
- year,
- hour,
- minute,
- ampm,
- };
- }
- }
- else {
- /**
- * Reset the active parts if the value is not set.
- * This will clear the selected calendar day when
- * performing a clear action or using the reset() method.
- */
- this.activeParts = [];
- }
- /**
- * Only animate if:
- * 1. We're using grid style (wheel style pickers should just jump to new value)
- * 2. The month and/or year actually changed, and both are defined (otherwise there's nothing to animate to)
- * 3. The calendar body is visible (prevents animation when in collapsed datetime-button, for example)
- * 4. The month/year picker is not open (since you wouldn't see the animation anyway)
- */
- const didChangeMonth = (month !== undefined && month !== workingParts.month) || (year !== undefined && year !== workingParts.year);
- const bodyIsVisible = el.classList.contains('datetime-ready');
- const { isGridStyle, showMonthAndYear } = this;
- let areAllSelectedDatesInSameMonth = true;
- if (Array.isArray(valueToProcess)) {
- const firstMonth = valueToProcess[0].month;
- for (const date of valueToProcess) {
- if (date.month !== firstMonth) {
- areAllSelectedDatesInSameMonth = false;
- break;
- }
- }
- }
- /**
- * If there is more than one date selected
- * and the dates aren't all in the same month,
- * then we should neither animate to the date
- * nor update the working parts because we do
- * not know which date the user wants to view.
- */
- if (areAllSelectedDatesInSameMonth) {
- if (isGridStyle && didChangeMonth && bodyIsVisible && !showMonthAndYear) {
- this.animateToDate(targetValue);
- }
- else {
- /**
- * We only need to do this if we didn't just animate to a new month,
- * since that calls prevMonth/nextMonth which calls setWorkingParts for us.
- */
- this.setWorkingParts({
- month,
- day,
- year,
- hour,
- minute,
- ampm,
- });
- }
- }
- };
- this.animateToDate = async (targetValue) => {
- const { workingParts } = this;
- /**
- * Tell other render functions that we need to force the
- * target month to appear in place of the actual next/prev month.
- * Because this is a State variable, a rerender will be triggered
- * automatically, updating the rendered months.
- */
- this.forceRenderDate = targetValue;
- /**
- * Flag that we've started scrolling to the forced date.
- * The resolve function will be called by the datetime's
- * scroll listener when it's done updating everything.
- * This is a replacement for making prev/nextMonth async,
- * since the logic we're waiting on is in a listener.
- */
- const forceDateScrollingPromise = new Promise((resolve) => {
- this.resolveForceDateScrolling = resolve;
- });
- /**
- * Animate smoothly to the forced month. This will also update
- * workingParts and correct the surrounding months for us.
- */
- const targetMonthIsBefore = isBefore(targetValue, workingParts);
- targetMonthIsBefore ? this.prevMonth() : this.nextMonth();
- await forceDateScrollingPromise;
- this.resolveForceDateScrolling = undefined;
- this.forceRenderDate = undefined;
- };
- this.onFocus = () => {
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.ionBlur.emit();
- };
- this.hasValue = () => {
- return this.value != null;
- };
- this.nextMonth = () => {
- const calendarBodyRef = this.calendarBodyRef;
- if (!calendarBodyRef) {
- return;
- }
- const nextMonth = calendarBodyRef.querySelector('.calendar-month:last-of-type');
- if (!nextMonth) {
- return;
- }
- const left = nextMonth.offsetWidth * 2;
- calendarBodyRef.scrollTo({
- top: 0,
- left: left * (isRTL$1(this.el) ? -1 : 1),
- behavior: 'smooth',
- });
- };
- this.prevMonth = () => {
- const calendarBodyRef = this.calendarBodyRef;
- if (!calendarBodyRef) {
- return;
- }
- const prevMonth = calendarBodyRef.querySelector('.calendar-month:first-of-type');
- if (!prevMonth) {
- return;
- }
- calendarBodyRef.scrollTo({
- top: 0,
- left: 0,
- behavior: 'smooth',
- });
- };
- this.toggleMonthAndYearView = () => {
- this.showMonthAndYear = !this.showMonthAndYear;
- };
- this.showMonthAndYear = false;
- this.activeParts = [];
- this.workingParts = {
- month: 5,
- day: 28,
- year: 2021,
- hour: 13,
- minute: 52,
- ampm: 'pm',
- };
- this.isTimePopoverOpen = false;
- this.forceRenderDate = undefined;
- this.color = 'primary';
- this.name = this.inputId;
- this.disabled = false;
- this.formatOptions = undefined;
- this.readonly = false;
- this.isDateEnabled = undefined;
- this.min = undefined;
- this.max = undefined;
- this.presentation = 'date-time';
- this.cancelText = 'Cancel';
- this.doneText = 'Done';
- this.clearText = 'Clear';
- this.yearValues = undefined;
- this.monthValues = undefined;
- this.dayValues = undefined;
- this.hourValues = undefined;
- this.minuteValues = undefined;
- this.locale = 'default';
- this.firstDayOfWeek = 0;
- this.titleSelectedDatesFormatter = undefined;
- this.multiple = false;
- this.highlightedDates = undefined;
- this.value = undefined;
- this.showDefaultTitle = false;
- this.showDefaultButtons = false;
- this.showClearButton = false;
- this.showDefaultTimeLabel = true;
- this.hourCycle = undefined;
- this.size = 'fixed';
- this.preferWheel = false;
- }
- formatOptionsChanged() {
- const { el, formatOptions, presentation } = this;
- checkForPresentationFormatMismatch(el, presentation, formatOptions);
- warnIfTimeZoneProvided(el, formatOptions);
- }
- disabledChanged() {
- this.emitStyle();
- }
- minChanged() {
- this.processMinParts();
- }
- maxChanged() {
- this.processMaxParts();
- }
- presentationChanged() {
- const { el, formatOptions, presentation } = this;
- checkForPresentationFormatMismatch(el, presentation, formatOptions);
- }
- get isGridStyle() {
- const { presentation, preferWheel } = this;
- const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
- return hasDatePresentation && !preferWheel;
- }
- yearValuesChanged() {
- this.parsedYearValues = convertToArrayOfNumbers(this.yearValues);
- }
- monthValuesChanged() {
- this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues);
- }
- dayValuesChanged() {
- this.parsedDayValues = convertToArrayOfNumbers(this.dayValues);
- }
- hourValuesChanged() {
- this.parsedHourValues = convertToArrayOfNumbers(this.hourValues);
- }
- minuteValuesChanged() {
- this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues);
- }
- /**
- * Update the datetime value when the value changes
- */
- async valueChanged() {
- const { value } = this;
- if (this.hasValue()) {
- this.processValue(value);
- }
- this.emitStyle();
- this.ionValueChange.emit({ value });
- }
- /**
- * Confirms the selected datetime value, updates the
- * `value` property, and optionally closes the popover
- * or modal that the datetime was presented in.
- */
- async confirm(closeOverlay = false) {
- const { isCalendarPicker, activeParts, preferWheel, workingParts } = this;
- /**
- * We only update the value if the presentation is not a calendar picker.
- */
- if (activeParts !== undefined || !isCalendarPicker) {
- const activePartsIsArray = Array.isArray(activeParts);
- if (activePartsIsArray && activeParts.length === 0) {
- if (preferWheel) {
- /**
- * If the datetime is using a wheel picker, but the
- * active parts are empty, then the user has confirmed the
- * initial value (working parts) presented to them.
- */
- this.setValue(convertDataToISO(workingParts));
- }
- else {
- this.setValue(undefined);
- }
- }
- else {
- this.setValue(convertDataToISO(activeParts));
- }
- }
- if (closeOverlay) {
- this.closeParentOverlay(CONFIRM_ROLE);
- }
- }
- /**
- * Resets the internal state of the datetime but does not update the value.
- * Passing a valid ISO-8601 string will reset the state of the component to the provided date.
- * If no value is provided, the internal state will be reset to the clamped value of the min, max and today.
- */
- async reset(startDate) {
- this.processValue(startDate);
- }
- /**
- * Emits the ionCancel event and
- * optionally closes the popover
- * or modal that the datetime was
- * presented in.
- */
- async cancel(closeOverlay = false) {
- this.ionCancel.emit();
- if (closeOverlay) {
- this.closeParentOverlay(CANCEL_ROLE);
- }
- }
- get isCalendarPicker() {
- const { presentation } = this;
- return presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
- }
- connectedCallback() {
- this.clearFocusVisible = startFocusVisible(this.el).destroy;
- }
- disconnectedCallback() {
- if (this.clearFocusVisible) {
- this.clearFocusVisible();
- this.clearFocusVisible = undefined;
- }
- }
- initializeListeners() {
- this.initializeCalendarListener();
- this.initializeKeyboardListeners();
- }
- componentDidLoad() {
- const { el, intersectionTrackerRef } = this;
- /**
- * If a scrollable element is hidden using `display: none`,
- * it will not have a scroll height meaning we cannot scroll elements
- * into view. As a result, we will need to wait for the datetime to become
- * visible if used inside of a modal or a popover otherwise the scrollable
- * areas will not have the correct values snapped into place.
- */
- const visibleCallback = (entries) => {
- const ev = entries[0];
- if (!ev.isIntersecting) {
- return;
- }
- this.initializeListeners();
- /**
- * TODO FW-2793: Datetime needs a frame to ensure that it
- * can properly scroll contents into view. As a result
- * we hide the scrollable content until after that frame
- * so users do not see the content quickly shifting. The downside
- * is that the content will pop into view a frame after. Maybe there
- * is a better way to handle this?
- */
- writeTask(() => {
- this.el.classList.add('datetime-ready');
- });
- };
- const visibleIO = new IntersectionObserver(visibleCallback, { threshold: 0.01, root: el });
- /**
- * Use raf to avoid a race condition between the component loading and
- * its display animation starting (such as when shown in a modal). This
- * could cause the datetime to start at a visibility of 0, erroneously
- * triggering the `hiddenIO` observer below.
- */
- raf(() => visibleIO === null || visibleIO === void 0 ? void 0 : visibleIO.observe(intersectionTrackerRef));
- /**
- * We need to clean up listeners when the datetime is hidden
- * in a popover/modal so that we can properly scroll containers
- * back into view if they are re-presented. When the datetime is hidden
- * the scroll areas have scroll widths/heights of 0px, so any snapping
- * we did originally has been lost.
- */
- const hiddenCallback = (entries) => {
- const ev = entries[0];
- if (ev.isIntersecting) {
- return;
- }
- this.destroyInteractionListeners();
- /**
- * When datetime is hidden, we need to make sure that
- * the month/year picker is closed. Otherwise,
- * it will be open when the datetime re-appears
- * and the scroll area of the calendar grid will be 0.
- * As a result, the wrong month will be shown.
- */
- this.showMonthAndYear = false;
- writeTask(() => {
- this.el.classList.remove('datetime-ready');
- });
- };
- const hiddenIO = new IntersectionObserver(hiddenCallback, { threshold: 0, root: el });
- raf(() => hiddenIO === null || hiddenIO === void 0 ? void 0 : hiddenIO.observe(intersectionTrackerRef));
- /**
- * Datetime uses Ionic components that emit
- * ionFocus and ionBlur. These events are
- * composed meaning they will cross
- * the shadow dom boundary. We need to
- * stop propagation on these events otherwise
- * developers will see 2 ionFocus or 2 ionBlur
- * events at a time.
- */
- const root = getElementRoot(this.el);
- root.addEventListener('ionFocus', (ev) => ev.stopPropagation());
- root.addEventListener('ionBlur', (ev) => ev.stopPropagation());
- }
- /**
- * When the presentation is changed, all calendar content is recreated,
- * so we need to re-init behavior with the new elements.
- */
- componentDidRender() {
- const { presentation, prevPresentation, calendarBodyRef, minParts, preferWheel, forceRenderDate } = this;
- /**
- * TODO(FW-2165)
- * Remove this when https://bugs.webkit.org/show_bug.cgi?id=235960 is fixed.
- * When using `min`, we add `scroll-snap-align: none`
- * to the disabled month so that users cannot scroll to it.
- * This triggers a bug in WebKit where the scroll position is reset.
- * Since the month change logic is handled by a scroll listener,
- * this causes the month to change leading to `scroll-snap-align`
- * changing again, thus changing the scroll position again and causing
- * an infinite loop.
- * This issue only applies to the calendar grid, so we can disable
- * it if the calendar grid is not being used.
- */
- const hasCalendarGrid = !preferWheel && ['date-time', 'time-date', 'date'].includes(presentation);
- if (minParts !== undefined && hasCalendarGrid && calendarBodyRef) {
- const workingMonth = calendarBodyRef.querySelector('.calendar-month:nth-of-type(1)');
- /**
- * We need to make sure the datetime is not in the process
- * of scrolling to a new datetime value if the value
- * is updated programmatically.
- * Otherwise, the datetime will appear to not scroll at all because
- * we are resetting the scroll position to the center of the view.
- * Prior to the datetime's value being updated programmatically,
- * the calendarBodyRef is scrolled such that the middle month is centered
- * in the view. The below code updates the scroll position so the middle
- * month is also centered in the view. Since the scroll position did not change,
- * the scroll callback in this file does not fire,
- * and the resolveForceDateScrolling promise never resolves.
- */
- if (workingMonth && forceRenderDate === undefined) {
- calendarBodyRef.scrollLeft = workingMonth.clientWidth * (isRTL$1(this.el) ? -1 : 1);
- }
- }
- if (prevPresentation === null) {
- this.prevPresentation = presentation;
- return;
- }
- if (presentation === prevPresentation) {
- return;
- }
- this.prevPresentation = presentation;
- this.destroyInteractionListeners();
- this.initializeListeners();
- /**
- * The month/year picker from the date interface
- * should be closed as it is not available in non-date
- * interfaces.
- */
- this.showMonthAndYear = false;
- raf(() => {
- this.ionRender.emit();
- });
- }
- componentWillLoad() {
- const { el, formatOptions, highlightedDates, multiple, presentation, preferWheel } = this;
- if (multiple) {
- if (presentation !== 'date') {
- printIonWarning('[ion-datetime] - Multiple date selection is only supported for presentation="date".', el);
- }
- if (preferWheel) {
- printIonWarning('[ion-datetime] - Multiple date selection is not supported with preferWheel="true".', el);
- }
- }
- if (highlightedDates !== undefined) {
- if (presentation !== 'date' && presentation !== 'date-time' && presentation !== 'time-date') {
- printIonWarning('[ion-datetime] - The highlightedDates property is only supported with the date, date-time, and time-date presentations.', el);
- }
- if (preferWheel) {
- printIonWarning('[ion-datetime] - The highlightedDates property is not supported with preferWheel="true".', el);
- }
- }
- if (formatOptions) {
- checkForPresentationFormatMismatch(el, presentation, formatOptions);
- warnIfTimeZoneProvided(el, formatOptions);
- }
- const hourValues = (this.parsedHourValues = convertToArrayOfNumbers(this.hourValues));
- const minuteValues = (this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues));
- const monthValues = (this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues));
- const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
- const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
- const todayParts = (this.todayParts = parseDate(getToday()));
- this.processMinParts();
- this.processMaxParts();
- this.defaultParts = getClosestValidDate({
- refParts: todayParts,
- monthValues,
- dayValues,
- yearValues,
- hourValues,
- minuteValues,
- minParts: this.minParts,
- maxParts: this.maxParts,
- });
- this.processValue(this.value);
- this.emitStyle();
- }
- emitStyle() {
- this.ionStyle.emit({
- interactive: true,
- datetime: true,
- 'interactive-disabled': this.disabled,
- });
- }
- /**
- * Universal render methods
- * These are pieces of datetime that
- * are rendered independently of presentation.
- */
- renderFooter() {
- const { disabled, readonly, showDefaultButtons, showClearButton } = this;
- /**
- * The cancel, clear, and confirm buttons
- * should not be interactive if the datetime
- * is disabled or readonly.
- */
- const isButtonDisabled = disabled || readonly;
- const hasSlottedButtons = this.el.querySelector('[slot="buttons"]') !== null;
- if (!hasSlottedButtons && !showDefaultButtons && !showClearButton) {
- return;
- }
- const clearButtonClick = () => {
- this.reset();
- this.setValue(undefined);
- };
- /**
- * By default we render two buttons:
- * Cancel - Dismisses the datetime and
- * does not update the `value` prop.
- * OK - Dismisses the datetime and
- * updates the `value` prop.
- */
- return (hAsync("div", { class: "datetime-footer" }, hAsync("div", { class: "datetime-buttons" }, hAsync("div", { class: {
- ['datetime-action-buttons']: true,
- ['has-clear-button']: this.showClearButton,
- } }, hAsync("slot", { name: "buttons" }, hAsync("ion-buttons", null, showDefaultButtons && (hAsync("ion-button", { id: "cancel-button", color: this.color, onClick: () => this.cancel(true), disabled: isButtonDisabled }, this.cancelText)), hAsync("div", { class: "datetime-action-buttons-container" }, showClearButton && (hAsync("ion-button", { id: "clear-button", color: this.color, onClick: () => clearButtonClick(), disabled: isButtonDisabled }, this.clearText)), showDefaultButtons && (hAsync("ion-button", { id: "confirm-button", color: this.color, onClick: () => this.confirm(true), disabled: isButtonDisabled }, this.doneText)))))))));
- }
- /**
- * Wheel picker render methods
- */
- renderWheelPicker(forcePresentation = this.presentation) {
- /**
- * If presentation="time-date" we switch the
- * order of the render array here instead of
- * manually reordering each date/time picker
- * column with CSS. This allows for additional
- * flexibility if we need to render subsets
- * of the date/time data or do additional ordering
- * within the child render functions.
- */
- const renderArray = forcePresentation === 'time-date'
- ? [this.renderTimePickerColumns(forcePresentation), this.renderDatePickerColumns(forcePresentation)]
- : [this.renderDatePickerColumns(forcePresentation), this.renderTimePickerColumns(forcePresentation)];
- return hAsync("ion-picker", null, renderArray);
- }
- renderDatePickerColumns(forcePresentation) {
- return forcePresentation === 'date-time' || forcePresentation === 'time-date'
- ? this.renderCombinedDatePickerColumn()
- : this.renderIndividualDatePickerColumns(forcePresentation);
- }
- renderCombinedDatePickerColumn() {
- const { defaultParts, disabled, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
- const activePart = this.getActivePartsWithFallback();
- /**
- * By default, generate a range of 3 months:
- * Previous month, current month, and next month
- */
- const monthsToRender = generateMonths(workingParts);
- const lastMonth = monthsToRender[monthsToRender.length - 1];
- /**
- * Ensure that users can select the entire window of dates.
- */
- monthsToRender[0].day = 1;
- lastMonth.day = getNumDaysInMonth(lastMonth.month, lastMonth.year);
- /**
- * Narrow the dates rendered based on min/max dates (if any).
- * The `min` date is used if the min is after the generated min month.
- * The `max` date is used if the max is before the generated max month.
- * This ensures that the sliding window always stays at 3 months
- * but still allows future dates to be lazily rendered based on any min/max
- * constraints.
- */
- const min = minParts !== undefined && isAfter(minParts, monthsToRender[0]) ? minParts : monthsToRender[0];
- const max = maxParts !== undefined && isBefore(maxParts, lastMonth) ? maxParts : lastMonth;
- const result = getCombinedDateColumnData(locale, todayParts, min, max, this.parsedDayValues, this.parsedMonthValues);
- let items = result.items;
- const parts = result.parts;
- if (isDateEnabled) {
- items = items.map((itemObject, index) => {
- const referenceParts = parts[index];
- let disabled;
- try {
- /**
- * The `isDateEnabled` implementation is try-catch wrapped
- * to prevent exceptions in the user's function from
- * interrupting the calendar rendering.
- */
- disabled = !isDateEnabled(convertDataToISO(referenceParts));
- }
- catch (e) {
- printIonError('[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
- }
- return Object.assign(Object.assign({}, itemObject), { disabled });
- });
- }
- /**
- * If we have selected a day already, then default the column
- * to that value. Otherwise, set it to the default date.
- */
- const todayString = workingParts.day !== null
- ? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
- : `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
- return (hAsync("ion-picker-column", { "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
- const { value } = ev.detail;
- const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
- this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
- this.setActiveParts(Object.assign(Object.assign({}, activePart), findPart));
- ev.stopPropagation();
- } }, items.map((item) => (hAsync("ion-picker-column-option", { part: item.value === todayString ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: item.value, disabled: item.disabled, value: item.value }, item.text)))));
- }
- renderIndividualDatePickerColumns(forcePresentation) {
- const { workingParts, isDateEnabled } = this;
- const shouldRenderMonths = forcePresentation !== 'year' && forcePresentation !== 'time';
- const months = shouldRenderMonths
- ? getMonthColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedMonthValues)
- : [];
- const shouldRenderDays = forcePresentation === 'date';
- let days = shouldRenderDays
- ? getDayColumnData(this.locale, workingParts, this.minParts, this.maxParts, this.parsedDayValues)
- : [];
- if (isDateEnabled) {
- days = days.map((dayObject) => {
- const { value } = dayObject;
- const valueNum = typeof value === 'string' ? parseInt(value) : value;
- const referenceParts = {
- month: workingParts.month,
- day: valueNum,
- year: workingParts.year,
- };
- let disabled;
- try {
- /**
- * The `isDateEnabled` implementation is try-catch wrapped
- * to prevent exceptions in the user's function from
- * interrupting the calendar rendering.
- */
- disabled = !isDateEnabled(convertDataToISO(referenceParts));
- }
- catch (e) {
- printIonError('[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', e);
- }
- return Object.assign(Object.assign({}, dayObject), { disabled });
- });
- }
- const shouldRenderYears = forcePresentation !== 'month' && forcePresentation !== 'time';
- const years = shouldRenderYears
- ? getYearColumnData(this.locale, this.defaultParts, this.minParts, this.maxParts, this.parsedYearValues)
- : [];
- /**
- * Certain locales show the day before the month.
- */
- const showMonthFirst = isMonthFirstLocale(this.locale, { month: 'numeric', day: 'numeric' });
- let renderArray = [];
- if (showMonthFirst) {
- renderArray = [
- this.renderMonthPickerColumn(months),
- this.renderDayPickerColumn(days),
- this.renderYearPickerColumn(years),
- ];
- }
- else {
- renderArray = [
- this.renderDayPickerColumn(days),
- this.renderMonthPickerColumn(months),
- this.renderYearPickerColumn(years),
- ];
- }
- return renderArray;
- }
- renderDayPickerColumn(days) {
- var _a;
- if (days.length === 0) {
- return [];
- }
- const { disabled, workingParts } = this;
- const activePart = this.getActivePartsWithFallback();
- const pickerColumnValue = (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined;
- return (hAsync("ion-picker-column", { "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
- this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
- ev.stopPropagation();
- } }, days.map((day) => (hAsync("ion-picker-column-option", { part: day.value === pickerColumnValue ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: day.value, disabled: day.disabled, value: day.value }, day.text)))));
- }
- renderMonthPickerColumn(months) {
- if (months.length === 0) {
- return [];
- }
- const { disabled, workingParts } = this;
- const activePart = this.getActivePartsWithFallback();
- return (hAsync("ion-picker-column", { "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
- this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
- ev.stopPropagation();
- } }, months.map((month) => (hAsync("ion-picker-column-option", { part: month.value === workingParts.month ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: month.value, disabled: month.disabled, value: month.value }, month.text)))));
- }
- renderYearPickerColumn(years) {
- if (years.length === 0) {
- return [];
- }
- const { disabled, workingParts } = this;
- const activePart = this.getActivePartsWithFallback();
- return (hAsync("ion-picker-column", { "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
- this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { year: ev.detail.value }));
- ev.stopPropagation();
- } }, years.map((year) => (hAsync("ion-picker-column-option", { part: year.value === workingParts.year ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: year.value, disabled: year.disabled, value: year.value }, year.text)))));
- }
- renderTimePickerColumns(forcePresentation) {
- if (['date', 'month', 'month-year', 'year'].includes(forcePresentation)) {
- return [];
- }
- /**
- * If a user has not selected a date,
- * then we should show all times. If the
- * user has selected a date (even if it has
- * not been confirmed yet), we should apply
- * the max and min restrictions so that the
- * time picker shows values that are
- * appropriate for the selected date.
- */
- const activePart = this.getActivePart();
- const userHasSelectedDate = activePart !== undefined;
- const { hoursData, minutesData, dayPeriodData } = getTimeColumnsData(this.locale, this.workingParts, this.hourCycle, userHasSelectedDate ? this.minParts : undefined, userHasSelectedDate ? this.maxParts : undefined, this.parsedHourValues, this.parsedMinuteValues);
- return [
- this.renderHourPickerColumn(hoursData),
- this.renderMinutePickerColumn(minutesData),
- this.renderDayPeriodPickerColumn(dayPeriodData),
- ];
- }
- renderHourPickerColumn(hoursData) {
- const { disabled, workingParts } = this;
- if (hoursData.length === 0)
- return [];
- const activePart = this.getActivePartsWithFallback();
- return (hAsync("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
- this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
- this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
- ev.stopPropagation();
- } }, hoursData.map((hour) => (hAsync("ion-picker-column-option", { part: hour.value === activePart.hour ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: hour.value, disabled: hour.disabled, value: hour.value }, hour.text)))));
- }
- renderMinutePickerColumn(minutesData) {
- const { disabled, workingParts } = this;
- if (minutesData.length === 0)
- return [];
- const activePart = this.getActivePartsWithFallback();
- return (hAsync("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
- this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
- this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
- ev.stopPropagation();
- } }, minutesData.map((minute) => (hAsync("ion-picker-column-option", { part: minute.value === activePart.minute ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: minute.value, disabled: minute.disabled, value: minute.value }, minute.text)))));
- }
- renderDayPeriodPickerColumn(dayPeriodData) {
- const { disabled, workingParts } = this;
- if (dayPeriodData.length === 0) {
- return [];
- }
- const activePart = this.getActivePartsWithFallback();
- const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
- return (hAsync("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
- const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
- this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
- this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
- ev.stopPropagation();
- } }, dayPeriodData.map((dayPeriod) => (hAsync("ion-picker-column-option", { part: dayPeriod.value === activePart.ampm ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: dayPeriod.value, disabled: dayPeriod.disabled, value: dayPeriod.value }, dayPeriod.text)))));
- }
- renderWheelView(forcePresentation) {
- const { locale } = this;
- const showMonthFirst = isMonthFirstLocale(locale);
- const columnOrder = showMonthFirst ? 'month-first' : 'year-first';
- return (hAsync("div", { class: {
- [`wheel-order-${columnOrder}`]: true,
- } }, this.renderWheelPicker(forcePresentation)));
- }
- /**
- * Grid Render Methods
- */
- renderCalendarHeader(mode) {
- const { disabled } = this;
- const expandedIcon = mode === 'ios' ? chevronDown : caretUpSharp;
- const collapsedIcon = mode === 'ios' ? chevronForward : caretDownSharp;
- const prevMonthDisabled = disabled || isPrevMonthDisabled(this.workingParts, this.minParts, this.maxParts);
- const nextMonthDisabled = disabled || isNextMonthDisabled(this.workingParts, this.maxParts);
- // don't use the inheritAttributes util because it removes dir from the host, and we still need that
- const hostDir = this.el.getAttribute('dir') || undefined;
- return (hAsync("div", { class: "calendar-header" }, hAsync("div", { class: "calendar-action-buttons" }, hAsync("div", { class: "calendar-month-year" }, hAsync("button", { class: {
- 'calendar-month-year-toggle': true,
- 'ion-activatable': true,
- 'ion-focusable': true,
- }, part: "month-year-button", disabled: disabled, "aria-label": this.showMonthAndYear ? 'Hide year picker' : 'Show year picker', onClick: () => this.toggleMonthAndYearView() }, hAsync("span", { id: "toggle-wrapper" }, getMonthAndYear(this.locale, this.workingParts), hAsync("ion-icon", { "aria-hidden": "true", icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false, flipRtl: true })), mode === 'md' && hAsync("ion-ripple-effect", null))), hAsync("div", { class: "calendar-next-prev" }, hAsync("ion-buttons", null, hAsync("ion-button", { "aria-label": "Previous month", disabled: prevMonthDisabled, onClick: () => this.prevMonth() }, hAsync("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronBack, lazy: false, flipRtl: true })), hAsync("ion-button", { "aria-label": "Next month", disabled: nextMonthDisabled, onClick: () => this.nextMonth() }, hAsync("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronForward, lazy: false, flipRtl: true }))))), hAsync("div", { class: "calendar-days-of-week", "aria-hidden": "true" }, getDaysOfWeek(this.locale, mode, this.firstDayOfWeek % 7).map((d) => {
- return hAsync("div", { class: "day-of-week" }, d);
- }))));
- }
- renderMonth(month, year) {
- const { disabled, readonly } = this;
- const yearAllowed = this.parsedYearValues === undefined || this.parsedYearValues.includes(year);
- const monthAllowed = this.parsedMonthValues === undefined || this.parsedMonthValues.includes(month);
- const isCalMonthDisabled = !yearAllowed || !monthAllowed;
- const isDatetimeDisabled = disabled || readonly;
- const swipeDisabled = disabled ||
- isMonthDisabled({
- month,
- year,
- day: null,
- }, {
- // The day is not used when checking if a month is disabled.
- // Users should be able to access the min or max month, even if the
- // min/max date is out of bounds (e.g. min is set to Feb 15, Feb should not be disabled).
- minParts: Object.assign(Object.assign({}, this.minParts), { day: null }),
- maxParts: Object.assign(Object.assign({}, this.maxParts), { day: null }),
- });
- // The working month should never have swipe disabled.
- // Otherwise the CSS scroll snap will not work and the user
- // can free-scroll the calendar.
- const isWorkingMonth = this.workingParts.month === month && this.workingParts.year === year;
- const activePart = this.getActivePartsWithFallback();
- return (hAsync("div", { "aria-hidden": !isWorkingMonth ? 'true' : null, class: {
- 'calendar-month': true,
- // Prevents scroll snap swipe gestures for months outside of the min/max bounds
- 'calendar-month-disabled': !isWorkingMonth && swipeDisabled,
- } }, hAsync("div", { class: "calendar-month-grid" }, getDaysOfMonth(month, year, this.firstDayOfWeek % 7).map((dateObject, index) => {
- const { day, dayOfWeek } = dateObject;
- const { el, highlightedDates, isDateEnabled, multiple } = this;
- const referenceParts = { month, day, year };
- const isCalendarPadding = day === null;
- const { isActive, isToday, ariaLabel, ariaSelected, disabled: isDayDisabled, text, } = getCalendarDayState(this.locale, referenceParts, this.activeParts, this.todayParts, this.minParts, this.maxParts, this.parsedDayValues);
- const dateIsoString = convertDataToISO(referenceParts);
- let isCalDayDisabled = isCalMonthDisabled || isDayDisabled;
- if (!isCalDayDisabled && isDateEnabled !== undefined) {
- try {
- /**
- * The `isDateEnabled` implementation is try-catch wrapped
- * to prevent exceptions in the user's function from
- * interrupting the calendar rendering.
- */
- isCalDayDisabled = !isDateEnabled(dateIsoString);
- }
- catch (e) {
- printIonError('[ion-datetime] - Exception thrown from provided `isDateEnabled` function. Please check your function and try again.', el, e);
- }
- }
- /**
- * Some days are constrained through max & min or allowed dates
- * and also disabled because the component is readonly or disabled.
- * These need to be displayed differently.
- */
- const isCalDayConstrained = isCalDayDisabled && isDatetimeDisabled;
- const isButtonDisabled = isCalDayDisabled || isDatetimeDisabled;
- let dateStyle = undefined;
- /**
- * Custom highlight styles should not override the style for selected dates,
- * nor apply to "filler days" at the start of the grid.
- */
- if (highlightedDates !== undefined && !isActive && day !== null) {
- dateStyle = getHighlightStyles(highlightedDates, dateIsoString, el);
- }
- let dateParts = undefined;
- // "Filler days" at the beginning of the grid should not get the calendar day
- // CSS parts added to them
- if (!isCalendarPadding) {
- dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}${isCalDayDisabled ? ' disabled' : ''}`;
- }
- return (hAsync("div", { class: "calendar-day-wrapper" }, hAsync("button", {
- // We need to use !important for the inline styles here because
- // otherwise the CSS shadow parts will override these styles.
- // See https://github.com/WICG/webcomponents/issues/847
- // Both the CSS shadow parts and highlightedDates styles are
- // provided by the developer, but highlightedDates styles should
- // always take priority.
- ref: (el) => {
- if (el) {
- el.style.setProperty('color', `${dateStyle ? dateStyle.textColor : ''}`, 'important');
- el.style.setProperty('background-color', `${dateStyle ? dateStyle.backgroundColor : ''}`, 'important');
- }
- }, tabindex: "-1", "data-day": day, "data-month": month, "data-year": year, "data-index": index, "data-day-of-week": dayOfWeek, disabled: isButtonDisabled, class: {
- 'calendar-day-padding': isCalendarPadding,
- 'calendar-day': true,
- 'calendar-day-active': isActive,
- 'calendar-day-constrained': isCalDayConstrained,
- 'calendar-day-today': isToday,
- }, part: dateParts, "aria-hidden": isCalendarPadding ? 'true' : null, "aria-selected": ariaSelected, "aria-label": ariaLabel, onClick: () => {
- if (isCalendarPadding) {
- return;
- }
- this.setWorkingParts(Object.assign(Object.assign({}, this.workingParts), { month,
- day,
- year }));
- // multiple only needs date info, so we can wipe out other fields like time
- if (multiple) {
- this.setActiveParts({
- month,
- day,
- year,
- }, isActive);
- }
- else {
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { month,
- day,
- year }));
- }
- }
- }, text)));
- }))));
- }
- renderCalendarBody() {
- return (hAsync("div", { class: "calendar-body ion-focusable", ref: (el) => (this.calendarBodyRef = el), tabindex: "0" }, generateMonths(this.workingParts, this.forceRenderDate).map(({ month, year }) => {
- return this.renderMonth(month, year);
- })));
- }
- renderCalendar(mode) {
- return (hAsync("div", { class: "datetime-calendar", key: "datetime-calendar" }, this.renderCalendarHeader(mode), this.renderCalendarBody()));
- }
- renderTimeLabel() {
- const hasSlottedTimeLabel = this.el.querySelector('[slot="time-label"]') !== null;
- if (!hasSlottedTimeLabel && !this.showDefaultTimeLabel) {
- return;
- }
- return hAsync("slot", { name: "time-label" }, "Time");
- }
- renderTimeOverlay() {
- const { disabled, hourCycle, isTimePopoverOpen, locale, formatOptions } = this;
- const computedHourCycle = getHourCycle(locale, hourCycle);
- const activePart = this.getActivePartsWithFallback();
- return [
- hAsync("div", { class: "time-header" }, this.renderTimeLabel()),
- hAsync("button", { class: {
- 'time-body': true,
- 'time-body-active': isTimePopoverOpen,
- }, part: `time-button${isTimePopoverOpen ? ' active' : ''}`, "aria-expanded": "false", "aria-haspopup": "true", disabled: disabled, onClick: async (ev) => {
- const { popoverRef } = this;
- if (popoverRef) {
- this.isTimePopoverOpen = true;
- popoverRef.present(new CustomEvent('ionShadowTarget', {
- detail: {
- ionShadowTarget: ev.target,
- },
- }));
- await popoverRef.onWillDismiss();
- this.isTimePopoverOpen = false;
- }
- } }, getLocalizedTime(locale, activePart, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time)),
- hAsync("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
- /**
- * Intersection Observers do not consistently fire between Blink and Webkit
- * when toggling the visibility of the popover and trying to scroll the picker
- * column to the correct time value.
- *
- * This will correctly scroll the element position to the correct time value,
- * before the popover is fully presented.
- */
- const cols = ev.target.querySelectorAll('ion-picker-column');
- // TODO (FW-615): Potentially remove this when intersection observers are fixed in picker column
- cols.forEach((col) => col.scrollActiveItemIntoView());
- }, style: {
- '--offset-y': '-10px',
- '--min-width': 'fit-content',
- },
- // Allow native browser keyboard events to support up/down/home/end key
- // navigation within the time picker.
- keyboardEvents: true, ref: (el) => (this.popoverRef = el) }, this.renderWheelPicker('time')),
- ];
- }
- getHeaderSelectedDateText() {
- var _a;
- const { activeParts, formatOptions, multiple, titleSelectedDatesFormatter } = this;
- const isArray = Array.isArray(activeParts);
- let headerText;
- if (multiple && isArray && activeParts.length !== 1) {
- headerText = `${activeParts.length} days`; // default/fallback for multiple selection
- if (titleSelectedDatesFormatter !== undefined) {
- try {
- headerText = titleSelectedDatesFormatter(convertDataToISO(activeParts));
- }
- catch (e) {
- printIonError('[ion-datetime] - Exception in provided `titleSelectedDatesFormatter`:', e);
- }
- }
- }
- else {
- // for exactly 1 day selected (multiple set or not), show a formatted version of that
- headerText = getLocalizedDateTime(this.locale, this.getActivePartsWithFallback(), (_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _a !== void 0 ? _a : { weekday: 'short', month: 'short', day: 'numeric' });
- }
- return headerText;
- }
- renderHeader(showExpandedHeader = true) {
- const hasSlottedTitle = this.el.querySelector('[slot="title"]') !== null;
- if (!hasSlottedTitle && !this.showDefaultTitle) {
- return;
- }
- return (hAsync("div", { class: "datetime-header" }, hAsync("div", { class: "datetime-title" }, hAsync("slot", { name: "title" }, "Select Date")), showExpandedHeader && hAsync("div", { class: "datetime-selected-date" }, this.getHeaderSelectedDateText())));
- }
- /**
- * Render time picker inside of datetime.
- * Do not pass color prop to segment on
- * iOS mode. MD segment has been customized and
- * should take on the color prop, but iOS
- * should just be the default segment.
- */
- renderTime() {
- const { presentation } = this;
- const timeOnlyPresentation = presentation === 'time';
- return (hAsync("div", { class: "datetime-time" }, timeOnlyPresentation ? this.renderWheelPicker() : this.renderTimeOverlay()));
- }
- /**
- * Renders the month/year picker that is
- * displayed on the calendar grid.
- * The .datetime-year class has additional
- * styles that let us show/hide the
- * picker when the user clicks on the
- * toggle in the calendar header.
- */
- renderCalendarViewMonthYearPicker() {
- return hAsync("div", { class: "datetime-year" }, this.renderWheelView('month-year'));
- }
- /**
- * Render entry point
- * All presentation types are rendered from here.
- */
- renderDatetime(mode) {
- const { presentation, preferWheel } = this;
- /**
- * Certain presentation types have separate grid and wheel displays.
- * If preferWheel is true then we should show a wheel picker instead.
- */
- const hasWheelVariant = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
- if (preferWheel && hasWheelVariant) {
- return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
- }
- switch (presentation) {
- case 'date-time':
- return [
- this.renderHeader(),
- this.renderCalendar(mode),
- this.renderCalendarViewMonthYearPicker(),
- this.renderTime(),
- this.renderFooter(),
- ];
- case 'time-date':
- return [
- this.renderHeader(),
- this.renderTime(),
- this.renderCalendar(mode),
- this.renderCalendarViewMonthYearPicker(),
- this.renderFooter(),
- ];
- case 'time':
- return [this.renderHeader(false), this.renderTime(), this.renderFooter()];
- case 'month':
- case 'month-year':
- case 'year':
- return [this.renderHeader(false), this.renderWheelView(), this.renderFooter()];
- default:
- return [
- this.renderHeader(),
- this.renderCalendar(mode),
- this.renderCalendarViewMonthYearPicker(),
- this.renderFooter(),
- ];
- }
- }
- render() {
- const { name, value, disabled, el, color, readonly, showMonthAndYear, preferWheel, presentation, size, isGridStyle, } = this;
- const mode = getIonMode$1(this);
- const isMonthAndYearPresentation = presentation === 'year' || presentation === 'month' || presentation === 'month-year';
- const shouldShowMonthAndYear = showMonthAndYear || isMonthAndYearPresentation;
- const monthYearPickerOpen = showMonthAndYear && !isMonthAndYearPresentation;
- const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
- const hasWheelVariant = hasDatePresentation && preferWheel;
- renderHiddenInput(true, el, name, formatValue(value), disabled);
- return (hAsync(Host, { key: 'c3dfea8f46fcbcef38eb9e8a69b1b46a4e4b82fd', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses$1(color, {
- [mode]: true,
- ['datetime-readonly']: readonly,
- ['datetime-disabled']: disabled,
- 'show-month-and-year': shouldShowMonthAndYear,
- 'month-year-picker-open': monthYearPickerOpen,
- [`datetime-presentation-${presentation}`]: true,
- [`datetime-size-${size}`]: true,
- [`datetime-prefer-wheel`]: hasWheelVariant,
- [`datetime-grid`]: isGridStyle,
- })) }, hAsync("div", { key: '75c91243cf6a51f44b83d7cf7d8c0c96bfd3c83f', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "formatOptions": ["formatOptionsChanged"],
- "disabled": ["disabledChanged"],
- "min": ["minChanged"],
- "max": ["maxChanged"],
- "presentation": ["presentationChanged"],
- "yearValues": ["yearValuesChanged"],
- "monthValues": ["monthValuesChanged"],
- "dayValues": ["dayValuesChanged"],
- "hourValues": ["hourValuesChanged"],
- "minuteValues": ["minuteValuesChanged"],
- "value": ["valueChanged"]
- }; }
- static get style() { return {
- ios: IonDatetimeIosStyle0,
- md: IonDatetimeMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-datetime",
- "$members$": {
- "color": [1],
- "name": [1],
- "disabled": [4],
- "formatOptions": [16],
- "readonly": [4],
- "isDateEnabled": [16],
- "min": [1025],
- "max": [1025],
- "presentation": [1],
- "cancelText": [1, "cancel-text"],
- "doneText": [1, "done-text"],
- "clearText": [1, "clear-text"],
- "yearValues": [8, "year-values"],
- "monthValues": [8, "month-values"],
- "dayValues": [8, "day-values"],
- "hourValues": [8, "hour-values"],
- "minuteValues": [8, "minute-values"],
- "locale": [1],
- "firstDayOfWeek": [2, "first-day-of-week"],
- "titleSelectedDatesFormatter": [16],
- "multiple": [4],
- "highlightedDates": [16],
- "value": [1025],
- "showDefaultTitle": [4, "show-default-title"],
- "showDefaultButtons": [4, "show-default-buttons"],
- "showClearButton": [4, "show-clear-button"],
- "showDefaultTimeLabel": [4, "show-default-time-label"],
- "hourCycle": [1, "hour-cycle"],
- "size": [1],
- "preferWheel": [4, "prefer-wheel"],
- "showMonthAndYear": [32],
- "activeParts": [32],
- "workingParts": [32],
- "isTimePopoverOpen": [32],
- "forceRenderDate": [32],
- "confirm": [64],
- "reset": [64],
- "cancel": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- let datetimeIds = 0;
- const CANCEL_ROLE = 'datetime-cancel';
- const CONFIRM_ROLE = 'datetime-confirm';
- const WHEEL_ITEM_PART = 'wheel-item';
- const WHEEL_ITEM_ACTIVE_PART = `active`;
- const datetimeButtonIosCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}:host button{-webkit-padding-start:13px;padding-inline-start:13px;-webkit-padding-end:13px;padding-inline-end:13px;padding-top:7px;padding-bottom:7px}:host button.ion-activated{color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}";
- var IonDatetimeButtonIosStyle0 = datetimeButtonIosCss;
- const datetimeButtonMdCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}:host button{-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px}";
- var IonDatetimeButtonMdStyle0 = datetimeButtonMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot date-target - Content displayed inside of the date button.
- * @slot time-target - Content displayed inside of the time button.
- *
- * @part native - The native HTML button that wraps the slotted text.
- */
- class DatetimeButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.datetimeEl = null;
- this.overlayEl = null;
- /**
- * Accepts one or more string values and converts
- * them to DatetimeParts. This is done so datetime-button
- * can work with an array internally and not need
- * to keep checking if the datetime value is `string` or `string[]`.
- */
- this.getParsedDateValues = (value) => {
- if (value === undefined || value === null) {
- return [];
- }
- if (Array.isArray(value)) {
- return value;
- }
- return [value];
- };
- /**
- * Check the value property on the linked
- * ion-datetime and then format it according
- * to the locale specified on ion-datetime.
- */
- this.setDateTimeText = () => {
- var _a, _b, _c, _d, _e;
- const { datetimeEl, datetimePresentation } = this;
- if (!datetimeEl) {
- return;
- }
- const { value, locale, formatOptions, hourCycle, preferWheel, multiple, titleSelectedDatesFormatter } = datetimeEl;
- const parsedValues = this.getParsedDateValues(value);
- /**
- * Both ion-datetime and ion-datetime-button default
- * to today's date and time if no value is set.
- */
- const parsedDatetimes = parseDate(parsedValues.length > 0 ? parsedValues : [getToday()]);
- if (!parsedDatetimes) {
- return;
- }
- /**
- * If developers incorrectly use multiple="true"
- * with non "date" datetimes, then just select
- * the first value so the interface does
- * not appear broken. Datetime will provide a
- * warning in the console.
- */
- const firstParsedDatetime = parsedDatetimes[0];
- const computedHourCycle = getHourCycle(locale, hourCycle);
- this.dateText = this.timeText = undefined;
- switch (datetimePresentation) {
- case 'date-time':
- case 'time-date':
- const dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _a !== void 0 ? _a : { month: 'short', day: 'numeric', year: 'numeric' });
- const timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time);
- if (preferWheel) {
- this.dateText = `${dateText} ${timeText}`;
- }
- else {
- this.dateText = dateText;
- this.timeText = timeText;
- }
- break;
- case 'date':
- if (multiple && parsedValues.length !== 1) {
- let headerText = `${parsedValues.length} days`; // default/fallback for multiple selection
- if (titleSelectedDatesFormatter !== undefined) {
- try {
- headerText = titleSelectedDatesFormatter(parsedValues);
- }
- catch (e) {
- printIonError('[ion-datetime-button] - Exception in provided `titleSelectedDatesFormatter`:', e);
- }
- }
- this.dateText = headerText;
- }
- else {
- this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _b !== void 0 ? _b : { month: 'short', day: 'numeric', year: 'numeric' });
- }
- break;
- case 'time':
- this.timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time);
- break;
- case 'month-year':
- this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _c !== void 0 ? _c : { month: 'long', year: 'numeric' });
- break;
- case 'month':
- this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) !== null && _d !== void 0 ? _d : { month: 'long' });
- break;
- case 'year':
- this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_e = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) !== null && _e !== void 0 ? _e : { year: 'numeric' });
- break;
- }
- };
- /**
- * Waits for the ion-datetime to re-render.
- * This is needed in order to correctly position
- * a popover relative to the trigger element.
- */
- this.waitForDatetimeChanges = async () => {
- const { datetimeEl } = this;
- if (!datetimeEl) {
- return Promise.resolve();
- }
- return new Promise((resolve) => {
- addEventListener$1(datetimeEl, 'ionRender', resolve, { once: true });
- });
- };
- this.handleDateClick = async (ev) => {
- const { datetimeEl, datetimePresentation } = this;
- if (!datetimeEl) {
- return;
- }
- let needsPresentationChange = false;
- /**
- * When clicking the date button,
- * we need to make sure that only a date
- * picker is displayed. For presentation styles
- * that display content other than a date picker,
- * we need to update the presentation style.
- */
- switch (datetimePresentation) {
- case 'date-time':
- case 'time-date':
- const needsChange = datetimeEl.presentation !== 'date';
- /**
- * The date+time wheel picker
- * shows date and time together,
- * so do not adjust the presentation
- * in that case.
- */
- if (!datetimeEl.preferWheel && needsChange) {
- datetimeEl.presentation = 'date';
- needsPresentationChange = true;
- }
- break;
- }
- /**
- * Track which button was clicked
- * so that it can have the correct
- * activated styles applied when
- * the modal/popover containing
- * the datetime is opened.
- */
- this.selectedButton = 'date';
- this.presentOverlay(ev, needsPresentationChange, this.dateTargetEl);
- };
- this.handleTimeClick = (ev) => {
- const { datetimeEl, datetimePresentation } = this;
- if (!datetimeEl) {
- return;
- }
- let needsPresentationChange = false;
- /**
- * When clicking the time button,
- * we need to make sure that only a time
- * picker is displayed. For presentation styles
- * that display content other than a time picker,
- * we need to update the presentation style.
- */
- switch (datetimePresentation) {
- case 'date-time':
- case 'time-date':
- const needsChange = datetimeEl.presentation !== 'time';
- if (needsChange) {
- datetimeEl.presentation = 'time';
- needsPresentationChange = true;
- }
- break;
- }
- /**
- * Track which button was clicked
- * so that it can have the correct
- * activated styles applied when
- * the modal/popover containing
- * the datetime is opened.
- */
- this.selectedButton = 'time';
- this.presentOverlay(ev, needsPresentationChange, this.timeTargetEl);
- };
- /**
- * If the datetime is presented in an
- * overlay, the datetime and overlay
- * should be appropriately sized.
- * These classes provide default sizing values
- * that developers can customize.
- * The goal is to provide an overlay that is
- * reasonably sized with a datetime that
- * fills the entire container.
- */
- this.presentOverlay = async (ev, needsPresentationChange, triggerEl) => {
- const { overlayEl } = this;
- if (!overlayEl) {
- return;
- }
- if (overlayEl.tagName === 'ION-POPOVER') {
- /**
- * When the presentation on datetime changes,
- * we need to wait for the component to re-render
- * otherwise the computed width/height of the
- * popover content will be wrong, causing
- * the popover to not align with the trigger element.
- */
- if (needsPresentationChange) {
- await this.waitForDatetimeChanges();
- }
- /**
- * We pass the trigger button element
- * so that the popover aligns with the individual
- * button that was clicked, not the component container.
- */
- overlayEl.present(Object.assign(Object.assign({}, ev), { detail: {
- ionShadowTarget: triggerEl,
- } }));
- }
- else {
- overlayEl.present();
- }
- };
- this.datetimePresentation = 'date-time';
- this.dateText = undefined;
- this.timeText = undefined;
- this.datetimeActive = false;
- this.selectedButton = undefined;
- this.color = 'primary';
- this.disabled = false;
- this.datetime = undefined;
- }
- async componentWillLoad() {
- const { datetime } = this;
- if (!datetime) {
- printIonError('[ion-datetime-button] - An ID associated with an ion-datetime instance is required to function properly.', this.el);
- return;
- }
- const datetimeEl = (this.datetimeEl = document.getElementById(datetime));
- if (!datetimeEl) {
- printIonError(`[ion-datetime-button] - No ion-datetime instance found for ID '${datetime}'.`, this.el);
- return;
- }
- /**
- * The element reference must be an ion-datetime. Print an error
- * if a non-datetime element was provided.
- */
- if (datetimeEl.tagName !== 'ION-DATETIME') {
- printIonError(`[ion-datetime-button] - Expected an ion-datetime instance for ID '${datetime}' but received '${datetimeEl.tagName.toLowerCase()}' instead.`, datetimeEl);
- return;
- }
- /**
- * Since the datetime can be used in any context (overlays, accordion, etc)
- * we track when it is visible to determine when it is active.
- * This informs which button is highlighted as well as the
- * aria-expanded state.
- */
- const io = new IntersectionObserver((entries) => {
- const ev = entries[0];
- this.datetimeActive = ev.isIntersecting;
- }, {
- threshold: 0.01,
- });
- io.observe(datetimeEl);
- /**
- * Get a reference to any modal/popover
- * the datetime is being used in so we can
- * correctly size it when it is presented.
- */
- const overlayEl = (this.overlayEl = datetimeEl.closest('ion-modal, ion-popover'));
- /**
- * The .ion-datetime-button-overlay class contains
- * styles that allow any modal/popover to be
- * sized according to the dimensions of the datetime.
- * If developers want a smaller/larger overlay all they need
- * to do is change the width/height of the datetime.
- * Additionally, this lets us avoid having to set
- * explicit widths on each variant of datetime.
- */
- if (overlayEl) {
- overlayEl.classList.add('ion-datetime-button-overlay');
- }
- componentOnReady(datetimeEl, () => {
- const datetimePresentation = (this.datetimePresentation = datetimeEl.presentation || 'date-time');
- /**
- * Set the initial display
- * in the rendered buttons.
- *
- * From there, we need to listen
- * for ionChange to be emitted
- * from datetime so we know when
- * to re-render the displayed
- * text in the buttons.
- */
- this.setDateTimeText();
- addEventListener$1(datetimeEl, 'ionValueChange', this.setDateTimeText);
- /**
- * Configure the initial selected button
- * in the event that the datetime is displayed
- * without clicking one of the datetime buttons.
- * For example, a datetime could be expanded
- * in an accordion. In this case users only
- * need to click the accordion header to show
- * the datetime.
- */
- switch (datetimePresentation) {
- case 'date-time':
- case 'date':
- case 'month-year':
- case 'month':
- case 'year':
- this.selectedButton = 'date';
- break;
- case 'time-date':
- case 'time':
- this.selectedButton = 'time';
- break;
- }
- });
- }
- render() {
- const { color, dateText, timeText, selectedButton, datetimeActive, disabled } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '11d037e6ab061e5116842970760b04850b42f2c7', class: createColorClasses$1(color, {
- [mode]: true,
- [`${selectedButton}-active`]: datetimeActive,
- ['datetime-button-disabled']: disabled,
- }) }, dateText && (hAsync("button", { key: '08ecb62da0fcbf7466a1f2403276712a3ff17fbc', class: "ion-activatable", id: "date-button", "aria-expanded": datetimeActive ? 'true' : 'false', onClick: this.handleDateClick, disabled: disabled, part: "native", ref: (el) => (this.dateTargetEl = el) }, hAsync("slot", { key: '1c04853d4d23c0f1a594602bde44511c98355644', name: "date-target" }, dateText), mode === 'md' && hAsync("ion-ripple-effect", { key: '5fc566cd4bc885bcf983ce99e3dc65d7f485bf9b' }))), timeText && (hAsync("button", { key: 'c9c5c34ac338badf8659da22bea5829d62c51169', class: "ion-activatable", id: "time-button", "aria-expanded": datetimeActive ? 'true' : 'false', onClick: this.handleTimeClick, disabled: disabled, part: "native", ref: (el) => (this.timeTargetEl = el) }, hAsync("slot", { key: '147a9d2069dbf737f6fc64787823d6d5af5aa653', name: "time-target" }, timeText), mode === 'md' && hAsync("ion-ripple-effect", { key: '70a5e25b75ed90ac6bba003468435f67aa9d8f0a' })))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonDatetimeButtonIosStyle0,
- md: IonDatetimeButtonMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-datetime-button",
- "$members$": {
- "color": [513],
- "disabled": [516],
- "datetime": [1],
- "datetimePresentation": [32],
- "dateText": [32],
- "timeText": [32],
- "datetimeActive": [32],
- "selectedButton": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"], ["disabled", "disabled"]]
- }; }
- }
- const fabCss = ":host{position:absolute;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;z-index:999}:host(.fab-horizontal-center){left:0px;right:0px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}:host(.fab-horizontal-start){left:calc(10px + var(--ion-safe-area-left, 0px));}:host-context([dir=rtl]):host(.fab-horizontal-start),:host-context([dir=rtl]).fab-horizontal-start{right:calc(10px + var(--ion-safe-area-right, 0px));left:unset}@supports selector(:dir(rtl)){:host(.fab-horizontal-start:dir(rtl)){right:calc(10px + var(--ion-safe-area-right, 0px));left:unset}}:host(.fab-horizontal-end){right:calc(10px + var(--ion-safe-area-right, 0px));}:host-context([dir=rtl]):host(.fab-horizontal-end),:host-context([dir=rtl]).fab-horizontal-end{left:calc(10px + var(--ion-safe-area-left, 0px));right:unset}@supports selector(:dir(rtl)){:host(.fab-horizontal-end:dir(rtl)){left:calc(10px + var(--ion-safe-area-left, 0px));right:unset}}:host(.fab-vertical-top){top:10px}:host(.fab-vertical-top.fab-edge){top:0}:host(.fab-vertical-top.fab-edge) ::slotted(ion-fab-button){margin-top:-50%}:host(.fab-vertical-top.fab-edge) ::slotted(ion-fab-button.fab-button-small){margin-top:calc((-100% + 16px) / 2)}:host(.fab-vertical-top.fab-edge) ::slotted(ion-fab-list.fab-list-side-start),:host(.fab-vertical-top.fab-edge) ::slotted(ion-fab-list.fab-list-side-end){margin-top:-50%}:host(.fab-vertical-top.fab-edge) ::slotted(ion-fab-list.fab-list-side-top),:host(.fab-vertical-top.fab-edge) ::slotted(ion-fab-list.fab-list-side-bottom){margin-top:calc(50% + 10px)}:host(.fab-vertical-bottom){bottom:10px}:host(.fab-vertical-bottom.fab-edge){bottom:0}:host(.fab-vertical-bottom.fab-edge) ::slotted(ion-fab-button){margin-bottom:-50%}:host(.fab-vertical-bottom.fab-edge) ::slotted(ion-fab-button.fab-button-small){margin-bottom:calc((-100% + 16px) / 2)}:host(.fab-vertical-bottom.fab-edge) ::slotted(ion-fab-list.fab-list-side-start),:host(.fab-vertical-bottom.fab-edge) ::slotted(ion-fab-list.fab-list-side-end){margin-bottom:-50%}:host(.fab-vertical-bottom.fab-edge) ::slotted(ion-fab-list.fab-list-side-top),:host(.fab-vertical-bottom.fab-edge) ::slotted(ion-fab-list.fab-list-side-bottom){margin-bottom:calc(50% + 10px)}:host(.fab-vertical-center){top:0px;bottom:0px;margin-top:auto;margin-bottom:auto}";
- var IonFabStyle0 = fabCss;
- class Fab {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.horizontal = undefined;
- this.vertical = undefined;
- this.edge = false;
- this.activated = false;
- }
- activatedChanged() {
- const activated = this.activated;
- const fab = this.getFab();
- if (fab) {
- fab.activated = activated;
- }
- Array.from(this.el.querySelectorAll('ion-fab-list')).forEach((list) => {
- list.activated = activated;
- });
- }
- componentDidLoad() {
- if (this.activated) {
- this.activatedChanged();
- }
- }
- /**
- * Close an active FAB list container.
- */
- async close() {
- this.activated = false;
- }
- getFab() {
- return this.el.querySelector('ion-fab-button');
- }
- /**
- * Opens/Closes the FAB list container.
- * @internal
- */
- async toggle() {
- const hasList = !!this.el.querySelector('ion-fab-list');
- if (hasList) {
- this.activated = !this.activated;
- }
- }
- render() {
- const { horizontal, vertical, edge } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '8a310806d0e748d7ebb0ed3d9a2652038e0f2960', class: {
- [mode]: true,
- [`fab-horizontal-${horizontal}`]: horizontal !== undefined,
- [`fab-vertical-${vertical}`]: vertical !== undefined,
- 'fab-edge': edge,
- } }, hAsync("slot", { key: '9394ef6d6e5b0410fa6ba212171f687fb178ce2d' })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "activated": ["activatedChanged"]
- }; }
- static get style() { return IonFabStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-fab",
- "$members$": {
- "horizontal": [1],
- "vertical": [1],
- "edge": [4],
- "activated": [1028],
- "close": [64],
- "toggle": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const fabButtonIosCss = ":host{--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--background-hover:var(--ion-color-primary-contrast, #fff);--background-hover-opacity:.08;--transition:background-color, opacity 100ms linear;--ripple-color:currentColor;--border-radius:50%;--border-width:0;--border-style:none;--border-color:initial;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:56px;height:56px;font-size:14px;text-align:center;text-overflow:ellipsis;text-transform:none;white-space:nowrap;-webkit-font-kerning:none;font-kerning:none}.button-native{border-radius:var(--border-radius);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;-webkit-transform:var(--transform);transform:var(--transform);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);background-clip:padding-box;color:var(--color);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);contain:strict;cursor:pointer;overflow:hidden;z-index:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box}::slotted(ion-icon){line-height:1}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.button-inner{left:0;right:0;top:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-transition:all ease-in-out 300ms;transition:all ease-in-out 300ms;-webkit-transition-property:opacity, -webkit-transform;transition-property:opacity, -webkit-transform;transition-property:transform, opacity;transition-property:transform, opacity, -webkit-transform;z-index:1}:host(.fab-button-disabled){cursor:default;opacity:0.5;pointer-events:none}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-activated) .button-native{color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}::slotted(ion-icon){line-height:1}:host(.fab-button-small){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px;margin-bottom:8px;width:40px;height:40px}.close-icon{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;left:0;right:0;top:0;position:absolute;height:100%;-webkit-transform:scale(0.4) rotateZ(-45deg);transform:scale(0.4) rotateZ(-45deg);-webkit-transition:all ease-in-out 300ms;transition:all ease-in-out 300ms;-webkit-transition-property:opacity, -webkit-transform;transition-property:opacity, -webkit-transform;transition-property:transform, opacity;transition-property:transform, opacity, -webkit-transform;font-size:var(--close-icon-font-size);opacity:0;z-index:1}:host(.fab-button-close-active) .close-icon{-webkit-transform:scale(1) rotateZ(0deg);transform:scale(1) rotateZ(0deg);opacity:1}:host(.fab-button-close-active) .button-inner{-webkit-transform:scale(0.4) rotateZ(45deg);transform:scale(0.4) rotateZ(45deg);opacity:0}ion-ripple-effect{color:var(--ripple-color)}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.fab-button-translucent) .button-native{-webkit-backdrop-filter:var(--backdrop-filter);backdrop-filter:var(--backdrop-filter)}}:host(.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{--background:var(--ion-color-primary, #0054e9);--background-activated:var(--ion-color-primary-shade, #004acd);--background-focused:var(--ion-color-primary-shade, #004acd);--background-hover:var(--ion-color-primary-tint, #1a65eb);--background-activated-opacity:1;--background-focused-opacity:1;--background-hover-opacity:1;--color:var(--ion-color-primary-contrast, #fff);--box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);--transition:0.2s transform cubic-bezier(0.25, 1.11, 0.78, 1.59);--close-icon-font-size:28px}:host(.ion-activated){--box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);--transform:scale(1.1);--transition:0.2s transform ease-out}::slotted(ion-icon){font-size:28px}:host(.fab-button-in-list){--background:var(--ion-color-light, #f4f5f8);--background-activated:var(--ion-color-light-shade, #d7d8da);--background-focused:var(--background-activated);--background-hover:var(--ion-color-light-tint, #f5f6f9);--color:var(--ion-color-light-contrast, #000);--color-activated:var(--ion-color-light-contrast, #000);--color-focused:var(--color-activated);--transition:transform 200ms ease 10ms, opacity 200ms ease 10ms}:host(.fab-button-in-list) ::slotted(ion-icon){font-size:18px}:host(.ion-color.ion-focused) .button-native::after{background:var(--ion-color-shade)}:host(.ion-color.ion-focused) .button-native,:host(.ion-color.ion-activated) .button-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .button-native::after,:host(.ion-color.ion-activated) .button-native::after{background:var(--ion-color-shade)}@media (any-hover: hover){:host(.ion-color:hover) .button-native{color:var(--ion-color-contrast)}:host(.ion-color:hover) .button-native::after{background:var(--ion-color-tint)}}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.fab-button-translucent){--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.9);--background-hover:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.8);--background-focused:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.82);--backdrop-filter:saturate(180%) blur(20px)}:host(.fab-button-translucent-in-list){--background:rgba(var(--ion-color-light-rgb, 244, 245, 248), 0.9);--background-hover:rgba(var(--ion-color-light-rgb, 244, 245, 248), 0.8);--background-focused:rgba(var(--ion-color-light-rgb, 244, 245, 248), 0.82)}}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){@media (any-hover: hover){:host(.fab-button-translucent.ion-color:hover) .button-native{background:rgba(var(--ion-color-base-rgb), 0.8)}}:host(.ion-color.fab-button-translucent) .button-native{background:rgba(var(--ion-color-base-rgb), 0.9)}:host(.ion-color.ion-focused.fab-button-translucent) .button-native,:host(.ion-color.ion-activated.fab-button-translucent) .button-native{background:var(--ion-color-base)}}";
- var IonFabButtonIosStyle0 = fabButtonIosCss;
- const fabButtonMdCss = ":host{--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--background-hover:var(--ion-color-primary-contrast, #fff);--background-hover-opacity:.08;--transition:background-color, opacity 100ms linear;--ripple-color:currentColor;--border-radius:50%;--border-width:0;--border-style:none;--border-color:initial;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:56px;height:56px;font-size:14px;text-align:center;text-overflow:ellipsis;text-transform:none;white-space:nowrap;-webkit-font-kerning:none;font-kerning:none}.button-native{border-radius:var(--border-radius);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;-webkit-transform:var(--transform);transform:var(--transform);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);background-clip:padding-box;color:var(--color);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);contain:strict;cursor:pointer;overflow:hidden;z-index:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box}::slotted(ion-icon){line-height:1}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.button-inner{left:0;right:0;top:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-transition:all ease-in-out 300ms;transition:all ease-in-out 300ms;-webkit-transition-property:opacity, -webkit-transform;transition-property:opacity, -webkit-transform;transition-property:transform, opacity;transition-property:transform, opacity, -webkit-transform;z-index:1}:host(.fab-button-disabled){cursor:default;opacity:0.5;pointer-events:none}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-activated) .button-native{color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}::slotted(ion-icon){line-height:1}:host(.fab-button-small){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px;margin-bottom:8px;width:40px;height:40px}.close-icon{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;left:0;right:0;top:0;position:absolute;height:100%;-webkit-transform:scale(0.4) rotateZ(-45deg);transform:scale(0.4) rotateZ(-45deg);-webkit-transition:all ease-in-out 300ms;transition:all ease-in-out 300ms;-webkit-transition-property:opacity, -webkit-transform;transition-property:opacity, -webkit-transform;transition-property:transform, opacity;transition-property:transform, opacity, -webkit-transform;font-size:var(--close-icon-font-size);opacity:0;z-index:1}:host(.fab-button-close-active) .close-icon{-webkit-transform:scale(1) rotateZ(0deg);transform:scale(1) rotateZ(0deg);opacity:1}:host(.fab-button-close-active) .button-inner{-webkit-transform:scale(0.4) rotateZ(45deg);transform:scale(0.4) rotateZ(45deg);opacity:0}ion-ripple-effect{color:var(--ripple-color)}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.fab-button-translucent) .button-native{-webkit-backdrop-filter:var(--backdrop-filter);backdrop-filter:var(--backdrop-filter)}}:host(.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{--background:var(--ion-color-primary, #0054e9);--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--background-activated-opacity:0;--background-focused-opacity:.24;--background-hover-opacity:.08;--color:var(--ion-color-primary-contrast, #fff);--box-shadow:0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);--transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1), background-color 280ms cubic-bezier(0.4, 0, 0.2, 1), color 280ms cubic-bezier(0.4, 0, 0.2, 1), opacity 15ms linear 30ms, transform 270ms cubic-bezier(0, 0, 0.2, 1) 0ms;--close-icon-font-size:24px}:host(.ion-activated){--box-shadow:0 7px 8px -4px rgba(0, 0, 0, 0.2), 0 12px 17px 2px rgba(0, 0, 0, 0.14), 0 5px 22px 4px rgba(0, 0, 0, 0.12)}::slotted(ion-icon){font-size:24px}:host(.fab-button-in-list){--color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);--color-activated:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);--color-focused:var(--color-activated);--background:var(--ion-color-light, #f4f5f8);--background-activated:transparent;--background-focused:var(--ion-color-light-shade, #d7d8da);--background-hover:var(--ion-color-light-tint, #f5f6f9)}:host(.fab-button-in-list) ::slotted(ion-icon){font-size:18px}:host(.ion-color.ion-focused) .button-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .button-native::after{background:var(--ion-color-contrast)}:host(.ion-color.ion-activated) .button-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activated) .button-native::after{background:transparent}@media (any-hover: hover){:host(.ion-color:hover) .button-native{color:var(--ion-color-contrast)}:host(.ion-color:hover) .button-native::after{background:var(--ion-color-contrast)}}";
- var IonFabButtonMdStyle0 = fabButtonMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part native - The native HTML button or anchor element that wraps all child elements.
- * @part close-icon - The close icon that is displayed when a fab list opens (uses ion-icon).
- */
- class FabButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.fab = null;
- this.inheritedAttributes = {};
- this.onFocus = () => {
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.ionBlur.emit();
- };
- this.onClick = () => {
- const { fab } = this;
- if (!fab) {
- return;
- }
- fab.toggle();
- };
- this.color = undefined;
- this.activated = false;
- this.disabled = false;
- this.download = undefined;
- this.href = undefined;
- this.rel = undefined;
- this.routerDirection = 'forward';
- this.routerAnimation = undefined;
- this.target = undefined;
- this.show = false;
- this.translucent = false;
- this.type = 'button';
- this.size = undefined;
- this.closeIcon = close;
- }
- connectedCallback() {
- this.fab = this.el.closest('ion-fab');
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- }
- render() {
- const { el, disabled, color, href, activated, show, translucent, size, inheritedAttributes } = this;
- const inList = hostContext('ion-fab-list', el);
- const mode = getIonMode$1(this);
- const TagType = href === undefined ? 'button' : 'a';
- const attrs = TagType === 'button'
- ? { type: this.type }
- : {
- download: this.download,
- href,
- rel: this.rel,
- target: this.target,
- };
- return (hAsync(Host, { key: '4eee204d20b0e2ffed49a88f6cb3e04b6697965c', onClick: this.onClick, "aria-disabled": disabled ? 'true' : null, class: createColorClasses$1(color, {
- [mode]: true,
- 'fab-button-in-list': inList,
- 'fab-button-translucent-in-list': inList && translucent,
- 'fab-button-close-active': activated,
- 'fab-button-show': show,
- 'fab-button-disabled': disabled,
- 'fab-button-translucent': translucent,
- 'ion-activatable': true,
- 'ion-focusable': true,
- [`fab-button-${size}`]: size !== undefined,
- }) }, hAsync(TagType, Object.assign({ key: '914561622c0c6bd41453e828a7d8a39f924875ac' }, attrs, { class: "button-native", part: "native", disabled: disabled, onFocus: this.onFocus, onBlur: this.onBlur, onClick: (ev) => openURL(href, ev, this.routerDirection, this.routerAnimation) }, inheritedAttributes), hAsync("ion-icon", { key: '2c8090742a64c62a79243667027a195cca9d5912', "aria-hidden": "true", icon: this.closeIcon, part: "close-icon", class: "close-icon", lazy: false }), hAsync("span", { key: 'c3e55291e4c4d306d34a4b95dd2e727e87bdf39c', class: "button-inner" }, hAsync("slot", { key: 'f8e57f71d8f8878d9746cfece82f57f19ef9e988' })), mode === 'md' && hAsync("ion-ripple-effect", { key: 'a5e94fa0bb9836072300617245ed0c1b4887bac6' }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonFabButtonIosStyle0,
- md: IonFabButtonMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-fab-button",
- "$members$": {
- "color": [513],
- "activated": [4],
- "disabled": [4],
- "download": [1],
- "href": [1],
- "rel": [1],
- "routerDirection": [1, "router-direction"],
- "routerAnimation": [16],
- "target": [1],
- "show": [4],
- "translucent": [4],
- "type": [1],
- "size": [1],
- "closeIcon": [1, "close-icon"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const fabListCss = ":host{margin-left:0;margin-right:0;margin-top:calc(100% + 10px);margin-bottom:calc(100% + 10px);display:none;position:absolute;top:0;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;min-width:56px;min-height:56px}:host(.fab-list-active){display:-ms-flexbox;display:flex}::slotted(.fab-button-in-list){margin-left:0;margin-right:0;margin-top:8px;margin-bottom:8px;width:40px;height:40px;-webkit-transform:scale(0);transform:scale(0);opacity:0;visibility:hidden}:host(.fab-list-side-top) ::slotted(.fab-button-in-list),:host(.fab-list-side-bottom) ::slotted(.fab-button-in-list){margin-left:0;margin-right:0;margin-top:5px;margin-bottom:5px}:host(.fab-list-side-start) ::slotted(.fab-button-in-list),:host(.fab-list-side-end) ::slotted(.fab-button-in-list){-webkit-margin-start:5px;margin-inline-start:5px;-webkit-margin-end:5px;margin-inline-end:5px;margin-top:0;margin-bottom:0}::slotted(.fab-button-in-list.fab-button-show){-webkit-transform:scale(1);transform:scale(1);opacity:1;visibility:visible}:host(.fab-list-side-top){top:auto;bottom:0;-ms-flex-direction:column-reverse;flex-direction:column-reverse}:host(.fab-list-side-start){-webkit-margin-start:calc(100% + 10px);margin-inline-start:calc(100% + 10px);-webkit-margin-end:calc(100% + 10px);margin-inline-end:calc(100% + 10px);margin-top:0;margin-bottom:0;-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.fab-list-side-start){inset-inline-end:0}:host(.fab-list-side-end){-webkit-margin-start:calc(100% + 10px);margin-inline-start:calc(100% + 10px);-webkit-margin-end:calc(100% + 10px);margin-inline-end:calc(100% + 10px);margin-top:0;margin-bottom:0;-ms-flex-direction:row;flex-direction:row}:host(.fab-list-side-end){inset-inline-start:0}";
- var IonFabListStyle0 = fabListCss;
- class FabList {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.activated = false;
- this.side = 'bottom';
- }
- activatedChanged(activated) {
- const fabs = Array.from(this.el.querySelectorAll('ion-fab-button'));
- // if showing the fabs add a timeout, else show immediately
- const timeout = activated ? 30 : 0;
- fabs.forEach((fab, i) => {
- setTimeout(() => (fab.show = activated), i * timeout);
- });
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '64b33366447f66c7f979cfac56307fbb1a6fac1c', class: {
- [mode]: true,
- 'fab-list-active': this.activated,
- [`fab-list-side-${this.side}`]: true,
- } }, hAsync("slot", { key: 'd9f474f7f20fd7e813db358fddc720534ca05bb6' })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "activated": ["activatedChanged"]
- }; }
- static get style() { return IonFabListStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-fab-list",
- "$members$": {
- "activated": [4],
- "side": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const ION_CONTENT_TAG_NAME = 'ION-CONTENT';
- const ION_CONTENT_ELEMENT_SELECTOR = 'ion-content';
- const ION_CONTENT_CLASS_SELECTOR = '.ion-content-scroll-host';
- /**
- * Selector used for implementations reliant on `<ion-content>` for scroll event changes.
- *
- * Developers should use the `.ion-content-scroll-host` selector to target the element emitting
- * scroll events. With virtual scroll implementations this will be the host element for
- * the scroll viewport.
- */
- const ION_CONTENT_SELECTOR = `${ION_CONTENT_ELEMENT_SELECTOR}, ${ION_CONTENT_CLASS_SELECTOR}`;
- const isIonContent = (el) => el.tagName === ION_CONTENT_TAG_NAME;
- /**
- * Waits for the element host fully initialize before
- * returning the inner scroll element.
- *
- * For `ion-content` the scroll target will be the result
- * of the `getScrollElement` function.
- *
- * For custom implementations it will be the element host
- * or a selector within the host, if supplied through `scrollTarget`.
- */
- const getScrollElement = async (el) => {
- if (isIonContent(el)) {
- await new Promise((resolve) => componentOnReady(el, resolve));
- return el.getScrollElement();
- }
- return el;
- };
- /**
- * Queries the element matching the selector for IonContent.
- * See ION_CONTENT_SELECTOR for the selector used.
- */
- const findIonContent = (el) => {
- /**
- * First we try to query the custom scroll host selector in cases where
- * the implementation is using an outer `ion-content` with an inner custom
- * scroll container.
- */
- const customContentHost = el.querySelector(ION_CONTENT_CLASS_SELECTOR);
- if (customContentHost) {
- return customContentHost;
- }
- return el.querySelector(ION_CONTENT_SELECTOR);
- };
- /**
- * Queries the closest element matching the selector for IonContent.
- */
- const findClosestIonContent = (el) => {
- return el.closest(ION_CONTENT_SELECTOR);
- };
- /**
- * Prints an error informing developers that an implementation requires an element to be used
- * within either the `ion-content` selector or the `.ion-content-scroll-host` class.
- */
- const printIonContentErrorMsg = (el) => {
- return printRequiredElementError(el, ION_CONTENT_ELEMENT_SELECTOR);
- };
- /**
- * Several components in Ionic need to prevent scrolling
- * during a gesture (card modal, range, item sliding, etc).
- * Use this utility to account for ion-content and custom content hosts.
- */
- const disableContentScrollY = (contentEl) => {
- if (isIonContent(contentEl)) {
- const ionContent = contentEl;
- const initialScrollY = ionContent.scrollY;
- ionContent.scrollY = false;
- /**
- * This should be passed into resetContentScrollY
- * so that we can revert ion-content's scrollY to the
- * correct state. For example, if scrollY = false
- * initially, we do not want to enable scrolling
- * when we call resetContentScrollY.
- */
- return initialScrollY;
- }
- else {
- contentEl.style.setProperty('overflow', 'hidden');
- return true;
- }
- };
- const resetContentScrollY = (contentEl, initialScrollY) => {
- if (isIonContent(contentEl)) {
- contentEl.scrollY = initialScrollY;
- }
- else {
- contentEl.style.removeProperty('overflow');
- }
- };
- var ExceptionCode;
- (function (ExceptionCode) {
- /**
- * API is not implemented.
- *
- * This usually means the API can't be used because it is not implemented for
- * the current platform.
- */
- ExceptionCode["Unimplemented"] = "UNIMPLEMENTED";
- /**
- * API is not available.
- *
- * This means the API can't be used right now because:
- * - it is currently missing a prerequisite, such as network connectivity
- * - it requires a particular platform or browser version
- */
- ExceptionCode["Unavailable"] = "UNAVAILABLE";
- })(ExceptionCode || (ExceptionCode = {}));
- var KeyboardResize;
- (function (KeyboardResize) {
- /**
- * Only the `body` HTML element will be resized.
- * Relative units are not affected, because the viewport does not change.
- *
- * @since 1.0.0
- */
- KeyboardResize["Body"] = "body";
- /**
- * Only the `ion-app` HTML element will be resized.
- * Use it only for Ionic Framework apps.
- *
- * @since 1.0.0
- */
- KeyboardResize["Ionic"] = "ionic";
- /**
- * The whole native Web View will be resized when the keyboard shows/hides.
- * This affects the `vh` relative unit.
- *
- * @since 1.0.0
- */
- KeyboardResize["Native"] = "native";
- /**
- * Neither the app nor the Web View are resized.
- *
- * @since 1.0.0
- */
- KeyboardResize["None"] = "none";
- })(KeyboardResize || (KeyboardResize = {}));
- const Keyboard = {
- getEngine() {
- const capacitor = getCapacitor();
- if (capacitor === null || capacitor === void 0 ? void 0 : capacitor.isPluginAvailable('Keyboard')) {
- return capacitor.Plugins.Keyboard;
- }
- return undefined;
- },
- getResizeMode() {
- const engine = this.getEngine();
- if (!(engine === null || engine === void 0 ? void 0 : engine.getResizeMode)) {
- return Promise.resolve(undefined);
- }
- return engine.getResizeMode().catch((e) => {
- if (e.code === ExceptionCode.Unimplemented) {
- // If the native implementation is not available
- // we treat it the same as if the plugin is not available.
- return undefined;
- }
- throw e;
- });
- },
- };
- /**
- * The element that resizes when the keyboard opens
- * is going to depend on the resize mode
- * which is why we check that here.
- */
- const getResizeContainer = (resizeMode) => {
- /**
- * If doc is undefined then we are
- * in an SSR environment, so the keyboard
- * adjustment does not apply.
- * If the webview does not resize then there
- * is no container to resize.
- */
- if (doc === undefined || resizeMode === KeyboardResize.None || resizeMode === undefined) {
- return null;
- }
- /**
- * The three remaining resize modes: Native, Ionic, and Body
- * all cause `ion-app` to resize, so we can listen for changes
- * on that. In the event `ion-app` is not available then
- * we can fall back to `body`.
- */
- const ionApp = doc.querySelector('ion-app');
- return ionApp !== null && ionApp !== void 0 ? ionApp : doc.body;
- };
- /**
- * Get the height of ion-app or body.
- * This is used for determining if the webview
- * has resized before the keyboard closed.
- * */
- const getResizeContainerHeight = (resizeMode) => {
- const containerElement = getResizeContainer(resizeMode);
- return containerElement === null ? 0 : containerElement.clientHeight;
- };
- /**
- * Creates a controller that tracks and reacts to opening or closing the keyboard.
- *
- * @internal
- * @param keyboardChangeCallback A function to call when the keyboard opens or closes.
- */
- const createKeyboardController = async (keyboardChangeCallback) => {
- let keyboardWillShowHandler;
- let keyboardWillHideHandler;
- let keyboardVisible;
- /**
- * This lets us determine if the webview content
- * has resized as a result of the keyboard.
- */
- let initialResizeContainerHeight;
- const init = async () => {
- const resizeOptions = await Keyboard.getResizeMode();
- const resizeMode = resizeOptions === undefined ? undefined : resizeOptions.mode;
- keyboardWillShowHandler = () => {
- /**
- * We need to compute initialResizeContainerHeight right before
- * the keyboard opens to guarantee the resize container is visible.
- * The resize container may not be visible if we compute this
- * as soon as the keyboard controller is created.
- * We should only need to do this once to avoid additional clientHeight
- * computations.
- */
- if (initialResizeContainerHeight === undefined) {
- initialResizeContainerHeight = getResizeContainerHeight(resizeMode);
- }
- keyboardVisible = true;
- fireChangeCallback(keyboardVisible, resizeMode);
- };
- keyboardWillHideHandler = () => {
- keyboardVisible = false;
- fireChangeCallback(keyboardVisible, resizeMode);
- };
- win$1 === null || win$1 === void 0 ? void 0 : win$1.addEventListener('keyboardWillShow', keyboardWillShowHandler);
- win$1 === null || win$1 === void 0 ? void 0 : win$1.addEventListener('keyboardWillHide', keyboardWillHideHandler);
- };
- const fireChangeCallback = (state, resizeMode) => {
- if (keyboardChangeCallback) {
- keyboardChangeCallback(state, createResizePromiseIfNeeded(resizeMode));
- }
- };
- /**
- * Code responding to keyboard lifecycles may need
- * to show/hide content once the webview has
- * resized as a result of the keyboard showing/hiding.
- * createResizePromiseIfNeeded provides a way for code to wait for the
- * resize event that was triggered as a result of the keyboard.
- */
- const createResizePromiseIfNeeded = (resizeMode) => {
- if (
- /**
- * If we are in an SSR environment then there is
- * no window to resize. Additionally, if there
- * is no resize mode or the resize mode is "None"
- * then initialResizeContainerHeight will be 0
- */
- initialResizeContainerHeight === 0 ||
- /**
- * If the keyboard is closed before the webview resizes initially
- * then the webview will never resize.
- */
- initialResizeContainerHeight === getResizeContainerHeight(resizeMode)) {
- return;
- }
- /**
- * Get the resize container so we can
- * attach the ResizeObserver below to
- * the correct element.
- */
- const containerElement = getResizeContainer(resizeMode);
- if (containerElement === null) {
- return;
- }
- /**
- * Some part of the web content should resize,
- * and we need to listen for a resize.
- */
- return new Promise((resolve) => {
- const callback = () => {
- /**
- * As per the spec, the ResizeObserver
- * will fire when observation starts if
- * the observed element is rendered and does not
- * have a size of 0 x 0. However, the watched element
- * may or may not have resized by the time this first
- * callback is fired. As a result, we need to check
- * the dimensions of the element.
- *
- * https://www.w3.org/TR/resize-observer/#intro
- */
- if (containerElement.clientHeight === initialResizeContainerHeight) {
- /**
- * The resize happened, so stop listening
- * for resize on this element.
- */
- ro.disconnect();
- resolve();
- }
- };
- /**
- * In Capacitor there can be delay between when the window
- * resizes and when the container element resizes, so we cannot
- * rely on a 'resize' event listener on the window.
- * Instead, we need to determine when the container
- * element resizes using a ResizeObserver.
- */
- const ro = new ResizeObserver(callback);
- ro.observe(containerElement);
- });
- };
- const destroy = () => {
- win$1 === null || win$1 === void 0 ? void 0 : win$1.removeEventListener('keyboardWillShow', keyboardWillShowHandler);
- win$1 === null || win$1 === void 0 ? void 0 : win$1.removeEventListener('keyboardWillHide', keyboardWillHideHandler);
- keyboardWillShowHandler = keyboardWillHideHandler = undefined;
- };
- const isKeyboardVisible = () => keyboardVisible;
- await init();
- return { init, destroy, isKeyboardVisible };
- };
- const handleFooterFade = (scrollEl, baseEl) => {
- readTask(() => {
- const scrollTop = scrollEl.scrollTop;
- const maxScroll = scrollEl.scrollHeight - scrollEl.clientHeight;
- /**
- * Toolbar background will fade
- * out over fadeDuration in pixels.
- */
- const fadeDuration = 10;
- /**
- * Begin fading out maxScroll - 30px
- * from the bottom of the content.
- * Also determine how close we are
- * to starting the fade. If we are
- * before the starting point, the
- * scale value will get clamped to 0.
- * If we are after the maxScroll (rubber
- * band scrolling), the scale value will
- * get clamped to 1.
- */
- const fadeStart = maxScroll - fadeDuration;
- const distanceToStart = scrollTop - fadeStart;
- const scale = clamp(0, 1 - distanceToStart / fadeDuration, 1);
- writeTask(() => {
- baseEl.style.setProperty('--opacity-scale', scale.toString());
- });
- });
- };
- const footerIosCss = "ion-footer{display:block;position:relative;-ms-flex-order:1;order:1;width:100%;z-index:10}ion-footer.footer-toolbar-padding ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-ios ion-toolbar:first-of-type{--border-width:0.55px 0 0}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.footer-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.footer-translucent-ios ion-toolbar{--opacity:.8}}.footer-ios.ion-no-border ion-toolbar:first-of-type{--border-width:0}.footer-collapse-fade ion-toolbar{--opacity-scale:inherit}";
- var IonFooterIosStyle0 = footerIosCss;
- const footerMdCss = "ion-footer{display:block;position:relative;-ms-flex-order:1;order:1;width:100%;z-index:10}ion-footer.footer-toolbar-padding ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-md{-webkit-box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12)}.footer-md.ion-no-border{-webkit-box-shadow:none;box-shadow:none}";
- var IonFooterMdStyle0 = footerMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Footer {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.keyboardCtrl = null;
- this.checkCollapsibleFooter = () => {
- const mode = getIonMode$1(this);
- if (mode !== 'ios') {
- return;
- }
- const { collapse } = this;
- const hasFade = collapse === 'fade';
- this.destroyCollapsibleFooter();
- if (hasFade) {
- const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner');
- const contentEl = pageEl ? findIonContent(pageEl) : null;
- if (!contentEl) {
- printIonContentErrorMsg(this.el);
- return;
- }
- this.setupFadeFooter(contentEl);
- }
- };
- this.setupFadeFooter = async (contentEl) => {
- const scrollEl = (this.scrollEl = await getScrollElement(contentEl));
- /**
- * Handle fading of toolbars on scroll
- */
- this.contentScrollCallback = () => {
- handleFooterFade(scrollEl, this.el);
- };
- scrollEl.addEventListener('scroll', this.contentScrollCallback);
- handleFooterFade(scrollEl, this.el);
- };
- this.keyboardVisible = false;
- this.collapse = undefined;
- this.translucent = false;
- }
- componentDidLoad() {
- this.checkCollapsibleFooter();
- }
- componentDidUpdate() {
- this.checkCollapsibleFooter();
- }
- async connectedCallback() {
- this.keyboardCtrl = await createKeyboardController(async (keyboardOpen, waitForResize) => {
- /**
- * If the keyboard is hiding, then we need to wait
- * for the webview to resize. Otherwise, the footer
- * will flicker before the webview resizes.
- */
- if (keyboardOpen === false && waitForResize !== undefined) {
- await waitForResize;
- }
- this.keyboardVisible = keyboardOpen; // trigger re-render by updating state
- });
- }
- disconnectedCallback() {
- if (this.keyboardCtrl) {
- this.keyboardCtrl.destroy();
- }
- }
- destroyCollapsibleFooter() {
- if (this.scrollEl && this.contentScrollCallback) {
- this.scrollEl.removeEventListener('scroll', this.contentScrollCallback);
- this.contentScrollCallback = undefined;
- }
- }
- render() {
- const { translucent, collapse } = this;
- const mode = getIonMode$1(this);
- const tabs = this.el.closest('ion-tabs');
- const tabBar = tabs === null || tabs === void 0 ? void 0 : tabs.querySelector(':scope > ion-tab-bar');
- return (hAsync(Host, { key: 'ddc228f1a1e7fa4f707dccf74db2490ca3241137', role: "contentinfo", class: {
- [mode]: true,
- // Used internally for styling
- [`footer-${mode}`]: true,
- [`footer-translucent`]: translucent,
- [`footer-translucent-${mode}`]: translucent,
- ['footer-toolbar-padding']: !this.keyboardVisible && (!tabBar || tabBar.slot !== 'bottom'),
- [`footer-collapse-${collapse}`]: collapse !== undefined,
- } }, mode === 'ios' && translucent && hAsync("div", { key: 'e16ed4963ff94e06de77eb8038201820af73937c', class: "footer-background" }), hAsync("slot", { key: 'f186934febf85d37133d9351a96c1a64b0a4b203' })));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonFooterIosStyle0,
- md: IonFooterMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 36,
- "$tagName$": "ion-footer",
- "$members$": {
- "collapse": [1],
- "translucent": [4],
- "keyboardVisible": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const gridCss = ":host{-webkit-padding-start:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;display:block;-ms-flex:1;flex:1}@media (min-width: 576px){:host{-webkit-padding-start:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px))}}@media (min-width: 768px){:host{-webkit-padding-start:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px))}}@media (min-width: 992px){:host{-webkit-padding-start:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px))}}@media (min-width: 1200px){:host{-webkit-padding-start:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px))}}:host(.grid-fixed){width:var(--ion-grid-width-xs, var(--ion-grid-width, 100%));max-width:100%}@media (min-width: 576px){:host(.grid-fixed){width:var(--ion-grid-width-sm, var(--ion-grid-width, 540px))}}@media (min-width: 768px){:host(.grid-fixed){width:var(--ion-grid-width-md, var(--ion-grid-width, 720px))}}@media (min-width: 992px){:host(.grid-fixed){width:var(--ion-grid-width-lg, var(--ion-grid-width, 960px))}}@media (min-width: 1200px){:host(.grid-fixed){width:var(--ion-grid-width-xl, var(--ion-grid-width, 1140px))}}:host(.ion-no-padding){--ion-grid-column-padding:0;--ion-grid-column-padding-xs:0;--ion-grid-column-padding-sm:0;--ion-grid-column-padding-md:0;--ion-grid-column-padding-lg:0;--ion-grid-column-padding-xl:0}";
- var IonGridStyle0 = gridCss;
- class Grid {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.fixed = false;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '617127ecfabf9bf615bef1dda1be3fed5a065949', class: {
- [mode]: true,
- 'grid-fixed': this.fixed,
- } }, hAsync("slot", { key: 'c781fff853b093d8f44bdb7943bbc4f17c903803' })));
- }
- static get style() { return IonGridStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-grid",
- "$members$": {
- "fixed": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const TRANSITION = 'all 0.2s ease-in-out';
- const cloneElement = (tagName) => {
- const getCachedEl = document.querySelector(`${tagName}.ion-cloned-element`);
- if (getCachedEl !== null) {
- return getCachedEl;
- }
- const clonedEl = document.createElement(tagName);
- clonedEl.classList.add('ion-cloned-element');
- clonedEl.style.setProperty('display', 'none');
- document.body.appendChild(clonedEl);
- return clonedEl;
- };
- const createHeaderIndex = (headerEl) => {
- if (!headerEl) {
- return;
- }
- const toolbars = headerEl.querySelectorAll('ion-toolbar');
- return {
- el: headerEl,
- toolbars: Array.from(toolbars).map((toolbar) => {
- const ionTitleEl = toolbar.querySelector('ion-title');
- return {
- el: toolbar,
- background: toolbar.shadowRoot.querySelector('.toolbar-background'),
- ionTitleEl,
- innerTitleEl: ionTitleEl ? ionTitleEl.shadowRoot.querySelector('.toolbar-title') : null,
- ionButtonsEl: Array.from(toolbar.querySelectorAll('ion-buttons')),
- };
- }),
- };
- };
- const handleContentScroll = (scrollEl, scrollHeaderIndex, contentEl) => {
- readTask(() => {
- const scrollTop = scrollEl.scrollTop;
- const scale = clamp(1, 1 + -scrollTop / 500, 1.1);
- // Native refresher should not cause titles to scale
- const nativeRefresher = contentEl.querySelector('ion-refresher.refresher-native');
- if (nativeRefresher === null) {
- writeTask(() => {
- scaleLargeTitles(scrollHeaderIndex.toolbars, scale);
- });
- }
- });
- };
- const setToolbarBackgroundOpacity = (headerEl, opacity) => {
- /**
- * Fading in the backdrop opacity
- * should happen after the large title
- * has collapsed, so it is handled
- * by handleHeaderFade()
- */
- if (headerEl.collapse === 'fade') {
- return;
- }
- if (opacity === undefined) {
- headerEl.style.removeProperty('--opacity-scale');
- }
- else {
- headerEl.style.setProperty('--opacity-scale', opacity.toString());
- }
- };
- const handleToolbarBorderIntersection = (ev, mainHeaderIndex, scrollTop) => {
- if (!ev[0].isIntersecting) {
- return;
- }
- /**
- * There is a bug in Safari where overflow scrolling on a non-body element
- * does not always reset the scrollTop position to 0 when letting go. It will
- * set to 1 once the rubber band effect has ended. This causes the background to
- * appear slightly on certain app setups.
- *
- * Additionally, we check if user is rubber banding (scrolling is negative)
- * as this can mean they are using pull to refresh. Once the refresher starts,
- * the content is transformed which can cause the intersection observer to erroneously
- * fire here as well.
- */
- const scale = ev[0].intersectionRatio > 0.9 || scrollTop <= 0 ? 0 : ((1 - ev[0].intersectionRatio) * 100) / 75;
- setToolbarBackgroundOpacity(mainHeaderIndex.el, scale === 1 ? undefined : scale);
- };
- /**
- * If toolbars are intersecting, hide the scrollable toolbar content
- * and show the primary toolbar content. If the toolbars are not intersecting,
- * hide the primary toolbar content and show the scrollable toolbar content
- */
- const handleToolbarIntersection = (ev, // TODO(FW-2832): type (IntersectionObserverEntry[] triggers errors which should be sorted)
- mainHeaderIndex, scrollHeaderIndex, scrollEl) => {
- writeTask(() => {
- const scrollTop = scrollEl.scrollTop;
- handleToolbarBorderIntersection(ev, mainHeaderIndex, scrollTop);
- const event = ev[0];
- const intersection = event.intersectionRect;
- const intersectionArea = intersection.width * intersection.height;
- const rootArea = event.rootBounds.width * event.rootBounds.height;
- const isPageHidden = intersectionArea === 0 && rootArea === 0;
- const leftDiff = Math.abs(intersection.left - event.boundingClientRect.left);
- const rightDiff = Math.abs(intersection.right - event.boundingClientRect.right);
- const isPageTransitioning = intersectionArea > 0 && (leftDiff >= 5 || rightDiff >= 5);
- if (isPageHidden || isPageTransitioning) {
- return;
- }
- if (event.isIntersecting) {
- setHeaderActive(mainHeaderIndex, false);
- setHeaderActive(scrollHeaderIndex);
- }
- else {
- /**
- * There is a bug with IntersectionObserver on Safari
- * where `event.isIntersecting === false` when cancelling
- * a swipe to go back gesture. Checking the intersection
- * x, y, width, and height provides a workaround. This bug
- * does not happen when using Safari + Web Animations,
- * only Safari + CSS Animations.
- */
- const hasValidIntersection = (intersection.x === 0 && intersection.y === 0) || (intersection.width !== 0 && intersection.height !== 0);
- if (hasValidIntersection && scrollTop > 0) {
- setHeaderActive(mainHeaderIndex);
- setHeaderActive(scrollHeaderIndex, false);
- setToolbarBackgroundOpacity(mainHeaderIndex.el);
- }
- }
- });
- };
- const setHeaderActive = (headerIndex, active = true) => {
- const headerEl = headerIndex.el;
- const toolbars = headerIndex.toolbars;
- const ionTitles = toolbars.map((toolbar) => toolbar.ionTitleEl);
- if (active) {
- headerEl.classList.remove('header-collapse-condense-inactive');
- ionTitles.forEach((ionTitle) => {
- if (ionTitle) {
- ionTitle.removeAttribute('aria-hidden');
- }
- });
- }
- else {
- headerEl.classList.add('header-collapse-condense-inactive');
- /**
- * The small title should only be accessed by screen readers
- * when the large title collapses into the small title due
- * to scrolling.
- *
- * Originally, the header was given `aria-hidden="true"`
- * but this caused issues with screen readers not being
- * able to access any focusable elements within the header.
- */
- ionTitles.forEach((ionTitle) => {
- if (ionTitle) {
- ionTitle.setAttribute('aria-hidden', 'true');
- }
- });
- }
- };
- const scaleLargeTitles = (toolbars = [], scale = 1, transition = false) => {
- toolbars.forEach((toolbar) => {
- const ionTitle = toolbar.ionTitleEl;
- const titleDiv = toolbar.innerTitleEl;
- if (!ionTitle || ionTitle.size !== 'large') {
- return;
- }
- titleDiv.style.transition = transition ? TRANSITION : '';
- titleDiv.style.transform = `scale3d(${scale}, ${scale}, 1)`;
- });
- };
- const handleHeaderFade = (scrollEl, baseEl, condenseHeader) => {
- readTask(() => {
- const scrollTop = scrollEl.scrollTop;
- const baseElHeight = baseEl.clientHeight;
- const fadeStart = condenseHeader ? condenseHeader.clientHeight : 0;
- /**
- * If we are using fade header with a condense
- * header, then the toolbar backgrounds should
- * not begin to fade in until the condense
- * header has fully collapsed.
- *
- * Additionally, the main content should not
- * overflow out of the container until the
- * condense header has fully collapsed. When
- * using just the condense header the content
- * should overflow out of the container.
- */
- if (condenseHeader !== null && scrollTop < fadeStart) {
- baseEl.style.setProperty('--opacity-scale', '0');
- scrollEl.style.setProperty('clip-path', `inset(${baseElHeight}px 0px 0px 0px)`);
- return;
- }
- const distanceToStart = scrollTop - fadeStart;
- const fadeDuration = 10;
- const scale = clamp(0, distanceToStart / fadeDuration, 1);
- writeTask(() => {
- scrollEl.style.removeProperty('clip-path');
- baseEl.style.setProperty('--opacity-scale', scale.toString());
- });
- });
- };
- const headerIosCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:-webkit-sticky;position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:0px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}ion-header.header-ios:not(.header-collapse-main):has(~ion-content ion-header.header-ios[collapse=condense],~ion-content ion-header.header-ios.header-collapse-condense){opacity:0}";
- var IonHeaderIosStyle0 = headerIosCss;
- const headerMdCss = "ion-header{display:block;position:relative;-ms-flex-order:-1;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md{-webkit-box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12)}.header-collapse-condense{display:none}.header-md.ion-no-border{-webkit-box-shadow:none;box-shadow:none}";
- var IonHeaderMdStyle0 = headerMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Header {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.inheritedAttributes = {};
- this.setupFadeHeader = async (contentEl, condenseHeader) => {
- const scrollEl = (this.scrollEl = await getScrollElement(contentEl));
- /**
- * Handle fading of toolbars on scroll
- */
- this.contentScrollCallback = () => {
- handleHeaderFade(this.scrollEl, this.el, condenseHeader);
- };
- scrollEl.addEventListener('scroll', this.contentScrollCallback);
- handleHeaderFade(this.scrollEl, this.el, condenseHeader);
- };
- this.collapse = undefined;
- this.translucent = false;
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- }
- componentDidLoad() {
- this.checkCollapsibleHeader();
- }
- componentDidUpdate() {
- this.checkCollapsibleHeader();
- }
- disconnectedCallback() {
- this.destroyCollapsibleHeader();
- }
- async checkCollapsibleHeader() {
- const mode = getIonMode$1(this);
- if (mode !== 'ios') {
- return;
- }
- const { collapse } = this;
- const hasCondense = collapse === 'condense';
- const hasFade = collapse === 'fade';
- this.destroyCollapsibleHeader();
- if (hasCondense) {
- const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner');
- const contentEl = pageEl ? findIonContent(pageEl) : null;
- // Cloned elements are always needed in iOS transition
- writeTask(() => {
- const title = cloneElement('ion-title');
- title.size = 'large';
- cloneElement('ion-back-button');
- });
- await this.setupCondenseHeader(contentEl, pageEl);
- }
- else if (hasFade) {
- const pageEl = this.el.closest('ion-app,ion-page,.ion-page,page-inner');
- const contentEl = pageEl ? findIonContent(pageEl) : null;
- if (!contentEl) {
- printIonContentErrorMsg(this.el);
- return;
- }
- const condenseHeader = contentEl.querySelector('ion-header[collapse="condense"]');
- await this.setupFadeHeader(contentEl, condenseHeader);
- }
- }
- destroyCollapsibleHeader() {
- if (this.intersectionObserver) {
- this.intersectionObserver.disconnect();
- this.intersectionObserver = undefined;
- }
- if (this.scrollEl && this.contentScrollCallback) {
- this.scrollEl.removeEventListener('scroll', this.contentScrollCallback);
- this.contentScrollCallback = undefined;
- }
- if (this.collapsibleMainHeader) {
- this.collapsibleMainHeader.classList.remove('header-collapse-main');
- this.collapsibleMainHeader = undefined;
- }
- }
- async setupCondenseHeader(contentEl, pageEl) {
- if (!contentEl || !pageEl) {
- printIonContentErrorMsg(this.el);
- return;
- }
- if (typeof IntersectionObserver === 'undefined') {
- return;
- }
- this.scrollEl = await getScrollElement(contentEl);
- const headers = pageEl.querySelectorAll('ion-header');
- this.collapsibleMainHeader = Array.from(headers).find((header) => header.collapse !== 'condense');
- if (!this.collapsibleMainHeader) {
- return;
- }
- const mainHeaderIndex = createHeaderIndex(this.collapsibleMainHeader);
- const scrollHeaderIndex = createHeaderIndex(this.el);
- if (!mainHeaderIndex || !scrollHeaderIndex) {
- return;
- }
- setHeaderActive(mainHeaderIndex, false);
- setToolbarBackgroundOpacity(mainHeaderIndex.el, 0);
- /**
- * Handle interaction between toolbar collapse and
- * showing/hiding content in the primary ion-header
- * as well as progressively showing/hiding the main header
- * border as the top-most toolbar collapses or expands.
- */
- const toolbarIntersection = (ev) => {
- handleToolbarIntersection(ev, mainHeaderIndex, scrollHeaderIndex, this.scrollEl);
- };
- this.intersectionObserver = new IntersectionObserver(toolbarIntersection, {
- root: contentEl,
- threshold: [0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1],
- });
- this.intersectionObserver.observe(scrollHeaderIndex.toolbars[scrollHeaderIndex.toolbars.length - 1].el);
- /**
- * Handle scaling of large iOS titles and
- * showing/hiding border on last toolbar
- * in primary header
- */
- this.contentScrollCallback = () => {
- handleContentScroll(this.scrollEl, scrollHeaderIndex, contentEl);
- };
- this.scrollEl.addEventListener('scroll', this.contentScrollCallback);
- writeTask(() => {
- if (this.collapsibleMainHeader !== undefined) {
- this.collapsibleMainHeader.classList.add('header-collapse-main');
- }
- });
- }
- render() {
- const { translucent, inheritedAttributes } = this;
- const mode = getIonMode$1(this);
- const collapse = this.collapse || 'none';
- // banner role must be at top level, so remove role if inside a menu
- const roleType = hostContext('ion-menu', this.el) ? 'none' : 'banner';
- return (hAsync(Host, Object.assign({ key: 'b6cc27f0b08afc9fcc889683525da765d80ba672', role: roleType, class: {
- [mode]: true,
- // Used internally for styling
- [`header-${mode}`]: true,
- [`header-translucent`]: this.translucent,
- [`header-collapse-${collapse}`]: true,
- [`header-translucent-${mode}`]: this.translucent,
- } }, inheritedAttributes), mode === 'ios' && translucent && hAsync("div", { key: '395766d4dcee3398bc91960db21f922095292f14', class: "header-background" }), hAsync("slot", { key: '09a67ece27b258ff1248805d43d92a49b2c6859a' })));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonHeaderIosStyle0,
- md: IonHeaderMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 36,
- "$tagName$": "ion-header",
- "$members$": {
- "collapse": [1],
- "translucent": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const getName = (iconName, icon, mode, ios, md) => {
- // default to "md" if somehow the mode wasn't set
- mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
- // if an icon was passed in using the ios or md attributes
- // set the iconName to whatever was passed in
- if (ios && mode === 'ios') {
- iconName = toLower(ios);
- }
- else if (md && mode === 'md') {
- iconName = toLower(md);
- }
- else {
- if (!iconName && icon && !isSrc(icon)) {
- iconName = icon;
- }
- if (isStr(iconName)) {
- iconName = toLower(iconName);
- }
- }
- if (!isStr(iconName) || iconName.trim() === '') {
- return null;
- }
- // only allow alpha characters and dash
- const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
- if (invalidChars !== '') {
- return null;
- }
- return iconName;
- };
- const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
- const isStr = (val) => typeof val === 'string';
- const toLower = (val) => val.toLowerCase();
- /**
- * Elements inside of web components sometimes need to inherit global attributes
- * set on the host. For example, the inner input in `ion-input` should inherit
- * the `title` attribute that developers set directly on `ion-input`. This
- * helper function should be called in componentWillLoad and assigned to a variable
- * that is later used in the render function.
- *
- * This does not need to be reactive as changing attributes on the host element
- * does not trigger a re-render.
- */
- const inheritAttributes = (el, attributes = []) => {
- const attributeObject = {};
- attributes.forEach(attr => {
- if (el.hasAttribute(attr)) {
- const value = el.getAttribute(attr);
- if (value !== null) {
- attributeObject[attr] = el.getAttribute(attr);
- }
- el.removeAttribute(attr);
- }
- });
- return attributeObject;
- };
- /**
- * Returns `true` if the document or host element
- * has a `dir` set to `rtl`. The host value will always
- * take priority over the root document value.
- */
- const isRTL = (hostEl) => {
- if (hostEl) {
- if (hostEl.dir !== '') {
- return hostEl.dir.toLowerCase() === 'rtl';
- }
- }
- return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';
- };
- const iconCss = ":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;-webkit-box-sizing:content-box !important;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}@supports (background: -webkit-named-image(i)){:host(.icon-rtl) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}}@supports not selector(:dir(rtl)) and selector(:host-context([dir='rtl'])){:host(.icon-rtl) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}}:host(.flip-rtl):host-context([dir='rtl']) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}@supports selector(:dir(rtl)){:host(.flip-rtl:dir(rtl)) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{-webkit-transform:scaleX(1);transform:scaleX(1)}}:host(.icon-small){font-size:1.125rem !important}:host(.icon-large){font-size:2rem !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";
- var IonIconStyle0 = iconCss;
- class Icon {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.iconName = null;
- this.inheritedAttributes = {};
- this.didLoadIcon = false;
- this.svgContent = undefined;
- this.isVisible = false;
- this.mode = getIonMode();
- this.color = undefined;
- this.ios = undefined;
- this.md = undefined;
- this.flipRtl = undefined;
- this.name = undefined;
- this.src = undefined;
- this.icon = undefined;
- this.size = undefined;
- this.lazy = false;
- this.sanitize = true;
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
- }
- connectedCallback() {
- // purposely do not return the promise here because loading
- // the svg file should not hold up loading the app
- // only load the svg if it's visible
- this.waitUntilVisible(this.el, '50px', () => {
- this.isVisible = true;
- this.loadIcon();
- });
- }
- componentDidLoad() {
- /**
- * Addresses an Angular issue where property values are assigned after the 'connectedCallback' but prior to the registration of watchers.
- * This enhancement ensures the loading of an icon when the component has finished rendering and the icon has yet to apply the SVG data.
- * This modification pertains to the usage of Angular's binding syntax:
- * `<ion-icon [name]="myIconName"></ion-icon>`
- */
- if (!this.didLoadIcon) {
- this.loadIcon();
- }
- }
- disconnectedCallback() {
- if (this.io) {
- this.io.disconnect();
- this.io = undefined;
- }
- }
- waitUntilVisible(el, rootMargin, cb) {
- {
- // browser doesn't support IntersectionObserver
- // so just fallback to always show it
- cb();
- }
- }
- loadIcon() {
- this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
- }
- render() {
- const { flipRtl, iconName, inheritedAttributes, el } = this;
- const mode = this.mode || 'md';
- // we have designated that arrows & chevrons should automatically flip (unless flip-rtl is set to false) because "back" is left in ltr and right in rtl, and "forward" is the opposite
- const shouldAutoFlip = iconName
- ? (iconName.includes('arrow') || iconName.includes('chevron')) && flipRtl !== false
- : false;
- // if shouldBeFlippable is true, the icon should change direction when `dir` changes
- const shouldBeFlippable = flipRtl || shouldAutoFlip;
- return (hAsync(Host, Object.assign({ role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': shouldBeFlippable, 'icon-rtl': shouldBeFlippable && isRTL(el) }) }, inheritedAttributes), (hAsync("div", { class: "icon-inner" }))));
- }
- static get assetsDirs() { return ["svg"]; }
- get el() { return getElement(this); }
- static get watchers() { return {
- "name": ["loadIcon"],
- "src": ["loadIcon"],
- "icon": ["loadIcon"],
- "ios": ["loadIcon"],
- "md": ["loadIcon"]
- }; }
- static get style() { return IonIconStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-icon",
- "$members$": {
- "mode": [1025],
- "color": [1],
- "ios": [1],
- "md": [1],
- "flipRtl": [4, "flip-rtl"],
- "name": [513],
- "src": [1],
- "icon": [8],
- "size": [1],
- "lazy": [4],
- "sanitize": [4],
- "svgContent": [32],
- "isVisible": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["name", "name"]]
- }; }
- }
- const getIonMode = () => 'md';
- const createColorClasses = (color) => {
- return color
- ? {
- 'ion-color': true,
- [`ion-color-${color}`]: true,
- }
- : null;
- };
- const imgCss = ":host{display:block;-o-object-fit:contain;object-fit:contain}img{display:block;width:100%;height:100%;-o-object-fit:inherit;object-fit:inherit;-o-object-position:inherit;object-position:inherit}";
- var IonImgStyle0 = imgCss;
- /**
- * @part image - The inner `img` element.
- */
- class Img {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionImgWillLoad = createEvent(this, "ionImgWillLoad", 7);
- this.ionImgDidLoad = createEvent(this, "ionImgDidLoad", 7);
- this.ionError = createEvent(this, "ionError", 7);
- this.inheritedAttributes = {};
- this.onLoad = () => {
- this.ionImgDidLoad.emit();
- };
- this.onError = () => {
- this.ionError.emit();
- };
- this.loadSrc = undefined;
- this.loadError = undefined;
- this.alt = undefined;
- this.src = undefined;
- }
- srcChanged() {
- this.addIO();
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAttributes$1(this.el, ['draggable']);
- }
- componentDidLoad() {
- this.addIO();
- }
- addIO() {
- if (this.src === undefined) {
- return;
- }
- if (typeof window !== 'undefined' &&
- 'IntersectionObserver' in window &&
- 'IntersectionObserverEntry' in window &&
- 'isIntersecting' in window.IntersectionObserverEntry.prototype) {
- this.removeIO();
- this.io = new IntersectionObserver((data) => {
- /**
- * On slower devices, it is possible for an intersection observer entry to contain multiple
- * objects in the array. This happens when quickly scrolling an image into view and then out of
- * view. In this case, the last object represents the current state of the component.
- */
- if (data[data.length - 1].isIntersecting) {
- this.load();
- this.removeIO();
- }
- });
- this.io.observe(this.el);
- }
- else {
- // fall back to setTimeout for Safari and IE
- setTimeout(() => this.load(), 200);
- }
- }
- load() {
- this.loadError = this.onError;
- this.loadSrc = this.src;
- this.ionImgWillLoad.emit();
- }
- removeIO() {
- if (this.io) {
- this.io.disconnect();
- this.io = undefined;
- }
- }
- render() {
- const { loadSrc, alt, onLoad, loadError, inheritedAttributes } = this;
- const { draggable } = inheritedAttributes;
- return (hAsync(Host, { key: 'da600442894427dee1974a28e545613afac69fca', class: getIonMode$1(this) }, hAsync("img", { key: '16df0c7069af86c0fa7ce5af598bc0f63b4eb71a', decoding: "async", src: loadSrc, alt: alt, onLoad: onLoad, onError: loadError, part: "image", draggable: isDraggable(draggable) })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "src": ["srcChanged"]
- }; }
- static get style() { return IonImgStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-img",
- "$members$": {
- "alt": [1],
- "src": [1],
- "loadSrc": [32],
- "loadError": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- /**
- * Enumerated strings must be set as booleans
- * as Stencil will not render 'false' in the DOM.
- * The need to explicitly render draggable="true"
- * as only certain elements are draggable by default.
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable.
- */
- const isDraggable = (draggable) => {
- switch (draggable) {
- case 'true':
- return true;
- case 'false':
- return false;
- default:
- return undefined;
- }
- };
- const infiniteScrollCss = "ion-infinite-scroll{display:none;width:100%}.infinite-scroll-enabled{display:block}";
- var IonInfiniteScrollStyle0 = infiniteScrollCss;
- class InfiniteScroll {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionInfinite = createEvent(this, "ionInfinite", 7);
- this.thrPx = 0;
- this.thrPc = 0;
- /**
- * didFire exists so that ionInfinite
- * does not fire multiple times if
- * users continue to scroll after
- * scrolling into the infinite
- * scroll threshold.
- */
- this.didFire = false;
- this.isBusy = false;
- this.onScroll = () => {
- const scrollEl = this.scrollEl;
- if (!scrollEl || !this.canStart()) {
- return 1;
- }
- const infiniteHeight = this.el.offsetHeight;
- if (infiniteHeight === 0) {
- // if there is no height of this element then do nothing
- return 2;
- }
- const scrollTop = scrollEl.scrollTop;
- const scrollHeight = scrollEl.scrollHeight;
- const height = scrollEl.offsetHeight;
- const threshold = this.thrPc !== 0 ? height * this.thrPc : this.thrPx;
- const distanceFromInfinite = this.position === 'bottom'
- ? scrollHeight - infiniteHeight - scrollTop - threshold - height
- : scrollTop - infiniteHeight - threshold;
- if (distanceFromInfinite < 0) {
- if (!this.didFire) {
- this.isLoading = true;
- this.didFire = true;
- this.ionInfinite.emit();
- return 3;
- }
- }
- return 4;
- };
- this.isLoading = false;
- this.threshold = '15%';
- this.disabled = false;
- this.position = 'bottom';
- }
- thresholdChanged() {
- const val = this.threshold;
- if (val.lastIndexOf('%') > -1) {
- this.thrPx = 0;
- this.thrPc = parseFloat(val) / 100;
- }
- else {
- this.thrPx = parseFloat(val);
- this.thrPc = 0;
- }
- }
- disabledChanged() {
- const disabled = this.disabled;
- if (disabled) {
- this.isLoading = false;
- this.isBusy = false;
- }
- this.enableScrollEvents(!disabled);
- }
- async connectedCallback() {
- const contentEl = findClosestIonContent(this.el);
- if (!contentEl) {
- printIonContentErrorMsg(this.el);
- return;
- }
- this.scrollEl = await getScrollElement(contentEl);
- this.thresholdChanged();
- this.disabledChanged();
- if (this.position === 'top') {
- writeTask(() => {
- if (this.scrollEl) {
- this.scrollEl.scrollTop = this.scrollEl.scrollHeight - this.scrollEl.clientHeight;
- }
- });
- }
- }
- disconnectedCallback() {
- this.enableScrollEvents(false);
- this.scrollEl = undefined;
- }
- /**
- * Call `complete()` within the `ionInfinite` output event handler when
- * your async operation has completed. For example, the `loading`
- * state is while the app is performing an asynchronous operation,
- * such as receiving more data from an AJAX request to add more items
- * to a data list. Once the data has been received and UI updated, you
- * then call this method to signify that the loading has completed.
- * This method will change the infinite scroll's state from `loading`
- * to `enabled`.
- */
- async complete() {
- const scrollEl = this.scrollEl;
- if (!this.isLoading || !scrollEl) {
- return;
- }
- this.isLoading = false;
- if (this.position === 'top') {
- /**
- * New content is being added at the top, but the scrollTop position stays the same,
- * which causes a scroll jump visually. This algorithm makes sure to prevent this.
- * (Frame 1)
- * - complete() is called, but the UI hasn't had time to update yet.
- * - Save the current content dimensions.
- * - Wait for the next frame using _dom.read, so the UI will be updated.
- * (Frame 2)
- * - Read the new content dimensions.
- * - Calculate the height difference and the new scroll position.
- * - Delay the scroll position change until other possible dom reads are done using _dom.write to be performant.
- * (Still frame 2, if I'm correct)
- * - Change the scroll position (= visually maintain the scroll position).
- * - Change the state to re-enable the InfiniteScroll.
- * - This should be after changing the scroll position, or it could
- * cause the InfiniteScroll to be triggered again immediately.
- * (Frame 3)
- * Done.
- */
- this.isBusy = true;
- // ******** DOM READ ****************
- // Save the current content dimensions before the UI updates
- const prev = scrollEl.scrollHeight - scrollEl.scrollTop;
- // ******** DOM READ ****************
- requestAnimationFrame(() => {
- readTask(() => {
- // UI has updated, save the new content dimensions
- const scrollHeight = scrollEl.scrollHeight;
- // New content was added on top, so the scroll position should be changed immediately to prevent it from jumping around
- const newScrollTop = scrollHeight - prev;
- // ******** DOM WRITE ****************
- requestAnimationFrame(() => {
- writeTask(() => {
- scrollEl.scrollTop = newScrollTop;
- this.isBusy = false;
- this.didFire = false;
- });
- });
- });
- });
- }
- else {
- this.didFire = false;
- }
- }
- canStart() {
- return !this.disabled && !this.isBusy && !!this.scrollEl && !this.isLoading;
- }
- enableScrollEvents(shouldListen) {
- if (this.scrollEl) {
- if (shouldListen) {
- this.scrollEl.addEventListener('scroll', this.onScroll);
- }
- else {
- this.scrollEl.removeEventListener('scroll', this.onScroll);
- }
- }
- }
- render() {
- const mode = getIonMode$1(this);
- const disabled = this.disabled;
- return (hAsync(Host, { key: 'e844956795f69be33396ce4480aa7a54ad01b28c', class: {
- [mode]: true,
- 'infinite-scroll-loading': this.isLoading,
- 'infinite-scroll-enabled': !disabled,
- } }));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "threshold": ["thresholdChanged"],
- "disabled": ["disabledChanged"]
- }; }
- static get style() { return IonInfiniteScrollStyle0; }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-infinite-scroll",
- "$members$": {
- "threshold": [1],
- "disabled": [4],
- "position": [1],
- "isLoading": [32],
- "complete": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const infiniteScrollContentIosCss = "ion-infinite-scroll-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;min-height:84px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.infinite-loading{margin-left:0;margin-right:0;margin-top:0;margin-bottom:32px;display:none;width:100%}.infinite-loading-text{-webkit-margin-start:32px;margin-inline-start:32px;-webkit-margin-end:32px;margin-inline-end:32px;margin-top:4px;margin-bottom:0}.infinite-scroll-loading ion-infinite-scroll-content>.infinite-loading{display:block}.infinite-scroll-content-ios .infinite-loading-text{color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}.infinite-scroll-content-ios .infinite-loading-spinner .spinner-lines-ios line,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-lines-small-ios line,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-crescent circle{stroke:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}.infinite-scroll-content-ios .infinite-loading-spinner .spinner-bubbles circle,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-circles circle,.infinite-scroll-content-ios .infinite-loading-spinner .spinner-dots circle{fill:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}";
- var IonInfiniteScrollContentIosStyle0 = infiniteScrollContentIosCss;
- const infiniteScrollContentMdCss = "ion-infinite-scroll-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;min-height:84px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.infinite-loading{margin-left:0;margin-right:0;margin-top:0;margin-bottom:32px;display:none;width:100%}.infinite-loading-text{-webkit-margin-start:32px;margin-inline-start:32px;-webkit-margin-end:32px;margin-inline-end:32px;margin-top:4px;margin-bottom:0}.infinite-scroll-loading ion-infinite-scroll-content>.infinite-loading{display:block}.infinite-scroll-content-md .infinite-loading-text{color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}.infinite-scroll-content-md .infinite-loading-spinner .spinner-lines-md line,.infinite-scroll-content-md .infinite-loading-spinner .spinner-lines-small-md line,.infinite-scroll-content-md .infinite-loading-spinner .spinner-crescent circle{stroke:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}.infinite-scroll-content-md .infinite-loading-spinner .spinner-bubbles circle,.infinite-scroll-content-md .infinite-loading-spinner .spinner-circles circle,.infinite-scroll-content-md .infinite-loading-spinner .spinner-dots circle{fill:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}";
- var IonInfiniteScrollContentMdStyle0 = infiniteScrollContentMdCss;
- class InfiniteScrollContent {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
- this.loadingSpinner = undefined;
- this.loadingText = undefined;
- }
- componentDidLoad() {
- if (this.loadingSpinner === undefined) {
- const mode = getIonMode$1(this);
- this.loadingSpinner = config.get('infiniteLoadingSpinner', config.get('spinner', mode === 'ios' ? 'lines' : 'crescent'));
- }
- }
- renderLoadingText() {
- const { customHTMLEnabled, loadingText } = this;
- if (customHTMLEnabled) {
- return hAsync("div", { class: "infinite-loading-text", innerHTML: sanitizeDOMString(loadingText) });
- }
- return hAsync("div", { class: "infinite-loading-text" }, this.loadingText);
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '7c16060dcfe2a0b0fb3e2f8f4c449589a76f1baa', class: {
- [mode]: true,
- // Used internally for styling
- [`infinite-scroll-content-${mode}`]: true,
- } }, hAsync("div", { key: 'a94f4d8746e053dc718f97520bd7e48cb316443a', class: "infinite-loading" }, this.loadingSpinner && (hAsync("div", { key: '10143d5d2a50a2a2bc5de1cee8e7ab51263bcf23', class: "infinite-loading-spinner" }, hAsync("ion-spinner", { key: '8846e88191690d9c61a0b462889ed56fbfed8b0d', name: this.loadingSpinner }))), this.loadingText !== undefined && this.renderLoadingText())));
- }
- static get style() { return {
- ios: IonInfiniteScrollContentIosStyle0,
- md: IonInfiniteScrollContentMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 32,
- "$tagName$": "ion-infinite-scroll-content",
- "$members$": {
- "loadingSpinner": [1025, "loading-spinner"],
- "loadingText": [1, "loading-text"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- /**
- * A utility to calculate the size of an outline notch
- * width relative to the content passed. This is used in
- * components such as `ion-select` with `fill="outline"`
- * where we need to pass slotted HTML content. This is not
- * needed when rendering plaintext content because we can
- * render the plaintext again hidden with `opacity: 0` inside
- * of the notch. As a result we can rely on the intrinsic size
- * of the element to correctly compute the notch width. We
- * cannot do this with slotted content because we cannot project
- * it into 2 places at once.
- *
- * @internal
- * @param el: The host element
- * @param getNotchSpacerEl: A function that returns a reference to the notch spacer element inside of the component template.
- * @param getLabelSlot: A function that returns a reference to the slotted content.
- */
- const createNotchController = (el, getNotchSpacerEl, getLabelSlot) => {
- let notchVisibilityIO;
- const needsExplicitNotchWidth = () => {
- const notchSpacerEl = getNotchSpacerEl();
- if (
- /**
- * If the notch is not being used
- * then we do not need to set the notch width.
- */
- notchSpacerEl === undefined ||
- /**
- * If either the label property is being
- * used or the label slot is not defined,
- * then we do not need to estimate the notch width.
- */
- el.label !== undefined ||
- getLabelSlot() === null) {
- return false;
- }
- return true;
- };
- const calculateNotchWidth = () => {
- if (needsExplicitNotchWidth()) {
- /**
- * Run this the frame after
- * the browser has re-painted the host element.
- * Otherwise, the label element may have a width
- * of 0 and the IntersectionObserver will be used.
- */
- raf(() => {
- setNotchWidth();
- });
- }
- };
- /**
- * When using a label prop we can render
- * the label value inside of the notch and
- * let the browser calculate the size of the notch.
- * However, we cannot render the label slot in multiple
- * places so we need to manually calculate the notch dimension
- * based on the size of the slotted content.
- *
- * This function should only be used to set the notch width
- * on slotted label content. The notch width for label prop
- * content is automatically calculated based on the
- * intrinsic size of the label text.
- */
- const setNotchWidth = () => {
- const notchSpacerEl = getNotchSpacerEl();
- if (notchSpacerEl === undefined) {
- return;
- }
- if (!needsExplicitNotchWidth()) {
- notchSpacerEl.style.removeProperty('width');
- return;
- }
- const width = getLabelSlot().scrollWidth;
- if (
- /**
- * If the computed width of the label is 0
- * and notchSpacerEl's offsetParent is null
- * then that means the element is hidden.
- * As a result, we need to wait for the element
- * to become visible before setting the notch width.
- *
- * We do not check el.offsetParent because
- * that can be null if the host element has
- * position: fixed applied to it.
- * notchSpacerEl does not have position: fixed.
- */
- width === 0 &&
- notchSpacerEl.offsetParent === null &&
- win$1 !== undefined &&
- 'IntersectionObserver' in win$1) {
- /**
- * If there is an IO already attached
- * then that will update the notch
- * once the element becomes visible.
- * As a result, there is no need to create
- * another one.
- */
- if (notchVisibilityIO !== undefined) {
- return;
- }
- const io = (notchVisibilityIO = new IntersectionObserver((ev) => {
- /**
- * If the element is visible then we
- * can try setting the notch width again.
- */
- if (ev[0].intersectionRatio === 1) {
- setNotchWidth();
- io.disconnect();
- notchVisibilityIO = undefined;
- }
- },
- /**
- * Set the root to be the host element
- * This causes the IO callback
- * to be fired in WebKit as soon as the element
- * is visible. If we used the default root value
- * then WebKit would only fire the IO callback
- * after any animations (such as a modal transition)
- * finished, and there would potentially be a flicker.
- */
- { threshold: 0.01, root: el }));
- io.observe(notchSpacerEl);
- return;
- }
- /**
- * If the element is visible then we can set the notch width.
- * The notch is only visible when the label is scaled,
- * which is why we multiply the width by 0.75 as this is
- * the same amount the label element is scaled by in the host CSS.
- * (See $form-control-label-stacked-scale in ionic.globals.scss).
- */
- notchSpacerEl.style.setProperty('width', `${width * 0.75}px`);
- };
- const destroy = () => {
- if (notchVisibilityIO) {
- notchVisibilityIO.disconnect();
- notchVisibilityIO = undefined;
- }
- };
- return {
- calculateNotchWidth,
- destroy,
- };
- };
- /**
- * Uses the compareWith param to compare two values to determine if they are equal.
- *
- * @param currentValue The current value of the control.
- * @param compareValue The value to compare against.
- * @param compareWith The function or property name to use to compare values.
- */
- const compareOptions = (currentValue, compareValue, compareWith) => {
- if (typeof compareWith === 'function') {
- return compareWith(currentValue, compareValue);
- }
- else if (typeof compareWith === 'string') {
- return currentValue[compareWith] === compareValue[compareWith];
- }
- else {
- return Array.isArray(compareValue) ? compareValue.includes(currentValue) : currentValue === compareValue;
- }
- };
- /**
- * Compares a value against the current value(s) to determine if it is selected.
- *
- * @param currentValue The current value of the control.
- * @param compareValue The value to compare against.
- * @param compareWith The function or property name to use to compare values.
- */
- const isOptionSelected = (currentValue, compareValue, compareWith) => {
- if (currentValue === undefined) {
- return false;
- }
- if (Array.isArray(currentValue)) {
- return currentValue.some((val) => compareOptions(val, compareValue, compareWith));
- }
- else {
- return compareOptions(currentValue, compareValue, compareWith);
- }
- };
- /**
- * Used to update a scoped component that uses emulated slots. This fires when
- * content is passed into the slot or when the content inside of a slot changes.
- * This is not needed for components using native slots in the Shadow DOM.
- * @internal
- * @param el The host element to observe
- * @param slotName mutationCallback will fire when nodes on these slot(s) change
- * @param mutationCallback The callback to fire whenever the slotted content changes
- */
- const createSlotMutationController = (el, slotName, mutationCallback) => {
- let hostMutationObserver;
- let slottedContentMutationObserver;
- if (win$1 !== undefined && 'MutationObserver' in win$1) {
- const slots = Array.isArray(slotName) ? slotName : [slotName];
- hostMutationObserver = new MutationObserver((entries) => {
- for (const entry of entries) {
- for (const node of entry.addedNodes) {
- /**
- * Check to see if the added node
- * is our slotted content.
- */
- if (node.nodeType === Node.ELEMENT_NODE && slots.includes(node.slot)) {
- /**
- * If so, we want to watch the slotted
- * content itself for changes. This lets us
- * detect when content inside of the slot changes.
- */
- mutationCallback();
- /**
- * Adding the listener in an raf
- * waits until Stencil moves the slotted element
- * into the correct place in the event that
- * slotted content is being added.
- */
- raf(() => watchForSlotChange(node));
- return;
- }
- }
- }
- });
- hostMutationObserver.observe(el, {
- childList: true,
- /**
- * This fixes an issue with the `ion-input` and
- * `ion-textarea` not re-rendering in some cases
- * when using the label slot functionality.
- *
- * HTML element patches in Stencil that are enabled
- * by the `experimentalSlotFixes` flag in Stencil v4
- * result in DOM manipulations that won't trigger
- * the current mutation observer configuration and
- * callback.
- */
- subtree: true,
- });
- }
- /**
- * Listen for changes inside of the slotted content.
- * We can listen for subtree changes here to be
- * informed of text within the slotted content
- * changing. Doing this on the host is possible
- * but it is much more expensive to do because
- * it also listens for changes to the internals
- * of the component.
- */
- const watchForSlotChange = (slottedEl) => {
- var _a;
- if (slottedContentMutationObserver) {
- slottedContentMutationObserver.disconnect();
- slottedContentMutationObserver = undefined;
- }
- slottedContentMutationObserver = new MutationObserver((entries) => {
- mutationCallback();
- for (const entry of entries) {
- for (const node of entry.removedNodes) {
- /**
- * If the element was removed then we
- * need to destroy the MutationObserver
- * so the element can be garbage collected.
- */
- if (node.nodeType === Node.ELEMENT_NODE && node.slot === slotName) {
- destroySlottedContentObserver();
- }
- }
- }
- });
- /**
- * Listen for changes inside of the element
- * as well as anything deep in the tree.
- * We listen on the parentElement so that we can
- * detect when slotted element itself is removed.
- */
- slottedContentMutationObserver.observe((_a = slottedEl.parentElement) !== null && _a !== void 0 ? _a : slottedEl, { subtree: true, childList: true });
- };
- const destroy = () => {
- if (hostMutationObserver) {
- hostMutationObserver.disconnect();
- hostMutationObserver = undefined;
- }
- destroySlottedContentObserver();
- };
- const destroySlottedContentObserver = () => {
- if (slottedContentMutationObserver) {
- slottedContentMutationObserver.disconnect();
- slottedContentMutationObserver = undefined;
- }
- };
- return {
- destroy,
- };
- };
- const getCounterText = (value, maxLength, counterFormatter) => {
- const valueLength = value == null ? 0 : value.toString().length;
- const defaultCounterText = defaultCounterFormatter(valueLength, maxLength);
- /**
- * If developers did not pass a custom formatter,
- * use the default one.
- */
- if (counterFormatter === undefined) {
- return defaultCounterText;
- }
- /**
- * Otherwise, try to use the custom formatter
- * and fallback to the default formatter if
- * there was an error.
- */
- try {
- return counterFormatter(valueLength, maxLength);
- }
- catch (e) {
- printIonError('[ion-input] - Exception in provided `counterFormatter`:', e);
- return defaultCounterText;
- }
- };
- const defaultCounterFormatter = (length, maxlength) => {
- return `${length} / ${maxlength}`;
- };
- const inputIosCss = ".sc-ion-input-ios-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--background:transparent;--color:initial;--border-style:solid;--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;width:100%;min-height:44px;padding:0 !important;color:var(--color);font-family:var(--ion-font-family, inherit);z-index:2}ion-item[slot=start].sc-ion-input-ios-h,ion-item [slot=start].sc-ion-input-ios-h,ion-item[slot=end].sc-ion-input-ios-h,ion-item [slot=end].sc-ion-input-ios-h{width:auto}.ion-color.sc-ion-input-ios-h{--highlight-color-focused:var(--ion-color-base)}.input-label-placement-floating.sc-ion-input-ios-h,.input-label-placement-stacked.sc-ion-input-ios-h{min-height:56px}.native-input.sc-ion-input-ios{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:inline-block;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;height:100%;max-height:100%;border:0;outline:none;background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:1}.native-input.sc-ion-input-ios::-webkit-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-ios::-moz-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-ios:-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-ios::-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-ios::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-ios:-webkit-autofill{background-color:transparent}.native-input.sc-ion-input-ios:invalid{-webkit-box-shadow:none;box-shadow:none}.native-input.sc-ion-input-ios::-ms-clear{display:none}.cloned-input.sc-ion-input-ios{top:0;bottom:0;position:absolute;pointer-events:none}.cloned-input.sc-ion-input-ios{inset-inline-start:0}.cloned-input.sc-ion-input-ios:disabled{opacity:1}.input-clear-icon.sc-ion-input-ios{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;background-position:center;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:30px;height:30px;border:0;outline:none;background-color:transparent;background-repeat:no-repeat;color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));visibility:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}.in-item-color.sc-ion-input-ios-h .input-clear-icon.sc-ion-input-ios{color:inherit}.input-clear-icon.sc-ion-input-ios:focus{opacity:0.5}.has-value.sc-ion-input-ios-h .input-clear-icon.sc-ion-input-ios{visibility:visible}.input-wrapper.sc-ion-input-ios{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:stretch;align-items:stretch;height:inherit;min-height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;background:var(--background);line-height:normal}.native-wrapper.sc-ion-input-ios{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;width:100%}.ion-touched.ion-invalid.sc-ion-input-ios-h{--highlight-color:var(--highlight-color-invalid)}.ion-valid.sc-ion-input-ios-h{--highlight-color:var(--highlight-color-valid)}.input-bottom.sc-ion-input-ios{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:5px;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;border-top:var(--border-width) var(--border-style) var(--border-color);font-size:0.75rem;white-space:normal}.has-focus.ion-valid.sc-ion-input-ios-h,.ion-touched.ion-invalid.sc-ion-input-ios-h{--border-color:var(--highlight-color)}.input-bottom.sc-ion-input-ios .error-text.sc-ion-input-ios{display:none;color:var(--highlight-color-invalid)}.input-bottom.sc-ion-input-ios .helper-text.sc-ion-input-ios{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}.ion-touched.ion-invalid.sc-ion-input-ios-h .input-bottom.sc-ion-input-ios .error-text.sc-ion-input-ios{display:block}.ion-touched.ion-invalid.sc-ion-input-ios-h .input-bottom.sc-ion-input-ios .helper-text.sc-ion-input-ios{display:none}.input-bottom.sc-ion-input-ios .counter.sc-ion-input-ios{-webkit-margin-start:auto;margin-inline-start:auto;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));white-space:nowrap;-webkit-padding-start:16px;padding-inline-start:16px}.has-focus.sc-ion-input-ios-h input.sc-ion-input-ios{caret-color:var(--highlight-color)}.label-text-wrapper.sc-ion-input-ios{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;max-width:200px;-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);pointer-events:none}.label-text.sc-ion-input-ios,.sc-ion-input-ios-s>[slot=label]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden.sc-ion-input-ios,.input-outline-notch-hidden.sc-ion-input-ios{display:none}.input-wrapper.sc-ion-input-ios input.sc-ion-input-ios{-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1)}.input-label-placement-start.sc-ion-input-ios-h .input-wrapper.sc-ion-input-ios{-ms-flex-direction:row;flex-direction:row}.input-label-placement-start.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.input-label-placement-end.sc-ion-input-ios-h .input-wrapper.sc-ion-input-ios{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.input-label-placement-end.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}.input-label-placement-fixed.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.input-label-placement-fixed.sc-ion-input-ios-h .label-text.sc-ion-input-ios{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.input-label-placement-stacked.sc-ion-input-ios-h .input-wrapper.sc-ion-input-ios,.input-label-placement-floating.sc-ion-input-ios-h .input-wrapper.sc-ion-input-ios{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:start}.input-label-placement-stacked.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,.input-label-placement-floating.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios{-webkit-transform-origin:left top;transform-origin:left top;max-width:100%;z-index:2}[dir=rtl].sc-ion-input-ios-h -no-combinator.input-label-placement-stacked.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,[dir=rtl] .sc-ion-input-ios-h -no-combinator.input-label-placement-stacked.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,[dir=rtl].input-label-placement-stacked.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,[dir=rtl] .input-label-placement-stacked.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,[dir=rtl].sc-ion-input-ios-h -no-combinator.input-label-placement-floating.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,[dir=rtl] .sc-ion-input-ios-h -no-combinator.input-label-placement-floating.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,[dir=rtl].input-label-placement-floating.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios,[dir=rtl] .input-label-placement-floating.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.input-label-placement-stacked.sc-ion-input-ios-h:dir(rtl) .label-text-wrapper.sc-ion-input-ios,.input-label-placement-floating.sc-ion-input-ios-h:dir(rtl) .label-text-wrapper.sc-ion-input-ios{-webkit-transform-origin:right top;transform-origin:right top}}.input-label-placement-stacked.sc-ion-input-ios-h input.sc-ion-input-ios,.input-label-placement-floating.sc-ion-input-ios-h input.sc-ion-input-ios{margin-left:0;margin-right:0;margin-top:1px;margin-bottom:0}.input-label-placement-floating.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios{-webkit-transform:translateY(100%) scale(1);transform:translateY(100%) scale(1)}.input-label-placement-floating.sc-ion-input-ios-h input.sc-ion-input-ios{opacity:0}.has-focus.input-label-placement-floating.sc-ion-input-ios-h input.sc-ion-input-ios,.has-value.input-label-placement-floating.sc-ion-input-ios-h input.sc-ion-input-ios{opacity:1}.label-floating.sc-ion-input-ios-h .label-text-wrapper.sc-ion-input-ios{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75);max-width:calc(100% / 0.75)}.sc-ion-input-ios-s>[slot=start]:last-of-type{-webkit-margin-end:16px;margin-inline-end:16px;-webkit-margin-start:0;margin-inline-start:0}.sc-ion-input-ios-s>[slot=end]:first-of-type{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}.sc-ion-input-ios-h[disabled].sc-ion-input-ios-s>ion-input-password-toggle,.sc-ion-input-ios-h[disabled] .sc-ion-input-ios-s>ion-input-password-toggle,.sc-ion-input-ios-h[readonly].sc-ion-input-ios-s>ion-input-password-toggle,.sc-ion-input-ios-h[readonly] .sc-ion-input-ios-s>ion-input-password-toggle{display:none}.sc-ion-input-ios-h{--border-width:0.55px;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));--highlight-height:0px;font-size:inherit}.input-clear-icon.sc-ion-input-ios ion-icon.sc-ion-input-ios{width:18px;height:18px}.input-disabled.sc-ion-input-ios-h{opacity:0.3}.sc-ion-input-ios-s>ion-button[slot=start].button-has-icon-only,.sc-ion-input-ios-s>ion-button[slot=end].button-has-icon-only{--border-radius:50%;--padding-start:0;--padding-end:0;--padding-top:0;--padding-bottom:0;aspect-ratio:1}";
- var IonInputIosStyle0 = inputIosCss;
- const inputMdCss = ".sc-ion-input-md-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--background:transparent;--color:initial;--border-style:solid;--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;width:100%;min-height:44px;padding:0 !important;color:var(--color);font-family:var(--ion-font-family, inherit);z-index:2}ion-item[slot=start].sc-ion-input-md-h,ion-item [slot=start].sc-ion-input-md-h,ion-item[slot=end].sc-ion-input-md-h,ion-item [slot=end].sc-ion-input-md-h{width:auto}.ion-color.sc-ion-input-md-h{--highlight-color-focused:var(--ion-color-base)}.input-label-placement-floating.sc-ion-input-md-h,.input-label-placement-stacked.sc-ion-input-md-h{min-height:56px}.native-input.sc-ion-input-md{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:inline-block;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;height:100%;max-height:100%;border:0;outline:none;background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:1}.native-input.sc-ion-input-md::-webkit-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md::-moz-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md:-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md::-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md:-webkit-autofill{background-color:transparent}.native-input.sc-ion-input-md:invalid{-webkit-box-shadow:none;box-shadow:none}.native-input.sc-ion-input-md::-ms-clear{display:none}.cloned-input.sc-ion-input-md{top:0;bottom:0;position:absolute;pointer-events:none}.cloned-input.sc-ion-input-md{inset-inline-start:0}.cloned-input.sc-ion-input-md:disabled{opacity:1}.input-clear-icon.sc-ion-input-md{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;background-position:center;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:30px;height:30px;border:0;outline:none;background-color:transparent;background-repeat:no-repeat;color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));visibility:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}.in-item-color.sc-ion-input-md-h .input-clear-icon.sc-ion-input-md{color:inherit}.input-clear-icon.sc-ion-input-md:focus{opacity:0.5}.has-value.sc-ion-input-md-h .input-clear-icon.sc-ion-input-md{visibility:visible}.input-wrapper.sc-ion-input-md{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:stretch;align-items:stretch;height:inherit;min-height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;background:var(--background);line-height:normal}.native-wrapper.sc-ion-input-md{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;width:100%}.ion-touched.ion-invalid.sc-ion-input-md-h{--highlight-color:var(--highlight-color-invalid)}.ion-valid.sc-ion-input-md-h{--highlight-color:var(--highlight-color-valid)}.input-bottom.sc-ion-input-md{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:5px;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;border-top:var(--border-width) var(--border-style) var(--border-color);font-size:0.75rem;white-space:normal}.has-focus.ion-valid.sc-ion-input-md-h,.ion-touched.ion-invalid.sc-ion-input-md-h{--border-color:var(--highlight-color)}.input-bottom.sc-ion-input-md .error-text.sc-ion-input-md{display:none;color:var(--highlight-color-invalid)}.input-bottom.sc-ion-input-md .helper-text.sc-ion-input-md{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}.ion-touched.ion-invalid.sc-ion-input-md-h .input-bottom.sc-ion-input-md .error-text.sc-ion-input-md{display:block}.ion-touched.ion-invalid.sc-ion-input-md-h .input-bottom.sc-ion-input-md .helper-text.sc-ion-input-md{display:none}.input-bottom.sc-ion-input-md .counter.sc-ion-input-md{-webkit-margin-start:auto;margin-inline-start:auto;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));white-space:nowrap;-webkit-padding-start:16px;padding-inline-start:16px}.has-focus.sc-ion-input-md-h input.sc-ion-input-md{caret-color:var(--highlight-color)}.label-text-wrapper.sc-ion-input-md{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;max-width:200px;-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);pointer-events:none}.label-text.sc-ion-input-md,.sc-ion-input-md-s>[slot=label]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden.sc-ion-input-md,.input-outline-notch-hidden.sc-ion-input-md{display:none}.input-wrapper.sc-ion-input-md input.sc-ion-input-md{-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1)}.input-label-placement-start.sc-ion-input-md-h .input-wrapper.sc-ion-input-md{-ms-flex-direction:row;flex-direction:row}.input-label-placement-start.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.input-label-placement-end.sc-ion-input-md-h .input-wrapper.sc-ion-input-md{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.input-label-placement-end.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}.input-label-placement-fixed.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.input-label-placement-fixed.sc-ion-input-md-h .label-text.sc-ion-input-md{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.input-label-placement-stacked.sc-ion-input-md-h .input-wrapper.sc-ion-input-md,.input-label-placement-floating.sc-ion-input-md-h .input-wrapper.sc-ion-input-md{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:start}.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-transform-origin:left top;transform-origin:left top;max-width:100%;z-index:2}[dir=rtl].sc-ion-input-md-h -no-combinator.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .sc-ion-input-md-h -no-combinator.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl].input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl].sc-ion-input-md-h -no-combinator.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .sc-ion-input-md-h -no-combinator.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl].input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.input-label-placement-stacked.sc-ion-input-md-h:dir(rtl) .label-text-wrapper.sc-ion-input-md,.input-label-placement-floating.sc-ion-input-md-h:dir(rtl) .label-text-wrapper.sc-ion-input-md{-webkit-transform-origin:right top;transform-origin:right top}}.input-label-placement-stacked.sc-ion-input-md-h input.sc-ion-input-md,.input-label-placement-floating.sc-ion-input-md-h input.sc-ion-input-md{margin-left:0;margin-right:0;margin-top:1px;margin-bottom:0}.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-transform:translateY(100%) scale(1);transform:translateY(100%) scale(1)}.input-label-placement-floating.sc-ion-input-md-h input.sc-ion-input-md{opacity:0}.has-focus.input-label-placement-floating.sc-ion-input-md-h input.sc-ion-input-md,.has-value.input-label-placement-floating.sc-ion-input-md-h input.sc-ion-input-md{opacity:1}.label-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75);max-width:calc(100% / 0.75)}.sc-ion-input-md-s>[slot=start]:last-of-type{-webkit-margin-end:16px;margin-inline-end:16px;-webkit-margin-start:0;margin-inline-start:0}.sc-ion-input-md-s>[slot=end]:first-of-type{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}.sc-ion-input-md-h[disabled].sc-ion-input-md-s>ion-input-password-toggle,.sc-ion-input-md-h[disabled] .sc-ion-input-md-s>ion-input-password-toggle,.sc-ion-input-md-h[readonly].sc-ion-input-md-s>ion-input-password-toggle,.sc-ion-input-md-h[readonly] .sc-ion-input-md-s>ion-input-password-toggle{display:none}.input-fill-solid.sc-ion-input-md-h{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--border-color:var(--ion-color-step-500, var(--ion-background-color-step-500, gray));--border-radius:4px;--padding-start:16px;--padding-end:16px;min-height:56px}.input-fill-solid.sc-ion-input-md-h .input-wrapper.sc-ion-input-md{border-bottom:var(--border-width) var(--border-style) var(--border-color)}.has-focus.input-fill-solid.ion-valid.sc-ion-input-md-h,.input-fill-solid.ion-touched.ion-invalid.sc-ion-input-md-h{--border-color:var(--highlight-color)}.input-fill-solid.sc-ion-input-md-h .input-bottom.sc-ion-input-md{border-top:none}@media (any-hover: hover){.input-fill-solid.sc-ion-input-md-h:hover{--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6));--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}}.input-fill-solid.has-focus.sc-ion-input-md-h{--background:var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}.input-fill-solid.sc-ion-input-md-h .input-wrapper.sc-ion-input-md{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0px;border-end-start-radius:0px}.label-floating.input-fill-solid.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{max-width:calc(100% / 0.75)}.input-fill-outline.sc-ion-input-md-h{--border-color:var(--ion-color-step-300, var(--ion-background-color-step-300, #b3b3b3));--border-radius:4px;--padding-start:16px;--padding-end:16px;min-height:56px}.input-fill-outline.input-shape-round.sc-ion-input-md-h{--border-radius:28px;--padding-start:32px;--padding-end:32px}.has-focus.input-fill-outline.ion-valid.sc-ion-input-md-h,.input-fill-outline.ion-touched.ion-invalid.sc-ion-input-md-h{--border-color:var(--highlight-color)}@media (any-hover: hover){.input-fill-outline.sc-ion-input-md-h:hover{--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}}.input-fill-outline.has-focus.sc-ion-input-md-h{--border-width:var(--highlight-height);--border-color:var(--highlight-color)}.input-fill-outline.sc-ion-input-md-h .input-bottom.sc-ion-input-md{border-top:none}.input-fill-outline.sc-ion-input-md-h .input-wrapper.sc-ion-input-md{border-bottom:none}.input-fill-outline.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,.input-fill-outline.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-transform-origin:left top;transform-origin:left top;position:absolute;max-width:calc(100% - var(--padding-start) - var(--padding-end))}[dir=rtl].sc-ion-input-md-h -no-combinator.input-fill-outline.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .sc-ion-input-md-h -no-combinator.input-fill-outline.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl].input-fill-outline.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .input-fill-outline.input-label-placement-stacked.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl].sc-ion-input-md-h -no-combinator.input-fill-outline.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .sc-ion-input-md-h -no-combinator.input-fill-outline.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl].input-fill-outline.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,[dir=rtl] .input-fill-outline.input-label-placement-floating.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.input-fill-outline.input-label-placement-stacked.sc-ion-input-md-h:dir(rtl) .label-text-wrapper.sc-ion-input-md,.input-fill-outline.input-label-placement-floating.sc-ion-input-md-h:dir(rtl) .label-text-wrapper.sc-ion-input-md{-webkit-transform-origin:right top;transform-origin:right top}}.input-fill-outline.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{position:relative}.label-floating.input-fill-outline.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{-webkit-transform:translateY(-32%) scale(0.75);transform:translateY(-32%) scale(0.75);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;max-width:calc((100% - var(--padding-start) - var(--padding-end) - 8px) / 0.75)}.input-fill-outline.input-label-placement-stacked.sc-ion-input-md-h input.sc-ion-input-md,.input-fill-outline.input-label-placement-floating.sc-ion-input-md-h input.sc-ion-input-md{margin-left:0;margin-right:0;margin-top:6px;margin-bottom:6px}.input-fill-outline.sc-ion-input-md-h .input-outline-container.sc-ion-input-md{left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;width:100%;height:100%}.input-fill-outline.sc-ion-input-md-h .input-outline-start.sc-ion-input-md,.input-fill-outline.sc-ion-input-md-h .input-outline-end.sc-ion-input-md{pointer-events:none}.input-fill-outline.sc-ion-input-md-h .input-outline-start.sc-ion-input-md,.input-fill-outline.sc-ion-input-md-h .input-outline-notch.sc-ion-input-md,.input-fill-outline.sc-ion-input-md-h .input-outline-end.sc-ion-input-md{border-top:var(--border-width) var(--border-style) var(--border-color);border-bottom:var(--border-width) var(--border-style) var(--border-color)}.input-fill-outline.sc-ion-input-md-h .input-outline-notch.sc-ion-input-md{max-width:calc(100% - var(--padding-start) - var(--padding-end))}.input-fill-outline.sc-ion-input-md-h .notch-spacer.sc-ion-input-md{-webkit-padding-end:8px;padding-inline-end:8px;font-size:calc(1em * 0.75);opacity:0;pointer-events:none;-webkit-box-sizing:content-box;box-sizing:content-box}.input-fill-outline.sc-ion-input-md-h .input-outline-start.sc-ion-input-md{border-start-start-radius:var(--border-radius);border-start-end-radius:0px;border-end-end-radius:0px;border-end-start-radius:var(--border-radius);-webkit-border-start:var(--border-width) var(--border-style) var(--border-color);border-inline-start:var(--border-width) var(--border-style) var(--border-color);width:calc(var(--padding-start) - 4px)}.input-fill-outline.sc-ion-input-md-h .input-outline-end.sc-ion-input-md{-webkit-border-end:var(--border-width) var(--border-style) var(--border-color);border-inline-end:var(--border-width) var(--border-style) var(--border-color);border-start-start-radius:0px;border-start-end-radius:var(--border-radius);border-end-end-radius:var(--border-radius);border-end-start-radius:0px;-ms-flex-positive:1;flex-grow:1}.label-floating.input-fill-outline.sc-ion-input-md-h .input-outline-notch.sc-ion-input-md{border-top:none}.sc-ion-input-md-h{--border-width:1px;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));--highlight-height:2px;font-size:inherit}.input-clear-icon.sc-ion-input-md ion-icon.sc-ion-input-md{width:22px;height:22px}.input-disabled.sc-ion-input-md-h{opacity:0.38}.has-focus.ion-valid.sc-ion-input-md-h,.ion-touched.ion-invalid.sc-ion-input-md-h{--border-color:var(--highlight-color)}.input-bottom.sc-ion-input-md .counter.sc-ion-input-md{letter-spacing:0.0333333333em}.input-label-placement-floating.has-focus.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,.input-label-placement-stacked.has-focus.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{color:var(--highlight-color)}.has-focus.input-label-placement-floating.ion-valid.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,.input-label-placement-floating.ion-touched.ion-invalid.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,.has-focus.input-label-placement-stacked.ion-valid.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md,.input-label-placement-stacked.ion-touched.ion-invalid.sc-ion-input-md-h .label-text-wrapper.sc-ion-input-md{color:var(--highlight-color)}.input-highlight.sc-ion-input-md{bottom:-1px;position:absolute;width:100%;height:var(--highlight-height);-webkit-transform:scale(0);transform:scale(0);-webkit-transition:-webkit-transform 200ms;transition:-webkit-transform 200ms;transition:transform 200ms;transition:transform 200ms, -webkit-transform 200ms;background:var(--highlight-color)}.input-highlight.sc-ion-input-md{inset-inline-start:0}.has-focus.sc-ion-input-md-h .input-highlight.sc-ion-input-md{-webkit-transform:scale(1);transform:scale(1)}.in-item.sc-ion-input-md-h .input-highlight.sc-ion-input-md{bottom:0}.in-item.sc-ion-input-md-h .input-highlight.sc-ion-input-md{inset-inline-start:0}.input-shape-round.sc-ion-input-md-h{--border-radius:16px}.sc-ion-input-md-s>ion-button[slot=start].button-has-icon-only,.sc-ion-input-md-s>ion-button[slot=end].button-has-icon-only{--border-radius:50%;--padding-start:8px;--padding-end:8px;--padding-top:8px;--padding-bottom:8px;aspect-ratio:1;min-height:40px}";
- var IonInputMdStyle0 = inputMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot label - The label text to associate with the input. Use the `labelPlacement` property to control where the label is placed relative to the input. Use this if you need to render a label with custom HTML. (EXPERIMENTAL)
- * @slot start - Content to display at the leading edge of the input. (EXPERIMENTAL)
- * @slot end - Content to display at the trailing edge of the input. (EXPERIMENTAL)
- */
- class Input {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionInput = createEvent(this, "ionInput", 7);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.inputId = `ion-input-${inputIds++}`;
- this.helperTextId = `${this.inputId}-helper-text`;
- this.errorTextId = `${this.inputId}-error-text`;
- this.inheritedAttributes = {};
- this.isComposing = false;
- /**
- * `true` if the input was cleared as a result of the user typing
- * with `clearOnEdit` enabled.
- *
- * Resets when the input loses focus.
- */
- this.didInputClearOnEdit = false;
- this.onInput = (ev) => {
- const input = ev.target;
- if (input) {
- this.value = input.value || '';
- }
- this.emitInputChange(ev);
- };
- this.onChange = (ev) => {
- this.emitValueChange(ev);
- };
- this.onBlur = (ev) => {
- this.hasFocus = false;
- if (this.focusedValue !== this.value) {
- /**
- * Emits the `ionChange` event when the input value
- * is different than the value when the input was focused.
- */
- this.emitValueChange(ev);
- }
- this.didInputClearOnEdit = false;
- this.ionBlur.emit(ev);
- };
- this.onFocus = (ev) => {
- this.hasFocus = true;
- this.focusedValue = this.value;
- this.ionFocus.emit(ev);
- };
- this.onKeydown = (ev) => {
- this.checkClearOnEdit(ev);
- };
- this.onCompositionStart = () => {
- this.isComposing = true;
- };
- this.onCompositionEnd = () => {
- this.isComposing = false;
- };
- this.clearTextInput = (ev) => {
- if (this.clearInput && !this.readonly && !this.disabled && ev) {
- ev.preventDefault();
- ev.stopPropagation();
- // Attempt to focus input again after pressing clear button
- this.setFocus();
- }
- this.value = '';
- this.emitInputChange(ev);
- };
- /**
- * Stops propagation when the label is clicked,
- * otherwise, two clicks will be triggered.
- */
- this.onLabelClick = (ev) => {
- // Only stop propagation if the click was directly on the label
- // and not on the input or other child elements
- if (ev.target === ev.currentTarget) {
- ev.stopPropagation();
- }
- };
- this.hasFocus = false;
- this.color = undefined;
- this.autocapitalize = 'off';
- this.autocomplete = 'off';
- this.autocorrect = 'off';
- this.autofocus = false;
- this.clearInput = false;
- this.clearInputIcon = undefined;
- this.clearOnEdit = undefined;
- this.counter = false;
- this.counterFormatter = undefined;
- this.debounce = undefined;
- this.disabled = false;
- this.enterkeyhint = undefined;
- this.errorText = undefined;
- this.fill = undefined;
- this.inputmode = undefined;
- this.helperText = undefined;
- this.label = undefined;
- this.labelPlacement = 'start';
- this.max = undefined;
- this.maxlength = undefined;
- this.min = undefined;
- this.minlength = undefined;
- this.multiple = undefined;
- this.name = this.inputId;
- this.pattern = undefined;
- this.placeholder = undefined;
- this.readonly = false;
- this.required = false;
- this.shape = undefined;
- this.spellcheck = false;
- this.step = undefined;
- this.type = 'text';
- this.value = '';
- }
- debounceChanged() {
- const { ionInput, debounce, originalIonInput } = this;
- /**
- * If debounce is undefined, we have to manually revert the ionInput emitter in case
- * debounce used to be set to a number. Otherwise, the event would stay debounced.
- */
- this.ionInput = debounce === undefined ? originalIonInput !== null && originalIonInput !== void 0 ? originalIonInput : ionInput : debounceEvent(ionInput, debounce);
- }
- /**
- * Whenever the type on the input changes we need
- * to update the internal type prop on the password
- * toggle so that that correct icon is shown.
- */
- onTypeChange() {
- const passwordToggle = this.el.querySelector('ion-input-password-toggle');
- if (passwordToggle) {
- passwordToggle.type = this.type;
- }
- }
- /**
- * Update the native input element when the value changes
- */
- valueChanged() {
- const nativeInput = this.nativeInput;
- const value = this.getValue();
- if (nativeInput && nativeInput.value !== value && !this.isComposing) {
- /**
- * Assigning the native input's value on attribute
- * value change, allows `ionInput` implementations
- * to override the control's value.
- *
- * Used for patterns such as input trimming (removing whitespace),
- * or input masking.
- */
- nativeInput.value = value;
- }
- }
- /**
- * dir is a globally enumerated attribute.
- * As a result, creating these as properties
- * can have unintended side effects. Instead, we
- * listen for attribute changes and inherit them
- * to the inner `<input>` element.
- */
- onDirChanged(newValue) {
- this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { dir: newValue });
- }
- /**
- * This prevents the native input from emitting the click event.
- * Instead, the click event from the ion-input is emitted.
- */
- onClickCapture(ev) {
- const nativeInput = this.nativeInput;
- if (nativeInput && ev.target === nativeInput) {
- ev.stopPropagation();
- this.el.click();
- }
- }
- componentWillLoad() {
- this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el)), inheritAttributes$1(this.el, ['tabindex', 'title', 'data-form-type', 'dir']));
- }
- connectedCallback() {
- const { el } = this;
- this.slotMutationController = createSlotMutationController(el, ['label', 'start', 'end'], () => forceUpdate());
- this.notchController = createNotchController(el, () => this.notchSpacerEl, () => this.labelSlot);
- this.debounceChanged();
- }
- componentDidLoad() {
- this.originalIonInput = this.ionInput;
- /**
- * Set the type on the password toggle in the event that this input's
- * type was set async and does not match the default type for the password toggle.
- * This can happen when the type is bound using a JS framework binding syntax
- * such as [type] in Angular.
- */
- this.onTypeChange();
- this.debounceChanged();
- }
- componentDidRender() {
- var _a;
- (_a = this.notchController) === null || _a === void 0 ? void 0 : _a.calculateNotchWidth();
- }
- disconnectedCallback() {
- if (this.slotMutationController) {
- this.slotMutationController.destroy();
- this.slotMutationController = undefined;
- }
- if (this.notchController) {
- this.notchController.destroy();
- this.notchController = undefined;
- }
- }
- /**
- * Sets focus on the native `input` in `ion-input`. Use this method instead of the global
- * `input.focus()`.
- *
- * Developers who wish to focus an input when a page enters
- * should call `setFocus()` in the `ionViewDidEnter()` lifecycle method.
- *
- * Developers who wish to focus an input when an overlay is presented
- * should call `setFocus` after `didPresent` has resolved.
- *
- * See [managing focus](/docs/developing/managing-focus) for more information.
- */
- async setFocus() {
- if (this.nativeInput) {
- this.nativeInput.focus();
- }
- }
- /**
- * Returns the native `<input>` element used under the hood.
- */
- async getInputElement() {
- /**
- * If this gets called in certain early lifecycle hooks (ex: Vue onMounted),
- * nativeInput won't be defined yet with the custom elements build, so wait for it to load in.
- */
- if (!this.nativeInput) {
- await new Promise((resolve) => componentOnReady(this.el, resolve));
- }
- return Promise.resolve(this.nativeInput);
- }
- /**
- * Emits an `ionChange` event.
- *
- * This API should be called for user committed changes.
- * This API should not be used for external value changes.
- */
- emitValueChange(event) {
- const { value } = this;
- // Checks for both null and undefined values
- const newValue = value == null ? value : value.toString();
- // Emitting a value change should update the internal state for tracking the focused value
- this.focusedValue = newValue;
- this.ionChange.emit({ value: newValue, event });
- }
- /**
- * Emits an `ionInput` event.
- */
- emitInputChange(event) {
- const { value } = this;
- // Checks for both null and undefined values
- const newValue = value == null ? value : value.toString();
- this.ionInput.emit({ value: newValue, event });
- }
- shouldClearOnEdit() {
- const { type, clearOnEdit } = this;
- return clearOnEdit === undefined ? type === 'password' : clearOnEdit;
- }
- getValue() {
- return typeof this.value === 'number' ? this.value.toString() : (this.value || '').toString();
- }
- checkClearOnEdit(ev) {
- if (!this.shouldClearOnEdit()) {
- return;
- }
- /**
- * The following keys do not modify the
- * contents of the input. As a result, pressing
- * them should not edit the input.
- *
- * We can't check to see if the value of the input
- * was changed because we call checkClearOnEdit
- * in a keydown listener, and the key has not yet
- * been added to the input.
- */
- const IGNORED_KEYS = ['Enter', 'Tab', 'Shift', 'Meta', 'Alt', 'Control'];
- const pressedIgnoredKey = IGNORED_KEYS.includes(ev.key);
- /**
- * Clear the input if the control has not been previously cleared during focus.
- * Do not clear if the user hitting enter to submit a form.
- */
- if (!this.didInputClearOnEdit && this.hasValue() && !pressedIgnoredKey) {
- this.value = '';
- this.emitInputChange(ev);
- }
- /**
- * Pressing an IGNORED_KEYS first and
- * then an allowed key will cause the input to not
- * be cleared.
- */
- if (!pressedIgnoredKey) {
- this.didInputClearOnEdit = true;
- }
- }
- hasValue() {
- return this.getValue().length > 0;
- }
- /**
- * Renders the helper text or error text values
- */
- renderHintText() {
- const { helperText, errorText, helperTextId, errorTextId } = this;
- return [
- hAsync("div", { id: helperTextId, class: "helper-text" }, helperText),
- hAsync("div", { id: errorTextId, class: "error-text" }, errorText),
- ];
- }
- getHintTextID() {
- const { el, helperText, errorText, helperTextId, errorTextId } = this;
- if (el.classList.contains('ion-touched') && el.classList.contains('ion-invalid') && errorText) {
- return errorTextId;
- }
- if (helperText) {
- return helperTextId;
- }
- return undefined;
- }
- renderCounter() {
- const { counter, maxlength, counterFormatter, value } = this;
- if (counter !== true || maxlength === undefined) {
- return;
- }
- return hAsync("div", { class: "counter" }, getCounterText(value, maxlength, counterFormatter));
- }
- /**
- * Responsible for rendering helper text,
- * error text, and counter. This element should only
- * be rendered if hint text is set or counter is enabled.
- */
- renderBottomContent() {
- const { counter, helperText, errorText, maxlength } = this;
- /**
- * undefined and empty string values should
- * be treated as not having helper/error text.
- */
- const hasHintText = !!helperText || !!errorText;
- const hasCounter = counter === true && maxlength !== undefined;
- if (!hasHintText && !hasCounter) {
- return;
- }
- return (hAsync("div", { class: "input-bottom" }, this.renderHintText(), this.renderCounter()));
- }
- renderLabel() {
- const { label } = this;
- return (hAsync("div", { class: {
- 'label-text-wrapper': true,
- 'label-text-wrapper-hidden': !this.hasLabel,
- } }, label === undefined ? hAsync("slot", { name: "label" }) : hAsync("div", { class: "label-text" }, label)));
- }
- /**
- * Gets any content passed into the `label` slot,
- * not the <slot> definition.
- */
- get labelSlot() {
- return this.el.querySelector('[slot="label"]');
- }
- /**
- * Returns `true` if label content is provided
- * either by a prop or a content. If you want
- * to get the plaintext value of the label use
- * the `labelText` getter instead.
- */
- get hasLabel() {
- return this.label !== undefined || this.labelSlot !== null;
- }
- /**
- * Renders the border container
- * when fill="outline".
- */
- renderLabelContainer() {
- const mode = getIonMode$1(this);
- const hasOutlineFill = mode === 'md' && this.fill === 'outline';
- if (hasOutlineFill) {
- /**
- * The outline fill has a special outline
- * that appears around the input and the label.
- * Certain stacked and floating label placements cause the
- * label to translate up and create a "cut out"
- * inside of that border by using the notch-spacer element.
- */
- return [
- hAsync("div", { class: "input-outline-container" }, hAsync("div", { class: "input-outline-start" }), hAsync("div", { class: {
- 'input-outline-notch': true,
- 'input-outline-notch-hidden': !this.hasLabel,
- } }, hAsync("div", { class: "notch-spacer", "aria-hidden": "true", ref: (el) => (this.notchSpacerEl = el) }, this.label)), hAsync("div", { class: "input-outline-end" })),
- this.renderLabel(),
- ];
- }
- /**
- * If not using the outline style,
- * we can render just the label.
- */
- return this.renderLabel();
- }
- render() {
- const { disabled, fill, readonly, shape, inputId, labelPlacement, el, hasFocus, clearInputIcon } = this;
- const mode = getIonMode$1(this);
- const value = this.getValue();
- const inItem = hostContext('ion-item', this.el);
- const shouldRenderHighlight = mode === 'md' && fill !== 'outline' && !inItem;
- const defaultClearIcon = mode === 'ios' ? closeCircle : closeSharp;
- const clearIconData = clearInputIcon !== null && clearInputIcon !== void 0 ? clearInputIcon : defaultClearIcon;
- const hasValue = this.hasValue();
- const hasStartEndSlots = el.querySelector('[slot="start"], [slot="end"]') !== null;
- /**
- * If the label is stacked, it should always sit above the input.
- * For floating labels, the label should move above the input if
- * the input has a value, is focused, or has anything in either
- * the start or end slot.
- *
- * If there is content in the start slot, the label would overlap
- * it if not forced to float. This is also applied to the end slot
- * because with the default or solid fills, the input is not
- * vertically centered in the container, but the label is. This
- * causes the slots and label to appear vertically offset from each
- * other when the label isn't floating above the input. This doesn't
- * apply to the outline fill, but this was not accounted for to keep
- * things consistent.
- *
- * TODO(FW-5592): Remove hasStartEndSlots condition
- */
- const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || hasFocus || hasStartEndSlots));
- return (hAsync(Host, { key: '41b2526627e7d2773a80f011b123284203a71ca0', class: createColorClasses$1(this.color, {
- [mode]: true,
- 'has-value': hasValue,
- 'has-focus': hasFocus,
- 'label-floating': labelShouldFloat,
- [`input-fill-${fill}`]: fill !== undefined,
- [`input-shape-${shape}`]: shape !== undefined,
- [`input-label-placement-${labelPlacement}`]: true,
- 'in-item': inItem,
- 'in-item-color': hostContext('ion-item.ion-color', this.el),
- 'input-disabled': disabled,
- }) }, hAsync("label", { key: '9ab078363e32528102b441ad1791d83f86fdcbdc', class: "input-wrapper", htmlFor: inputId, onClick: this.onLabelClick }, this.renderLabelContainer(), hAsync("div", { key: 'e34b594980ec62e4c618e827fadf7669a39ad0d8', class: "native-wrapper", onClick: this.onLabelClick }, hAsync("slot", { key: '12dc04ead5502e9e5736240e918bf9331bf7b5d9', name: "start" }), hAsync("input", Object.assign({ key: 'df356eb4ced23109b2c0242f36dc043aba8782d6', class: "native-input", ref: (input) => (this.nativeInput = input), id: inputId, disabled: disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.type, value: value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown, onCompositionstart: this.onCompositionStart, onCompositionend: this.onCompositionEnd, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === this.errorTextId }, this.inheritedAttributes)), this.clearInput && !readonly && !disabled && (hAsync("button", { key: 'aa7cb47ac287140a68c5cb0ee9359abaa611e21b', "aria-label": "reset", type: "button", class: "input-clear-icon", onPointerDown: (ev) => {
- /**
- * This prevents mobile browsers from
- * blurring the input when the clear
- * button is activated.
- */
- ev.preventDefault();
- }, onFocusin: (ev) => {
- /**
- * Prevent the focusin event from bubbling otherwise it will cause the focusin
- * event listener in scroll assist to fire. When this fires, focus will be moved
- * back to the input even if the clear button was never tapped. This poses issues
- * for screen readers as it means users would be unable to swipe past the clear button.
- */
- ev.stopPropagation();
- }, onClick: this.clearTextInput }, hAsync("ion-icon", { key: 'cd03e46b97299d9db5cedf81944ae9bbe72bacdc', "aria-hidden": "true", icon: clearIconData }))), hAsync("slot", { key: 'de36b79a89c4b413beba22e8a74c53dbf57a84ab', name: "end" })), shouldRenderHighlight && hAsync("div", { key: 'f088509073845bf767ea7ccfde1e917e1cf93cc1', class: "input-highlight" })), this.renderBottomContent()));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "debounce": ["debounceChanged"],
- "type": ["onTypeChange"],
- "value": ["valueChanged"],
- "dir": ["onDirChanged"]
- }; }
- static get style() { return {
- ios: IonInputIosStyle0,
- md: IonInputMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 38,
- "$tagName$": "ion-input",
- "$members$": {
- "color": [513],
- "autocapitalize": [1],
- "autocomplete": [1],
- "autocorrect": [1],
- "autofocus": [4],
- "clearInput": [4, "clear-input"],
- "clearInputIcon": [1, "clear-input-icon"],
- "clearOnEdit": [4, "clear-on-edit"],
- "counter": [4],
- "counterFormatter": [16],
- "debounce": [2],
- "disabled": [516],
- "enterkeyhint": [1],
- "errorText": [1, "error-text"],
- "fill": [1],
- "inputmode": [1],
- "helperText": [1, "helper-text"],
- "label": [1],
- "labelPlacement": [1, "label-placement"],
- "max": [8],
- "maxlength": [2],
- "min": [8],
- "minlength": [2],
- "multiple": [4],
- "name": [1],
- "pattern": [1],
- "placeholder": [1],
- "readonly": [516],
- "required": [4],
- "shape": [1],
- "spellcheck": [4],
- "step": [1],
- "type": [1],
- "value": [1032],
- "hasFocus": [32],
- "setFocus": [64],
- "getInputElement": [64]
- },
- "$listeners$": [[2, "click", "onClickCapture"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"], ["disabled", "disabled"], ["readonly", "readonly"]]
- }; }
- }
- let inputIds = 0;
- const iosInputPasswordToggleCss = "";
- var IonInputPasswordToggleIosStyle0 = iosInputPasswordToggleCss;
- const mdInputPasswordToggleCss = "";
- var IonInputPasswordToggleMdStyle0 = mdInputPasswordToggleCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class InputPasswordToggle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.togglePasswordVisibility = () => {
- const { inputElRef } = this;
- if (!inputElRef) {
- return;
- }
- inputElRef.type = inputElRef.type === 'text' ? 'password' : 'text';
- };
- this.color = undefined;
- this.showIcon = undefined;
- this.hideIcon = undefined;
- this.type = 'password';
- }
- /**
- * Whenever the input type changes we need to re-run validation to ensure the password
- * toggle is being used with the correct input type. If the application changes the type
- * outside of this component we also need to re-render so the correct icon is shown.
- */
- onTypeChange(newValue) {
- if (newValue !== 'text' && newValue !== 'password') {
- printIonWarning(`[ion-input-password-toggle] - Only inputs of type "text" or "password" are supported. Input of type "${newValue}" is not compatible.`, this.el);
- return;
- }
- }
- connectedCallback() {
- const { el } = this;
- const inputElRef = (this.inputElRef = el.closest('ion-input'));
- if (!inputElRef) {
- printIonWarning('[ion-input-password-toggle] - No ancestor ion-input found. This component must be slotted inside of an ion-input.', el);
- return;
- }
- /**
- * Important: Set the type in connectedCallback because the default value
- * of this.type may not always be accurate. Usually inputs have the "password" type
- * but it is possible to have the input to initially have the "text" type. In that scenario
- * the wrong icon will show briefly before switching to the correct icon. Setting the
- * type here allows us to avoid that flicker.
- */
- this.type = inputElRef.type;
- }
- disconnectedCallback() {
- this.inputElRef = null;
- }
- render() {
- var _a, _b;
- const { color, type } = this;
- const mode = getIonMode$1(this);
- const showPasswordIcon = (_a = this.showIcon) !== null && _a !== void 0 ? _a : eye;
- const hidePasswordIcon = (_b = this.hideIcon) !== null && _b !== void 0 ? _b : eyeOff;
- const isPasswordVisible = type === 'text';
- return (hAsync(Host, { key: '1a28e078c83e74c72d8bb8189ece93ec2e3fa3d0', class: createColorClasses$1(color, {
- [mode]: true,
- }) }, hAsync("ion-button", { key: '039d1bab764093bb6fe4a34299b0872abda087fd', mode: mode, color: color, fill: "clear", shape: "round", "aria-checked": isPasswordVisible ? 'true' : 'false', "aria-label": "show password", role: "switch", type: "button", onPointerDown: (ev) => {
- /**
- * This prevents mobile browsers from
- * blurring the input when the password toggle
- * button is activated.
- */
- ev.preventDefault();
- }, onClick: this.togglePasswordVisibility }, hAsync("ion-icon", { key: '26477ee97b808c3d79944bf5e33d4e05f1ae0b3f', slot: "icon-only", "aria-hidden": "true", icon: isPasswordVisible ? hidePasswordIcon : showPasswordIcon }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "type": ["onTypeChange"]
- }; }
- static get style() { return {
- ios: IonInputPasswordToggleIosStyle0,
- md: IonInputPasswordToggleMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-input-password-toggle",
- "$members$": {
- "color": [513],
- "showIcon": [1, "show-icon"],
- "hideIcon": [1, "hide-icon"],
- "type": [1025]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const itemIosCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--detail-icon-color:initial;--detail-icon-font-size:1.25em;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.ion-color) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color) .item-native,:host(.ion-color) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-control-needs-pointer-cursor){cursor:pointer}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-right:var(--padding-end);padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;z-index:1;-webkit-box-sizing:border-box;box-sizing:border-box}:host-context([dir=rtl]) .item-native{padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}[dir=rtl] .item-native{padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}@supports selector(:dir(rtl)){.item-native:dir(rtl){padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;-webkit-transition:var(--transition);transition:var(--transition);z-index:-1}button,a{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-left:var(--inner-padding-start);display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);-webkit-box-shadow:var(--inner-box-shadow);box-shadow:var(--inner-box-shadow);overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}:host-context([dir=rtl]) .item-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}[dir=rtl] .item-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}@supports selector(:dir(rtl)){.item-inner:dir(rtl){padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}}.item-detail-icon{-webkit-margin-start:calc(var(--inner-padding-end) / 2);margin-inline-start:calc(var(--inner-padding-end) / 2);-webkit-margin-end:-6px;margin-inline-end:-6px;color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){-ms-flex:1;flex:1;width:-webkit-min-content;width:-moz-min-content;width:min-content;max-width:100%}:host(.item-input){-ms-flex-align:center;align-items:center}.input-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;text-overflow:ellipsis;overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){-ms-flex-align:start;align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio){position:relative}:host(.item-textarea){-ms-flex-align:stretch;align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host{--min-height:44px;--transition:background-color 200ms linear, opacity 200ms linear;--padding-start:16px;--inner-padding-end:16px;--inner-border-width:0px 0px 0.55px 0px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:var(--ion-text-color, #000);--background-focused:var(--ion-text-color, #000);--background-hover:currentColor;--background-activated-opacity:.12;--background-focused-opacity:.15;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));--color:var(--ion-item-color, var(--ion-text-color, #000));font-size:1rem}:host(.ion-activated){--transition:none}:host(.ion-color.ion-focused) .item-native::after{background:#000;opacity:0.15}:host(.ion-color.ion-activated) .item-native::after{background:#000;opacity:0.12}:host(.item-lines-full){--border-width:0px 0px 0.55px 0px}:host(.item-lines-inset){--inner-border-width:0px 0px 0.55px 0px}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0px}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0px}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:2px;margin-bottom:2px}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}::slotted(.button-small){--padding-top:1px;--padding-bottom:1px;--padding-start:.5em;--padding-end:.5em;min-height:24px;font-size:0.8125rem}::slotted(ion-avatar){width:36px;height:36px}::slotted(ion-thumbnail){--size:56px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px;margin-bottom:8px}:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){-webkit-margin-start:0px;margin-inline-start:0px}::slotted(ion-label){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:10px;margin-bottom:10px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:68px}";
- var IonItemIosStyle0 = itemIosCss;
- const itemMdCss = ":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--detail-icon-color:initial;--detail-icon-font-size:1.25em;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.ion-color) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color) .item-native,:host(.ion-color) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-control-needs-pointer-cursor){cursor:pointer}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-right:var(--padding-end);padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;z-index:1;-webkit-box-sizing:border-box;box-sizing:border-box}:host-context([dir=rtl]) .item-native{padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}[dir=rtl] .item-native{padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}@supports selector(:dir(rtl)){.item-native:dir(rtl){padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0;-webkit-transition:var(--transition);transition:var(--transition);z-index:-1}button,a{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-left:var(--inner-padding-start);display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);-webkit-box-shadow:var(--inner-box-shadow);box-shadow:var(--inner-box-shadow);overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}:host-context([dir=rtl]) .item-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}[dir=rtl] .item-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}@supports selector(:dir(rtl)){.item-inner:dir(rtl){padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}}.item-detail-icon{-webkit-margin-start:calc(var(--inner-padding-end) / 2);margin-inline-start:calc(var(--inner-padding-end) / 2);-webkit-margin-end:-6px;margin-inline-end:-6px;color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){-ms-flex:1;flex:1;width:-webkit-min-content;width:-moz-min-content;width:min-content;max-width:100%}:host(.item-input){-ms-flex-align:center;align-items:center}.input-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;text-overflow:ellipsis;overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){-ms-flex-align:start;align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio){position:relative}:host(.item-textarea){-ms-flex-align:stretch;align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host{--min-height:48px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));--color:var(--ion-item-color, var(--ion-text-color, #000));--transition:opacity 15ms linear, background-color 15ms linear;--padding-start:16px;--inner-padding-end:16px;--inner-border-width:0 0 1px 0;font-size:1rem;font-weight:normal;text-transform:none}:host(.ion-color.ion-activated) .item-native::after{background:transparent}:host(.item-interactive){--border-width:0 0 1px 0;--inner-border-width:0}:host(.item-lines-full){--border-width:0 0 1px 0}:host(.item-lines-inset){--inner-border-width:0 0 1px 0}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0}:host(.item-multi-line) ::slotted([slot=start]),:host(.item-multi-line) ::slotted([slot=end]){margin-top:16px;margin-bottom:16px;-ms-flex-item-align:start;align-self:flex-start}::slotted([slot=start]){-webkit-margin-end:16px;margin-inline-end:16px}::slotted([slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:1.5em}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){-webkit-margin-end:32px;margin-inline-end:32px}::slotted(ion-icon[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-ms-flex-item-align:start;align-self:flex-start;font-size:0.6875rem}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){--size:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){-webkit-margin-end:16px;margin-inline-end:16px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:10px;margin-bottom:10px}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){-webkit-margin-start:0;margin-inline-start:0}::slotted(.button-small){--padding-top:2px;--padding-bottom:2px;--padding-start:.6em;--padding-end:.6em;min-height:25px;font-size:0.75rem}:host(.item-label-floating),:host(.item-label-stacked){--min-height:55px}:host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked),:host(.ion-focused:not(.ion-color)) ::slotted(.label-floating),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating){color:var(--ion-color-primary, #0054e9)}";
- var IonItemMdStyle0 = itemMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - Content is placed between the named slots if provided without a slot.
- * @slot start - Content is placed to the left of the item text in LTR, and to the right in RTL.
- * @slot end - Content is placed to the right of the item text in LTR, and to the left in RTL.
- *
- * @part native - The native HTML button, anchor or div element that wraps all child elements.
- * @part detail-icon - The chevron icon for the item. Only applies when `detail="true"`.
- */
- class Item {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.labelColorStyles = {};
- this.itemStyles = new Map();
- this.inheritedAriaAttributes = {};
- this.multipleInputs = false;
- this.focusable = true;
- this.color = undefined;
- this.button = false;
- this.detail = undefined;
- this.detailIcon = chevronForward;
- this.disabled = false;
- this.download = undefined;
- this.href = undefined;
- this.rel = undefined;
- this.lines = undefined;
- this.routerAnimation = undefined;
- this.routerDirection = 'forward';
- this.target = undefined;
- this.type = 'button';
- }
- buttonChanged() {
- // Update the focusable option when the button option is changed
- this.focusable = this.isFocusable();
- }
- labelColorChanged(ev) {
- const { color } = this;
- // There will be a conflict with item color if
- // we apply the label color to item, so we ignore
- // the label color if the user sets a color on item
- if (color === undefined) {
- this.labelColorStyles = ev.detail;
- }
- }
- itemStyle(ev) {
- ev.stopPropagation();
- const tagName = ev.target.tagName;
- const updatedStyles = ev.detail;
- const newStyles = {};
- const childStyles = this.itemStyles.get(tagName) || {};
- let hasStyleChange = false;
- Object.keys(updatedStyles).forEach((key) => {
- if (updatedStyles[key]) {
- const itemKey = `item-${key}`;
- if (!childStyles[itemKey]) {
- hasStyleChange = true;
- }
- newStyles[itemKey] = true;
- }
- });
- if (!hasStyleChange && Object.keys(newStyles).length !== Object.keys(childStyles).length) {
- hasStyleChange = true;
- }
- if (hasStyleChange) {
- this.itemStyles.set(tagName, newStyles);
- }
- }
- connectedCallback() {
- this.hasStartEl();
- }
- componentWillLoad() {
- this.inheritedAriaAttributes = inheritAttributes$1(this.el, ['aria-label']);
- }
- componentDidLoad() {
- raf(() => {
- this.setMultipleInputs();
- this.focusable = this.isFocusable();
- });
- }
- // If the item contains multiple clickable elements and/or inputs, then the item
- // should not have a clickable input cover over the entire item to prevent
- // interfering with their individual click events
- setMultipleInputs() {
- // The following elements have a clickable cover that is relative to the entire item
- const covers = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
- // The following elements can accept focus alongside the previous elements
- // therefore if these elements are also a child of item, we don't want the
- // input cover on top of those interfering with their clicks
- const inputs = this.el.querySelectorAll('ion-input, ion-range, ion-searchbar, ion-segment, ion-textarea, ion-toggle');
- // The following elements should also stay clickable when an input with cover is present
- const clickables = this.el.querySelectorAll('ion-router-link, ion-button, a, button');
- // Check for multiple inputs to change the position of the input cover to relative
- // for all of the covered inputs above
- this.multipleInputs =
- covers.length + inputs.length > 1 ||
- covers.length + clickables.length > 1 ||
- (covers.length > 0 && this.isClickable());
- }
- // If the item contains an input including a checkbox, datetime, select, or radio
- // then the item will have a clickable input cover that covers the item
- // that should get the hover, focused and activated states UNLESS it has multiple
- // inputs, then those need to individually get each click
- hasCover() {
- const inputs = this.el.querySelectorAll('ion-checkbox, ion-datetime, ion-select, ion-radio');
- return inputs.length === 1 && !this.multipleInputs;
- }
- // If the item has an href or button property it will render a native
- // anchor or button that is clickable
- isClickable() {
- return this.href !== undefined || this.button;
- }
- canActivate() {
- return this.isClickable() || this.hasCover();
- }
- isFocusable() {
- const focusableChild = this.el.querySelector('.ion-focusable');
- return this.canActivate() || focusableChild !== null;
- }
- hasStartEl() {
- const startEl = this.el.querySelector('[slot="start"]');
- if (startEl !== null) {
- this.el.classList.add('item-has-start-slot');
- }
- }
- getFirstInteractive() {
- const controls = this.el.querySelectorAll('ion-toggle:not([disabled]), ion-checkbox:not([disabled]), ion-radio:not([disabled]), ion-select:not([disabled]), ion-input:not([disabled]), ion-textarea:not([disabled])');
- return controls[0];
- }
- render() {
- const { detail, detailIcon, download, labelColorStyles, lines, disabled, href, rel, target, routerAnimation, routerDirection, inheritedAriaAttributes, multipleInputs, } = this;
- const childStyles = {};
- const mode = getIonMode$1(this);
- const clickable = this.isClickable();
- const canActivate = this.canActivate();
- const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
- const attrs = TagType === 'button'
- ? { type: this.type }
- : {
- download,
- href,
- rel,
- target,
- };
- let clickFn = {};
- const firstInteractive = this.getFirstInteractive();
- // Only set onClick if the item is clickable to prevent screen
- // readers from reading all items as clickable
- if (clickable || (firstInteractive !== undefined && !multipleInputs)) {
- clickFn = {
- onClick: (ev) => {
- if (clickable) {
- openURL(href, ev, routerDirection, routerAnimation);
- }
- if (firstInteractive !== undefined && !multipleInputs) {
- const path = ev.composedPath();
- const target = path[0];
- if (ev.isTrusted) {
- /**
- * Dispatches a click event to the first interactive element,
- * when it is the result of a user clicking on the item.
- *
- * We check if the click target is in the shadow root,
- * which means the user clicked on the .item-native or
- * .item-inner padding.
- */
- const clickedWithinShadowRoot = this.el.shadowRoot.contains(target);
- if (clickedWithinShadowRoot) {
- /**
- * For input/textarea clicking the padding should focus the
- * text field (thus making it editable). For everything else,
- * we want to click the control so it activates.
- */
- if (firstInteractive.tagName === 'ION-INPUT' || firstInteractive.tagName === 'ION-TEXTAREA') {
- firstInteractive.setFocus();
- }
- firstInteractive.click();
- /**
- * Stop the item event from being triggered
- * as the firstInteractive click event will also
- * trigger the item click event.
- */
- ev.stopImmediatePropagation();
- }
- }
- }
- },
- };
- }
- const showDetail = detail !== undefined ? detail : mode === 'ios' && clickable;
- this.itemStyles.forEach((value) => {
- Object.assign(childStyles, value);
- });
- const ariaDisabled = disabled || childStyles['item-interactive-disabled'] ? 'true' : null;
- const inList = hostContext('ion-list', this.el) && !hostContext('ion-radio-group', this.el);
- /**
- * Inputs and textareas do not need to show a cursor pointer.
- * However, other form controls such as checkboxes and radios do.
- */
- const firstInteractiveNeedsPointerCursor = firstInteractive !== undefined && !['ION-INPUT', 'ION-TEXTAREA'].includes(firstInteractive.tagName);
- return (hAsync(Host, { key: '15e7d3b674c25232bc2d51573b291c72548690e5', "aria-disabled": ariaDisabled, class: Object.assign(Object.assign(Object.assign({}, childStyles), labelColorStyles), createColorClasses$1(this.color, {
- item: true,
- [mode]: true,
- 'item-lines-default': lines === undefined,
- [`item-lines-${lines}`]: lines !== undefined,
- 'item-control-needs-pointer-cursor': firstInteractiveNeedsPointerCursor,
- 'item-disabled': disabled,
- 'in-list': inList,
- 'item-multiple-inputs': this.multipleInputs,
- 'ion-activatable': canActivate,
- 'ion-focusable': this.focusable,
- 'item-rtl': document.dir === 'rtl',
- })), role: inList ? 'listitem' : null }, hAsync(TagType, Object.assign({ key: 'f27ae647501e29db554efe8f12f498b165d1dbf6' }, attrs, inheritedAriaAttributes, { class: "item-native", part: "native", disabled: disabled }, clickFn), hAsync("slot", { key: 'ba039a321df0e4bd5ce11e7a6e7e174c8623b112', name: "start" }), hAsync("div", { key: 'e67fdf4ad9086d855da8402ca04ffe292cf6ce67', class: "item-inner" }, hAsync("div", { key: '2434348a0b3f10052a340c57a7ac127ddc851729', class: "input-wrapper" }, hAsync("slot", { key: '3e27090ae4dab734541b3fd2c94de0f98c0f0030' })), hAsync("slot", { key: '52dc633b60fe612d48d2efffbf2c4c62692bef85', name: "end" }), showDetail && (hAsync("ion-icon", { key: '4fb7397dc8cf4cecb82f19a6151f85112b73992b', icon: detailIcon, lazy: false, class: "item-detail-icon", part: "detail-icon", "aria-hidden": "true", "flip-rtl": detailIcon === chevronForward }))), canActivate && mode === 'md' && hAsync("ion-ripple-effect", { key: '09b2413a7a484ecd8ffb00805223727da4d4e344' }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "button": ["buttonChanged"]
- }; }
- static get style() { return {
- ios: IonItemIosStyle0,
- md: IonItemMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-item",
- "$members$": {
- "color": [513],
- "button": [4],
- "detail": [4],
- "detailIcon": [1, "detail-icon"],
- "disabled": [516],
- "download": [1],
- "href": [1],
- "rel": [1],
- "lines": [1],
- "routerAnimation": [16],
- "routerDirection": [1, "router-direction"],
- "target": [1],
- "type": [1],
- "multipleInputs": [32],
- "focusable": [32]
- },
- "$listeners$": [[0, "ionColor", "labelColorChanged"], [0, "ionStyle", "itemStyle"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"], ["disabled", "disabled"]]
- }; }
- }
- const itemDividerIosCss = ":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);padding-right:var(--padding-end);padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;-webkit-box-sizing:border-box;box-sizing:border-box}:host-context([dir=rtl]){padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}@supports selector(:dir(rtl)){:host(:dir(rtl)){padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:-webkit-sticky;position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-left:var(--inner-padding-start);display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border:0;overflow:hidden}:host-context([dir=rtl]) .item-divider-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}[dir=rtl] .item-divider-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}@supports selector(:dir(rtl)){.item-divider-inner:dir(rtl){padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}}.item-divider-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6));--color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));--padding-start:16px;--inner-padding-end:8px;border-radius:0;position:relative;min-height:28px;font-size:1.0625rem;font-weight:600}:host([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:2px;margin-bottom:2px}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px}::slotted(h2){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px}::slotted(h3),::slotted(h4),::slotted(h5),::slotted(h6){margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:var(--ion-text-color-step-550, #a3a3a3);font-size:0.875rem;line-height:normal;text-overflow:inherit;overflow:inherit}::slotted(h2:last-child) ::slotted(h3:last-child),::slotted(h4:last-child),::slotted(h5:last-child),::slotted(h6:last-child),::slotted(p:last-child){margin-bottom:0}";
- var IonItemDividerIosStyle0 = itemDividerIosCss;
- const itemDividerMdCss = ":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);padding-right:var(--padding-end);padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;-webkit-box-sizing:border-box;box-sizing:border-box}:host-context([dir=rtl]){padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}@supports selector(:dir(rtl)){:host(:dir(rtl)){padding-right:calc(var(--padding-start) + var(--ion-safe-area-right, 0px));padding-left:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:-webkit-sticky;position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-left:var(--inner-padding-start);display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border:0;overflow:hidden}:host-context([dir=rtl]) .item-divider-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}[dir=rtl] .item-divider-inner{padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}@supports selector(:dir(rtl)){.item-divider-inner:dir(rtl){padding-right:var(--inner-padding-start);padding-left:calc(var(--ion-safe-area-left, 0px) + var(--inner-padding-end))}}.item-divider-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-background-color, #fff);--color:var(--ion-color-step-400, var(--ion-text-color-step-600, #999999));--padding-start:16px;--inner-padding-end:16px;min-height:30px;border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));font-size:0.875rem}::slotted([slot=start]){-webkit-margin-end:16px;margin-inline-end:16px}::slotted([slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:13px;margin-bottom:10px}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:1.7142857143em}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){-webkit-margin-end:32px;margin-inline-end:32px}::slotted(ion-icon[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-ms-flex-item-align:start;align-self:flex-start;font-size:0.6875rem}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){--size:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){-webkit-margin-end:16px;margin-inline-end:16px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px}::slotted(h2){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px}::slotted(h3,h4,h5,h6){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));font-size:0.875rem;line-height:normal;text-overflow:inherit;overflow:inherit}";
- var IonItemDividerMdStyle0 = itemDividerMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - Content is placed between the named slots if provided without a slot.
- * @slot start - Content is placed to the left of the divider text in LTR, and to the right in RTL.
- * @slot end - Content is placed to the right of the divider text in LTR, and to the left in RTL.
- */
- class ItemDivider {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- this.sticky = false;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '7150b1a3a881c3c312db40821acb9830c2885ccf', class: createColorClasses$1(this.color, {
- [mode]: true,
- 'item-divider-sticky': this.sticky,
- item: true,
- }) }, hAsync("slot", { key: '6e9d9615f475392a81177bc49b4b01dbdab67925', name: "start" }), hAsync("div", { key: '12fe6b840ad1a1897cc34529e488207b2df448f7', class: "item-divider-inner" }, hAsync("div", { key: '626776a8c9887dd2df5ecf3b7861beb742b41e03', class: "item-divider-wrapper" }, hAsync("slot", { key: '90379dd99914e24ae45c9571c8d390f9b6622fd4' })), hAsync("slot", { key: '105644332c08530155b9cd8e8c6fa9e332072a63', name: "end" }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonItemDividerIosStyle0,
- md: IonItemDividerMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-item-divider",
- "$members$": {
- "color": [513],
- "sticky": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const itemGroupIosCss = "ion-item-group{display:block}";
- var IonItemGroupIosStyle0 = itemGroupIosCss;
- const itemGroupMdCss = "ion-item-group{display:block}";
- var IonItemGroupMdStyle0 = itemGroupMdCss;
- class ItemGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'de2a969ed0dda880bc560a325848b28d0287fdb9', role: "group", class: {
- [mode]: true,
- // Used internally for styling
- [`item-group-${mode}`]: true,
- item: true,
- } }));
- }
- static get style() { return {
- ios: IonItemGroupIosStyle0,
- md: IonItemGroupMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 32,
- "$tagName$": "ion-item-group",
- "$members$": undefined,
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const itemOptionIosCss = ":host{--background:var(--ion-color-primary, #0054e9);--color:var(--ion-color-primary-contrast, #fff);background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;-webkit-padding-start:0.7em;padding-inline-start:0.7em;-webkit-padding-end:0.7em;padding-inline-end:0.7em;padding-top:0;padding-bottom:0;display:inline-block;position:relative;width:100%;height:100%;border:0;outline:none;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box}.button-inner{display:-ms-flexbox;display:flex;-ms-flex-flow:column nowrap;flex-flow:column nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%}.horizontal-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%}::slotted(*){-ms-flex-negative:0;flex-shrink:0}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:5px;margin-inline-end:5px;margin-top:0;margin-bottom:0}::slotted([slot=end]){-webkit-margin-start:5px;margin-inline-start:5px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}::slotted([slot=icon-only]){padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px;margin-top:0;margin-bottom:0;min-width:0.9em;font-size:1.8em}:host(.item-option-expandable){-ms-flex-negative:0;flex-shrink:0;-webkit-transition-duration:0;transition-duration:0;-webkit-transition-property:none;transition-property:none;-webkit-transition-timing-function:cubic-bezier(0.65, 0.05, 0.36, 1);transition-timing-function:cubic-bezier(0.65, 0.05, 0.36, 1)}:host(.item-option-disabled){pointer-events:none}:host(.item-option-disabled) .button-native{cursor:default;opacity:0.5;pointer-events:none}:host{font-size:clamp(16px, 1rem, 35.2px)}:host(.ion-activated){background:var(--ion-color-primary-shade, #004acd)}:host(.ion-color.ion-activated){background:var(--ion-color-shade)}";
- var IonItemOptionIosStyle0 = itemOptionIosCss;
- const itemOptionMdCss = ":host{--background:var(--ion-color-primary, #0054e9);--color:var(--ion-color-primary-contrast, #fff);background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;-webkit-padding-start:0.7em;padding-inline-start:0.7em;-webkit-padding-end:0.7em;padding-inline-end:0.7em;padding-top:0;padding-bottom:0;display:inline-block;position:relative;width:100%;height:100%;border:0;outline:none;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box}.button-inner{display:-ms-flexbox;display:flex;-ms-flex-flow:column nowrap;flex-flow:column nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%}.horizontal-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%}::slotted(*){-ms-flex-negative:0;flex-shrink:0}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:5px;margin-inline-end:5px;margin-top:0;margin-bottom:0}::slotted([slot=end]){-webkit-margin-start:5px;margin-inline-start:5px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}::slotted([slot=icon-only]){padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px;margin-top:0;margin-bottom:0;min-width:0.9em;font-size:1.8em}:host(.item-option-expandable){-ms-flex-negative:0;flex-shrink:0;-webkit-transition-duration:0;transition-duration:0;-webkit-transition-property:none;transition-property:none;-webkit-transition-timing-function:cubic-bezier(0.65, 0.05, 0.36, 1);transition-timing-function:cubic-bezier(0.65, 0.05, 0.36, 1)}:host(.item-option-disabled){pointer-events:none}:host(.item-option-disabled) .button-native{cursor:default;opacity:0.5;pointer-events:none}:host{font-size:0.875rem;font-weight:500;text-transform:uppercase}";
- var IonItemOptionMdStyle0 = itemOptionMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - Content is placed between the named slots if provided without a slot.
- * @slot start - Content is placed to the left of the option text in LTR, and to the right in RTL.
- * @slot top - Content is placed above the option text.
- * @slot icon-only - Should be used on an icon in an option that has no text.
- * @slot bottom - Content is placed below the option text.
- * @slot end - Content is placed to the right of the option text in LTR, and to the left in RTL.
- *
- * @part native - The native HTML button or anchor element that wraps all child elements.
- */
- class ItemOption {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.onClick = (ev) => {
- const el = ev.target.closest('ion-item-option');
- if (el) {
- ev.preventDefault();
- }
- };
- this.color = undefined;
- this.disabled = false;
- this.download = undefined;
- this.expandable = false;
- this.href = undefined;
- this.rel = undefined;
- this.target = undefined;
- this.type = 'button';
- }
- render() {
- const { disabled, expandable, href } = this;
- const TagType = href === undefined ? 'button' : 'a';
- const mode = getIonMode$1(this);
- const attrs = TagType === 'button'
- ? { type: this.type }
- : {
- download: this.download,
- href: this.href,
- target: this.target,
- };
- return (hAsync(Host, { key: '1b7708dd178dc2c9280652ca3da38c84ba7b767f', onClick: this.onClick, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'item-option-disabled': disabled,
- 'item-option-expandable': expandable,
- 'ion-activatable': true,
- }) }, hAsync(TagType, Object.assign({ key: 'd9f899f5425ad6b97071494485aa3ca90bc89d30' }, attrs, { class: "button-native", part: "native", disabled: disabled }), hAsync("span", { key: 'adc2cf72b4363be9b9eeb3584723e2bfc862af20', class: "button-inner" }, hAsync("slot", { key: 'e668fe8e655a74e6a35e979e0cd488506b962dbf', name: "top" }), hAsync("div", { key: '2ddcdb92b6b19c3cc549a7aee2400d1a6eeb51f1', class: "horizontal-wrapper" }, hAsync("slot", { key: '441f13df18b72e5ed6bb51b157722e065b5847d2', name: "start" }), hAsync("slot", { key: '425d815874b49e1628880160d7175ed3ca36ca39', name: "icon-only" }), hAsync("slot", { key: '27437d3fa3365b12bc030704e18481fdfb14aebb' }), hAsync("slot", { key: 'bd39330771c7f85c6df10f7f9050335ee7f14ff0', name: "end" })), hAsync("slot", { key: '440cb6dc7743d50b261d4bf61d2c24e24b89e58c', name: "bottom" })), mode === 'md' && hAsync("ion-ripple-effect", { key: '29632941464bbb34551cf64961187643f62bf755' }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonItemOptionIosStyle0,
- md: IonItemOptionMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-item-option",
- "$members$": {
- "color": [513],
- "disabled": [4],
- "download": [1],
- "expandable": [4],
- "href": [1],
- "rel": [1],
- "target": [1],
- "type": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const itemOptionsIosCss = "ion-item-options{top:0;right:0;-ms-flex-pack:end;justify-content:flex-end;display:none;position:absolute;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1}:host-context([dir=rtl]) ion-item-options{-ms-flex-pack:start;justify-content:flex-start}:host-context([dir=rtl]) ion-item-options:not(.item-options-end){right:auto;left:0;-ms-flex-pack:end;justify-content:flex-end}[dir=rtl] ion-item-options{-ms-flex-pack:start;justify-content:flex-start}[dir=rtl] ion-item-options:not(.item-options-end){right:auto;left:0;-ms-flex-pack:end;justify-content:flex-end}@supports selector(:dir(rtl)){ion-item-options:dir(rtl){-ms-flex-pack:start;justify-content:flex-start}ion-item-options:dir(rtl):not(.item-options-end){right:auto;left:0;-ms-flex-pack:end;justify-content:flex-end}}.item-options-start{right:auto;left:0;-ms-flex-pack:start;justify-content:flex-start}:host-context([dir=rtl]) .item-options-start{-ms-flex-pack:end;justify-content:flex-end}[dir=rtl] .item-options-start{-ms-flex-pack:end;justify-content:flex-end}@supports selector(:dir(rtl)){.item-options-start:dir(rtl){-ms-flex-pack:end;justify-content:flex-end}}[dir=ltr] .item-options-start ion-item-option:first-child,[dir=rtl] .item-options-start ion-item-option:last-child{padding-left:var(--ion-safe-area-left)}[dir=ltr] .item-options-end ion-item-option:last-child,[dir=rtl] .item-options-end ion-item-option:first-child{padding-right:var(--ion-safe-area-right)}:host-context([dir=rtl]) .item-sliding-active-slide.item-sliding-active-options-start ion-item-options:not(.item-options-end){width:100%;visibility:visible}[dir=rtl] .item-sliding-active-slide.item-sliding-active-options-start ion-item-options:not(.item-options-end){width:100%;visibility:visible}@supports selector(:dir(rtl)){.item-sliding-active-slide:dir(rtl).item-sliding-active-options-start ion-item-options:not(.item-options-end){width:100%;visibility:visible}}.item-sliding-active-slide ion-item-options{display:-ms-flexbox;display:flex;visibility:hidden}.item-sliding-active-slide.item-sliding-active-options-start .item-options-start,.item-sliding-active-slide.item-sliding-active-options-end ion-item-options:not(.item-options-start){width:100%;visibility:visible}.item-options-ios{border-bottom-width:0;border-bottom-style:solid;border-bottom-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))))}.item-options-ios.item-options-end{border-bottom-width:0.55px}.list-ios-lines-none .item-options-ios{border-bottom-width:0}.list-ios-lines-full .item-options-ios,.list-ios-lines-inset .item-options-ios.item-options-end{border-bottom-width:0.55px}";
- var IonItemOptionsIosStyle0 = itemOptionsIosCss;
- const itemOptionsMdCss = "ion-item-options{top:0;right:0;-ms-flex-pack:end;justify-content:flex-end;display:none;position:absolute;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1}:host-context([dir=rtl]) ion-item-options{-ms-flex-pack:start;justify-content:flex-start}:host-context([dir=rtl]) ion-item-options:not(.item-options-end){right:auto;left:0;-ms-flex-pack:end;justify-content:flex-end}[dir=rtl] ion-item-options{-ms-flex-pack:start;justify-content:flex-start}[dir=rtl] ion-item-options:not(.item-options-end){right:auto;left:0;-ms-flex-pack:end;justify-content:flex-end}@supports selector(:dir(rtl)){ion-item-options:dir(rtl){-ms-flex-pack:start;justify-content:flex-start}ion-item-options:dir(rtl):not(.item-options-end){right:auto;left:0;-ms-flex-pack:end;justify-content:flex-end}}.item-options-start{right:auto;left:0;-ms-flex-pack:start;justify-content:flex-start}:host-context([dir=rtl]) .item-options-start{-ms-flex-pack:end;justify-content:flex-end}[dir=rtl] .item-options-start{-ms-flex-pack:end;justify-content:flex-end}@supports selector(:dir(rtl)){.item-options-start:dir(rtl){-ms-flex-pack:end;justify-content:flex-end}}[dir=ltr] .item-options-start ion-item-option:first-child,[dir=rtl] .item-options-start ion-item-option:last-child{padding-left:var(--ion-safe-area-left)}[dir=ltr] .item-options-end ion-item-option:last-child,[dir=rtl] .item-options-end ion-item-option:first-child{padding-right:var(--ion-safe-area-right)}:host-context([dir=rtl]) .item-sliding-active-slide.item-sliding-active-options-start ion-item-options:not(.item-options-end){width:100%;visibility:visible}[dir=rtl] .item-sliding-active-slide.item-sliding-active-options-start ion-item-options:not(.item-options-end){width:100%;visibility:visible}@supports selector(:dir(rtl)){.item-sliding-active-slide:dir(rtl).item-sliding-active-options-start ion-item-options:not(.item-options-end){width:100%;visibility:visible}}.item-sliding-active-slide ion-item-options{display:-ms-flexbox;display:flex;visibility:hidden}.item-sliding-active-slide.item-sliding-active-options-start .item-options-start,.item-sliding-active-slide.item-sliding-active-options-end ion-item-options:not(.item-options-start){width:100%;visibility:visible}.item-options-md{border-bottom-width:0;border-bottom-style:solid;border-bottom-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))))}.list-md-lines-none .item-options-md{border-bottom-width:0}.list-md-lines-full .item-options-md,.list-md-lines-inset .item-options-md.item-options-end{border-bottom-width:1px}";
- var IonItemOptionsMdStyle0 = itemOptionsMdCss;
- class ItemOptions {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionSwipe = createEvent(this, "ionSwipe", 7);
- this.side = 'end';
- }
- /** @internal */
- async fireSwipeEvent() {
- this.ionSwipe.emit({
- side: this.side,
- });
- }
- render() {
- const mode = getIonMode$1(this);
- const isEnd = isEndSide(this.side);
- return (hAsync(Host, { key: '7df4b71547524bf359c48e1b40ccbc44e850f632', class: {
- [mode]: true,
- // Used internally for styling
- [`item-options-${mode}`]: true,
- /**
- * Note: The "start" and "end" terms refer to the
- * direction ion-item-option instances within ion-item-options flow.
- * They do not refer to how ion-item-options flows within ion-item-sliding.
- * As a result, "item-options-start" means the ion-item-options container
- * always appears on the left, and "item-options-end" means the ion-item-options
- * container always appears on the right.
- */
- 'item-options-start': !isEnd,
- 'item-options-end': isEnd,
- } }));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonItemOptionsIosStyle0,
- md: IonItemOptionsMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 32,
- "$tagName$": "ion-item-options",
- "$members$": {
- "side": [1],
- "fireSwipeEvent": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const watchForOptions = (containerEl, tagName, onChange) => {
- if (typeof MutationObserver === 'undefined') {
- return;
- }
- const mutation = new MutationObserver((mutationList) => {
- onChange(getSelectedOption(mutationList, tagName));
- });
- mutation.observe(containerEl, {
- childList: true,
- subtree: true,
- });
- return mutation;
- };
- const getSelectedOption = (mutationList, tagName) => {
- let newOption;
- mutationList.forEach((mut) => {
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
- for (let i = 0; i < mut.addedNodes.length; i++) {
- newOption = findCheckedOption(mut.addedNodes[i], tagName) || newOption;
- }
- });
- return newOption;
- };
- /**
- * The "value" key is only set on some components such as ion-select-option.
- * As a result, we create a default union type of HTMLElement and the "value" key.
- * However, implementers are required to provide the appropriate component type
- * such as HTMLIonSelectOptionElement.
- */
- const findCheckedOption = (node, tagName) => {
- /**
- * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
- * The above check ensures "node" is an Element (nodeType 1).
- */
- if (node.nodeType !== 1) {
- return undefined;
- }
- // HTMLElement inherits from Element, so we cast "el" as T.
- const el = node;
- const options = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));
- return options.find((o) => o.value === el.value);
- };
- const itemSlidingCss = "ion-item-sliding{display:block;position:relative;width:100%;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}ion-item-sliding .item{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.item-sliding-active-slide .item{position:relative;-webkit-transition:-webkit-transform 500ms cubic-bezier(0.36, 0.66, 0.04, 1);transition:-webkit-transform 500ms cubic-bezier(0.36, 0.66, 0.04, 1);transition:transform 500ms cubic-bezier(0.36, 0.66, 0.04, 1);transition:transform 500ms cubic-bezier(0.36, 0.66, 0.04, 1), -webkit-transform 500ms cubic-bezier(0.36, 0.66, 0.04, 1);opacity:1;z-index:2;pointer-events:none;will-change:transform}.item-sliding-closing ion-item-options{pointer-events:none}.item-sliding-active-swipe-end .item-options-end .item-option-expandable{padding-left:100%;-ms-flex-order:1;order:1;-webkit-transition-duration:0.6s;transition-duration:0.6s;-webkit-transition-property:padding-left;transition-property:padding-left}:host-context([dir=rtl]) .item-sliding-active-swipe-end .item-options-end .item-option-expandable{-ms-flex-order:-1;order:-1}[dir=rtl] .item-sliding-active-swipe-end .item-options-end .item-option-expandable{-ms-flex-order:-1;order:-1}@supports selector(:dir(rtl)){.item-sliding-active-swipe-end .item-options-end .item-option-expandable:dir(rtl){-ms-flex-order:-1;order:-1}}.item-sliding-active-swipe-start .item-options-start .item-option-expandable{padding-right:100%;-ms-flex-order:-1;order:-1;-webkit-transition-duration:0.6s;transition-duration:0.6s;-webkit-transition-property:padding-right;transition-property:padding-right}:host-context([dir=rtl]) .item-sliding-active-swipe-start .item-options-start .item-option-expandable{-ms-flex-order:1;order:1}[dir=rtl] .item-sliding-active-swipe-start .item-options-start .item-option-expandable{-ms-flex-order:1;order:1}@supports selector(:dir(rtl)){.item-sliding-active-swipe-start .item-options-start .item-option-expandable:dir(rtl){-ms-flex-order:1;order:1}}";
- var IonItemSlidingStyle0 = itemSlidingCss;
- const SWIPE_MARGIN = 30;
- const ELASTIC_FACTOR = 0.55;
- let openSlidingItem;
- class ItemSliding {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionDrag = createEvent(this, "ionDrag", 7);
- this.item = null;
- this.openAmount = 0;
- this.initialOpenAmount = 0;
- this.optsWidthRightSide = 0;
- this.optsWidthLeftSide = 0;
- this.sides = 0 /* ItemSide.None */;
- this.optsDirty = true;
- this.contentEl = null;
- this.initialContentScrollY = true;
- this.state = 2 /* SlidingState.Disabled */;
- this.disabled = false;
- }
- disabledChanged() {
- if (this.gesture) {
- this.gesture.enable(!this.disabled);
- }
- }
- async connectedCallback() {
- const { el } = this;
- this.item = el.querySelector('ion-item');
- this.contentEl = findClosestIonContent(el);
- /**
- * The MutationObserver needs to be added before we
- * call updateOptions below otherwise we may miss
- * ion-item-option elements that are added to the DOM
- * while updateOptions is running and before the MutationObserver
- * has been initialized.
- */
- this.mutationObserver = watchForOptions(el, 'ion-item-option', async () => {
- await this.updateOptions();
- });
- await this.updateOptions();
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el,
- gestureName: 'item-swipe',
- gesturePriority: 100,
- threshold: 5,
- canStart: (ev) => this.canStart(ev),
- onStart: () => this.onStart(),
- onMove: (ev) => this.onMove(ev),
- onEnd: (ev) => this.onEnd(ev),
- });
- this.disabledChanged();
- }
- disconnectedCallback() {
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- this.item = null;
- this.leftOptions = this.rightOptions = undefined;
- if (openSlidingItem === this.el) {
- openSlidingItem = undefined;
- }
- if (this.mutationObserver) {
- this.mutationObserver.disconnect();
- this.mutationObserver = undefined;
- }
- }
- /**
- * Get the amount the item is open in pixels.
- */
- getOpenAmount() {
- return Promise.resolve(this.openAmount);
- }
- /**
- * Get the ratio of the open amount of the item compared to the width of the options.
- * If the number returned is positive, then the options on the right side are open.
- * If the number returned is negative, then the options on the left side are open.
- * If the absolute value of the number is greater than 1, the item is open more than
- * the width of the options.
- */
- getSlidingRatio() {
- return Promise.resolve(this.getSlidingRatioSync());
- }
- /**
- * Open the sliding item.
- *
- * @param side The side of the options to open. If a side is not provided, it will open the first set of options it finds within the item.
- */
- async open(side) {
- var _a;
- /**
- * It is possible for the item to be added to the DOM
- * after the item-sliding component was created. As a result,
- * if this.item is null, then we should attempt to
- * query for the ion-item again.
- * However, if the item is already defined then
- * we do not query for it again.
- */
- const item = (this.item = (_a = this.item) !== null && _a !== void 0 ? _a : this.el.querySelector('ion-item'));
- if (item === null) {
- return;
- }
- const optionsToOpen = this.getOptions(side);
- if (!optionsToOpen) {
- return;
- }
- /**
- * If side is not set, we need to infer the side
- * so we know which direction to move the options
- */
- if (side === undefined) {
- side = optionsToOpen === this.leftOptions ? 'start' : 'end';
- }
- // In RTL we want to switch the sides
- side = isEndSide(side) ? 'end' : 'start';
- const isStartOpen = this.openAmount < 0;
- const isEndOpen = this.openAmount > 0;
- /**
- * If a side is open and a user tries to
- * re-open the same side, we should not do anything
- */
- if (isStartOpen && optionsToOpen === this.leftOptions) {
- return;
- }
- if (isEndOpen && optionsToOpen === this.rightOptions) {
- return;
- }
- this.closeOpened();
- this.state = 4 /* SlidingState.Enabled */;
- requestAnimationFrame(() => {
- this.calculateOptsWidth();
- const width = side === 'end' ? this.optsWidthRightSide : -this.optsWidthLeftSide;
- openSlidingItem = this.el;
- this.setOpenAmount(width, false);
- this.state = side === 'end' ? 8 /* SlidingState.End */ : 16 /* SlidingState.Start */;
- });
- }
- /**
- * Close the sliding item. Items can also be closed from the [List](./list).
- */
- async close() {
- this.setOpenAmount(0, true);
- }
- /**
- * Close all of the sliding items in the list. Items can also be closed from the [List](./list).
- */
- async closeOpened() {
- if (openSlidingItem !== undefined) {
- openSlidingItem.close();
- openSlidingItem = undefined;
- return true;
- }
- return false;
- }
- /**
- * Given an optional side, return the ion-item-options element.
- *
- * @param side This side of the options to get. If a side is not provided it will
- * return the first one available.
- */
- getOptions(side) {
- if (side === undefined) {
- return this.leftOptions || this.rightOptions;
- }
- else if (side === 'start') {
- return this.leftOptions;
- }
- else {
- return this.rightOptions;
- }
- }
- async updateOptions() {
- const options = this.el.querySelectorAll('ion-item-options');
- let sides = 0;
- // Reset left and right options in case they were removed
- this.leftOptions = this.rightOptions = undefined;
- for (let i = 0; i < options.length; i++) {
- const item = options.item(i);
- /**
- * We cannot use the componentOnReady helper
- * util here since we need to wait for all of these items
- * to be ready before we set `this.sides` and `this.optsDirty`.
- */
- // eslint-disable-next-line custom-rules/no-component-on-ready-method
- const option = item.componentOnReady !== undefined ? await item.componentOnReady() : item;
- const side = isEndSide(option.side) ? 'end' : 'start';
- if (side === 'start') {
- this.leftOptions = option;
- sides |= 1 /* ItemSide.Start */;
- }
- else {
- this.rightOptions = option;
- sides |= 2 /* ItemSide.End */;
- }
- }
- this.optsDirty = true;
- this.sides = sides;
- }
- canStart(gesture) {
- /**
- * If very close to start of the screen
- * do not open left side so swipe to go
- * back will still work.
- */
- const rtl = document.dir === 'rtl';
- const atEdge = rtl ? window.innerWidth - gesture.startX < 15 : gesture.startX < 15;
- if (atEdge) {
- return false;
- }
- const selected = openSlidingItem;
- if (selected && selected !== this.el) {
- this.closeOpened();
- }
- return !!(this.rightOptions || this.leftOptions);
- }
- onStart() {
- /**
- * We need to query for the ion-item
- * every time the gesture starts. Developers
- * may toggle ion-item elements via *ngIf.
- */
- this.item = this.el.querySelector('ion-item');
- const { contentEl } = this;
- if (contentEl) {
- this.initialContentScrollY = disableContentScrollY(contentEl);
- }
- openSlidingItem = this.el;
- if (this.tmr !== undefined) {
- clearTimeout(this.tmr);
- this.tmr = undefined;
- }
- if (this.openAmount === 0) {
- this.optsDirty = true;
- this.state = 4 /* SlidingState.Enabled */;
- }
- this.initialOpenAmount = this.openAmount;
- if (this.item) {
- this.item.style.transition = 'none';
- }
- }
- onMove(gesture) {
- if (this.optsDirty) {
- this.calculateOptsWidth();
- }
- let openAmount = this.initialOpenAmount - gesture.deltaX;
- switch (this.sides) {
- case 2 /* ItemSide.End */:
- openAmount = Math.max(0, openAmount);
- break;
- case 1 /* ItemSide.Start */:
- openAmount = Math.min(0, openAmount);
- break;
- case 3 /* ItemSide.Both */:
- break;
- case 0 /* ItemSide.None */:
- return;
- default:
- printIonWarning('[ion-item-sliding] - invalid ItemSideFlags value', this.sides);
- break;
- }
- let optsWidth;
- if (openAmount > this.optsWidthRightSide) {
- optsWidth = this.optsWidthRightSide;
- openAmount = optsWidth + (openAmount - optsWidth) * ELASTIC_FACTOR;
- }
- else if (openAmount < -this.optsWidthLeftSide) {
- optsWidth = -this.optsWidthLeftSide;
- openAmount = optsWidth + (openAmount - optsWidth) * ELASTIC_FACTOR;
- }
- this.setOpenAmount(openAmount, false);
- }
- onEnd(gesture) {
- const { contentEl, initialContentScrollY } = this;
- if (contentEl) {
- resetContentScrollY(contentEl, initialContentScrollY);
- }
- const velocity = gesture.velocityX;
- let restingPoint = this.openAmount > 0 ? this.optsWidthRightSide : -this.optsWidthLeftSide;
- // Check if the drag didn't clear the buttons mid-point
- // and we aren't moving fast enough to swipe open
- const isResetDirection = this.openAmount > 0 === !(velocity < 0);
- const isMovingFast = Math.abs(velocity) > 0.3;
- const isOnCloseZone = Math.abs(this.openAmount) < Math.abs(restingPoint / 2);
- if (swipeShouldReset(isResetDirection, isMovingFast, isOnCloseZone)) {
- restingPoint = 0;
- }
- const state = this.state;
- this.setOpenAmount(restingPoint, true);
- if ((state & 32 /* SlidingState.SwipeEnd */) !== 0 && this.rightOptions) {
- this.rightOptions.fireSwipeEvent();
- }
- else if ((state & 64 /* SlidingState.SwipeStart */) !== 0 && this.leftOptions) {
- this.leftOptions.fireSwipeEvent();
- }
- }
- calculateOptsWidth() {
- this.optsWidthRightSide = 0;
- if (this.rightOptions) {
- this.rightOptions.style.display = 'flex';
- this.optsWidthRightSide = this.rightOptions.offsetWidth;
- this.rightOptions.style.display = '';
- }
- this.optsWidthLeftSide = 0;
- if (this.leftOptions) {
- this.leftOptions.style.display = 'flex';
- this.optsWidthLeftSide = this.leftOptions.offsetWidth;
- this.leftOptions.style.display = '';
- }
- this.optsDirty = false;
- }
- setOpenAmount(openAmount, isFinal) {
- if (this.tmr !== undefined) {
- clearTimeout(this.tmr);
- this.tmr = undefined;
- }
- if (!this.item) {
- return;
- }
- const { el } = this;
- const style = this.item.style;
- this.openAmount = openAmount;
- if (isFinal) {
- style.transition = '';
- }
- if (openAmount > 0) {
- this.state =
- openAmount >= this.optsWidthRightSide + SWIPE_MARGIN
- ? 8 /* SlidingState.End */ | 32 /* SlidingState.SwipeEnd */
- : 8 /* SlidingState.End */;
- }
- else if (openAmount < 0) {
- this.state =
- openAmount <= -this.optsWidthLeftSide - SWIPE_MARGIN
- ? 16 /* SlidingState.Start */ | 64 /* SlidingState.SwipeStart */
- : 16 /* SlidingState.Start */;
- }
- else {
- /**
- * The sliding options should not be
- * clickable while the item is closing.
- */
- el.classList.add('item-sliding-closing');
- /**
- * Item sliding cannot be interrupted
- * while closing the item. If it did,
- * it would allow the item to get into an
- * inconsistent state where multiple
- * items are then open at the same time.
- */
- if (this.gesture) {
- this.gesture.enable(false);
- }
- this.tmr = setTimeout(() => {
- this.state = 2 /* SlidingState.Disabled */;
- this.tmr = undefined;
- if (this.gesture) {
- this.gesture.enable(!this.disabled);
- }
- el.classList.remove('item-sliding-closing');
- }, 600);
- openSlidingItem = undefined;
- style.transform = '';
- return;
- }
- style.transform = `translate3d(${-openAmount}px,0,0)`;
- this.ionDrag.emit({
- amount: openAmount,
- ratio: this.getSlidingRatioSync(),
- });
- }
- getSlidingRatioSync() {
- if (this.openAmount > 0) {
- return this.openAmount / this.optsWidthRightSide;
- }
- else if (this.openAmount < 0) {
- return this.openAmount / this.optsWidthLeftSide;
- }
- else {
- return 0;
- }
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'f8aea4bb9802b111ef358cc6c172a635637ae1f8', class: {
- [mode]: true,
- 'item-sliding-active-slide': this.state !== 2 /* SlidingState.Disabled */,
- 'item-sliding-active-options-end': (this.state & 8 /* SlidingState.End */) !== 0,
- 'item-sliding-active-options-start': (this.state & 16 /* SlidingState.Start */) !== 0,
- 'item-sliding-active-swipe-end': (this.state & 32 /* SlidingState.SwipeEnd */) !== 0,
- 'item-sliding-active-swipe-start': (this.state & 64 /* SlidingState.SwipeStart */) !== 0,
- } }));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledChanged"]
- }; }
- static get style() { return IonItemSlidingStyle0; }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-item-sliding",
- "$members$": {
- "disabled": [4],
- "state": [32],
- "getOpenAmount": [64],
- "getSlidingRatio": [64],
- "open": [64],
- "close": [64],
- "closeOpened": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const swipeShouldReset = (isResetDirection, isMovingFast, isOnResetZone) => {
- // The logic required to know when the sliding item should close (openAmount=0)
- // depends on three booleans (isResetDirection, isMovingFast, isOnResetZone)
- // and it ended up being too complicated to be written manually without errors
- // so the truth table is attached below: (0=false, 1=true)
- // isResetDirection | isMovingFast | isOnResetZone || shouldClose
- // 0 | 0 | 0 || 0
- // 0 | 0 | 1 || 1
- // 0 | 1 | 0 || 0
- // 0 | 1 | 1 || 0
- // 1 | 0 | 0 || 0
- // 1 | 0 | 1 || 1
- // 1 | 1 | 0 || 1
- // 1 | 1 | 1 || 1
- // The resulting expression was generated by resolving the K-map (Karnaugh map):
- return (!isMovingFast && isOnResetZone) || (isResetDirection && isMovingFast);
- };
- const labelIosCss = ".item.sc-ion-label-ios-h,.item .sc-ion-label-ios-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;-webkit-box-sizing:border-box;box-sizing:border-box}.ion-color.sc-ion-label-ios-h{color:var(--ion-color-base)}.ion-text-nowrap.sc-ion-label-ios-h{overflow:hidden}.item-interactive-disabled.sc-ion-label-ios-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-ios-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-ios-h,.item-input .sc-ion-label-ios-h{-ms-flex:initial;flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-ios-h,.item-textarea .sc-ion-label-ios-h{-ms-flex-item-align:baseline;align-self:baseline}.item-skeleton-text.sc-ion-label-ios-h,.item-skeleton-text .sc-ion-label-ios-h{overflow:hidden}.label-fixed.sc-ion-label-ios-h{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-ios-h,.label-floating.sc-ion-label-ios-h{margin-bottom:0;-ms-flex-item-align:stretch;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-ios-h{-webkit-transition:none;transition:none}.sc-ion-label-ios-s h1,.sc-ion-label-ios-s h2,.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-ios-h{font-size:0.875rem;line-height:1.5}.label-stacked.sc-ion-label-ios-h{margin-bottom:4px;font-size:0.875rem}.label-floating.sc-ion-label-ios-h{margin-bottom:0;-webkit-transform:translate(0, 29px);transform:translate(0, 29px);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:-webkit-transform 150ms ease-in-out;transition:-webkit-transform 150ms ease-in-out;transition:transform 150ms ease-in-out;transition:transform 150ms ease-in-out, -webkit-transform 150ms ease-in-out}[dir=rtl].sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl] .sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl].label-floating.sc-ion-label-ios-h,[dir=rtl] .label-floating.sc-ion-label-ios-h{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.label-floating.sc-ion-label-ios-h:dir(rtl){-webkit-transform-origin:right top;transform-origin:right top}}.item-textarea.label-floating.sc-ion-label-ios-h,.item-textarea .label-floating.sc-ion-label-ios-h{-webkit-transform:translate(0, 28px);transform:translate(0, 28px)}.item-has-focus.label-floating.sc-ion-label-ios-h,.item-has-focus .label-floating.sc-ion-label-ios-h,.item-has-placeholder.sc-ion-label-ios-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-ios-h,.item-has-value.label-floating.sc-ion-label-ios-h,.item-has-value .label-floating.sc-ion-label-ios-h{-webkit-transform:scale(0.82);transform:scale(0.82)}.sc-ion-label-ios-s h1{margin-left:0;margin-right:0;margin-top:3px;margin-bottom:2px;font-size:1.375rem;font-weight:normal}.sc-ion-label-ios-s h2{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:1.0625rem;font-weight:normal}.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:0.875rem;font-weight:normal;line-height:normal}.sc-ion-label-ios-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:0.875rem;line-height:normal;text-overflow:inherit;overflow:inherit}.sc-ion-label-ios-s>p{color:var(--ion-color-step-400, var(--ion-text-color-step-600, #999999))}.sc-ion-label-ios-h.in-item-color.sc-ion-label-ios-s>p{color:inherit}.sc-ion-label-ios-s h2:last-child,.sc-ion-label-ios-s h3:last-child,.sc-ion-label-ios-s h4:last-child,.sc-ion-label-ios-s h5:last-child,.sc-ion-label-ios-s h6:last-child,.sc-ion-label-ios-s p:last-child{margin-bottom:0}";
- var IonLabelIosStyle0 = labelIosCss;
- const labelMdCss = ".item.sc-ion-label-md-h,.item .sc-ion-label-md-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;-webkit-box-sizing:border-box;box-sizing:border-box}.ion-color.sc-ion-label-md-h{color:var(--ion-color-base)}.ion-text-nowrap.sc-ion-label-md-h{overflow:hidden}.item-interactive-disabled.sc-ion-label-md-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-md-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-md-h,.item-input .sc-ion-label-md-h{-ms-flex:initial;flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-md-h,.item-textarea .sc-ion-label-md-h{-ms-flex-item-align:baseline;align-self:baseline}.item-skeleton-text.sc-ion-label-md-h,.item-skeleton-text .sc-ion-label-md-h{overflow:hidden}.label-fixed.sc-ion-label-md-h{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-bottom:0;-ms-flex-item-align:stretch;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-md-h{-webkit-transition:none;transition:none}.sc-ion-label-md-s h1,.sc-ion-label-md-s h2,.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-md-h{line-height:1.5}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-transform-origin:top left;transform-origin:top left}.label-stacked.label-rtl.sc-ion-label-md-h,.label-floating.label-rtl.sc-ion-label-md-h{-webkit-transform-origin:top right;transform-origin:top right}.label-stacked.sc-ion-label-md-h{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75);-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1)}.label-floating.sc-ion-label-md-h{-webkit-transform:translateY(96%);transform:translateY(96%);-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1)}.ion-focused.label-floating.sc-ion-label-md-h,.ion-focused .label-floating.sc-ion-label-md-h,.item-has-focus.label-floating.sc-ion-label-md-h,.item-has-focus .label-floating.sc-ion-label-md-h,.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h,.item-has-value.label-floating.sc-ion-label-md-h,.item-has-value .label-floating.sc-ion-label-md-h{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75)}.ion-focused.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-focused .label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-primary, #0054e9)}.ion-focused.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-contrast)}.ion-invalid.ion-touched.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--highlight-color-invalid)}.sc-ion-label-md-s h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:1.5rem;font-weight:normal}.sc-ion-label-md-s h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:1rem;font-weight:normal}.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:0.875rem;font-weight:normal;line-height:normal}.sc-ion-label-md-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:0.875rem;line-height:1.25rem;text-overflow:inherit;overflow:inherit}.sc-ion-label-md-s>p{color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}.sc-ion-label-md-h.in-item-color.sc-ion-label-md-s>p{color:inherit}";
- var IonLabelMdStyle0 = labelMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Label {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionColor = createEvent(this, "ionColor", 7);
- this.ionStyle = createEvent(this, "ionStyle", 7);
- this.inRange = false;
- this.color = undefined;
- this.position = undefined;
- this.noAnimate = false;
- }
- componentWillLoad() {
- this.inRange = !!this.el.closest('ion-range');
- this.noAnimate = this.position === 'floating';
- this.emitStyle();
- this.emitColor();
- }
- componentDidLoad() {
- if (this.noAnimate) {
- setTimeout(() => {
- this.noAnimate = false;
- }, 1000);
- }
- }
- colorChanged() {
- this.emitColor();
- }
- positionChanged() {
- this.emitStyle();
- }
- emitColor() {
- const { color } = this;
- this.ionColor.emit({
- 'item-label-color': color !== undefined,
- [`ion-color-${color}`]: color !== undefined,
- });
- }
- emitStyle() {
- const { inRange, position } = this;
- // If the label is inside of a range we don't want
- // to override the classes added by the label that
- // is a direct child of the item
- if (!inRange) {
- this.ionStyle.emit({
- label: true,
- [`label-${position}`]: position !== undefined,
- });
- }
- }
- render() {
- const position = this.position;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '4da84c95351a74b547f8224ecfa66924d21398c5', class: createColorClasses$1(this.color, {
- [mode]: true,
- 'in-item-color': hostContext('ion-item.ion-color', this.el),
- [`label-${position}`]: position !== undefined,
- [`label-no-animate`]: this.noAnimate,
- 'label-rtl': document.dir === 'rtl',
- }) }, hAsync("slot", { key: 'ea158ebb620275e5492965234d0ab925d391f919' })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "color": ["colorChanged"],
- "position": ["positionChanged"]
- }; }
- static get style() { return {
- ios: IonLabelIosStyle0,
- md: IonLabelMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 38,
- "$tagName$": "ion-label",
- "$members$": {
- "color": [513],
- "position": [1],
- "noAnimate": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const listIosCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{-webkit-transform:translateZ(0);transform:translateZ(0);overflow:hidden}.list-ios{background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-ios.list-inset{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px;border-radius:10px}.list-ios.list-inset ion-item:only-child,.list-ios.list-inset ion-item:not(:only-of-type):last-of-type,.list-ios.list-inset ion-item-sliding:last-of-type ion-item{--border-width:0;--inner-border-width:0}.list-ios.list-inset+ion-list.list-inset{margin-top:0}.list-ios-lines-none .item-lines-default{--inner-border-width:0px;--border-width:0px}.list-ios-lines-full .item-lines-default{--inner-border-width:0px;--border-width:0 0 0.55px 0}.list-ios-lines-inset .item-lines-default{--inner-border-width:0 0 0.55px 0;--border-width:0px}ion-card .list-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
- var IonListIosStyle0 = listIosCss;
- const listMdCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{-webkit-transform:translateZ(0);transform:translateZ(0);overflow:hidden}.list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-md>.input:last-child::after{inset-inline-start:0}.list-md.list-inset{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px;border-radius:2px}.list-md.list-inset ion-item:not(:only-of-type):last-of-type,.list-md.list-inset ion-item-sliding:last-of-type ion-item{--border-width:0;--inner-border-width:0}.list-md.list-inset ion-item:only-child{--border-width:0;--inner-border-width:0}.list-md.list-inset+ion-list.list-inset{margin-top:0}.list-md-lines-none .item-lines-default{--inner-border-width:0px;--border-width:0px}.list-md-lines-full .item-lines-default{--inner-border-width:0px;--border-width:0 0 1px 0}.list-md-lines-inset .item-lines-default{--inner-border-width:0 0 1px 0;--border-width:0px}ion-card .list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
- var IonListMdStyle0 = listMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class List {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.lines = undefined;
- this.inset = false;
- }
- /**
- * If `ion-item-sliding` are used inside the list, this method closes
- * any open sliding item.
- *
- * Returns `true` if an actual `ion-item-sliding` is closed.
- */
- async closeSlidingItems() {
- const item = this.el.querySelector('ion-item-sliding');
- if (item === null || item === void 0 ? void 0 : item.closeOpened) {
- return item.closeOpened();
- }
- return false;
- }
- render() {
- const mode = getIonMode$1(this);
- const { lines, inset } = this;
- return (hAsync(Host, { key: '5ff2b0b3989cc99ce17abb8bcd7ec1847940d1ec', role: "list", class: {
- [mode]: true,
- // Used internally for styling
- [`list-${mode}`]: true,
- 'list-inset': inset,
- [`list-lines-${lines}`]: lines !== undefined,
- [`list-${mode}-lines-${lines}`]: lines !== undefined,
- } }));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonListIosStyle0,
- md: IonListMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 32,
- "$tagName$": "ion-list",
- "$members$": {
- "lines": [1],
- "inset": [4],
- "closeSlidingItems": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const listHeaderIosCss = ":host{--border-style:solid;--border-width:0;--inner-border-width:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;min-height:40px;border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}.list-header-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}::slotted(ion-label){-ms-flex:1 1 auto;flex:1 1 auto}:host(.list-header-lines-inset),:host(.list-header-lines-none){--border-width:0}:host(.list-header-lines-full),:host(.list-header-lines-none){--inner-border-width:0}:host{--background:transparent;--color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));padding-right:var(--ion-safe-area-right);padding-left:calc(var(--ion-safe-area-left, 0px) + 16px);position:relative;-ms-flex-align:end;align-items:flex-end;font-size:min(1.375rem, 56.1px);font-weight:700;letter-spacing:0}:host-context([dir=rtl]){padding-right:calc(var(--ion-safe-area-right, 0px) + 16px);padding-left:var(--ion-safe-area-left)}@supports selector(:dir(rtl)){:host(:dir(rtl)){padding-right:calc(var(--ion-safe-area-right, 0px) + 16px);padding-left:var(--ion-safe-area-left)}}::slotted(ion-button),::slotted(ion-label){margin-top:29px;margin-bottom:6px}::slotted(ion-button){--padding-top:0;--padding-bottom:0;-webkit-margin-start:3px;margin-inline-start:3px;-webkit-margin-end:3px;margin-inline-end:3px;min-height:1.4em}:host(.list-header-lines-full){--border-width:0 0 0.55px 0}:host(.list-header-lines-inset){--inner-border-width:0 0 0.55px 0}";
- var IonListHeaderIosStyle0 = listHeaderIosCss;
- const listHeaderMdCss = ":host{--border-style:solid;--border-width:0;--inner-border-width:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;min-height:40px;border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}.list-header-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}::slotted(ion-label){-ms-flex:1 1 auto;flex:1 1 auto}:host(.list-header-lines-inset),:host(.list-header-lines-none){--border-width:0}:host(.list-header-lines-full),:host(.list-header-lines-none){--inner-border-width:0}:host{--background:transparent;--color:var(--ion-text-color, #000);--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));padding-right:var(--ion-safe-area-right);padding-left:calc(var(--ion-safe-area-left, 0px) + 16px);min-height:45px;font-size:0.875rem}:host-context([dir=rtl]){padding-right:calc(var(--ion-safe-area-right, 0px) + 16px);padding-left:var(--ion-safe-area-left)}@supports selector(:dir(rtl)){:host(:dir(rtl)){padding-right:calc(var(--ion-safe-area-right, 0px) + 16px);padding-left:var(--ion-safe-area-left)}}:host(.list-header-lines-full){--border-width:0 0 1px 0}:host(.list-header-lines-inset){--inner-border-width:0 0 1px 0}";
- var IonListHeaderMdStyle0 = listHeaderMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class ListHeader {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- this.lines = undefined;
- }
- render() {
- const { lines } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '95ce2135e2b1ad4d7d6020b0fb9bc6e02b3c0851', class: createColorClasses$1(this.color, {
- [mode]: true,
- [`list-header-lines-${lines}`]: lines !== undefined,
- }) }, hAsync("div", { key: '3065b0a094bc31a90518898a5126a813c8a33816', class: "list-header-inner" }, hAsync("slot", { key: 'fe15c87d7867f3e5d8185645c49c0228496697b8' }))));
- }
- static get style() { return {
- ios: IonListHeaderIosStyle0,
- md: IonListHeaderMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-list-header",
- "$members$": {
- "color": [513],
- "lines": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- /**
- * iOS Loading Enter Animation
- */
- const iosEnterAnimation$4 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper')).keyframes([
- { offset: 0, opacity: 0.01, transform: 'scale(1.1)' },
- { offset: 1, opacity: 1, transform: 'scale(1)' },
- ]);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(200)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * iOS Loading Leave Animation
- */
- const iosLeaveAnimation$4 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper')).keyframes([
- { offset: 0, opacity: 0.99, transform: 'scale(1)' },
- { offset: 1, opacity: 0, transform: 'scale(0.9)' },
- ]);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(200)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * Md Loading Enter Animation
- */
- const mdEnterAnimation$3 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper')).keyframes([
- { offset: 0, opacity: 0.01, transform: 'scale(1.1)' },
- { offset: 1, opacity: 1, transform: 'scale(1)' },
- ]);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(200)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * Md Loading Leave Animation
- */
- const mdLeaveAnimation$3 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation.addElement(baseEl.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- wrapperAnimation.addElement(baseEl.querySelector('.loading-wrapper')).keyframes([
- { offset: 0, opacity: 0.99, transform: 'scale(1)' },
- { offset: 1, opacity: 0, transform: 'scale(0.9)' },
- ]);
- return baseAnimation
- .addElement(baseEl)
- .easing('ease-in-out')
- .duration(200)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- const loadingIosCss = ".sc-ion-loading-ios-h{--min-width:auto;--width:auto;--min-height:auto;--height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-loading-ios-h{display:none}.loading-wrapper.sc-ion-loading-ios{display:-ms-flexbox;display:flex;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);opacity:0;z-index:10}ion-spinner.sc-ion-loading-ios{color:var(--spinner-color)}.sc-ion-loading-ios-h{--background:var(--ion-overlay-background-color, var(--ion-color-step-100, var(--ion-background-color-step-100, #f9f9f9)));--max-width:270px;--max-height:90%;--spinner-color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));--backdrop-opacity:var(--ion-backdrop-opacity, 0.3);color:var(--ion-text-color, #000);font-size:0.875rem}.loading-wrapper.sc-ion-loading-ios{border-radius:8px;-webkit-padding-start:34px;padding-inline-start:34px;-webkit-padding-end:34px;padding-inline-end:34px;padding-top:24px;padding-bottom:24px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.loading-translucent.sc-ion-loading-ios-h .loading-wrapper.sc-ion-loading-ios{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}.loading-content.sc-ion-loading-ios{font-weight:bold}.loading-spinner.sc-ion-loading-ios+.loading-content.sc-ion-loading-ios{-webkit-margin-start:16px;margin-inline-start:16px}";
- var IonLoadingIosStyle0 = loadingIosCss;
- const loadingMdCss = ".sc-ion-loading-md-h{--min-width:auto;--width:auto;--min-height:auto;--height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-loading-md-h{display:none}.loading-wrapper.sc-ion-loading-md{display:-ms-flexbox;display:flex;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);opacity:0;z-index:10}ion-spinner.sc-ion-loading-md{color:var(--spinner-color)}.sc-ion-loading-md-h{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--max-width:280px;--max-height:90%;--spinner-color:var(--ion-color-primary, #0054e9);--backdrop-opacity:var(--ion-backdrop-opacity, 0.32);color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));font-size:0.875rem}.loading-wrapper.sc-ion-loading-md{border-radius:2px;-webkit-padding-start:24px;padding-inline-start:24px;-webkit-padding-end:24px;padding-inline-end:24px;padding-top:24px;padding-bottom:24px;-webkit-box-shadow:0 16px 20px rgba(0, 0, 0, 0.4);box-shadow:0 16px 20px rgba(0, 0, 0, 0.4)}.loading-spinner.sc-ion-loading-md+.loading-content.sc-ion-loading-md{-webkit-margin-start:16px;margin-inline-start:16px}";
- var IonLoadingMdStyle0 = loadingMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Loading {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.didPresent = createEvent(this, "ionLoadingDidPresent", 7);
- this.willPresent = createEvent(this, "ionLoadingWillPresent", 7);
- this.willDismiss = createEvent(this, "ionLoadingWillDismiss", 7);
- this.didDismiss = createEvent(this, "ionLoadingDidDismiss", 7);
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
- this.delegateController = createDelegateController(this);
- this.lockController = createLockController();
- this.triggerController = createTriggerController();
- this.customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
- this.presented = false;
- this.onBackdropTap = () => {
- this.dismiss(undefined, BACKDROP);
- };
- this.overlayIndex = undefined;
- this.delegate = undefined;
- this.hasController = false;
- this.keyboardClose = true;
- this.enterAnimation = undefined;
- this.leaveAnimation = undefined;
- this.message = undefined;
- this.cssClass = undefined;
- this.duration = 0;
- this.backdropDismiss = false;
- this.showBackdrop = true;
- this.spinner = undefined;
- this.translucent = false;
- this.animated = true;
- this.htmlAttributes = undefined;
- this.isOpen = false;
- this.trigger = undefined;
- }
- onIsOpenChange(newValue, oldValue) {
- if (newValue === true && oldValue === false) {
- this.present();
- }
- else if (newValue === false && oldValue === true) {
- this.dismiss();
- }
- }
- triggerChanged() {
- const { trigger, el, triggerController } = this;
- if (trigger) {
- triggerController.addClickListener(el, trigger);
- }
- }
- connectedCallback() {
- prepareOverlay(this.el);
- this.triggerChanged();
- }
- componentWillLoad() {
- var _a;
- if (this.spinner === undefined) {
- const mode = getIonMode$1(this);
- this.spinner = config.get('loadingSpinner', config.get('spinner', mode === 'ios' ? 'lines' : 'crescent'));
- }
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
- setOverlayId(this.el);
- }
- }
- componentDidLoad() {
- /**
- * If loading indicator was rendered with isOpen="true"
- * then we should open loading indicator immediately.
- */
- if (this.isOpen === true) {
- raf(() => this.present());
- }
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.triggerChanged();
- }
- disconnectedCallback() {
- this.triggerController.removeClickListener();
- }
- /**
- * Present the loading overlay after it has been created.
- */
- async present() {
- const unlock = await this.lockController.lock();
- await this.delegateController.attachViewToDom();
- await present(this, 'loadingEnter', iosEnterAnimation$4, mdEnterAnimation$3);
- if (this.duration > 0) {
- this.durationTimeout = setTimeout(() => this.dismiss(), this.duration + 10);
- }
- unlock();
- }
- /**
- * Dismiss the loading overlay after it has been presented.
- *
- * @param data Any data to emit in the dismiss events.
- * @param role The role of the element that is dismissing the loading.
- * This can be useful in a button handler for determining which button was
- * clicked to dismiss the loading.
- * Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
- *
- * This is a no-op if the overlay has not been presented yet. If you want
- * to remove an overlay from the DOM that was never presented, use the
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
- */
- async dismiss(data, role) {
- const unlock = await this.lockController.lock();
- if (this.durationTimeout) {
- clearTimeout(this.durationTimeout);
- }
- const dismissed = await dismiss(this, data, role, 'loadingLeave', iosLeaveAnimation$4, mdLeaveAnimation$3);
- if (dismissed) {
- this.delegateController.removeViewFromDom();
- }
- unlock();
- return dismissed;
- }
- /**
- * Returns a promise that resolves when the loading did dismiss.
- */
- onDidDismiss() {
- return eventMethod(this.el, 'ionLoadingDidDismiss');
- }
- /**
- * Returns a promise that resolves when the loading will dismiss.
- */
- onWillDismiss() {
- return eventMethod(this.el, 'ionLoadingWillDismiss');
- }
- renderLoadingMessage(msgId) {
- const { customHTMLEnabled, message } = this;
- if (customHTMLEnabled) {
- return hAsync("div", { class: "loading-content", id: msgId, innerHTML: sanitizeDOMString(message) });
- }
- return (hAsync("div", { class: "loading-content", id: msgId }, message));
- }
- render() {
- const { message, spinner, htmlAttributes, overlayIndex } = this;
- const mode = getIonMode$1(this);
- const msgId = `loading-${overlayIndex}-msg`;
- /**
- * If the message is defined, use that as the label.
- * Otherwise, don't set aria-labelledby.
- */
- const ariaLabelledBy = message !== undefined ? msgId : null;
- return (hAsync(Host, Object.assign({ key: 'd6066c8b56b1fe4b597a243a7dab191ef0d21286', role: "dialog", "aria-modal": "true", "aria-labelledby": ariaLabelledBy, tabindex: "-1" }, htmlAttributes, { style: {
- zIndex: `${40000 + this.overlayIndex}`,
- }, onIonBackdropTap: this.onBackdropTap, class: Object.assign(Object.assign({}, getClassMap(this.cssClass)), { [mode]: true, 'overlay-hidden': true, 'loading-translucent': this.translucent }) }), hAsync("ion-backdrop", { key: '2431eda00a2a3f510f5dfc39b7c7d47c056dfa3d', visible: this.showBackdrop, tappable: this.backdropDismiss }), hAsync("div", { key: 'cf210aaf5e754e4eccdb49cf7ead4647b3f9b2d1', tabindex: "0", "aria-hidden": "true" }), hAsync("div", { key: 'fa9375143d391656d70e181d25b952c77c2fc6ec', class: "loading-wrapper ion-overlay-wrapper" }, spinner && (hAsync("div", { key: '8e4a4ed994f7f62df86b03696ac95162df41f52d', class: "loading-spinner" }, hAsync("ion-spinner", { key: 'e5b323c272d365853ba92bd211e390b4fd4751d2', name: spinner, "aria-hidden": "true" }))), message !== undefined && this.renderLoadingMessage(msgId)), hAsync("div", { key: 'cae35ec8c34800477bff3ebcec8010e632158233', tabindex: "0", "aria-hidden": "true" })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "isOpen": ["onIsOpenChange"],
- "trigger": ["triggerChanged"]
- }; }
- static get style() { return {
- ios: IonLoadingIosStyle0,
- md: IonLoadingMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 34,
- "$tagName$": "ion-loading",
- "$members$": {
- "overlayIndex": [2, "overlay-index"],
- "delegate": [16],
- "hasController": [4, "has-controller"],
- "keyboardClose": [4, "keyboard-close"],
- "enterAnimation": [16],
- "leaveAnimation": [16],
- "message": [1],
- "cssClass": [1, "css-class"],
- "duration": [2],
- "backdropDismiss": [4, "backdrop-dismiss"],
- "showBackdrop": [4, "show-backdrop"],
- "spinner": [1025],
- "translucent": [4],
- "animated": [4],
- "htmlAttributes": [16],
- "isOpen": [4, "is-open"],
- "trigger": [1],
- "present": [64],
- "dismiss": [64],
- "onDidDismiss": [64],
- "onWillDismiss": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- /**
- * Based on:
- * https://stackoverflow.com/questions/7348009/y-coordinate-for-a-given-x-cubic-bezier
- * https://math.stackexchange.com/questions/26846/is-there-an-explicit-form-for-cubic-b%C3%A9zier-curves
- */
- /**
- * EXPERIMENTAL
- * Given a cubic-bezier curve, get the x value (time) given
- * the y value (progression).
- * Ex: cubic-bezier(0.32, 0.72, 0, 1);
- * P0: (0, 0)
- * P1: (0.32, 0.72)
- * P2: (0, 1)
- * P3: (1, 1)
- *
- * If you give a cubic bezier curve that never reaches the
- * provided progression, this function will return an empty array.
- */
- const getTimeGivenProgression = (p0, p1, p2, p3, progression) => {
- return solveCubicBezier(p0[1], p1[1], p2[1], p3[1], progression).map((tValue) => {
- return solveCubicParametricEquation(p0[0], p1[0], p2[0], p3[0], tValue);
- });
- };
- /**
- * Solve a cubic equation in one dimension (time)
- */
- const solveCubicParametricEquation = (p0, p1, p2, p3, t) => {
- const partA = 3 * p1 * Math.pow(t - 1, 2);
- const partB = -3 * p2 * t + 3 * p2 + p3 * t;
- const partC = p0 * Math.pow(t - 1, 3);
- return t * (partA + t * partB) - partC;
- };
- /**
- * Find the `t` value for a cubic bezier using Cardano's formula
- */
- const solveCubicBezier = (p0, p1, p2, p3, refPoint) => {
- p0 -= refPoint;
- p1 -= refPoint;
- p2 -= refPoint;
- p3 -= refPoint;
- const roots = solveCubicEquation(p3 - 3 * p2 + 3 * p1 - p0, 3 * p2 - 6 * p1 + 3 * p0, 3 * p1 - 3 * p0, p0);
- return roots.filter((root) => root >= 0 && root <= 1);
- };
- const solveQuadraticEquation = (a, b, c) => {
- const discriminant = b * b - 4 * a * c;
- if (discriminant < 0) {
- return [];
- }
- else {
- return [(-b + Math.sqrt(discriminant)) / (2 * a), (-b - Math.sqrt(discriminant)) / (2 * a)];
- }
- };
- const solveCubicEquation = (a, b, c, d) => {
- if (a === 0) {
- return solveQuadraticEquation(b, c, d);
- }
- b /= a;
- c /= a;
- d /= a;
- const p = (3 * c - b * b) / 3;
- const q = (2 * b * b * b - 9 * b * c + 27 * d) / 27;
- if (p === 0) {
- return [Math.pow(-q, 1 / 3)];
- }
- else if (q === 0) {
- return [Math.sqrt(-p), -Math.sqrt(-p)];
- }
- const discriminant = Math.pow(q / 2, 2) + Math.pow(p / 3, 3);
- if (discriminant === 0) {
- return [Math.pow(q / 2, 1 / 2) - b / 3];
- }
- else if (discriminant > 0) {
- return [
- Math.pow(-(q / 2) + Math.sqrt(discriminant), 1 / 3) - Math.pow(q / 2 + Math.sqrt(discriminant), 1 / 3) - b / 3,
- ];
- }
- const r = Math.sqrt(Math.pow(-(p / 3), 3));
- const phi = Math.acos(-(q / (2 * Math.sqrt(Math.pow(-(p / 3), 3)))));
- const s = 2 * Math.pow(r, 1 / 3);
- return [
- s * Math.cos(phi / 3) - b / 3,
- s * Math.cos((phi + 2 * Math.PI) / 3) - b / 3,
- s * Math.cos((phi + 4 * Math.PI) / 3) - b / 3,
- ];
- };
- /**
- * baseAnimation
- * Base class which is extended by the various types. Each
- * type will provide their own animations for open and close
- * and registers itself with Menu.
- */
- const baseAnimation = (isIos) => {
- // https://material.io/guidelines/motion/movement.html#movement-movement-in-out-of-screen-bounds
- // https://material.io/guidelines/motion/duration-easing.html#duration-easing-natural-easing-curves
- /**
- * "Apply the sharp curve to items temporarily leaving the screen that may return
- * from the same exit point. When they return, use the deceleration curve. On mobile,
- * this transition typically occurs over 300ms" -- MD Motion Guide
- */
- return createAnimation().duration(isIos ? 400 : 300);
- };
- /**
- * Menu Overlay Type
- * The menu slides over the content. The content
- * itself, which is under the menu, does not move.
- */
- const menuOverlayAnimation = (menu) => {
- let closedX;
- let openedX;
- const width = menu.width + 8;
- const menuAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- if (menu.isEndSide) {
- // right side
- closedX = width + 'px';
- openedX = '0px';
- }
- else {
- // left side
- closedX = -width + 'px';
- openedX = '0px';
- }
- menuAnimation.addElement(menu.menuInnerEl).fromTo('transform', `translateX(${closedX})`, `translateX(${openedX})`);
- const mode = getIonMode$1(menu);
- const isIos = mode === 'ios';
- const opacity = isIos ? 0.2 : 0.25;
- backdropAnimation.addElement(menu.backdropEl).fromTo('opacity', 0.01, opacity);
- return baseAnimation(isIos).addAnimation([menuAnimation, backdropAnimation]);
- };
- /**
- * Menu Push Type
- * The content slides over to reveal the menu underneath.
- * The menu itself also slides over to reveal its bad self.
- */
- const menuPushAnimation = (menu) => {
- let contentOpenedX;
- let menuClosedX;
- const mode = getIonMode$1(menu);
- const width = menu.width;
- if (menu.isEndSide) {
- contentOpenedX = -width + 'px';
- menuClosedX = width + 'px';
- }
- else {
- contentOpenedX = width + 'px';
- menuClosedX = -width + 'px';
- }
- const menuAnimation = createAnimation()
- .addElement(menu.menuInnerEl)
- .fromTo('transform', `translateX(${menuClosedX})`, 'translateX(0px)');
- const contentAnimation = createAnimation()
- .addElement(menu.contentEl)
- .fromTo('transform', 'translateX(0px)', `translateX(${contentOpenedX})`);
- const backdropAnimation = createAnimation().addElement(menu.backdropEl).fromTo('opacity', 0.01, 0.32);
- return baseAnimation(mode === 'ios').addAnimation([menuAnimation, contentAnimation, backdropAnimation]);
- };
- /**
- * Menu Reveal Type
- * The content slides over to reveal the menu underneath.
- * The menu itself, which is under the content, does not move.
- */
- const menuRevealAnimation = (menu) => {
- const mode = getIonMode$1(menu);
- const openedX = menu.width * (menu.isEndSide ? -1 : 1) + 'px';
- const contentOpen = createAnimation()
- .addElement(menu.contentEl) // REVIEW
- .fromTo('transform', 'translateX(0px)', `translateX(${openedX})`);
- return baseAnimation(mode === 'ios').addAnimation(contentOpen);
- };
- const createMenuController = () => {
- const menuAnimations = new Map();
- const menus = [];
- const open = async (menu) => {
- const menuEl = await get(menu, true);
- if (menuEl) {
- return menuEl.open();
- }
- return false;
- };
- const close = async (menu) => {
- const menuEl = await (menu !== undefined ? get(menu, true) : getOpen());
- if (menuEl !== undefined) {
- return menuEl.close();
- }
- return false;
- };
- const toggle = async (menu) => {
- const menuEl = await get(menu, true);
- if (menuEl) {
- return menuEl.toggle();
- }
- return false;
- };
- const enable = async (shouldEnable, menu) => {
- const menuEl = await get(menu);
- if (menuEl) {
- menuEl.disabled = !shouldEnable;
- }
- return menuEl;
- };
- const swipeGesture = async (shouldEnable, menu) => {
- const menuEl = await get(menu);
- if (menuEl) {
- menuEl.swipeGesture = shouldEnable;
- }
- return menuEl;
- };
- const isOpen = async (menu) => {
- if (menu != null) {
- const menuEl = await get(menu);
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- return menuEl !== undefined && menuEl.isOpen();
- }
- else {
- const menuEl = await getOpen();
- return menuEl !== undefined;
- }
- };
- const isEnabled = async (menu) => {
- const menuEl = await get(menu);
- if (menuEl) {
- return !menuEl.disabled;
- }
- return false;
- };
- /**
- * Finds and returns the menu specified by "menu" if registered.
- * @param menu - The side or ID of the desired menu
- * @param logOnMultipleSideMenus - If true, this function will log a warning
- * if "menu" is a side but multiple menus on the same side were found. Since this function
- * is used in multiple places, we default this log to false so that the calling
- * functions can choose whether or not it is appropriate to log this warning.
- */
- const get = async (menu, logOnMultipleSideMenus = false) => {
- await waitUntilReady();
- if (menu === 'start' || menu === 'end') {
- // there could be more than one menu on the same side
- // so first try to get the enabled one
- const menuRefs = menus.filter((m) => m.side === menu && !m.disabled);
- if (menuRefs.length >= 1) {
- if (menuRefs.length > 1 && logOnMultipleSideMenus) {
- printIonWarning(`menuController queried for a menu on the "${menu}" side, but ${menuRefs.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`, menuRefs.map((m) => m.el));
- }
- return menuRefs[0].el;
- }
- // didn't find a menu side that is enabled
- // so try to get the first menu side found
- const sideMenuRefs = menus.filter((m) => m.side === menu);
- if (sideMenuRefs.length >= 1) {
- if (sideMenuRefs.length > 1 && logOnMultipleSideMenus) {
- printIonWarning(`menuController queried for a menu on the "${menu}" side, but ${sideMenuRefs.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`, sideMenuRefs.map((m) => m.el));
- }
- return sideMenuRefs[0].el;
- }
- }
- else if (menu != null) {
- // the menuId was not left or right
- // so try to get the menu by its "id"
- return find((m) => m.menuId === menu);
- }
- // return the first enabled menu
- const menuEl = find((m) => !m.disabled);
- if (menuEl) {
- return menuEl;
- }
- // get the first menu in the array, if one exists
- return menus.length > 0 ? menus[0].el : undefined;
- };
- /**
- * Get the instance of the opened menu. Returns `null` if a menu is not found.
- */
- const getOpen = async () => {
- await waitUntilReady();
- return _getOpenSync();
- };
- /**
- * Get all menu instances.
- */
- const getMenus = async () => {
- await waitUntilReady();
- return getMenusSync();
- };
- /**
- * Get whether or not a menu is animating. Returns `true` if any
- * menu is currently animating.
- */
- const isAnimating = async () => {
- await waitUntilReady();
- return isAnimatingSync();
- };
- const registerAnimation = (name, animation) => {
- menuAnimations.set(name, animation);
- };
- const _register = (menu) => {
- if (menus.indexOf(menu) < 0) {
- menus.push(menu);
- }
- };
- const _unregister = (menu) => {
- const index = menus.indexOf(menu);
- if (index > -1) {
- menus.splice(index, 1);
- }
- };
- const _setOpen = async (menu, shouldOpen, animated, role) => {
- if (isAnimatingSync()) {
- return false;
- }
- if (shouldOpen) {
- const openedMenu = await getOpen();
- if (openedMenu && menu.el !== openedMenu) {
- await openedMenu.setOpen(false, false);
- }
- }
- return menu._setOpen(shouldOpen, animated, role);
- };
- const _createAnimation = (type, menuCmp) => {
- const animationBuilder = menuAnimations.get(type); // TODO(FW-2832): type
- if (!animationBuilder) {
- throw new Error('animation not registered');
- }
- const animation = animationBuilder(menuCmp);
- return animation;
- };
- const _getOpenSync = () => {
- return find((m) => m._isOpen);
- };
- const getMenusSync = () => {
- return menus.map((menu) => menu.el);
- };
- const isAnimatingSync = () => {
- return menus.some((menu) => menu.isAnimating);
- };
- const find = (predicate) => {
- const instance = menus.find(predicate);
- if (instance !== undefined) {
- return instance.el;
- }
- return undefined;
- };
- const waitUntilReady = () => {
- return Promise.all(Array.from(document.querySelectorAll('ion-menu')).map((menu) => new Promise((resolve) => componentOnReady(menu, resolve))));
- };
- registerAnimation('reveal', menuRevealAnimation);
- registerAnimation('push', menuPushAnimation);
- registerAnimation('overlay', menuOverlayAnimation);
- doc === null || doc === void 0 ? void 0 : doc.addEventListener('ionBackButton', (ev) => {
- const openMenu = _getOpenSync();
- if (openMenu) {
- ev.detail.register(MENU_BACK_BUTTON_PRIORITY, () => {
- return openMenu.close();
- });
- }
- });
- return {
- registerAnimation,
- get,
- getMenus,
- getOpen,
- isEnabled,
- swipeGesture,
- isAnimating,
- isOpen,
- enable,
- toggle,
- close,
- open,
- _getOpenSync,
- _createAnimation,
- _register,
- _unregister,
- _setOpen,
- };
- };
- const menuController = /*@__PURE__*/ createMenuController();
- const menuIosCss = ":host{--width:304px;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--background:var(--ion-background-color, #fff);left:0;right:0;top:0;bottom:0;display:none;position:absolute;contain:strict}:host(.show-menu){display:block}.menu-inner{-webkit-transform:translateX(-9999px);transform:translateX(-9999px);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:strict}:host(.menu-side-start) .menu-inner{--ion-safe-area-right:0px;top:0;bottom:0}:host(.menu-side-start) .menu-inner{inset-inline-start:0;inset-inline-end:auto}:host-context([dir=rtl]):host(.menu-side-start) .menu-inner,:host-context([dir=rtl]).menu-side-start .menu-inner{--ion-safe-area-right:unset;--ion-safe-area-left:0px}@supports selector(:dir(rtl)){:host(.menu-side-start:dir(rtl)) .menu-inner{--ion-safe-area-right:unset;--ion-safe-area-left:0px}}:host(.menu-side-end) .menu-inner{--ion-safe-area-left:0px;top:0;bottom:0}:host(.menu-side-end) .menu-inner{inset-inline-start:auto;inset-inline-end:0}:host-context([dir=rtl]):host(.menu-side-end) .menu-inner,:host-context([dir=rtl]).menu-side-end .menu-inner{--ion-safe-area-left:unset;--ion-safe-area-right:0px}@supports selector(:dir(rtl)){:host(.menu-side-end:dir(rtl)) .menu-inner{--ion-safe-area-left:unset;--ion-safe-area-right:0px}}ion-backdrop{display:none;opacity:0.01;z-index:-1}@media (max-width: 340px){.menu-inner{--width:264px}}:host(.menu-type-reveal){z-index:0}:host(.menu-type-reveal.show-menu) .menu-inner{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}:host(.menu-type-overlay){z-index:1000}:host(.menu-type-overlay) .show-backdrop{display:block;cursor:pointer}:host(.menu-pane-visible){-ms-flex:0 1 auto;flex:0 1 auto;width:var(--side-width, var(--width));min-width:var(--side-min-width, var(--min-width));max-width:var(--side-max-width, var(--max-width))}:host(.menu-pane-visible.split-pane-side){left:0;right:0;top:0;bottom:0;position:relative;-webkit-box-shadow:none;box-shadow:none;z-index:0}:host(.menu-pane-visible.split-pane-side.menu-enabled){display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0}:host(.menu-pane-visible.split-pane-side){-ms-flex-order:-1;order:-1}:host(.menu-pane-visible.split-pane-side[side=end]){-ms-flex-order:1;order:1}:host(.menu-pane-visible) .menu-inner{left:0;right:0;width:auto;-webkit-transform:none;transform:none;-webkit-box-shadow:none;box-shadow:none}:host(.menu-pane-visible) ion-backdrop{display:hidden !important}:host(.menu-pane-visible.split-pane-side){-webkit-border-start:0;border-inline-start:0;-webkit-border-end:var(--border);border-inline-end:var(--border);border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.menu-pane-visible.split-pane-side[side=end]){-webkit-border-start:var(--border);border-inline-start:var(--border);-webkit-border-end:0;border-inline-end:0;border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.menu-type-push){z-index:1000}:host(.menu-type-push) .show-backdrop{display:block}";
- var IonMenuIosStyle0 = menuIosCss;
- const menuMdCss = ":host{--width:304px;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--background:var(--ion-background-color, #fff);left:0;right:0;top:0;bottom:0;display:none;position:absolute;contain:strict}:host(.show-menu){display:block}.menu-inner{-webkit-transform:translateX(-9999px);transform:translateX(-9999px);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:strict}:host(.menu-side-start) .menu-inner{--ion-safe-area-right:0px;top:0;bottom:0}:host(.menu-side-start) .menu-inner{inset-inline-start:0;inset-inline-end:auto}:host-context([dir=rtl]):host(.menu-side-start) .menu-inner,:host-context([dir=rtl]).menu-side-start .menu-inner{--ion-safe-area-right:unset;--ion-safe-area-left:0px}@supports selector(:dir(rtl)){:host(.menu-side-start:dir(rtl)) .menu-inner{--ion-safe-area-right:unset;--ion-safe-area-left:0px}}:host(.menu-side-end) .menu-inner{--ion-safe-area-left:0px;top:0;bottom:0}:host(.menu-side-end) .menu-inner{inset-inline-start:auto;inset-inline-end:0}:host-context([dir=rtl]):host(.menu-side-end) .menu-inner,:host-context([dir=rtl]).menu-side-end .menu-inner{--ion-safe-area-left:unset;--ion-safe-area-right:0px}@supports selector(:dir(rtl)){:host(.menu-side-end:dir(rtl)) .menu-inner{--ion-safe-area-left:unset;--ion-safe-area-right:0px}}ion-backdrop{display:none;opacity:0.01;z-index:-1}@media (max-width: 340px){.menu-inner{--width:264px}}:host(.menu-type-reveal){z-index:0}:host(.menu-type-reveal.show-menu) .menu-inner{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}:host(.menu-type-overlay){z-index:1000}:host(.menu-type-overlay) .show-backdrop{display:block;cursor:pointer}:host(.menu-pane-visible){-ms-flex:0 1 auto;flex:0 1 auto;width:var(--side-width, var(--width));min-width:var(--side-min-width, var(--min-width));max-width:var(--side-max-width, var(--max-width))}:host(.menu-pane-visible.split-pane-side){left:0;right:0;top:0;bottom:0;position:relative;-webkit-box-shadow:none;box-shadow:none;z-index:0}:host(.menu-pane-visible.split-pane-side.menu-enabled){display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0}:host(.menu-pane-visible.split-pane-side){-ms-flex-order:-1;order:-1}:host(.menu-pane-visible.split-pane-side[side=end]){-ms-flex-order:1;order:1}:host(.menu-pane-visible) .menu-inner{left:0;right:0;width:auto;-webkit-transform:none;transform:none;-webkit-box-shadow:none;box-shadow:none}:host(.menu-pane-visible) ion-backdrop{display:hidden !important}:host(.menu-pane-visible.split-pane-side){-webkit-border-start:0;border-inline-start:0;-webkit-border-end:var(--border);border-inline-end:var(--border);border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.menu-pane-visible.split-pane-side[side=end]){-webkit-border-start:var(--border);border-inline-start:var(--border);-webkit-border-end:0;border-inline-end:0;border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.menu-type-overlay) .menu-inner{-webkit-box-shadow:4px 0px 16px rgba(0, 0, 0, 0.18);box-shadow:4px 0px 16px rgba(0, 0, 0, 0.18)}";
- var IonMenuMdStyle0 = menuMdCss;
- const iosEasing = 'cubic-bezier(0.32,0.72,0,1)';
- const mdEasing = 'cubic-bezier(0.0,0.0,0.2,1)';
- const iosEasingReverse = 'cubic-bezier(1, 0, 0.68, 0.28)';
- const mdEasingReverse = 'cubic-bezier(0.4, 0, 0.6, 1)';
- /**
- * @part container - The container for the menu content.
- * @part backdrop - The backdrop that appears over the main content when the menu is open.
- */
- class Menu {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionWillOpen = createEvent(this, "ionWillOpen", 7);
- this.ionWillClose = createEvent(this, "ionWillClose", 7);
- this.ionDidOpen = createEvent(this, "ionDidOpen", 7);
- this.ionDidClose = createEvent(this, "ionDidClose", 7);
- this.ionMenuChange = createEvent(this, "ionMenuChange", 7);
- this.lastOnEnd = 0;
- this.blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
- this.didLoad = false;
- /**
- * Flag used to determine if an open/close
- * operation was cancelled. For example, if
- * an app calls "menu.open" then disables the menu
- * part way through the animation, then this would
- * be considered a cancelled operation.
- */
- this.operationCancelled = false;
- this.isAnimating = false;
- this._isOpen = false;
- this.inheritedAttributes = {};
- this.handleFocus = (ev) => {
- /**
- * Overlays have their own focus trapping listener
- * so we do not want the two listeners to conflict
- * with each other. If the top-most overlay that is
- * open does not contain this ion-menu, then ion-menu's
- * focus trapping should not run.
- */
- const lastOverlay = getPresentedOverlay(document);
- if (lastOverlay && !lastOverlay.contains(this.el)) {
- return;
- }
- this.trapKeyboardFocus(ev, document);
- };
- this.isPaneVisible = false;
- this.isEndSide = false;
- this.contentId = undefined;
- this.menuId = undefined;
- this.type = undefined;
- this.disabled = false;
- this.side = 'start';
- this.swipeGesture = true;
- this.maxEdgeStart = 50;
- }
- typeChanged(type, oldType) {
- const contentEl = this.contentEl;
- if (contentEl) {
- if (oldType !== undefined) {
- contentEl.classList.remove(`menu-content-${oldType}`);
- }
- contentEl.classList.add(`menu-content-${type}`);
- contentEl.removeAttribute('style');
- }
- if (this.menuInnerEl) {
- // Remove effects of previous animations
- this.menuInnerEl.removeAttribute('style');
- }
- this.animation = undefined;
- }
- disabledChanged() {
- this.updateState();
- this.ionMenuChange.emit({
- disabled: this.disabled,
- open: this._isOpen,
- });
- }
- sideChanged() {
- this.isEndSide = isEndSide(this.side);
- /**
- * Menu direction animation is calculated based on the document direction.
- * If the document direction changes, we need to create a new animation.
- */
- this.animation = undefined;
- }
- swipeGestureChanged() {
- this.updateState();
- }
- async connectedCallback() {
- // TODO: connectedCallback is fired in CE build
- // before WC is defined. This needs to be fixed in Stencil.
- if (typeof customElements !== 'undefined' && customElements != null) {
- await customElements.whenDefined('ion-menu');
- }
- if (this.type === undefined) {
- this.type = config.get('menuType', 'overlay');
- }
- {
- return;
- }
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- }
- async componentDidLoad() {
- this.didLoad = true;
- /**
- * A menu inside of a split pane is assumed
- * to be a side pane.
- *
- * When the menu is loaded it needs to
- * see if it should be considered visible inside
- * of the split pane. If the split pane is
- * hidden then the menu should be too.
- */
- const splitPane = this.el.closest('ion-split-pane');
- if (splitPane !== null) {
- this.isPaneVisible = await splitPane.isVisible();
- }
- this.menuChanged();
- this.updateState();
- }
- menuChanged() {
- /**
- * Inform dependent components such as ion-menu-button
- * that the menu is ready. Note that we only want to do this
- * once the menu has been rendered which is why we check for didLoad.
- */
- if (this.didLoad) {
- this.ionMenuChange.emit({ disabled: this.disabled, open: this._isOpen });
- }
- }
- async disconnectedCallback() {
- /**
- * The menu should be closed when it is
- * unmounted from the DOM.
- * This is an async call, so we need to wait for
- * this to finish otherwise contentEl
- * will not have MENU_CONTENT_OPEN removed.
- */
- await this.close(false);
- this.blocker.destroy();
- menuController._unregister(this);
- if (this.animation) {
- this.animation.destroy();
- }
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- this.animation = undefined;
- this.contentEl = undefined;
- }
- onSplitPaneChanged(ev) {
- const closestSplitPane = this.el.closest('ion-split-pane');
- if (closestSplitPane !== null && closestSplitPane === ev.target) {
- this.isPaneVisible = ev.detail.visible;
- this.updateState();
- }
- }
- onBackdropClick(ev) {
- // TODO(FW-2832): type (CustomEvent triggers errors which should be sorted)
- if (this._isOpen && this.lastOnEnd < ev.timeStamp - 100) {
- const shouldClose = ev.composedPath ? !ev.composedPath().includes(this.menuInnerEl) : false;
- if (shouldClose) {
- ev.preventDefault();
- ev.stopPropagation();
- this.close(undefined, BACKDROP);
- }
- }
- }
- onKeydown(ev) {
- if (ev.key === 'Escape') {
- this.close(undefined, BACKDROP);
- }
- }
- /**
- * Returns `true` is the menu is open.
- */
- isOpen() {
- return Promise.resolve(this._isOpen);
- }
- /**
- * Returns `true` is the menu is active.
- *
- * A menu is active when it can be opened or closed, meaning it's enabled
- * and it's not part of a `ion-split-pane`.
- */
- isActive() {
- return Promise.resolve(this._isActive());
- }
- /**
- * Opens the menu. If the menu is already open or it can't be opened,
- * it returns `false`.
- */
- open(animated = true) {
- return this.setOpen(true, animated);
- }
- /**
- * Closes the menu. If the menu is already closed or it can't be closed,
- * it returns `false`.
- */
- close(animated = true, role) {
- return this.setOpen(false, animated, role);
- }
- /**
- * Toggles the menu. If the menu is already open, it will try to close, otherwise it will try to open it.
- * If the operation can't be completed successfully, it returns `false`.
- */
- toggle(animated = true) {
- return this.setOpen(!this._isOpen, animated);
- }
- /**
- * Opens or closes the button.
- * If the operation can't be completed successfully, it returns `false`.
- */
- setOpen(shouldOpen, animated = true, role) {
- return menuController._setOpen(this, shouldOpen, animated, role);
- }
- trapKeyboardFocus(ev, doc) {
- const target = ev.target;
- if (!target) {
- return;
- }
- /**
- * If the target is inside the menu contents, let the browser
- * focus as normal and keep a log of the last focused element.
- */
- if (this.el.contains(target)) {
- this.lastFocus = target;
- }
- else {
- /**
- * Otherwise, we are about to have focus go out of the menu.
- * Wrap the focus to either the first or last element.
- */
- const { el } = this;
- /**
- * Once we call `focusFirstDescendant`, another focus event
- * will fire, which will cause `lastFocus` to be updated
- * before we can run the code after that. We cache the value
- * here to avoid that.
- */
- focusFirstDescendant(el);
- /**
- * If the cached last focused element is the same as the now-
- * active element, that means the user was on the first element
- * already and pressed Shift + Tab, so we need to wrap to the
- * last descendant.
- */
- if (this.lastFocus === doc.activeElement) {
- focusLastDescendant(el);
- }
- }
- }
- async _setOpen(shouldOpen, animated = true, role) {
- // If the menu is disabled or it is currently being animated, let's do nothing
- if (!this._isActive() || this.isAnimating || shouldOpen === this._isOpen) {
- return false;
- }
- this.beforeAnimation(shouldOpen, role);
- await this.loadAnimation();
- await this.startAnimation(shouldOpen, animated);
- /**
- * If the animation was cancelled then
- * return false because the operation
- * did not succeed.
- */
- if (this.operationCancelled) {
- this.operationCancelled = false;
- return false;
- }
- this.afterAnimation(shouldOpen, role);
- return true;
- }
- async loadAnimation() {
- // Menu swipe animation takes the menu's inner width as parameter,
- // If `offsetWidth` changes, we need to create a new animation.
- const width = this.menuInnerEl.offsetWidth;
- /**
- * Menu direction animation is calculated based on the document direction.
- * If the document direction changes, we need to create a new animation.
- */
- const isEndSide$1 = isEndSide(this.side);
- if (width === this.width && this.animation !== undefined && isEndSide$1 === this.isEndSide) {
- return;
- }
- this.width = width;
- this.isEndSide = isEndSide$1;
- // Destroy existing animation
- if (this.animation) {
- this.animation.destroy();
- this.animation = undefined;
- }
- // Create new animation
- const animation = (this.animation = await menuController._createAnimation(this.type, this));
- if (!config.getBoolean('animated', true)) {
- animation.duration(0);
- }
- animation.fill('both');
- }
- async startAnimation(shouldOpen, animated) {
- const isReversed = !shouldOpen;
- const mode = getIonMode$1(this);
- const easing = mode === 'ios' ? iosEasing : mdEasing;
- const easingReverse = mode === 'ios' ? iosEasingReverse : mdEasingReverse;
- const ani = this.animation
- .direction(isReversed ? 'reverse' : 'normal')
- .easing(isReversed ? easingReverse : easing);
- if (animated) {
- await ani.play();
- }
- else {
- ani.play({ sync: true });
- }
- /**
- * We run this after the play invocation
- * instead of using ani.onFinish so that
- * multiple onFinish callbacks do not get
- * run if an animation is played, stopped,
- * and then played again.
- */
- if (ani.getDirection() === 'reverse') {
- ani.direction('normal');
- }
- }
- _isActive() {
- return !this.disabled && !this.isPaneVisible;
- }
- canSwipe() {
- return this.swipeGesture && !this.isAnimating && this._isActive();
- }
- canStart(detail) {
- // Do not allow swipe gesture if a modal is open
- const isModalPresented = !!document.querySelector('ion-modal.show-modal');
- if (isModalPresented || !this.canSwipe()) {
- return false;
- }
- if (this._isOpen) {
- return true;
- }
- else if (menuController._getOpenSync()) {
- return false;
- }
- return checkEdgeSide(window, detail.currentX, this.isEndSide, this.maxEdgeStart);
- }
- onWillStart() {
- this.beforeAnimation(!this._isOpen, GESTURE);
- return this.loadAnimation();
- }
- onStart() {
- if (!this.isAnimating || !this.animation) {
- assert(false, 'isAnimating has to be true');
- return;
- }
- // the cloned animation should not use an easing curve during seek
- this.animation.progressStart(true, this._isOpen ? 1 : 0);
- }
- onMove(detail) {
- if (!this.isAnimating || !this.animation) {
- assert(false, 'isAnimating has to be true');
- return;
- }
- const delta = computeDelta(detail.deltaX, this._isOpen, this.isEndSide);
- const stepValue = delta / this.width;
- this.animation.progressStep(this._isOpen ? 1 - stepValue : stepValue);
- }
- onEnd(detail) {
- if (!this.isAnimating || !this.animation) {
- assert(false, 'isAnimating has to be true');
- return;
- }
- const isOpen = this._isOpen;
- const isEndSide = this.isEndSide;
- const delta = computeDelta(detail.deltaX, isOpen, isEndSide);
- const width = this.width;
- const stepValue = delta / width;
- const velocity = detail.velocityX;
- const z = width / 2.0;
- const shouldCompleteRight = velocity >= 0 && (velocity > 0.2 || detail.deltaX > z);
- const shouldCompleteLeft = velocity <= 0 && (velocity < -0.2 || detail.deltaX < -z);
- const shouldComplete = isOpen
- ? isEndSide
- ? shouldCompleteRight
- : shouldCompleteLeft
- : isEndSide
- ? shouldCompleteLeft
- : shouldCompleteRight;
- let shouldOpen = !isOpen && shouldComplete;
- if (isOpen && !shouldComplete) {
- shouldOpen = true;
- }
- this.lastOnEnd = detail.currentTime;
- // Account for rounding errors in JS
- let newStepValue = shouldComplete ? 0.001 : -0.001;
- /**
- * stepValue can sometimes return a negative
- * value, but you can't have a negative time value
- * for the cubic bezier curve (at least with web animations)
- */
- const adjustedStepValue = stepValue < 0 ? 0.01 : stepValue;
- /**
- * Animation will be reversed here, so need to
- * reverse the easing curve as well
- *
- * Additionally, we need to account for the time relative
- * to the new easing curve, as `stepValue` is going to be given
- * in terms of a linear curve.
- */
- newStepValue +=
- getTimeGivenProgression([0, 0], [0.4, 0], [0.6, 1], [1, 1], clamp(0, adjustedStepValue, 0.9999))[0] || 0;
- const playTo = this._isOpen ? !shouldComplete : shouldComplete;
- this.animation
- .easing('cubic-bezier(0.4, 0.0, 0.6, 1)')
- .onFinish(() => this.afterAnimation(shouldOpen, GESTURE), { oneTimeCallback: true })
- .progressEnd(playTo ? 1 : 0, this._isOpen ? 1 - newStepValue : newStepValue, 300);
- }
- beforeAnimation(shouldOpen, role) {
- assert(!this.isAnimating, '_before() should not be called while animating');
- /**
- * When the menu is presented on an Android device, TalkBack's focus rings
- * may appear in the wrong position due to the transition (specifically
- * `transform` styles). This occurs because the focus rings are initially
- * displayed at the starting position of the elements before the transition
- * begins. This workaround ensures the focus rings do not appear in the
- * incorrect location.
- *
- * If this solution is applied to iOS devices, then it leads to a bug where
- * the overlays cannot be accessed by screen readers. This is due to
- * VoiceOver not being able to update the accessibility tree when the
- * `aria-hidden` is removed.
- */
- if (isPlatform('android')) {
- this.el.setAttribute('aria-hidden', 'true');
- }
- // this places the menu into the correct location before it animates in
- // this css class doesn't actually kick off any animations
- this.el.classList.add(SHOW_MENU);
- /**
- * We add a tabindex here so that focus trapping
- * still works even if the menu does not have
- * any focusable elements slotted inside. The
- * focus trapping utility will fallback to focusing
- * the menu so focus does not leave when the menu
- * is open.
- */
- this.el.setAttribute('tabindex', '0');
- if (this.backdropEl) {
- this.backdropEl.classList.add(SHOW_BACKDROP);
- }
- // add css class and hide content behind menu from screen readers
- if (this.contentEl) {
- this.contentEl.classList.add(MENU_CONTENT_OPEN);
- /**
- * When the menu is open and overlaying the main
- * content, the main content should not be announced
- * by the screenreader as the menu is the main
- * focus. This is useful with screenreaders that have
- * "read from top" gestures that read the entire
- * page from top to bottom when activated.
- * This should be done before the animation starts
- * so that users cannot accidentally scroll
- * the content while dragging a menu open.
- */
- this.contentEl.setAttribute('aria-hidden', 'true');
- }
- this.blocker.block();
- this.isAnimating = true;
- if (shouldOpen) {
- this.ionWillOpen.emit();
- }
- else {
- this.ionWillClose.emit({ role });
- }
- }
- afterAnimation(isOpen, role) {
- var _a;
- // keep opening/closing the menu disabled for a touch more yet
- // only add listeners/css if it's enabled and isOpen
- // and only remove listeners/css if it's not open
- // emit opened/closed events
- this._isOpen = isOpen;
- this.isAnimating = false;
- if (!this._isOpen) {
- this.blocker.unblock();
- }
- if (isOpen) {
- /**
- * When the menu is presented on an Android device, TalkBack's focus rings
- * may appear in the wrong position due to the transition (specifically
- * `transform` styles). The menu is hidden from screen readers during the
- * transition to prevent this. Once the transition is complete, the menu
- * is shown again.
- */
- if (isPlatform('android')) {
- this.el.removeAttribute('aria-hidden');
- }
- // emit open event
- this.ionDidOpen.emit();
- /**
- * Move focus to the menu to prepare focus trapping, as long as
- * it isn't already focused. Use the host element instead of the
- * first descendant to avoid the scroll position jumping around.
- */
- const focusedMenu = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('ion-menu');
- if (focusedMenu !== this.el) {
- this.el.focus();
- }
- // start focus trapping
- document.addEventListener('focus', this.handleFocus, true);
- }
- else {
- this.el.removeAttribute('aria-hidden');
- // remove css classes and unhide content from screen readers
- this.el.classList.remove(SHOW_MENU);
- /**
- * Remove tabindex from the menu component
- * so that is cannot be tabbed to.
- */
- this.el.removeAttribute('tabindex');
- if (this.contentEl) {
- this.contentEl.classList.remove(MENU_CONTENT_OPEN);
- /**
- * Remove aria-hidden so screen readers
- * can announce the main content again
- * now that the menu is not the main focus.
- */
- this.contentEl.removeAttribute('aria-hidden');
- }
- if (this.backdropEl) {
- this.backdropEl.classList.remove(SHOW_BACKDROP);
- }
- if (this.animation) {
- this.animation.stop();
- }
- // emit close event
- this.ionDidClose.emit({ role });
- // undo focus trapping so multiple menus don't collide
- document.removeEventListener('focus', this.handleFocus, true);
- }
- }
- updateState() {
- const isActive = this._isActive();
- if (this.gesture) {
- this.gesture.enable(isActive && this.swipeGesture);
- }
- /**
- * If the menu is disabled but it is still open
- * then we should close the menu immediately.
- * Additionally, if the menu is in the process
- * of animating {open, close} and the menu is disabled
- * then it should still be closed immediately.
- */
- if (!isActive) {
- /**
- * It is possible to disable the menu while
- * it is mid-animation. When this happens, we
- * need to set the operationCancelled flag
- * so that this._setOpen knows to return false
- * and not run the "afterAnimation" callback.
- */
- if (this.isAnimating) {
- this.operationCancelled = true;
- }
- /**
- * If the menu is disabled then we should
- * forcibly close the menu even if it is open.
- */
- this.afterAnimation(false, GESTURE);
- }
- }
- render() {
- const { type, disabled, el, isPaneVisible, inheritedAttributes, side } = this;
- const mode = getIonMode$1(this);
- /**
- * If the Close Watcher is enabled then
- * the ionBackButton listener in the menu controller
- * will handle closing the menu when Escape is pressed.
- */
- return (hAsync(Host, { key: '0a2ba4ff5600b80b54d1b5b45124779c6aa0d2f2', onKeyDown: shouldUseCloseWatcher() ? null : this.onKeydown, role: "navigation", "aria-label": inheritedAttributes['aria-label'] || 'menu', class: {
- [mode]: true,
- [`menu-type-${type}`]: true,
- 'menu-enabled': !disabled,
- [`menu-side-${side}`]: true,
- 'menu-pane-visible': isPaneVisible,
- 'split-pane-side': hostContext('ion-split-pane', el),
- } }, hAsync("div", { key: '40a222bcde4b959abc9939c44e89ea0cf8967aba', class: "menu-inner", part: "container", ref: (el) => (this.menuInnerEl = el) }, hAsync("slot", { key: '6a7ec5583294bb314990ff4ce6f25045652c07cb' })), hAsync("ion-backdrop", { key: '95f1e87237f3cc24845d91b744f935bad6bb460d', ref: (el) => (this.backdropEl = el), class: "menu-backdrop", tappable: false, stopPropagation: false, part: "backdrop" })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "type": ["typeChanged"],
- "disabled": ["disabledChanged"],
- "side": ["sideChanged"],
- "swipeGesture": ["swipeGestureChanged"]
- }; }
- static get style() { return {
- ios: IonMenuIosStyle0,
- md: IonMenuMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-menu",
- "$members$": {
- "contentId": [513, "content-id"],
- "menuId": [513, "menu-id"],
- "type": [1025],
- "disabled": [1028],
- "side": [513],
- "swipeGesture": [4, "swipe-gesture"],
- "maxEdgeStart": [2, "max-edge-start"],
- "isPaneVisible": [32],
- "isEndSide": [32],
- "isOpen": [64],
- "isActive": [64],
- "open": [64],
- "close": [64],
- "toggle": [64],
- "setOpen": [64]
- },
- "$listeners$": [[16, "ionSplitPaneVisible", "onSplitPaneChanged"], [2, "click", "onBackdropClick"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["contentId", "content-id"], ["menuId", "menu-id"], ["side", "side"]]
- }; }
- }
- const computeDelta = (deltaX, isOpen, isEndSide) => {
- return Math.max(0, isOpen !== isEndSide ? -deltaX : deltaX);
- };
- const checkEdgeSide = (win, posX, isEndSide, maxEdgeStart) => {
- if (isEndSide) {
- return posX >= win.innerWidth - maxEdgeStart;
- }
- else {
- return posX <= maxEdgeStart;
- }
- };
- const SHOW_MENU = 'show-menu';
- const SHOW_BACKDROP = 'show-backdrop';
- const MENU_CONTENT_OPEN = 'menu-content-open';
- // Given a menu, return whether or not the menu toggle should be visible
- const updateVisibility = async (menu) => {
- const menuEl = await menuController.get(menu);
- return !!(menuEl && (await menuEl.isActive()));
- };
- const menuButtonIosCss = ":host{--background:transparent;--color-focused:currentColor;--border-radius:initial;--padding-top:0;--padding-bottom:0;color:var(--color);text-align:center;text-decoration:none;text-overflow:ellipsis;text-transform:none;white-space:nowrap;-webkit-font-kerning:none;font-kerning:none}.button-native{border-radius:var(--border-radius);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;min-height:inherit;border:0;outline:none;background:var(--background);line-height:1;cursor:pointer;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;min-height:inherit;z-index:1}ion-icon{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;pointer-events:none}:host(.menu-button-hidden){display:none}:host(.menu-button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity, 0)}}:host(.ion-color) .button-native{color:var(--ion-color-base)}:host(.in-toolbar:not(.in-toolbar-color)){color:var(--ion-toolbar-color, var(--color))}:host{--background-focused:currentColor;--background-focused-opacity:.1;--border-radius:4px;--color:var(--ion-color-primary, #0054e9);--padding-start:5px;--padding-end:5px;min-height:32px;font-size:clamp(31px, 1.9375rem, 38.13px)}:host(.ion-activated){opacity:0.4}@media (any-hover: hover){:host(:hover){opacity:0.6}}";
- var IonMenuButtonIosStyle0 = menuButtonIosCss;
- const menuButtonMdCss = ":host{--background:transparent;--color-focused:currentColor;--border-radius:initial;--padding-top:0;--padding-bottom:0;color:var(--color);text-align:center;text-decoration:none;text-overflow:ellipsis;text-transform:none;white-space:nowrap;-webkit-font-kerning:none;font-kerning:none}.button-native{border-radius:var(--border-radius);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;min-height:inherit;border:0;outline:none;background:var(--background);line-height:1;cursor:pointer;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;min-height:inherit;z-index:1}ion-icon{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;pointer-events:none}:host(.menu-button-hidden){display:none}:host(.menu-button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity, 0)}}:host(.ion-color) .button-native{color:var(--ion-color-base)}:host(.in-toolbar:not(.in-toolbar-color)){color:var(--ion-toolbar-color, var(--color))}:host{--background-focused:currentColor;--background-focused-opacity:.12;--background-hover:currentColor;--background-hover-opacity:.04;--border-radius:50%;--color:initial;--padding-start:8px;--padding-end:8px;width:3rem;height:3rem;font-size:1.5rem}:host(.ion-color.ion-focused)::after{background:var(--ion-color-base)}@media (any-hover: hover){:host(.ion-color:hover) .button-native::after{background:var(--ion-color-base)}}";
- var IonMenuButtonMdStyle0 = menuButtonMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part native - The native HTML button element that wraps all child elements.
- * @part icon - The menu button icon (uses ion-icon).
- */
- class MenuButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.inheritedAttributes = {};
- this.onClick = async () => {
- return menuController.toggle(this.menu);
- };
- this.visible = false;
- this.color = undefined;
- this.disabled = false;
- this.menu = undefined;
- this.autoHide = true;
- this.type = 'button';
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- }
- componentDidLoad() {
- this.visibilityChanged();
- }
- async visibilityChanged() {
- this.visible = await updateVisibility(this.menu);
- }
- render() {
- const { color, disabled, inheritedAttributes } = this;
- const mode = getIonMode$1(this);
- const menuIcon = config.get('menuIcon', mode === 'ios' ? menuOutline : menuSharp);
- const hidden = this.autoHide && !this.visible;
- const attrs = {
- type: this.type,
- };
- const ariaLabel = inheritedAttributes['aria-label'] || 'menu';
- return (hAsync(Host, { key: '3cde3704f28eb275f4a5ff2985bbb68c1024e79c', onClick: this.onClick, "aria-disabled": disabled ? 'true' : null, "aria-hidden": hidden ? 'true' : null, class: createColorClasses$1(color, {
- [mode]: true,
- button: true, // ion-buttons target .button
- 'menu-button-hidden': hidden,
- 'menu-button-disabled': disabled,
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- 'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
- 'ion-activatable': true,
- 'ion-focusable': true,
- }) }, hAsync("button", Object.assign({ key: 'a02a3374288bd1759b6e352ada8eab0d45c6422f' }, attrs, { disabled: disabled, class: "button-native", part: "native", "aria-label": ariaLabel }), hAsync("span", { key: 'ba699f2277a4e7b27ce5e42faeefc53d8805bb43', class: "button-inner" }, hAsync("slot", { key: '829fe6cbdeb173f50d1a670389d1565baa6273e4' }, hAsync("ion-icon", { key: 'a9a9f7b8dcffc648a8429fe0adbe766869de72fd', part: "icon", icon: menuIcon, mode: mode, lazy: false, "aria-hidden": "true" }))), mode === 'md' && hAsync("ion-ripple-effect", { key: '48deca9a771a249f2fc76eaa8b9741c8d66d8355', type: "unbounded" }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonMenuButtonIosStyle0,
- md: IonMenuButtonMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-menu-button",
- "$members$": {
- "color": [513],
- "disabled": [4],
- "menu": [1],
- "autoHide": [4, "auto-hide"],
- "type": [1],
- "visible": [32]
- },
- "$listeners$": [[16, "ionMenuChange", "visibilityChanged"], [16, "ionSplitPaneVisible", "visibilityChanged"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const menuToggleCss = ":host(.menu-toggle-hidden){display:none}";
- var IonMenuToggleStyle0 = menuToggleCss;
- /**
- * @slot - Content is placed inside the toggle to act as the click target.
- */
- class MenuToggle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.onClick = () => {
- return menuController.toggle(this.menu);
- };
- this.visible = false;
- this.menu = undefined;
- this.autoHide = true;
- }
- connectedCallback() {
- this.visibilityChanged();
- }
- async visibilityChanged() {
- this.visible = await updateVisibility(this.menu);
- }
- render() {
- const mode = getIonMode$1(this);
- const hidden = this.autoHide && !this.visible;
- return (hAsync(Host, { key: '88e88fa13ac7f10ba3acfe378bd11cda0c7e2749', onClick: this.onClick, "aria-hidden": hidden ? 'true' : null, class: {
- [mode]: true,
- 'menu-toggle-hidden': hidden,
- } }, hAsync("slot", { key: '0a14c7b63eda64702d2fd1b4bc7db4809892842d' })));
- }
- static get style() { return IonMenuToggleStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-menu-toggle",
- "$members$": {
- "menu": [1],
- "autoHide": [4, "auto-hide"],
- "visible": [32]
- },
- "$listeners$": [[16, "ionMenuChange", "visibilityChanged"], [16, "ionSplitPaneVisible", "visibilityChanged"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- var Style;
- (function (Style) {
- Style["Dark"] = "DARK";
- Style["Light"] = "LIGHT";
- Style["Default"] = "DEFAULT";
- })(Style || (Style = {}));
- const StatusBar = {
- getEngine() {
- const capacitor = getCapacitor();
- if (capacitor === null || capacitor === void 0 ? void 0 : capacitor.isPluginAvailable('StatusBar')) {
- return capacitor.Plugins.StatusBar;
- }
- return undefined;
- },
- setStyle(options) {
- const engine = this.getEngine();
- if (!engine) {
- return;
- }
- engine.setStyle(options);
- },
- getStyle: async function () {
- const engine = this.getEngine();
- if (!engine) {
- return Style.Default;
- }
- const { style } = await engine.getInfo();
- return style;
- },
- };
- const LIFECYCLE_WILL_ENTER = 'ionViewWillEnter';
- const LIFECYCLE_DID_ENTER = 'ionViewDidEnter';
- const LIFECYCLE_WILL_LEAVE = 'ionViewWillLeave';
- const LIFECYCLE_DID_LEAVE = 'ionViewDidLeave';
- const LIFECYCLE_WILL_UNLOAD = 'ionViewWillUnload';
- /**
- * Moves focus to a specified element. Note that we do not remove the tabindex
- * because that can result in an unintentional blur. Non-focusables can't be
- * focused, so the body will get focused again.
- */
- const moveFocus = (el) => {
- el.tabIndex = -1;
- el.focus();
- };
- /**
- * Elements that are hidden using `display: none` should not be focused even if
- * they are present in the DOM.
- */
- const isVisible = (el) => {
- return el.offsetParent !== null;
- };
- /**
- * The focus controller allows us to manage focus within a view so assistive
- * technologies can inform users of changes to the navigation state. Traditional
- * native apps have a way of informing assistive technology about a navigation
- * state change. Mobile browsers have this too, but only when doing a full page
- * load. In a single page app we do not do that, so we need to build this
- * integration ourselves.
- */
- const createFocusController = () => {
- const saveViewFocus = (referenceEl) => {
- const focusManagerEnabled = config.get('focusManagerPriority', false);
- /**
- * When going back to a previously visited page focus should typically be moved
- * back to the element that was last focused when the user was on this view.
- */
- if (focusManagerEnabled) {
- const activeEl = document.activeElement;
- if (activeEl !== null && (referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.contains(activeEl))) {
- activeEl.setAttribute(LAST_FOCUS, 'true');
- }
- }
- };
- const setViewFocus = (referenceEl) => {
- const focusManagerPriorities = config.get('focusManagerPriority', false);
- /**
- * If the focused element is a descendant of the referenceEl then it's possible
- * that the app developer manually moved focus, so we do not want to override that.
- * This can happen with inputs the are focused when a view transitions in.
- */
- if (Array.isArray(focusManagerPriorities) && !referenceEl.contains(document.activeElement)) {
- /**
- * When going back to a previously visited view focus should always be moved back
- * to the element that the user was last focused on when they were on this view.
- */
- const lastFocus = referenceEl.querySelector(`[${LAST_FOCUS}]`);
- if (lastFocus && isVisible(lastFocus)) {
- moveFocus(lastFocus);
- return;
- }
- for (const priority of focusManagerPriorities) {
- /**
- * For each recognized case (excluding the default case) make sure to return
- * so that the fallback focus behavior does not run.
- *
- * We intentionally query for specific roles/semantic elements so that the
- * transition manager can work with both Ionic and non-Ionic UI components.
- *
- * If new selectors are added, be sure to remove the outline ring by adding
- * new selectors to rule in core.scss.
- */
- switch (priority) {
- case 'content':
- const content = referenceEl.querySelector('main, [role="main"]');
- if (content && isVisible(content)) {
- moveFocus(content);
- return;
- }
- break;
- case 'heading':
- const headingOne = referenceEl.querySelector('h1, [role="heading"][aria-level="1"]');
- if (headingOne && isVisible(headingOne)) {
- moveFocus(headingOne);
- return;
- }
- break;
- case 'banner':
- const header = referenceEl.querySelector('header, [role="banner"]');
- if (header && isVisible(header)) {
- moveFocus(header);
- return;
- }
- break;
- default:
- printIonWarning(`Unrecognized focus manager priority value ${priority}`);
- break;
- }
- }
- /**
- * If there is nothing to focus then focus the page so focus at least moves to
- * the correct view. The browser will then determine where within the page to
- * move focus to.
- */
- moveFocus(referenceEl);
- }
- };
- return {
- saveViewFocus,
- setViewFocus,
- };
- };
- const LAST_FOCUS = 'ion-last-focus';
- const iosTransitionAnimation$1 = () => Promise.resolve().then(function () { return ios_transition; });
- const mdTransitionAnimation$1 = () => Promise.resolve().then(function () { return md_transition; });
- const focusController = createFocusController();
- // TODO(FW-2832): types
- const transition = (opts) => {
- return new Promise((resolve, reject) => {
- writeTask(() => {
- beforeTransition(opts);
- runTransition(opts).then((result) => {
- if (result.animation) {
- result.animation.destroy();
- }
- afterTransition(opts);
- resolve(result);
- }, (error) => {
- afterTransition(opts);
- reject(error);
- });
- });
- });
- };
- const beforeTransition = (opts) => {
- const enteringEl = opts.enteringEl;
- const leavingEl = opts.leavingEl;
- focusController.saveViewFocus(leavingEl);
- setZIndex(enteringEl, leavingEl, opts.direction);
- if (opts.showGoBack) {
- enteringEl.classList.add('can-go-back');
- }
- else {
- enteringEl.classList.remove('can-go-back');
- }
- setPageHidden(enteringEl, false);
- /**
- * When transitioning, the page should not
- * respond to click events. This resolves small
- * issues like users double tapping the ion-back-button.
- * These pointer events are removed in `afterTransition`.
- */
- enteringEl.style.setProperty('pointer-events', 'none');
- if (leavingEl) {
- setPageHidden(leavingEl, false);
- leavingEl.style.setProperty('pointer-events', 'none');
- }
- };
- const runTransition = async (opts) => {
- const animationBuilder = await getAnimationBuilder(opts);
- const ani = animationBuilder && Build.isBrowser ? animation(animationBuilder, opts) : noAnimation(opts); // fast path for no animation
- return ani;
- };
- const afterTransition = (opts) => {
- const enteringEl = opts.enteringEl;
- const leavingEl = opts.leavingEl;
- enteringEl.classList.remove('ion-page-invisible');
- enteringEl.style.removeProperty('pointer-events');
- if (leavingEl !== undefined) {
- leavingEl.classList.remove('ion-page-invisible');
- leavingEl.style.removeProperty('pointer-events');
- }
- focusController.setViewFocus(enteringEl);
- };
- const getAnimationBuilder = async (opts) => {
- if (!opts.leavingEl || !opts.animated || opts.duration === 0) {
- return undefined;
- }
- if (opts.animationBuilder) {
- return opts.animationBuilder;
- }
- const getAnimation = opts.mode === 'ios'
- ? (await iosTransitionAnimation$1()).iosTransitionAnimation
- : (await mdTransitionAnimation$1()).mdTransitionAnimation;
- return getAnimation;
- };
- const animation = async (animationBuilder, opts) => {
- await waitForReady(opts, true);
- const trans = animationBuilder(opts.baseEl, opts);
- fireWillEvents(opts.enteringEl, opts.leavingEl);
- const didComplete = await playTransition(trans, opts);
- if (opts.progressCallback) {
- opts.progressCallback(undefined);
- }
- if (didComplete) {
- fireDidEvents(opts.enteringEl, opts.leavingEl);
- }
- return {
- hasCompleted: didComplete,
- animation: trans,
- };
- };
- const noAnimation = async (opts) => {
- const enteringEl = opts.enteringEl;
- const leavingEl = opts.leavingEl;
- const focusManagerEnabled = config.get('focusManagerPriority', false);
- /**
- * If the focus manager is enabled then we need to wait for Ionic components to be
- * rendered otherwise the component to focus may not be focused because it is hidden.
- */
- await waitForReady(opts, focusManagerEnabled);
- fireWillEvents(enteringEl, leavingEl);
- fireDidEvents(enteringEl, leavingEl);
- return {
- hasCompleted: true,
- };
- };
- const waitForReady = async (opts, defaultDeep) => {
- const deep = opts.deepWait !== undefined ? opts.deepWait : defaultDeep;
- if (deep) {
- await Promise.all([deepReady(opts.enteringEl), deepReady(opts.leavingEl)]);
- }
- await notifyViewReady(opts.viewIsReady, opts.enteringEl);
- };
- const notifyViewReady = async (viewIsReady, enteringEl) => {
- if (viewIsReady) {
- await viewIsReady(enteringEl);
- }
- };
- const playTransition = (trans, opts) => {
- const progressCallback = opts.progressCallback;
- const promise = new Promise((resolve) => {
- trans.onFinish((currentStep) => resolve(currentStep === 1));
- });
- // cool, let's do this, start the transition
- if (progressCallback) {
- // this is a swipe to go back, just get the transition progress ready
- // kick off the swipe animation start
- trans.progressStart(true);
- progressCallback(trans);
- }
- else {
- // only the top level transition should actually start "play"
- // kick it off and let it play through
- // ******** DOM WRITE ****************
- trans.play();
- }
- // create a callback for when the animation is done
- return promise;
- };
- const fireWillEvents = (enteringEl, leavingEl) => {
- lifecycle(leavingEl, LIFECYCLE_WILL_LEAVE);
- lifecycle(enteringEl, LIFECYCLE_WILL_ENTER);
- };
- const fireDidEvents = (enteringEl, leavingEl) => {
- lifecycle(enteringEl, LIFECYCLE_DID_ENTER);
- lifecycle(leavingEl, LIFECYCLE_DID_LEAVE);
- };
- const lifecycle = (el, eventName) => {
- if (el) {
- const ev = new CustomEvent(eventName, {
- bubbles: false,
- cancelable: false,
- });
- el.dispatchEvent(ev);
- }
- };
- /**
- * Wait two request animation frame loops.
- * This allows the framework implementations enough time to mount
- * the user-defined contents. This is often needed when using inline
- * modals and popovers that accept user components. For popover,
- * the contents must be mounted for the popover to be sized correctly.
- * For modals, the contents must be mounted for iOS to run the
- * transition correctly.
- *
- * On Angular and React, a single raf is enough time, but for Vue
- * we need to wait two rafs. As a result we are using two rafs for
- * all frameworks to ensure contents are mounted.
- */
- const waitForMount = () => {
- return new Promise((resolve) => raf(() => raf(() => resolve())));
- };
- const deepReady = async (el) => {
- const element = el;
- if (element) {
- if (element.componentOnReady != null) {
- // eslint-disable-next-line custom-rules/no-component-on-ready-method
- const stencilEl = await element.componentOnReady();
- if (stencilEl != null) {
- return;
- }
- /**
- * Custom elements in Stencil will have __registerHost.
- */
- }
- else if (element.__registerHost != null) {
- /**
- * Non-lazy loaded custom elements need to wait
- * one frame for component to be loaded.
- */
- const waitForCustomElement = new Promise((resolve) => raf(resolve));
- await waitForCustomElement;
- return;
- }
- await Promise.all(Array.from(element.children).map(deepReady));
- }
- };
- const setPageHidden = (el, hidden) => {
- if (hidden) {
- el.setAttribute('aria-hidden', 'true');
- el.classList.add('ion-page-hidden');
- }
- else {
- el.hidden = false;
- el.removeAttribute('aria-hidden');
- el.classList.remove('ion-page-hidden');
- }
- };
- const setZIndex = (enteringEl, leavingEl, direction) => {
- if (enteringEl !== undefined) {
- enteringEl.style.zIndex = direction === 'back' ? '99' : '101';
- }
- if (leavingEl !== undefined) {
- leavingEl.style.zIndex = '100';
- }
- };
- const getIonPageElement = (element) => {
- if (element.classList.contains('ion-page')) {
- return element;
- }
- const ionPage = element.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs');
- if (ionPage) {
- return ionPage;
- }
- // idk, return the original element so at least something animates and we don't have a null pointer
- return element;
- };
- const KEYBOARD_DID_OPEN = 'ionKeyboardDidShow';
- /**
- * Use y = mx + b to
- * figure out the backdrop value
- * at a particular x coordinate. This
- * is useful when the backdrop does
- * not begin to fade in until after
- * the 0 breakpoint.
- */
- const getBackdropValueForSheet = (x, backdropBreakpoint) => {
- /**
- * We will use these points:
- * (backdropBreakpoint, 0)
- * (maxBreakpoint, 1)
- * We know that at the beginning breakpoint,
- * the backdrop will be hidden. We also
- * know that at the maxBreakpoint, the backdrop
- * must be fully visible. maxBreakpoint should
- * always be 1 even if the maximum value
- * of the breakpoints array is not 1 since
- * the animation runs from a progress of 0
- * to a progress of 1.
- * m = (y2 - y1) / (x2 - x1)
- *
- * This is simplified from:
- * m = (1 - 0) / (maxBreakpoint - backdropBreakpoint)
- *
- * If the backdropBreakpoint is 1, we return 0 as the
- * backdrop is completely hidden.
- *
- */
- if (backdropBreakpoint === 1) {
- return 0;
- }
- const slope = 1 / (1 - backdropBreakpoint);
- /**
- * From here, compute b which is
- * the backdrop opacity if the offset
- * is 0. If the backdrop does not
- * begin to fade in until after the
- * 0 breakpoint, this b value will be
- * negative. This is fine as we never pass
- * b directly into the animation keyframes.
- * b = y - mx
- * Use a known point: (backdropBreakpoint, 0)
- * This is simplified from:
- * b = 0 - (backdropBreakpoint * slope)
- */
- const b = -(backdropBreakpoint * slope);
- /**
- * Finally, we can now determine the
- * backdrop offset given an arbitrary
- * gesture offset.
- */
- return x * slope + b;
- };
- /**
- * The tablet/desktop card modal activates
- * when the window width is >= 768.
- * At that point, the presenting element
- * is not transformed, so we do not need to
- * adjust the status bar color.
- *
- */
- const setCardStatusBarDark = () => {
- if (!win$1 || win$1.innerWidth >= 768) {
- return;
- }
- StatusBar.setStyle({ style: Style.Dark });
- };
- const setCardStatusBarDefault = (defaultStyle = Style.Default) => {
- if (!win$1 || win$1.innerWidth >= 768) {
- return;
- }
- StatusBar.setStyle({ style: defaultStyle });
- };
- const handleCanDismiss = async (el, animation) => {
- /**
- * If canDismiss is not a function
- * then we can return early. If canDismiss is `true`,
- * then canDismissBlocksGesture is `false` as canDismiss
- * will never interrupt the gesture. As a result,
- * this code block is never reached. If canDismiss is `false`,
- * then we never dismiss.
- */
- if (typeof el.canDismiss !== 'function') {
- return;
- }
- /**
- * Run the canDismiss callback.
- * If the function returns `true`,
- * then we can proceed with dismiss.
- */
- const shouldDismiss = await el.canDismiss(undefined, GESTURE);
- if (!shouldDismiss) {
- return;
- }
- /**
- * If canDismiss resolved after the snap
- * back animation finished, we can
- * dismiss immediately.
- *
- * If canDismiss resolved before the snap
- * back animation finished, we need to
- * wait until the snap back animation is
- * done before dismissing.
- */
- if (animation.isRunning()) {
- animation.onFinish(() => {
- el.dismiss(undefined, 'handler');
- }, { oneTimeCallback: true });
- }
- else {
- el.dismiss(undefined, 'handler');
- }
- };
- /**
- * This function lets us simulate a realistic spring-like animation
- * when swiping down on the modal.
- * There are two forces that we need to use to compute the spring physics:
- *
- * 1. Stiffness, k: This is a measure of resistance applied a spring.
- * 2. Dampening, c: This value has the effect of reducing or preventing oscillation.
- *
- * Using these two values, we can calculate the Spring Force and the Dampening Force
- * to compute the total force applied to a spring.
- *
- * Spring Force: This force pulls a spring back into its equilibrium position.
- * Hooke's Law tells us that that spring force (FS) = kX.
- * k is the stiffness of a spring, and X is the displacement of the spring from its
- * equilibrium position. In this case, it is the amount by which the free end
- * of a spring was displaced (stretched/pushed) from its "relaxed" position.
- *
- * Dampening Force: This force slows down motion. Without it, a spring would oscillate forever.
- * The dampening force, FD, can be found via this formula: FD = -cv
- * where c the dampening value and v is velocity.
- *
- * Therefore, the resulting force that is exerted on the block is:
- * F = FS + FD = -kX - cv
- *
- * Newton's 2nd Law tells us that F = ma:
- * ma = -kX - cv.
- *
- * For Ionic's purposes, we can assume that m = 1:
- * a = -kX - cv
- *
- * Imagine a block attached to the end of a spring. At equilibrium
- * the block is at position x = 1.
- * Pressing on the block moves it to position x = 0;
- * So, to calculate the displacement, we need to take the
- * current position and subtract the previous position from it.
- * X = x - x0 = 0 - 1 = -1.
- *
- * For Ionic's purposes, we are only pushing on the spring modal
- * so we have a max position of 1.
- * As a result, we can expand displacement to this formula:
- * X = x - 1
- *
- * a = -k(x - 1) - cv
- *
- * We can represent the motion of something as a function of time: f(t) = x.
- * The derivative of position gives us the velocity: f'(t)
- * The derivative of the velocity gives us the acceleration: f''(t)
- *
- * We can substitute the formula above with these values:
- *
- * f"(t) = -k * (f(t) - 1) - c * f'(t)
- *
- * This is called a differential equation.
- *
- * We know that at t = 0, we are at x = 0 because the modal does not move: f(0) = 0
- * This means our velocity is also zero: f'(0) = 0.
- *
- * We can cheat a bit and plug the formula into Wolfram Alpha.
- * However, we need to pick stiffness and dampening values:
- * k = 0.57
- * c = 15
- *
- * I picked these as they are fairly close to native iOS's spring effect
- * with the modal.
- *
- * What we plug in is this: f(0) = 0; f'(0) = 0; f''(t) = -0.57(f(t) - 1) - 15f'(t)
- *
- * The result is a formula that lets us calculate the acceleration
- * for a given time t.
- * Note: This is the approximate form of the solution. Wolfram Alpha will
- * give you a complex differential equation too.
- */
- const calculateSpringStep = (t) => {
- return 0.00255275 * 2.71828 ** (-14.9619 * t) - 1.00255 * 2.71828 ** (-0.0380968 * t) + 1;
- };
- // Defaults for the card swipe animation
- const SwipeToCloseDefaults = {
- MIN_PRESENTING_SCALE: 0.915,
- };
- const createSwipeToCloseGesture = (el, animation, statusBarStyle, onDismiss) => {
- /**
- * The step value at which a card modal
- * is eligible for dismissing via gesture.
- */
- const DISMISS_THRESHOLD = 0.5;
- const height = el.offsetHeight;
- let isOpen = false;
- let canDismissBlocksGesture = false;
- let contentEl = null;
- let scrollEl = null;
- const canDismissMaxStep = 0.2;
- let initialScrollY = true;
- let lastStep = 0;
- const getScrollY = () => {
- if (contentEl && isIonContent(contentEl)) {
- return contentEl.scrollY;
- /**
- * Custom scroll containers are intended to be
- * used with virtual scrolling, so we assume
- * there is scrolling in this case.
- */
- }
- else {
- return true;
- }
- };
- const canStart = (detail) => {
- const target = detail.event.target;
- if (target === null || !target.closest) {
- return true;
- }
- /**
- * If we are swiping on the content,
- * swiping should only be possible if
- * the content is scrolled all the way
- * to the top so that we do not interfere
- * with scrolling.
- *
- * We cannot assume that the `ion-content`
- * target will remain consistent between
- * swipes. For example, when using
- * ion-nav within a card modal it is
- * possible to swipe, push a view, and then
- * swipe again. The target content will not
- * be the same between swipes.
- */
- contentEl = findClosestIonContent(target);
- if (contentEl) {
- /**
- * The card should never swipe to close
- * on the content with a refresher.
- * Note: We cannot solve this by making the
- * swipeToClose gesture have a higher priority
- * than the refresher gesture as the iOS native
- * refresh gesture uses a scroll listener in
- * addition to a gesture.
- *
- * Note: Do not use getScrollElement here
- * because we need this to be a synchronous
- * operation, and getScrollElement is
- * asynchronous.
- */
- if (isIonContent(contentEl)) {
- const root = getElementRoot(contentEl);
- scrollEl = root.querySelector('.inner-scroll');
- }
- else {
- scrollEl = contentEl;
- }
- const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
- return !hasRefresherInContent && scrollEl.scrollTop === 0;
- }
- /**
- * Card should be swipeable on all
- * parts of the modal except for the footer.
- */
- const footer = target.closest('ion-footer');
- if (footer === null) {
- return true;
- }
- return false;
- };
- const onStart = (detail) => {
- const { deltaY } = detail;
- /**
- * Get the initial scrollY value so
- * that we can correctly reset the scrollY
- * prop when the gesture ends.
- */
- initialScrollY = getScrollY();
- /**
- * If canDismiss is anything other than `true`
- * then users should be able to swipe down
- * until a threshold is hit. At that point,
- * the card modal should not proceed any further.
- * TODO (FW-937)
- * Remove undefined check
- */
- canDismissBlocksGesture = el.canDismiss !== undefined && el.canDismiss !== true;
- /**
- * If we are pulling down, then
- * it is possible we are pulling on the
- * content. We do not want scrolling to
- * happen at the same time as the gesture.
- */
- if (deltaY > 0 && contentEl) {
- disableContentScrollY(contentEl);
- }
- animation.progressStart(true, isOpen ? 1 : 0);
- };
- const onMove = (detail) => {
- const { deltaY } = detail;
- /**
- * If we are pulling down, then
- * it is possible we are pulling on the
- * content. We do not want scrolling to
- * happen at the same time as the gesture.
- */
- if (deltaY > 0 && contentEl) {
- disableContentScrollY(contentEl);
- }
- /**
- * If we are swiping on the content
- * then the swipe gesture should only
- * happen if we are pulling down.
- *
- * However, if we pull up and
- * then down such that the scroll position
- * returns to 0, we should be able to swipe
- * the card.
- */
- const step = detail.deltaY / height;
- /**
- * Check if user is swiping down and
- * if we have a canDismiss value that
- * should block the gesture from
- * proceeding,
- */
- const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
- /**
- * If we are blocking the gesture from dismissing,
- * set the max step value so that the sheet cannot be
- * completely hidden.
- */
- const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
- /**
- * If we are blocking the gesture from
- * dismissing, calculate the spring modifier value
- * this will be added to the starting breakpoint
- * value to give the gesture a spring-like feeling.
- * Note that the starting breakpoint is always 0,
- * so we omit adding 0 to the result.
- */
- const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
- const clampedStep = clamp(0.0001, processedStep, maxStep);
- animation.progressStep(clampedStep);
- /**
- * When swiping down half way, the status bar style
- * should be reset to its default value.
- *
- * We track lastStep so that we do not fire these
- * functions on every onMove, only when the user has
- * crossed a certain threshold.
- */
- if (clampedStep >= DISMISS_THRESHOLD && lastStep < DISMISS_THRESHOLD) {
- setCardStatusBarDefault(statusBarStyle);
- /**
- * However, if we swipe back up, then the
- * status bar style should be set to have light
- * text on a dark background.
- */
- }
- else if (clampedStep < DISMISS_THRESHOLD && lastStep >= DISMISS_THRESHOLD) {
- setCardStatusBarDark();
- }
- lastStep = clampedStep;
- };
- const onEnd = (detail) => {
- const velocity = detail.velocityY;
- const step = detail.deltaY / height;
- const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
- const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
- const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
- const clampedStep = clamp(0.0001, processedStep, maxStep);
- const threshold = (detail.deltaY + velocity * 1000) / height;
- /**
- * If canDismiss blocks
- * the swipe gesture, then the
- * animation can never complete until
- * canDismiss is checked.
- */
- const shouldComplete = !isAttemptingDismissWithCanDismiss && threshold >= DISMISS_THRESHOLD;
- let newStepValue = shouldComplete ? -0.001 : 0.001;
- if (!shouldComplete) {
- animation.easing('cubic-bezier(1, 0, 0.68, 0.28)');
- newStepValue += getTimeGivenProgression([0, 0], [1, 0], [0.68, 0.28], [1, 1], clampedStep)[0];
- }
- else {
- animation.easing('cubic-bezier(0.32, 0.72, 0, 1)');
- newStepValue += getTimeGivenProgression([0, 0], [0.32, 0.72], [0, 1], [1, 1], clampedStep)[0];
- }
- const duration = shouldComplete
- ? computeDuration(step * height, velocity)
- : computeDuration((1 - clampedStep) * height, velocity);
- isOpen = shouldComplete;
- gesture.enable(false);
- if (contentEl) {
- resetContentScrollY(contentEl, initialScrollY);
- }
- animation
- .onFinish(() => {
- if (!shouldComplete) {
- gesture.enable(true);
- }
- })
- .progressEnd(shouldComplete ? 1 : 0, newStepValue, duration);
- /**
- * If the canDismiss value blocked the gesture
- * from proceeding, then we should ignore whatever
- * shouldComplete is. Whether or not the modal
- * animation should complete is now determined by
- * canDismiss.
- *
- * If the user swiped >25% of the way
- * to the max step, then we should
- * check canDismiss. 25% was chosen
- * to avoid accidental swipes.
- */
- if (isAttemptingDismissWithCanDismiss && clampedStep > maxStep / 4) {
- handleCanDismiss(el, animation);
- }
- else if (shouldComplete) {
- onDismiss();
- }
- };
- const gesture = createGesture({
- el,
- gestureName: 'modalSwipeToClose',
- gesturePriority: OVERLAY_GESTURE_PRIORITY,
- direction: 'y',
- threshold: 10,
- canStart,
- onStart,
- onMove,
- onEnd,
- });
- return gesture;
- };
- const computeDuration = (remaining, velocity) => {
- return clamp(400, remaining / Math.abs(velocity * 1.1), 500);
- };
- const createSheetEnterAnimation = (opts) => {
- const { currentBreakpoint, backdropBreakpoint, expandToScroll } = opts;
- /**
- * If the backdropBreakpoint is undefined, then the backdrop
- * should always fade in. If the backdropBreakpoint came before the
- * current breakpoint, then the backdrop should be fading in.
- */
- const shouldShowBackdrop = backdropBreakpoint === undefined || backdropBreakpoint < currentBreakpoint;
- const initialBackdrop = shouldShowBackdrop ? `calc(var(--backdrop-opacity) * ${currentBreakpoint})` : '0';
- const backdropAnimation = createAnimation('backdropAnimation').fromTo('opacity', 0, initialBackdrop);
- if (shouldShowBackdrop) {
- backdropAnimation
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- }
- const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
- { offset: 0, opacity: 1, transform: 'translateY(100%)' },
- { offset: 1, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
- ]);
- /**
- * This allows the content to be scrollable at any breakpoint.
- */
- const contentAnimation = !expandToScroll
- ? createAnimation('contentAnimation').keyframes([
- { offset: 0, opacity: 1, maxHeight: `${(1 - currentBreakpoint) * 100}%` },
- { offset: 1, opacity: 1, maxHeight: `${currentBreakpoint * 100}%` },
- ])
- : undefined;
- return { wrapperAnimation, backdropAnimation, contentAnimation };
- };
- const createSheetLeaveAnimation = (opts) => {
- const { currentBreakpoint, backdropBreakpoint } = opts;
- /**
- * Backdrop does not always fade in from 0 to 1 if backdropBreakpoint
- * is defined, so we need to account for that offset by figuring out
- * what the current backdrop value should be.
- */
- const backdropValue = `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(currentBreakpoint, backdropBreakpoint)})`;
- const defaultBackdrop = [
- { offset: 0, opacity: backdropValue },
- { offset: 1, opacity: 0 },
- ];
- const customBackdrop = [
- { offset: 0, opacity: backdropValue },
- { offset: backdropBreakpoint, opacity: 0 },
- { offset: 1, opacity: 0 },
- ];
- const backdropAnimation = createAnimation('backdropAnimation').keyframes(backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop);
- const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
- { offset: 0, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
- { offset: 1, opacity: 1, transform: `translateY(100%)` },
- ]);
- return { wrapperAnimation, backdropAnimation };
- };
- const createEnterAnimation$1 = () => {
- const backdropAnimation = createAnimation()
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(100vh)', 'translateY(0vh)');
- return { backdropAnimation, wrapperAnimation, contentAnimation: undefined };
- };
- /**
- * iOS Modal Enter Animation for the Card presentation style
- */
- const iosEnterAnimation$3 = (baseEl, opts) => {
- const { presentingEl, currentBreakpoint, expandToScroll } = opts;
- const root = getElementRoot(baseEl);
- const { wrapperAnimation, backdropAnimation, contentAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation$1();
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
- wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
- // The content animation is only added if scrolling is enabled for
- // all the breakpoints.
- !expandToScroll && (contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.addElement(baseEl.querySelector('.ion-page')));
- const baseAnimation = createAnimation('entering-base')
- .addElement(baseEl)
- .easing('cubic-bezier(0.32,0.72,0,1)')
- .duration(500)
- .addAnimation([wrapperAnimation])
- .beforeAddWrite(() => {
- if (expandToScroll) {
- // Scroll can only be done when the modal is fully expanded.
- return;
- }
- /**
- * There are some browsers that causes flickering when
- * dragging the content when scroll is enabled at every
- * breakpoint. This is due to the wrapper element being
- * transformed off the screen and having a snap animation.
- *
- * A workaround is to clone the footer element and append
- * it outside of the wrapper element. This way, the footer
- * is still visible and the drag can be done without
- * flickering. The original footer is hidden until the modal
- * is dismissed. This maintains the animation of the footer
- * when the modal is dismissed.
- *
- * The workaround needs to be done before the animation starts
- * so there are no flickering issues.
- */
- const ionFooter = baseEl.querySelector('ion-footer');
- /**
- * This check is needed to prevent more than one footer
- * from being appended to the shadow root.
- * Otherwise, iOS and MD enter animations would append
- * the footer twice.
- */
- const ionFooterAlreadyAppended = baseEl.shadowRoot.querySelector('ion-footer');
- if (ionFooter && !ionFooterAlreadyAppended) {
- const footerHeight = ionFooter.clientHeight;
- const clonedFooter = ionFooter.cloneNode(true);
- baseEl.shadowRoot.appendChild(clonedFooter);
- ionFooter.style.setProperty('display', 'none');
- ionFooter.setAttribute('aria-hidden', 'true');
- // Padding is added to prevent some content from being hidden.
- const page = baseEl.querySelector('.ion-page');
- page.style.setProperty('padding-bottom', `${footerHeight}px`);
- }
- });
- if (contentAnimation) {
- baseAnimation.addAnimation(contentAnimation);
- }
- if (presentingEl) {
- const isMobile = window.innerWidth < 768;
- const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
- const presentingElRoot = getElementRoot(presentingEl);
- const presentingAnimation = createAnimation().beforeStyles({
- transform: 'translateY(0)',
- 'transform-origin': 'top center',
- overflow: 'hidden',
- });
- const bodyEl = document.body;
- if (isMobile) {
- /**
- * Fallback for browsers that does not support `max()` (ex: Firefox)
- * No need to worry about statusbar padding since engines like Gecko
- * are not used as the engine for standalone Cordova/Capacitor apps
- */
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
- const modalTransform = hasCardModal ? '-10px' : transformOffset;
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
- const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
- presentingAnimation
- .afterStyles({
- transform: finalTransform,
- })
- .beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
- .addElement(presentingEl)
- .keyframes([
- { offset: 0, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
- { offset: 1, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
- ]);
- baseAnimation.addAnimation(presentingAnimation);
- }
- else {
- baseAnimation.addAnimation(backdropAnimation);
- if (!hasCardModal) {
- wrapperAnimation.fromTo('opacity', '0', '1');
- }
- else {
- const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
- const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
- presentingAnimation
- .afterStyles({
- transform: finalTransform,
- })
- .addElement(presentingElRoot.querySelector('.modal-wrapper'))
- .keyframes([
- { offset: 0, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
- { offset: 1, filter: 'contrast(0.85)', transform: finalTransform },
- ]);
- const shadowAnimation = createAnimation()
- .afterStyles({
- transform: finalTransform,
- })
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
- .keyframes([
- { offset: 0, opacity: '1', transform: 'translateY(0) scale(1)' },
- { offset: 1, opacity: '0', transform: finalTransform },
- ]);
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
- }
- }
- }
- else {
- baseAnimation.addAnimation(backdropAnimation);
- }
- return baseAnimation;
- };
- const createLeaveAnimation$1 = () => {
- const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
- const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(0vh)', 'translateY(100vh)');
- return { backdropAnimation, wrapperAnimation };
- };
- /**
- * iOS Modal Leave Animation
- */
- const iosLeaveAnimation$3 = (baseEl, opts, duration = 500) => {
- const { presentingEl, currentBreakpoint, expandToScroll } = opts;
- const root = getElementRoot(baseEl);
- const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation$1();
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
- wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
- const baseAnimation = createAnimation('leaving-base')
- .addElement(baseEl)
- .easing('cubic-bezier(0.32,0.72,0,1)')
- .duration(duration)
- .addAnimation(wrapperAnimation)
- .beforeAddWrite(() => {
- if (expandToScroll) {
- // Scroll can only be done when the modal is fully expanded.
- return;
- }
- /**
- * If expandToScroll is disabled, we need to swap
- * the visibility to the original, so the footer
- * dismisses with the modal and doesn't stay
- * until the modal is removed from the DOM.
- */
- const ionFooter = baseEl.querySelector('ion-footer');
- if (ionFooter) {
- const clonedFooter = baseEl.shadowRoot.querySelector('ion-footer');
- ionFooter.style.removeProperty('display');
- ionFooter.removeAttribute('aria-hidden');
- clonedFooter.style.setProperty('display', 'none');
- clonedFooter.setAttribute('aria-hidden', 'true');
- const page = baseEl.querySelector('.ion-page');
- page.style.removeProperty('padding-bottom');
- }
- });
- if (presentingEl) {
- const isMobile = window.innerWidth < 768;
- const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
- const presentingElRoot = getElementRoot(presentingEl);
- const presentingAnimation = createAnimation()
- .beforeClearStyles(['transform'])
- .afterClearStyles(['transform'])
- .onFinish((currentStep) => {
- // only reset background color if this is the last card-style modal
- if (currentStep !== 1) {
- return;
- }
- presentingEl.style.setProperty('overflow', '');
- const numModals = Array.from(bodyEl.querySelectorAll('ion-modal:not(.overlay-hidden)')).filter((m) => m.presentingElement !== undefined).length;
- if (numModals <= 1) {
- bodyEl.style.setProperty('background-color', '');
- }
- });
- const bodyEl = document.body;
- if (isMobile) {
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
- const modalTransform = hasCardModal ? '-10px' : transformOffset;
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
- const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
- presentingAnimation.addElement(presentingEl).keyframes([
- { offset: 0, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
- { offset: 1, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
- ]);
- baseAnimation.addAnimation(presentingAnimation);
- }
- else {
- baseAnimation.addAnimation(backdropAnimation);
- if (!hasCardModal) {
- wrapperAnimation.fromTo('opacity', '1', '0');
- }
- else {
- const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
- const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
- presentingAnimation
- .addElement(presentingElRoot.querySelector('.modal-wrapper'))
- .afterStyles({
- transform: 'translate3d(0, 0, 0)',
- })
- .keyframes([
- { offset: 0, filter: 'contrast(0.85)', transform: finalTransform },
- { offset: 1, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
- ]);
- const shadowAnimation = createAnimation()
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
- .afterStyles({
- transform: 'translateY(0) scale(1)',
- })
- .keyframes([
- { offset: 0, opacity: '0', transform: finalTransform },
- { offset: 1, opacity: '1', transform: 'translateY(0) scale(1)' },
- ]);
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
- }
- }
- }
- else {
- baseAnimation.addAnimation(backdropAnimation);
- }
- return baseAnimation;
- };
- const createEnterAnimation = () => {
- const backdropAnimation = createAnimation()
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- const wrapperAnimation = createAnimation().keyframes([
- { offset: 0, opacity: 0.01, transform: 'translateY(40px)' },
- { offset: 1, opacity: 1, transform: `translateY(0px)` },
- ]);
- return { backdropAnimation, wrapperAnimation, contentAnimation: undefined };
- };
- /**
- * Md Modal Enter Animation
- */
- const mdEnterAnimation$2 = (baseEl, opts) => {
- const { currentBreakpoint, expandToScroll } = opts;
- const root = getElementRoot(baseEl);
- const { wrapperAnimation, backdropAnimation, contentAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation();
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
- wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
- // The content animation is only added if scrolling is enabled for
- // all the breakpoints.
- expandToScroll && (contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.addElement(baseEl.querySelector('.ion-page')));
- const baseAnimation = createAnimation()
- .addElement(baseEl)
- .easing('cubic-bezier(0.36,0.66,0.04,1)')
- .duration(280)
- .addAnimation([backdropAnimation, wrapperAnimation])
- .beforeAddWrite(() => {
- if (expandToScroll) {
- // Scroll can only be done when the modal is fully expanded.
- return;
- }
- /**
- * There are some browsers that causes flickering when
- * dragging the content when scroll is enabled at every
- * breakpoint. This is due to the wrapper element being
- * transformed off the screen and having a snap animation.
- *
- * A workaround is to clone the footer element and append
- * it outside of the wrapper element. This way, the footer
- * is still visible and the drag can be done without
- * flickering. The original footer is hidden until the modal
- * is dismissed. This maintains the animation of the footer
- * when the modal is dismissed.
- *
- * The workaround needs to be done before the animation starts
- * so there are no flickering issues.
- */
- const ionFooter = baseEl.querySelector('ion-footer');
- /**
- * This check is needed to prevent more than one footer
- * from being appended to the shadow root.
- * Otherwise, iOS and MD enter animations would append
- * the footer twice.
- */
- const ionFooterAlreadyAppended = baseEl.shadowRoot.querySelector('ion-footer');
- if (ionFooter && !ionFooterAlreadyAppended) {
- const footerHeight = ionFooter.clientHeight;
- const clonedFooter = ionFooter.cloneNode(true);
- baseEl.shadowRoot.appendChild(clonedFooter);
- ionFooter.style.setProperty('display', 'none');
- ionFooter.setAttribute('aria-hidden', 'true');
- // Padding is added to prevent some content from being hidden.
- const page = baseEl.querySelector('.ion-page');
- page.style.setProperty('padding-bottom', `${footerHeight}px`);
- }
- });
- if (contentAnimation) {
- baseAnimation.addAnimation(contentAnimation);
- }
- return baseAnimation;
- };
- const createLeaveAnimation = () => {
- const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
- const wrapperAnimation = createAnimation().keyframes([
- { offset: 0, opacity: 0.99, transform: `translateY(0px)` },
- { offset: 1, opacity: 0, transform: 'translateY(40px)' },
- ]);
- return { backdropAnimation, wrapperAnimation };
- };
- /**
- * Md Modal Leave Animation
- */
- const mdLeaveAnimation$2 = (baseEl, opts) => {
- const { currentBreakpoint, expandToScroll } = opts;
- const root = getElementRoot(baseEl);
- const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation();
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
- wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
- const baseAnimation = createAnimation()
- .easing('cubic-bezier(0.47,0,0.745,0.715)')
- .duration(200)
- .addAnimation([backdropAnimation, wrapperAnimation])
- .beforeAddWrite(() => {
- if (expandToScroll) {
- // Scroll can only be done when the modal is fully expanded.
- return;
- }
- /**
- * If expandToScroll is disabled, we need to swap
- * the visibility to the original, so the footer
- * dismisses with the modal and doesn't stay
- * until the modal is removed from the DOM.
- */
- const ionFooter = baseEl.querySelector('ion-footer');
- if (ionFooter) {
- const clonedFooter = baseEl.shadowRoot.querySelector('ion-footer');
- ionFooter.style.removeProperty('display');
- ionFooter.removeAttribute('aria-hidden');
- clonedFooter.style.setProperty('display', 'none');
- clonedFooter.setAttribute('aria-hidden', 'true');
- const page = baseEl.querySelector('.ion-page');
- page.style.removeProperty('padding-bottom');
- }
- });
- return baseAnimation;
- };
- const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], expandToScroll, getCurrentBreakpoint, onDismiss, onBreakpointChange) => {
- // Defaults for the sheet swipe animation
- const defaultBackdrop = [
- { offset: 0, opacity: 'var(--backdrop-opacity)' },
- { offset: 1, opacity: 0.01 },
- ];
- const customBackdrop = [
- { offset: 0, opacity: 'var(--backdrop-opacity)' },
- { offset: 1 - backdropBreakpoint, opacity: 0 },
- { offset: 1, opacity: 0 },
- ];
- const SheetDefaults = {
- WRAPPER_KEYFRAMES: [
- { offset: 0, transform: 'translateY(0%)' },
- { offset: 1, transform: 'translateY(100%)' },
- ],
- BACKDROP_KEYFRAMES: backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop,
- CONTENT_KEYFRAMES: [
- { offset: 0, maxHeight: '100%' },
- { offset: 1, maxHeight: '0%' },
- ],
- };
- const contentEl = baseEl.querySelector('ion-content');
- const height = wrapperEl.clientHeight;
- let currentBreakpoint = initialBreakpoint;
- let offset = 0;
- let canDismissBlocksGesture = false;
- let cachedScrollEl = null;
- const canDismissMaxStep = 0.95;
- const maxBreakpoint = breakpoints[breakpoints.length - 1];
- const minBreakpoint = breakpoints[0];
- const wrapperAnimation = animation.childAnimations.find((ani) => ani.id === 'wrapperAnimation');
- const backdropAnimation = animation.childAnimations.find((ani) => ani.id === 'backdropAnimation');
- const contentAnimation = animation.childAnimations.find((ani) => ani.id === 'contentAnimation');
- const enableBackdrop = () => {
- baseEl.style.setProperty('pointer-events', 'auto');
- backdropEl.style.setProperty('pointer-events', 'auto');
- /**
- * When the backdrop is enabled, elements such
- * as inputs should not be focusable outside
- * the sheet.
- */
- baseEl.classList.remove(FOCUS_TRAP_DISABLE_CLASS);
- };
- const disableBackdrop = () => {
- baseEl.style.setProperty('pointer-events', 'none');
- backdropEl.style.setProperty('pointer-events', 'none');
- /**
- * When the backdrop is enabled, elements such
- * as inputs should not be focusable outside
- * the sheet.
- * Adding this class disables focus trapping
- * for the sheet temporarily.
- */
- baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS);
- };
- /**
- * Toggles the visible modal footer when `expandToScroll` is disabled.
- * @param footer The footer to show.
- */
- const swapFooterVisibility = (footer) => {
- const originalFooter = baseEl.querySelector('ion-footer');
- if (!originalFooter) {
- return;
- }
- const clonedFooter = wrapperEl.nextElementSibling;
- const footerToHide = footer === 'original' ? clonedFooter : originalFooter;
- const footerToShow = footer === 'original' ? originalFooter : clonedFooter;
- footerToShow.style.removeProperty('display');
- footerToShow.removeAttribute('aria-hidden');
- const page = baseEl.querySelector('.ion-page');
- if (footer === 'original') {
- page.style.removeProperty('padding-bottom');
- }
- else {
- const pagePadding = footerToShow.clientHeight;
- page.style.setProperty('padding-bottom', `${pagePadding}px`);
- }
- footerToHide.style.setProperty('display', 'none');
- footerToHide.setAttribute('aria-hidden', 'true');
- };
- /**
- * After the entering animation completes,
- * we need to set the animation to go from
- * offset 0 to offset 1 so that users can
- * swipe in any direction. We then set the
- * animation offset to the current breakpoint
- * so there is no flickering.
- */
- if (wrapperAnimation && backdropAnimation) {
- wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
- backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
- contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
- animation.progressStart(true, 1 - currentBreakpoint);
- /**
- * If backdrop is not enabled, then content
- * behind modal should be clickable. To do this, we need
- * to remove pointer-events from ion-modal as a whole.
- * ion-backdrop and .modal-wrapper always have pointer-events: auto
- * applied, so the modal content can still be interacted with.
- */
- const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint;
- if (shouldEnableBackdrop) {
- enableBackdrop();
- }
- else {
- disableBackdrop();
- }
- }
- if (contentEl && currentBreakpoint !== maxBreakpoint && expandToScroll) {
- contentEl.scrollY = false;
- }
- const canStart = (detail) => {
- /**
- * If we are swiping on the content, swiping should only be possible if the content
- * is scrolled all the way to the top so that we do not interfere with scrolling.
- *
- * We cannot assume that the `ion-content` target will remain consistent between swipes.
- * For example, when using ion-nav within a modal it is possible to swipe, push a view,
- * and then swipe again. The target content will not be the same between swipes.
- */
- const contentEl = findClosestIonContent(detail.event.target);
- currentBreakpoint = getCurrentBreakpoint();
- /**
- * If `expandToScroll` is disabled, we should not allow the swipe gesture
- * to start if the content is not scrolled to the top.
- */
- if (!expandToScroll && contentEl) {
- const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
- return scrollEl.scrollTop === 0;
- }
- if (currentBreakpoint === 1 && contentEl) {
- /**
- * The modal should never swipe to close on the content with a refresher.
- * Note 1: We cannot solve this by making this gesture have a higher priority than
- * the refresher gesture as the iOS native refresh gesture uses a scroll listener in
- * addition to a gesture.
- *
- * Note 2: Do not use getScrollElement here because we need this to be a synchronous
- * operation, and getScrollElement is asynchronous.
- */
- const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
- const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
- return !hasRefresherInContent && scrollEl.scrollTop === 0;
- }
- return true;
- };
- const onStart = (detail) => {
- /**
- * If canDismiss is anything other than `true`
- * then users should be able to swipe down
- * until a threshold is hit. At that point,
- * the card modal should not proceed any further.
- *
- * canDismiss is never fired via gesture if there is
- * no 0 breakpoint. However, it can be fired if the user
- * presses Esc or the hardware back button.
- * TODO (FW-937)
- * Remove undefined check
- */
- canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;
- /**
- * Cache the scroll element reference when the gesture starts,
- * this allows us to avoid querying the DOM for the target in onMove,
- * which would impact performance significantly.
- */
- if (!expandToScroll) {
- const targetEl = findClosestIonContent(detail.event.target);
- cachedScrollEl =
- targetEl && isIonContent(targetEl) ? getElementRoot(targetEl).querySelector('.inner-scroll') : targetEl;
- }
- /**
- * If expandToScroll is disabled, we need to swap
- * the footer visibility to the original, so if the modal
- * is dismissed, the footer dismisses with the modal
- * and doesn't stay on the screen after the modal is gone.
- */
- if (!expandToScroll) {
- swapFooterVisibility('original');
- }
- /**
- * If we are pulling down, then it is possible we are pulling on the content.
- * We do not want scrolling to happen at the same time as the gesture.
- */
- if (detail.deltaY > 0 && contentEl) {
- contentEl.scrollY = false;
- }
- raf(() => {
- /**
- * Dismisses the open keyboard when the sheet drag gesture is started.
- * Sets the focus onto the modal element.
- */
- baseEl.focus();
- });
- animation.progressStart(true, 1 - currentBreakpoint);
- };
- const onMove = (detail) => {
- /**
- * If `expandToScroll` is disabled, and an upwards swipe gesture is done within
- * the scrollable content, we should not allow the swipe gesture to continue.
- */
- if (!expandToScroll && detail.deltaY <= 0 && cachedScrollEl) {
- return;
- }
- /**
- * If we are pulling down, then it is possible we are pulling on the content.
- * We do not want scrolling to happen at the same time as the gesture.
- * This accounts for when the user scrolls down, scrolls all the way up, and then
- * pulls down again such that the modal should start to move.
- */
- if (detail.deltaY > 0 && contentEl) {
- contentEl.scrollY = false;
- }
- /**
- * Given the change in gesture position on the Y axis,
- * compute where the offset of the animation should be
- * relative to where the user dragged.
- */
- const initialStep = 1 - currentBreakpoint;
- const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined;
- const step = initialStep + detail.deltaY / height;
- const isAttemptingDismissWithCanDismiss = secondToLastBreakpoint !== undefined && step >= secondToLastBreakpoint && canDismissBlocksGesture;
- /**
- * If we are blocking the gesture from dismissing,
- * set the max step value so that the sheet cannot be
- * completely hidden.
- */
- const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
- /**
- * If we are blocking the gesture from
- * dismissing, calculate the spring modifier value
- * this will be added to the starting breakpoint
- * value to give the gesture a spring-like feeling.
- * Note that when isAttemptingDismissWithCanDismiss is true,
- * the modifier is always added to the breakpoint that
- * appears right after the 0 breakpoint.
- *
- * Note that this modifier is essentially the progression
- * between secondToLastBreakpoint and maxStep which is
- * why we subtract secondToLastBreakpoint. This lets us get
- * the result as a value from 0 to 1.
- */
- const processedStep = isAttemptingDismissWithCanDismiss && secondToLastBreakpoint !== undefined
- ? secondToLastBreakpoint +
- calculateSpringStep((step - secondToLastBreakpoint) / (maxStep - secondToLastBreakpoint))
- : step;
- offset = clamp(0.0001, processedStep, maxStep);
- animation.progressStep(offset);
- };
- const onEnd = (detail) => {
- /**
- * If expandToScroll is disabled, we should not allow the moveSheetToBreakpoint
- * function to be called if the user is trying to swipe content upwards and the content
- * is not scrolled to the top.
- */
- if (!expandToScroll && detail.deltaY <= 0 && cachedScrollEl && cachedScrollEl.scrollTop > 0) {
- return;
- }
- /**
- * When the gesture releases, we need to determine
- * the closest breakpoint to snap to.
- */
- const velocity = detail.velocityY;
- const threshold = (detail.deltaY + velocity * 350) / height;
- const diff = currentBreakpoint - threshold;
- const closest = breakpoints.reduce((a, b) => {
- return Math.abs(b - diff) < Math.abs(a - diff) ? b : a;
- });
- moveSheetToBreakpoint({
- breakpoint: closest,
- breakpointOffset: offset,
- canDismiss: canDismissBlocksGesture,
- /**
- * The swipe is user-driven, so we should
- * always animate when the gesture ends.
- */
- animated: true,
- });
- };
- const moveSheetToBreakpoint = (options) => {
- const { breakpoint, canDismiss, breakpointOffset, animated } = options;
- /**
- * canDismiss should only prevent snapping
- * when users are trying to dismiss. If canDismiss
- * is present but the user is trying to swipe upwards,
- * we should allow that to happen,
- */
- const shouldPreventDismiss = canDismiss && breakpoint === 0;
- const snapToBreakpoint = shouldPreventDismiss ? currentBreakpoint : breakpoint;
- const shouldRemainOpen = snapToBreakpoint !== 0;
- currentBreakpoint = 0;
- /**
- * Update the animation so that it plays from
- * the last offset to the closest snap point.
- */
- if (wrapperAnimation && backdropAnimation) {
- wrapperAnimation.keyframes([
- { offset: 0, transform: `translateY(${breakpointOffset * 100}%)` },
- { offset: 1, transform: `translateY(${(1 - snapToBreakpoint) * 100}%)` },
- ]);
- backdropAnimation.keyframes([
- {
- offset: 0,
- opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(1 - breakpointOffset, backdropBreakpoint)})`,
- },
- {
- offset: 1,
- opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(snapToBreakpoint, backdropBreakpoint)})`,
- },
- ]);
- if (contentAnimation) {
- /**
- * The modal content should scroll at any breakpoint when expandToScroll
- * is disabled. In order to do this, the content needs to be completely
- * viewable so scrolling can access everything. Otherwise, the default
- * behavior would show the content off the screen and only allow
- * scrolling when the sheet is fully expanded.
- */
- contentAnimation.keyframes([
- { offset: 0, maxHeight: `${(1 - breakpointOffset) * 100}%` },
- { offset: 1, maxHeight: `${snapToBreakpoint * 100}%` },
- ]);
- }
- animation.progressStep(0);
- }
- /**
- * Gesture should remain disabled until the
- * snapping animation completes.
- */
- gesture.enable(false);
- /**
- * If expandToScroll is disabled, we need to swap
- * the footer visibility to the cloned one so the footer
- * doesn't flicker when the sheet's height is animated.
- */
- if (!expandToScroll && shouldRemainOpen) {
- swapFooterVisibility('cloned');
- }
- if (shouldPreventDismiss) {
- handleCanDismiss(baseEl, animation);
- }
- else if (!shouldRemainOpen) {
- onDismiss();
- }
- /**
- * Enables scrolling immediately if the sheet is about to fully expand
- * or if it allows scrolling at any breakpoint. Without this, there would
- * be a ~500ms delay while the modal animation completes, causing a
- * noticeable lag. Native iOS allows scrolling as soon as the gesture is
- * released, so we align with that behavior.
- */
- if (contentEl && (snapToBreakpoint === breakpoints[breakpoints.length - 1] || !expandToScroll)) {
- contentEl.scrollY = true;
- }
- return new Promise((resolve) => {
- animation
- .onFinish(() => {
- if (shouldRemainOpen) {
- /**
- * Once the snapping animation completes,
- * we need to reset the animation to go
- * from 0 to 1 so users can swipe in any direction.
- * We then set the animation offset to the current
- * breakpoint so that it starts at the snapped position.
- */
- if (wrapperAnimation && backdropAnimation) {
- raf(() => {
- wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
- backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
- contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
- animation.progressStart(true, 1 - snapToBreakpoint);
- currentBreakpoint = snapToBreakpoint;
- onBreakpointChange(currentBreakpoint);
- /**
- * Backdrop should become enabled
- * after the backdropBreakpoint value
- */
- const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint;
- if (shouldEnableBackdrop) {
- enableBackdrop();
- }
- else {
- disableBackdrop();
- }
- gesture.enable(true);
- resolve();
- });
- }
- else {
- gesture.enable(true);
- resolve();
- }
- }
- else {
- resolve();
- }
- /**
- * This must be a one time callback
- * otherwise a new callback will
- * be added every time onEnd runs.
- */
- }, { oneTimeCallback: true })
- .progressEnd(1, 0, animated ? 500 : 0);
- });
- };
- const gesture = createGesture({
- el: wrapperEl,
- gestureName: 'modalSheet',
- gesturePriority: 40,
- direction: 'y',
- threshold: 10,
- canStart,
- onStart,
- onMove,
- onEnd,
- });
- return {
- gesture,
- moveSheetToBreakpoint,
- };
- };
- const modalIosCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.4)}:host(.modal-card),:host(.modal-sheet){--border-radius:10px}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:10px}}.modal-wrapper{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0)}@media screen and (max-width: 767px){@supports (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - max(30px, var(--ion-safe-area-top)) - 10px)}}@supports not (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - 40px)}}:host(.modal-card) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}:host(.modal-card){--backdrop-opacity:0;--width:100%;-ms-flex-align:end;align-items:flex-end}:host(.modal-card) .modal-shadow{display:none}:host(.modal-card) ion-backdrop{pointer-events:none}}@media screen and (min-width: 768px){:host(.modal-card){--width:calc(100% - 120px);--height:calc(100% - (120px + var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));--max-width:720px;--max-height:1000px;--backdrop-opacity:0;--box-shadow:0px 0px 30px 10px rgba(0, 0, 0, 0.1);-webkit-transition:all 0.5s ease-in-out;transition:all 0.5s ease-in-out}:host(.modal-card) .modal-wrapper{-webkit-box-shadow:none;box-shadow:none}:host(.modal-card) .modal-shadow{-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}}:host(.modal-sheet) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer ion-toolbar:first-of-type{padding-top:6px}";
- var IonModalIosStyle0 = modalIosCss;
- const modalMdCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:2px;--box-shadow:0 28px 48px rgba(0, 0, 0, 0.4)}}.modal-wrapper{-webkit-transform:translate3d(0, 40px, 0);transform:translate3d(0, 40px, 0);opacity:0.01}";
- var IonModalMdStyle0 = modalMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - Content is placed inside of the `.modal-content` element.
- *
- * @part backdrop - The `ion-backdrop` element.
- * @part content - The wrapper element for the default slot.
- * @part handle - The handle that is displayed at the top of the sheet modal when `handle="true"`.
- */
- class Modal {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.didPresent = createEvent(this, "ionModalDidPresent", 7);
- this.willPresent = createEvent(this, "ionModalWillPresent", 7);
- this.willDismiss = createEvent(this, "ionModalWillDismiss", 7);
- this.didDismiss = createEvent(this, "ionModalDidDismiss", 7);
- this.ionBreakpointDidChange = createEvent(this, "ionBreakpointDidChange", 7);
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
- this.ionMount = createEvent(this, "ionMount", 7);
- this.lockController = createLockController();
- this.triggerController = createTriggerController();
- this.coreDelegate = CoreDelegate();
- this.isSheetModal = false;
- this.inheritedAttributes = {};
- this.inline = false;
- // Whether or not modal is being dismissed via gesture
- this.gestureAnimationDismissing = false;
- this.onHandleClick = () => {
- const { sheetTransition, handleBehavior } = this;
- if (handleBehavior !== 'cycle' || sheetTransition !== undefined) {
- /**
- * The sheet modal should not advance to the next breakpoint
- * if the handle behavior is not `cycle` or if the handle
- * is clicked while the sheet is moving to a breakpoint.
- */
- return;
- }
- this.moveToNextBreakpoint();
- };
- this.onBackdropTap = () => {
- const { sheetTransition } = this;
- if (sheetTransition !== undefined) {
- /**
- * When the handle is double clicked at the largest breakpoint,
- * it will start to move to the first breakpoint. While transitioning,
- * the backdrop will often receive the second click. We prevent the
- * backdrop from dismissing the modal while moving between breakpoints.
- */
- return;
- }
- this.dismiss(undefined, BACKDROP);
- };
- this.onLifecycle = (modalEvent) => {
- const el = this.usersElement;
- const name = LIFECYCLE_MAP$1[modalEvent.type];
- if (el && name) {
- const ev = new CustomEvent(name, {
- bubbles: false,
- cancelable: false,
- detail: modalEvent.detail,
- });
- el.dispatchEvent(ev);
- }
- };
- this.presented = false;
- this.hasController = false;
- this.overlayIndex = undefined;
- this.delegate = undefined;
- this.keyboardClose = true;
- this.enterAnimation = undefined;
- this.leaveAnimation = undefined;
- this.breakpoints = undefined;
- this.expandToScroll = true;
- this.initialBreakpoint = undefined;
- this.backdropBreakpoint = 0;
- this.handle = undefined;
- this.handleBehavior = 'none';
- this.component = undefined;
- this.componentProps = undefined;
- this.cssClass = undefined;
- this.backdropDismiss = true;
- this.showBackdrop = true;
- this.animated = true;
- this.presentingElement = undefined;
- this.htmlAttributes = undefined;
- this.isOpen = false;
- this.trigger = undefined;
- this.keepContentsMounted = false;
- this.focusTrap = true;
- this.canDismiss = true;
- }
- onIsOpenChange(newValue, oldValue) {
- if (newValue === true && oldValue === false) {
- this.present();
- }
- else if (newValue === false && oldValue === true) {
- this.dismiss();
- }
- }
- triggerChanged() {
- const { trigger, el, triggerController } = this;
- if (trigger) {
- triggerController.addClickListener(el, trigger);
- }
- }
- breakpointsChanged(breakpoints) {
- if (breakpoints !== undefined) {
- this.sortedBreakpoints = breakpoints.sort((a, b) => a - b);
- }
- }
- connectedCallback() {
- const { el } = this;
- prepareOverlay(el);
- this.triggerChanged();
- }
- disconnectedCallback() {
- this.triggerController.removeClickListener();
- }
- componentWillLoad() {
- var _a;
- const { breakpoints, initialBreakpoint, el, htmlAttributes } = this;
- const isSheetModal = (this.isSheetModal = breakpoints !== undefined && initialBreakpoint !== undefined);
- const attributesToInherit = ['aria-label', 'role'];
- this.inheritedAttributes = inheritAttributes$1(el, attributesToInherit);
- /**
- * When using a controller modal you can set attributes
- * using the htmlAttributes property. Since the above attributes
- * need to be inherited inside of the modal, we need to look
- * and see if these attributes are being set via htmlAttributes.
- *
- * We could alternatively move this to componentDidLoad to simplify the work
- * here, but we'd then need to make inheritedAttributes a State variable,
- * thus causing another render to always happen after the first render.
- */
- if (htmlAttributes !== undefined) {
- attributesToInherit.forEach((attribute) => {
- const attributeValue = htmlAttributes[attribute];
- if (attributeValue) {
- /**
- * If an attribute we need to inherit was
- * set using htmlAttributes then add it to
- * inheritedAttributes and remove it from htmlAttributes.
- * This ensures the attribute is inherited and not
- * set on the host.
- *
- * In this case, if an inherited attribute is set
- * on the host element and using htmlAttributes then
- * htmlAttributes wins, but that's not a pattern that we recommend.
- * The only time you'd need htmlAttributes is when using modalController.
- */
- this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attribute]: htmlAttributes[attribute] });
- delete htmlAttributes[attribute];
- }
- });
- }
- if (isSheetModal) {
- this.currentBreakpoint = this.initialBreakpoint;
- }
- if (breakpoints !== undefined && initialBreakpoint !== undefined && !breakpoints.includes(initialBreakpoint)) {
- printIonWarning('[ion-modal] - Your breakpoints array must include the initialBreakpoint value.');
- }
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
- setOverlayId(this.el);
- }
- }
- componentDidLoad() {
- /**
- * If modal was rendered with isOpen="true"
- * then we should open modal immediately.
- */
- if (this.isOpen === true) {
- raf(() => this.present());
- }
- this.breakpointsChanged(this.breakpoints);
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.triggerChanged();
- }
- /**
- * Determines whether or not an overlay
- * is being used inline or via a controller/JS
- * and returns the correct delegate.
- * By default, subsequent calls to getDelegate
- * will use a cached version of the delegate.
- * This is useful for calling dismiss after
- * present so that the correct delegate is given.
- */
- getDelegate(force = false) {
- if (this.workingDelegate && !force) {
- return {
- delegate: this.workingDelegate,
- inline: this.inline,
- };
- }
- /**
- * If using overlay inline
- * we potentially need to use the coreDelegate
- * so that this works in vanilla JS apps.
- * If a developer has presented this component
- * via a controller, then we can assume
- * the component is already in the
- * correct place.
- */
- const parentEl = this.el.parentNode;
- const inline = (this.inline = parentEl !== null && !this.hasController);
- const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
- return { inline, delegate };
- }
- /**
- * Determines whether or not the
- * modal is allowed to dismiss based
- * on the state of the canDismiss prop.
- */
- async checkCanDismiss(data, role) {
- const { canDismiss } = this;
- if (typeof canDismiss === 'function') {
- return canDismiss(data, role);
- }
- return canDismiss;
- }
- /**
- * Present the modal overlay after it has been created.
- */
- async present() {
- const unlock = await this.lockController.lock();
- if (this.presented) {
- unlock();
- return;
- }
- const { presentingElement, el } = this;
- /**
- * If the modal is presented multiple times (inline modals), we
- * need to reset the current breakpoint to the initial breakpoint.
- */
- this.currentBreakpoint = this.initialBreakpoint;
- const { inline, delegate } = this.getDelegate(true);
- /**
- * Emit ionMount so JS Frameworks have an opportunity
- * to add the child component to the DOM. The child
- * component will be assigned to this.usersElement below.
- */
- this.ionMount.emit();
- this.usersElement = await attachComponent(delegate, el, this.component, ['ion-page'], this.componentProps, inline);
- /**
- * When using the lazy loaded build of Stencil, we need to wait
- * for every Stencil component instance to be ready before presenting
- * otherwise there can be a flash of unstyled content. With the
- * custom elements bundle we need to wait for the JS framework
- * mount the inner contents of the overlay otherwise WebKit may
- * get the transition incorrect.
- */
- if (hasLazyBuild(el)) {
- await deepReady(this.usersElement);
- /**
- * If keepContentsMounted="true" then the
- * JS Framework has already mounted the inner
- * contents so there is no need to wait.
- * Otherwise, we need to wait for the JS
- * Framework to mount the inner contents
- * of this component.
- */
- }
- else if (!this.keepContentsMounted) {
- await waitForMount();
- }
- writeTask(() => this.el.classList.add('show-modal'));
- const hasCardModal = presentingElement !== undefined;
- /**
- * We need to change the status bar at the
- * start of the animation so that it completes
- * by the time the card animation is done.
- */
- if (hasCardModal && getIonMode$1(this) === 'ios') {
- // Cache the original status bar color before the modal is presented
- this.statusBarStyle = await StatusBar.getStyle();
- setCardStatusBarDark();
- }
- await present(this, 'modalEnter', iosEnterAnimation$3, mdEnterAnimation$2, {
- presentingEl: presentingElement,
- currentBreakpoint: this.initialBreakpoint,
- backdropBreakpoint: this.backdropBreakpoint,
- expandToScroll: this.expandToScroll,
- });
- /* tslint:disable-next-line */
- if (typeof window !== 'undefined') {
- /**
- * This needs to be setup before any
- * non-transition async work so it can be dereferenced
- * in the dismiss method. The dismiss method
- * only waits for the entering transition
- * to finish. It does not wait for all of the `present`
- * method to resolve.
- */
- this.keyboardOpenCallback = () => {
- if (this.gesture) {
- /**
- * When the native keyboard is opened and the webview
- * is resized, the gesture implementation will become unresponsive
- * and enter a free-scroll mode.
- *
- * When the keyboard is opened, we disable the gesture for
- * a single frame and re-enable once the contents have repositioned
- * from the keyboard placement.
- */
- this.gesture.enable(false);
- raf(() => {
- if (this.gesture) {
- this.gesture.enable(true);
- }
- });
- }
- };
- window.addEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
- }
- if (this.isSheetModal) {
- this.initSheetGesture();
- }
- else if (hasCardModal) {
- this.initSwipeToClose();
- }
- unlock();
- }
- initSwipeToClose() {
- var _a;
- if (getIonMode$1(this) !== 'ios') {
- return;
- }
- const { el } = this;
- // All of the elements needed for the swipe gesture
- // should be in the DOM and referenced by now, except
- // for the presenting el
- const animationBuilder = this.leaveAnimation || config.get('modalLeave', iosLeaveAnimation$3);
- const ani = (this.animation = animationBuilder(el, {
- presentingEl: this.presentingElement,
- expandToScroll: this.expandToScroll,
- }));
- const contentEl = findIonContent(el);
- if (!contentEl) {
- printIonContentErrorMsg(el);
- return;
- }
- const statusBarStyle = (_a = this.statusBarStyle) !== null && _a !== void 0 ? _a : Style.Default;
- this.gesture = createSwipeToCloseGesture(el, ani, statusBarStyle, () => {
- /**
- * While the gesture animation is finishing
- * it is possible for a user to tap the backdrop.
- * This would result in the dismiss animation
- * being played again. Typically this is avoided
- * by setting `presented = false` on the overlay
- * component; however, we cannot do that here as
- * that would prevent the element from being
- * removed from the DOM.
- */
- this.gestureAnimationDismissing = true;
- /**
- * Reset the status bar style as the dismiss animation
- * starts otherwise the status bar will be the wrong
- * color for the duration of the dismiss animation.
- * The dismiss method does this as well, but
- * in this case it's only called once the animation
- * has finished.
- */
- setCardStatusBarDefault(this.statusBarStyle);
- this.animation.onFinish(async () => {
- await this.dismiss(undefined, GESTURE);
- this.gestureAnimationDismissing = false;
- });
- });
- this.gesture.enable(true);
- }
- initSheetGesture() {
- const { wrapperEl, initialBreakpoint, backdropBreakpoint } = this;
- if (!wrapperEl || initialBreakpoint === undefined) {
- return;
- }
- const animationBuilder = this.enterAnimation || config.get('modalEnter', iosEnterAnimation$3);
- const ani = (this.animation = animationBuilder(this.el, {
- presentingEl: this.presentingElement,
- currentBreakpoint: initialBreakpoint,
- backdropBreakpoint,
- expandToScroll: this.expandToScroll,
- }));
- ani.progressStart(true, 1);
- const { gesture, moveSheetToBreakpoint } = createSheetGesture(this.el, this.backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, ani, this.sortedBreakpoints, this.expandToScroll, () => { var _a; return (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : 0; }, () => this.sheetOnDismiss(), (breakpoint) => {
- if (this.currentBreakpoint !== breakpoint) {
- this.currentBreakpoint = breakpoint;
- this.ionBreakpointDidChange.emit({ breakpoint });
- }
- });
- this.gesture = gesture;
- this.moveSheetToBreakpoint = moveSheetToBreakpoint;
- this.gesture.enable(true);
- }
- sheetOnDismiss() {
- /**
- * While the gesture animation is finishing
- * it is possible for a user to tap the backdrop.
- * This would result in the dismiss animation
- * being played again. Typically this is avoided
- * by setting `presented = false` on the overlay
- * component; however, we cannot do that here as
- * that would prevent the element from being
- * removed from the DOM.
- */
- this.gestureAnimationDismissing = true;
- this.animation.onFinish(async () => {
- this.currentBreakpoint = 0;
- this.ionBreakpointDidChange.emit({ breakpoint: this.currentBreakpoint });
- await this.dismiss(undefined, GESTURE);
- this.gestureAnimationDismissing = false;
- });
- }
- /**
- * Dismiss the modal overlay after it has been presented.
- *
- * @param data Any data to emit in the dismiss events.
- * @param role The role of the element that is dismissing the modal. For example, 'cancel' or 'backdrop'.
- *
- * This is a no-op if the overlay has not been presented yet. If you want
- * to remove an overlay from the DOM that was never presented, use the
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
- */
- async dismiss(data, role) {
- var _a;
- if (this.gestureAnimationDismissing && role !== GESTURE) {
- return false;
- }
- /**
- * Because the canDismiss check below is async,
- * we need to claim a lock before the check happens,
- * in case the dismiss transition does run.
- */
- const unlock = await this.lockController.lock();
- /**
- * If a canDismiss handler is responsible
- * for calling the dismiss method, we should
- * not run the canDismiss check again.
- */
- if (role !== 'handler' && !(await this.checkCanDismiss(data, role))) {
- unlock();
- return false;
- }
- const { presentingElement } = this;
- /**
- * We need to start the status bar change
- * before the animation so that the change
- * finishes when the dismiss animation does.
- */
- const hasCardModal = presentingElement !== undefined;
- if (hasCardModal && getIonMode$1(this) === 'ios') {
- setCardStatusBarDefault(this.statusBarStyle);
- }
- /* tslint:disable-next-line */
- if (typeof window !== 'undefined' && this.keyboardOpenCallback) {
- window.removeEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
- this.keyboardOpenCallback = undefined;
- }
- const dismissed = await dismiss(this, data, role, 'modalLeave', iosLeaveAnimation$3, mdLeaveAnimation$2, {
- presentingEl: presentingElement,
- currentBreakpoint: (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : this.initialBreakpoint,
- backdropBreakpoint: this.backdropBreakpoint,
- expandToScroll: this.expandToScroll,
- });
- if (dismissed) {
- const { delegate } = this.getDelegate();
- await detachComponent(delegate, this.usersElement);
- writeTask(() => this.el.classList.remove('show-modal'));
- if (this.animation) {
- this.animation.destroy();
- }
- if (this.gesture) {
- this.gesture.destroy();
- }
- }
- this.currentBreakpoint = undefined;
- this.animation = undefined;
- unlock();
- return dismissed;
- }
- /**
- * Returns a promise that resolves when the modal did dismiss.
- */
- onDidDismiss() {
- return eventMethod(this.el, 'ionModalDidDismiss');
- }
- /**
- * Returns a promise that resolves when the modal will dismiss.
- */
- onWillDismiss() {
- return eventMethod(this.el, 'ionModalWillDismiss');
- }
- /**
- * Move a sheet style modal to a specific breakpoint. The breakpoint value must
- * be a value defined in your `breakpoints` array.
- */
- async setCurrentBreakpoint(breakpoint) {
- if (!this.isSheetModal) {
- printIonWarning('[ion-modal] - setCurrentBreakpoint is only supported on sheet modals.');
- return;
- }
- if (!this.breakpoints.includes(breakpoint)) {
- printIonWarning(`[ion-modal] - Attempted to set invalid breakpoint value ${breakpoint}. Please double check that the breakpoint value is part of your defined breakpoints.`);
- return;
- }
- const { currentBreakpoint, moveSheetToBreakpoint, canDismiss, breakpoints, animated } = this;
- if (currentBreakpoint === breakpoint) {
- return;
- }
- if (moveSheetToBreakpoint) {
- this.sheetTransition = moveSheetToBreakpoint({
- breakpoint,
- breakpointOffset: 1 - currentBreakpoint,
- canDismiss: canDismiss !== undefined && canDismiss !== true && breakpoints[0] === 0,
- animated,
- });
- await this.sheetTransition;
- this.sheetTransition = undefined;
- }
- }
- /**
- * Returns the current breakpoint of a sheet style modal
- */
- async getCurrentBreakpoint() {
- return this.currentBreakpoint;
- }
- async moveToNextBreakpoint() {
- const { breakpoints, currentBreakpoint } = this;
- if (!breakpoints || currentBreakpoint == null) {
- /**
- * If the modal does not have breakpoints and/or the current
- * breakpoint is not set, we can't move to the next breakpoint.
- */
- return false;
- }
- const allowedBreakpoints = breakpoints.filter((b) => b !== 0);
- const currentBreakpointIndex = allowedBreakpoints.indexOf(currentBreakpoint);
- const nextBreakpointIndex = (currentBreakpointIndex + 1) % allowedBreakpoints.length;
- const nextBreakpoint = allowedBreakpoints[nextBreakpointIndex];
- /**
- * Sets the current breakpoint to the next available breakpoint.
- * If the current breakpoint is the last breakpoint, we set the current
- * breakpoint to the first non-zero breakpoint to avoid dismissing the sheet.
- */
- await this.setCurrentBreakpoint(nextBreakpoint);
- return true;
- }
- render() {
- const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap, expandToScroll, } = this;
- const showHandle = handle !== false && isSheetModal;
- const mode = getIonMode$1(this);
- const isCardModal = presentingElement !== undefined && mode === 'ios';
- const isHandleCycle = handleBehavior === 'cycle';
- return (hAsync(Host, Object.assign({ key: '0991b2e4e32da511e59fb1463b47e4ac1b86d1ca', "no-router": true, tabindex: "-1" }, htmlAttributes, { style: {
- zIndex: `${20000 + this.overlayIndex}`,
- }, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, 'overlay-hidden': true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle }), hAsync("ion-backdrop", { key: 'ca9453ffe1021fb252ad9460676cfabb5633f00f', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && hAsync("div", { key: '9f8da446a7b0f3b26aec856e13f6d6d131a7e37b', class: "modal-shadow" }), hAsync("div", Object.assign({ key: '9d08bf600571849c97b58f66df40b496a358d1e1',
- /*
- role and aria-modal must be used on the
- same element. They must also be set inside the
- shadow DOM otherwise ion-button will not be highlighted
- when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
- */
- role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (hAsync("button", { key: 'f8bf0d1126e5376519101225d9965727121ee042', class: "modal-handle",
- // Prevents the handle from receiving keyboard focus when it does not cycle
- tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle" })), hAsync("slot", { key: '6d52849df98f2c6c8fbc03996a931ea6a39a512b' }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "isOpen": ["onIsOpenChange"],
- "trigger": ["triggerChanged"]
- }; }
- static get style() { return {
- ios: IonModalIosStyle0,
- md: IonModalMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-modal",
- "$members$": {
- "hasController": [4, "has-controller"],
- "overlayIndex": [2, "overlay-index"],
- "delegate": [16],
- "keyboardClose": [4, "keyboard-close"],
- "enterAnimation": [16],
- "leaveAnimation": [16],
- "breakpoints": [16],
- "expandToScroll": [4, "expand-to-scroll"],
- "initialBreakpoint": [2, "initial-breakpoint"],
- "backdropBreakpoint": [2, "backdrop-breakpoint"],
- "handle": [4],
- "handleBehavior": [1, "handle-behavior"],
- "component": [1],
- "componentProps": [16],
- "cssClass": [1, "css-class"],
- "backdropDismiss": [4, "backdrop-dismiss"],
- "showBackdrop": [4, "show-backdrop"],
- "animated": [4],
- "presentingElement": [16],
- "htmlAttributes": [16],
- "isOpen": [4, "is-open"],
- "trigger": [1],
- "keepContentsMounted": [4, "keep-contents-mounted"],
- "focusTrap": [4, "focus-trap"],
- "canDismiss": [4, "can-dismiss"],
- "presented": [32],
- "present": [64],
- "dismiss": [64],
- "onDidDismiss": [64],
- "onWillDismiss": [64],
- "setCurrentBreakpoint": [64],
- "getCurrentBreakpoint": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const LIFECYCLE_MAP$1 = {
- ionModalDidPresent: 'ionViewDidEnter',
- ionModalWillPresent: 'ionViewWillEnter',
- ionModalWillDismiss: 'ionViewWillLeave',
- ionModalDidDismiss: 'ionViewDidLeave',
- };
- const VIEW_STATE_NEW = 1;
- const VIEW_STATE_ATTACHED = 2;
- const VIEW_STATE_DESTROYED = 3;
- // TODO(FW-2832): types
- class ViewController {
- constructor(component, params) {
- this.component = component;
- this.params = params;
- this.state = VIEW_STATE_NEW;
- }
- async init(container) {
- this.state = VIEW_STATE_ATTACHED;
- if (!this.element) {
- const component = this.component;
- this.element = await attachComponent(this.delegate, container, component, ['ion-page', 'ion-page-invisible'], this.params);
- }
- }
- /**
- * DOM WRITE
- */
- _destroy() {
- assert(this.state !== VIEW_STATE_DESTROYED, 'view state must be ATTACHED');
- const element = this.element;
- if (element) {
- if (this.delegate) {
- this.delegate.removeViewFromDom(element.parentElement, element);
- }
- else {
- element.remove();
- }
- }
- this.nav = undefined;
- this.state = VIEW_STATE_DESTROYED;
- }
- }
- const matches = (view, id, params) => {
- if (!view) {
- return false;
- }
- if (view.component !== id) {
- return false;
- }
- return shallowEqualStringMap(view.params, params);
- };
- const convertToView = (page, params) => {
- if (!page) {
- return null;
- }
- if (page instanceof ViewController) {
- return page;
- }
- return new ViewController(page, params);
- };
- const convertToViews = (pages) => {
- return pages
- .map((page) => {
- if (page instanceof ViewController) {
- return page;
- }
- if ('component' in page) {
- return convertToView(page.component, page.componentProps === null ? undefined : page.componentProps);
- }
- return convertToView(page, undefined);
- })
- .filter((v) => v !== null);
- };
- const navCss = ":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:layout size style;z-index:0}";
- var IonNavStyle0 = navCss;
- class Nav {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionNavWillLoad = createEvent(this, "ionNavWillLoad", 7);
- this.ionNavWillChange = createEvent(this, "ionNavWillChange", 3);
- this.ionNavDidChange = createEvent(this, "ionNavDidChange", 3);
- this.transInstr = [];
- this.gestureOrAnimationInProgress = false;
- this.useRouter = false;
- this.isTransitioning = false;
- this.destroyed = false;
- this.views = [];
- this.didLoad = false;
- this.delegate = undefined;
- this.swipeGesture = undefined;
- this.animated = true;
- this.animation = undefined;
- this.rootParams = undefined;
- this.root = undefined;
- }
- swipeGestureChanged() {
- if (this.gesture) {
- this.gesture.enable(this.swipeGesture === true);
- }
- }
- rootChanged() {
- if (this.root === undefined) {
- return;
- }
- if (this.didLoad === false) {
- /**
- * If the component has not loaded yet, we can skip setting up the root component.
- * It will be called when `componentDidLoad` fires.
- */
- return;
- }
- if (!this.useRouter) {
- if (this.root !== undefined) {
- this.setRoot(this.root, this.rootParams);
- }
- }
- }
- componentWillLoad() {
- this.useRouter = document.querySelector('ion-router') !== null && this.el.closest('[no-router]') === null;
- if (this.swipeGesture === undefined) {
- const mode = getIonMode$1(this);
- this.swipeGesture = config.getBoolean('swipeBackEnabled', mode === 'ios');
- }
- this.ionNavWillLoad.emit();
- }
- async componentDidLoad() {
- // We want to set this flag before any watch callbacks are manually called
- this.didLoad = true;
- this.rootChanged();
- this.gesture = (await Promise.resolve().then(function () { return swipeBack; })).createSwipeBackGesture(this.el, this.canStart.bind(this), this.onStart.bind(this), this.onMove.bind(this), this.onEnd.bind(this));
- this.swipeGestureChanged();
- }
- connectedCallback() {
- this.destroyed = false;
- }
- disconnectedCallback() {
- for (const view of this.views) {
- lifecycle(view.element, LIFECYCLE_WILL_UNLOAD);
- view._destroy();
- }
- // Release swipe back gesture and transition.
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- this.transInstr.length = 0;
- this.views.length = 0;
- this.destroyed = true;
- }
- /**
- * Push a new component onto the current navigation stack. Pass any additional
- * information along as an object. This additional information is accessible
- * through NavParams.
- *
- * @param component The component to push onto the navigation stack.
- * @param componentProps Any properties of the component.
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- push(component, componentProps, opts, done) {
- return this.insert(-1, component, componentProps, opts, done);
- }
- /**
- * Inserts a component into the navigation stack at the specified index.
- * This is useful to add a component at any point in the navigation stack.
- *
- * @param insertIndex The index to insert the component at in the stack.
- * @param component The component to insert into the navigation stack.
- * @param componentProps Any properties of the component.
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- insert(insertIndex, component, componentProps, opts, done) {
- return this.insertPages(insertIndex, [{ component, componentProps }], opts, done);
- }
- /**
- * Inserts an array of components into the navigation stack at the specified index.
- * The last component in the array will become instantiated as a view, and animate
- * in to become the active view.
- *
- * @param insertIndex The index to insert the components at in the stack.
- * @param insertComponents The components to insert into the navigation stack.
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- insertPages(insertIndex, insertComponents, opts, done) {
- return this.queueTrns({
- insertStart: insertIndex,
- insertViews: insertComponents,
- opts,
- }, done);
- }
- /**
- * Pop a component off of the navigation stack. Navigates back from the current
- * component.
- *
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- pop(opts, done) {
- return this.removeIndex(-1, 1, opts, done);
- }
- /**
- * Pop to a specific index in the navigation stack.
- *
- * @param indexOrViewCtrl The index or view controller to pop to.
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- popTo(indexOrViewCtrl, opts, done) {
- const ti = {
- removeStart: -1,
- removeCount: -1,
- opts,
- };
- if (typeof indexOrViewCtrl === 'object' && indexOrViewCtrl.component) {
- ti.removeView = indexOrViewCtrl;
- ti.removeStart = 1;
- }
- else if (typeof indexOrViewCtrl === 'number') {
- ti.removeStart = indexOrViewCtrl + 1;
- }
- return this.queueTrns(ti, done);
- }
- /**
- * Navigate back to the root of the stack, no matter how far back that is.
- *
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- popToRoot(opts, done) {
- return this.removeIndex(1, -1, opts, done);
- }
- /**
- * Removes a component from the navigation stack at the specified index.
- *
- * @param startIndex The number to begin removal at.
- * @param removeCount The number of components to remove.
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- removeIndex(startIndex, removeCount = 1, opts, done) {
- return this.queueTrns({
- removeStart: startIndex,
- removeCount,
- opts,
- }, done);
- }
- /**
- * Set the root for the current navigation stack to a component.
- *
- * @param component The component to set as the root of the navigation stack.
- * @param componentProps Any properties of the component.
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- setRoot(component, componentProps, opts, done) {
- return this.setPages([{ component, componentProps }], opts, done);
- }
- /**
- * Set the views of the current navigation stack and navigate to the last view.
- * By default animations are disabled, but they can be enabled by passing options
- * to the navigation controller. Navigation parameters can also be passed to the
- * individual pages in the array.
- *
- * @param views The list of views to set as the navigation stack.
- * @param opts The navigation options.
- * @param done The transition complete function.
- */
- setPages(views, opts, done) {
- opts !== null && opts !== void 0 ? opts : (opts = {});
- // if animation wasn't set to true then default it to NOT animate
- if (opts.animated !== true) {
- opts.animated = false;
- }
- return this.queueTrns({
- insertStart: 0,
- insertViews: views,
- removeStart: 0,
- removeCount: -1,
- opts,
- }, done);
- }
- /**
- * Called by the router to update the view.
- *
- * @param id The component tag.
- * @param params The component params.
- * @param direction A direction hint.
- * @param animation an AnimationBuilder.
- *
- * @return the status.
- * @internal
- */
- setRouteId(id, params, direction, animation) {
- const active = this.getActiveSync();
- if (matches(active, id, params)) {
- return Promise.resolve({
- changed: false,
- element: active.element,
- });
- }
- let resolve;
- const promise = new Promise((r) => (resolve = r));
- let finish;
- const commonOpts = {
- updateURL: false,
- viewIsReady: (enteringEl) => {
- let mark;
- const p = new Promise((r) => (mark = r));
- resolve({
- changed: true,
- element: enteringEl,
- markVisible: async () => {
- mark();
- await finish;
- },
- });
- return p;
- },
- };
- if (direction === 'root') {
- finish = this.setRoot(id, params, commonOpts);
- }
- else {
- // Look for a view matching the target in the view stack.
- const viewController = this.views.find((v) => matches(v, id, params));
- if (viewController) {
- finish = this.popTo(viewController, Object.assign(Object.assign({}, commonOpts), { direction: 'back', animationBuilder: animation }));
- }
- else if (direction === 'forward') {
- finish = this.push(id, params, Object.assign(Object.assign({}, commonOpts), { animationBuilder: animation }));
- }
- else if (direction === 'back') {
- finish = this.setRoot(id, params, Object.assign(Object.assign({}, commonOpts), { direction: 'back', animated: true, animationBuilder: animation }));
- }
- }
- return promise;
- }
- /**
- * Called by <ion-router> to retrieve the current component.
- *
- * @internal
- */
- async getRouteId() {
- const active = this.getActiveSync();
- if (active) {
- return {
- id: active.element.tagName,
- params: active.params,
- element: active.element,
- };
- }
- return undefined;
- }
- /**
- * Get the active view.
- */
- async getActive() {
- return this.getActiveSync();
- }
- /**
- * Get the view at the specified index.
- *
- * @param index The index of the view.
- */
- async getByIndex(index) {
- return this.views[index];
- }
- /**
- * Returns `true` if the current view can go back.
- *
- * @param view The view to check.
- */
- async canGoBack(view) {
- return this.canGoBackSync(view);
- }
- /**
- * Get the previous view.
- *
- * @param view The view to get.
- */
- async getPrevious(view) {
- return this.getPreviousSync(view);
- }
- /**
- * Returns the number of views in the stack.
- */
- async getLength() {
- return Promise.resolve(this.views.length);
- }
- getActiveSync() {
- return this.views[this.views.length - 1];
- }
- canGoBackSync(view = this.getActiveSync()) {
- return !!(view && this.getPreviousSync(view));
- }
- getPreviousSync(view = this.getActiveSync()) {
- if (!view) {
- return undefined;
- }
- const views = this.views;
- const index = views.indexOf(view);
- return index > 0 ? views[index - 1] : undefined;
- }
- /**
- * Adds a navigation stack change to the queue and schedules it to run.
- *
- * @returns Whether the transition succeeds.
- */
- async queueTrns(ti, done) {
- var _a, _b;
- if (this.isTransitioning && ((_a = ti.opts) === null || _a === void 0 ? void 0 : _a.skipIfBusy)) {
- return false;
- }
- const promise = new Promise((resolve, reject) => {
- ti.resolve = resolve;
- ti.reject = reject;
- });
- ti.done = done;
- /**
- * If using router, check to see if navigation hooks
- * will allow us to perform this transition. This
- * is required in order for hooks to work with
- * the ion-back-button or swipe to go back.
- */
- if (ti.opts && ti.opts.updateURL !== false && this.useRouter) {
- const router = document.querySelector('ion-router');
- if (router) {
- const canTransition = await router.canTransition();
- if (canTransition === false) {
- return false;
- }
- if (typeof canTransition === 'string') {
- router.push(canTransition, ti.opts.direction || 'back');
- return false;
- }
- }
- }
- // Normalize empty
- if (((_b = ti.insertViews) === null || _b === void 0 ? void 0 : _b.length) === 0) {
- ti.insertViews = undefined;
- }
- // Enqueue transition instruction
- this.transInstr.push(ti);
- // if there isn't a transition already happening
- // then this will kick off this transition
- this.nextTrns();
- return promise;
- }
- success(result, ti) {
- if (this.destroyed) {
- this.fireError('nav controller was destroyed', ti);
- return;
- }
- if (ti.done) {
- ti.done(result.hasCompleted, result.requiresTransition, result.enteringView, result.leavingView, result.direction);
- }
- ti.resolve(result.hasCompleted);
- if (ti.opts.updateURL !== false && this.useRouter) {
- const router = document.querySelector('ion-router');
- if (router) {
- const direction = result.direction === 'back' ? 'back' : 'forward';
- router.navChanged(direction);
- }
- }
- }
- failed(rejectReason, ti) {
- if (this.destroyed) {
- this.fireError('nav controller was destroyed', ti);
- return;
- }
- this.transInstr.length = 0;
- this.fireError(rejectReason, ti);
- }
- fireError(rejectReason, ti) {
- if (ti.done) {
- ti.done(false, false, rejectReason);
- }
- if (ti.reject && !this.destroyed) {
- ti.reject(rejectReason);
- }
- else {
- ti.resolve(false);
- }
- }
- /**
- * Consumes the next transition in the queue.
- *
- * @returns whether the transition is executed.
- */
- nextTrns() {
- // this is the framework's bread 'n butta function
- // only one transition is allowed at any given time
- if (this.isTransitioning) {
- return false;
- }
- // there is no transition happening right now, executes the next instructions.
- const ti = this.transInstr.shift();
- if (!ti) {
- return false;
- }
- this.runTransition(ti);
- return true;
- }
- /** Executes all the transition instruction from the queue. */
- async runTransition(ti) {
- try {
- // set that this nav is actively transitioning
- this.ionNavWillChange.emit();
- this.isTransitioning = true;
- this.prepareTI(ti);
- const leavingView = this.getActiveSync();
- const enteringView = this.getEnteringView(ti, leavingView);
- if (!leavingView && !enteringView) {
- throw new Error('no views in the stack to be removed');
- }
- if (enteringView && enteringView.state === VIEW_STATE_NEW) {
- await enteringView.init(this.el);
- }
- this.postViewInit(enteringView, leavingView, ti);
- // Needs transition?
- const requiresTransition = (ti.enteringRequiresTransition || ti.leavingRequiresTransition) && enteringView !== leavingView;
- if (requiresTransition && ti.opts && leavingView) {
- const isBackDirection = ti.opts.direction === 'back';
- /**
- * If heading back, use the entering page's animation
- * unless otherwise specified by the developer.
- */
- if (isBackDirection) {
- ti.opts.animationBuilder = ti.opts.animationBuilder || (enteringView === null || enteringView === void 0 ? void 0 : enteringView.animationBuilder);
- }
- leavingView.animationBuilder = ti.opts.animationBuilder;
- }
- let result;
- if (requiresTransition) {
- result = await this.transition(enteringView, leavingView, ti);
- }
- else {
- // transition is not required, so we are already done!
- // they're inserting/removing the views somewhere in the middle or
- // beginning, so visually nothing needs to animate/transition
- // resolve immediately because there's no animation that's happening
- result = {
- hasCompleted: true,
- requiresTransition: false,
- };
- }
- this.success(result, ti);
- this.ionNavDidChange.emit();
- }
- catch (rejectReason) {
- this.failed(rejectReason, ti);
- }
- this.isTransitioning = false;
- this.nextTrns();
- }
- prepareTI(ti) {
- var _a, _b;
- var _c;
- const viewsLength = this.views.length;
- (_a = ti.opts) !== null && _a !== void 0 ? _a : (ti.opts = {});
- (_b = (_c = ti.opts).delegate) !== null && _b !== void 0 ? _b : (_c.delegate = this.delegate);
- if (ti.removeView !== undefined) {
- assert(ti.removeStart !== undefined, 'removeView needs removeStart');
- assert(ti.removeCount !== undefined, 'removeView needs removeCount');
- const index = this.views.indexOf(ti.removeView);
- if (index < 0) {
- throw new Error('removeView was not found');
- }
- ti.removeStart += index;
- }
- if (ti.removeStart !== undefined) {
- if (ti.removeStart < 0) {
- ti.removeStart = viewsLength - 1;
- }
- if (ti.removeCount < 0) {
- ti.removeCount = viewsLength - ti.removeStart;
- }
- ti.leavingRequiresTransition = ti.removeCount > 0 && ti.removeStart + ti.removeCount === viewsLength;
- }
- if (ti.insertViews) {
- // allow -1 to be passed in to auto push it on the end
- // and clean up the index if it's larger then the size of the stack
- if (ti.insertStart < 0 || ti.insertStart > viewsLength) {
- ti.insertStart = viewsLength;
- }
- ti.enteringRequiresTransition = ti.insertStart === viewsLength;
- }
- const insertViews = ti.insertViews;
- if (!insertViews) {
- return;
- }
- assert(insertViews.length > 0, 'length can not be zero');
- const viewControllers = convertToViews(insertViews);
- if (viewControllers.length === 0) {
- throw new Error('invalid views to insert');
- }
- // Check all the inserted view are correct
- for (const view of viewControllers) {
- view.delegate = ti.opts.delegate;
- const nav = view.nav;
- if (nav && nav !== this) {
- throw new Error('inserted view was already inserted');
- }
- if (view.state === VIEW_STATE_DESTROYED) {
- throw new Error('inserted view was already destroyed');
- }
- }
- ti.insertViews = viewControllers;
- }
- /**
- * Returns the view that will be entered considering the transition instructions.
- *
- * @param ti The instructions.
- * @param leavingView The view being left or undefined if none.
- *
- * @returns The view that will be entered, undefined if none.
- */
- getEnteringView(ti, leavingView) {
- // The last inserted view will be entered when view are inserted.
- const insertViews = ti.insertViews;
- if (insertViews !== undefined) {
- return insertViews[insertViews.length - 1];
- }
- // When views are deleted, we will enter the last view that is not removed and not the view being left.
- const removeStart = ti.removeStart;
- if (removeStart !== undefined) {
- const views = this.views;
- const removeEnd = removeStart + ti.removeCount;
- for (let i = views.length - 1; i >= 0; i--) {
- const view = views[i];
- if ((i < removeStart || i >= removeEnd) && view !== leavingView) {
- return view;
- }
- }
- }
- return undefined;
- }
- /**
- * Adds and Removes the views from the navigation stack.
- *
- * @param enteringView The view being entered.
- * @param leavingView The view being left.
- * @param ti The instructions.
- */
- postViewInit(enteringView, leavingView, ti) {
- var _a, _b, _c;
- assert(leavingView || enteringView, 'Both leavingView and enteringView are null');
- assert(ti.resolve, 'resolve must be valid');
- assert(ti.reject, 'reject must be valid');
- // Compute the views to remove.
- const opts = ti.opts;
- const { insertViews, removeStart, removeCount } = ti;
- /** Records the view to destroy */
- let destroyQueue;
- // there are views to remove
- if (removeStart !== undefined && removeCount !== undefined) {
- assert(removeStart >= 0, 'removeStart can not be negative');
- assert(removeCount >= 0, 'removeCount can not be negative');
- destroyQueue = [];
- for (let i = removeStart; i < removeStart + removeCount; i++) {
- const view = this.views[i];
- if (view !== undefined && view !== enteringView && view !== leavingView) {
- destroyQueue.push(view);
- }
- }
- // default the direction to "back"
- (_a = opts.direction) !== null && _a !== void 0 ? _a : (opts.direction = 'back');
- }
- const finalNumViews = this.views.length + ((_b = insertViews === null || insertViews === void 0 ? void 0 : insertViews.length) !== null && _b !== void 0 ? _b : 0) - (removeCount !== null && removeCount !== void 0 ? removeCount : 0);
- assert(finalNumViews >= 0, 'final balance can not be negative');
- if (finalNumViews === 0) {
- printIonWarning(`[ion-nav] - You can't remove all the pages in the navigation stack. nav.pop() is probably called too many times.`, this, this.el);
- throw new Error('navigation stack needs at least one root page');
- }
- // At this point the transition can not be rejected, any throw should be an error
- // Insert the new views in the stack.
- if (insertViews) {
- // add the views to the
- let insertIndex = ti.insertStart;
- for (const view of insertViews) {
- this.insertViewAt(view, insertIndex);
- insertIndex++;
- }
- if (ti.enteringRequiresTransition) {
- // default to forward if not already set
- (_c = opts.direction) !== null && _c !== void 0 ? _c : (opts.direction = 'forward');
- }
- }
- // if the views to be removed are in the beginning or middle
- // and there is not a view that needs to visually transition out
- // then just destroy them and don't transition anything
- // batch all of lifecycles together
- // let's make sure, callbacks are zoned
- if (destroyQueue && destroyQueue.length > 0) {
- for (const view of destroyQueue) {
- lifecycle(view.element, LIFECYCLE_WILL_LEAVE);
- lifecycle(view.element, LIFECYCLE_DID_LEAVE);
- lifecycle(view.element, LIFECYCLE_WILL_UNLOAD);
- }
- // once all lifecycle events has been delivered, we can safely detroy the views
- for (const view of destroyQueue) {
- this.destroyView(view);
- }
- }
- }
- async transition(enteringView, leavingView, ti) {
- // we should animate (duration > 0) if the pushed page is not the first one (startup)
- // or if it is a portal (modal, actionsheet, etc.)
- const opts = ti.opts;
- const progressCallback = opts.progressAnimation
- ? (ani) => {
- /**
- * Because this progress callback is called asynchronously
- * it is possible for the gesture to start and end before
- * the animation is ever set. In that scenario, we should
- * immediately call progressEnd so that the transition promise
- * resolves and the gesture does not get locked up.
- */
- if (ani !== undefined && !this.gestureOrAnimationInProgress) {
- this.gestureOrAnimationInProgress = true;
- ani.onFinish(() => {
- this.gestureOrAnimationInProgress = false;
- }, { oneTimeCallback: true });
- /**
- * Playing animation to beginning
- * with a duration of 0 prevents
- * any flickering when the animation
- * is later cleaned up.
- */
- ani.progressEnd(0, 0, 0);
- }
- else {
- this.sbAni = ani;
- }
- }
- : undefined;
- const mode = getIonMode$1(this);
- const enteringEl = enteringView.element;
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- const leavingEl = leavingView && leavingView.element;
- const animationOpts = Object.assign(Object.assign({ mode, showGoBack: this.canGoBackSync(enteringView), baseEl: this.el, progressCallback, animated: this.animated && config.getBoolean('animated', true), enteringEl,
- leavingEl }, opts), { animationBuilder: opts.animationBuilder || this.animation || config.get('navAnimation') });
- const { hasCompleted } = await transition(animationOpts);
- return this.transitionFinish(hasCompleted, enteringView, leavingView, opts);
- }
- transitionFinish(hasCompleted, enteringView, leavingView, opts) {
- /**
- * If the transition did not complete, the leavingView will still be the active
- * view on the stack. Otherwise unmount all the views after the enteringView.
- */
- const activeView = hasCompleted ? enteringView : leavingView;
- if (activeView) {
- this.unmountInactiveViews(activeView);
- }
- return {
- hasCompleted,
- requiresTransition: true,
- enteringView,
- leavingView,
- direction: opts.direction,
- };
- }
- /**
- * Inserts a view at the specified index.
- *
- * When the view already is in the stack it will be moved to the new position.
- *
- * @param view The view to insert.
- * @param index The index where to insert the view.
- */
- insertViewAt(view, index) {
- const views = this.views;
- const existingIndex = views.indexOf(view);
- if (existingIndex > -1) {
- assert(view.nav === this, 'view is not part of the nav');
- // The view already in the stack, removes it.
- views.splice(existingIndex, 1);
- // and add it back at the requested index.
- views.splice(index, 0, view);
- }
- else {
- assert(!view.nav, 'nav is used');
- // this is a new view to add to the stack
- // create the new entering view
- view.nav = this;
- views.splice(index, 0, view);
- }
- }
- /**
- * Removes a view from the stack.
- *
- * @param view The view to remove.
- */
- removeView(view) {
- assert(view.state === VIEW_STATE_ATTACHED || view.state === VIEW_STATE_DESTROYED, 'view state should be loaded or destroyed');
- const views = this.views;
- const index = views.indexOf(view);
- assert(index > -1, 'view must be part of the stack');
- if (index >= 0) {
- views.splice(index, 1);
- }
- }
- destroyView(view) {
- view._destroy();
- this.removeView(view);
- }
- /**
- * Unmounts all inactive views after the specified active view.
- *
- * DOM WRITE
- *
- * @param activeView The view that is actively visible in the stack. Used to calculate which views to unmount.
- */
- unmountInactiveViews(activeView) {
- // ok, cleanup time!! Destroy all of the views that are
- // INACTIVE and come after the active view
- // only do this if the views exist, though
- if (this.destroyed) {
- return;
- }
- const views = this.views;
- const activeViewIndex = views.indexOf(activeView);
- for (let i = views.length - 1; i >= 0; i--) {
- const view = views[i];
- /**
- * When inserting multiple views via insertPages
- * the last page will be transitioned to, but the
- * others will not be. As a result, a DOM element
- * will only be created for the last page inserted.
- * As a result, it is possible to have views in the
- * stack that do not have `view.element` yet.
- */
- const element = view.element;
- if (element) {
- if (i > activeViewIndex) {
- // this view comes after the active view
- // let's unload it
- lifecycle(element, LIFECYCLE_WILL_UNLOAD);
- this.destroyView(view);
- }
- else if (i < activeViewIndex) {
- // this view comes before the active view
- // and it is not a portal then ensure it is hidden
- setPageHidden(element, true);
- }
- }
- }
- }
- canStart() {
- return (!this.gestureOrAnimationInProgress &&
- !!this.swipeGesture &&
- !this.isTransitioning &&
- this.transInstr.length === 0 &&
- this.canGoBackSync());
- }
- onStart() {
- this.gestureOrAnimationInProgress = true;
- this.pop({ direction: 'back', progressAnimation: true });
- }
- onMove(stepValue) {
- if (this.sbAni) {
- this.sbAni.progressStep(stepValue);
- }
- }
- onEnd(shouldComplete, stepValue, dur) {
- if (this.sbAni) {
- this.sbAni.onFinish(() => {
- this.gestureOrAnimationInProgress = false;
- }, { oneTimeCallback: true });
- // Account for rounding errors in JS
- let newStepValue = shouldComplete ? -0.001 : 0.001;
- /**
- * Animation will be reversed here, so need to
- * reverse the easing curve as well
- *
- * Additionally, we need to account for the time relative
- * to the new easing curve, as `stepValue` is going to be given
- * in terms of a linear curve.
- */
- if (!shouldComplete) {
- this.sbAni.easing('cubic-bezier(1, 0, 0.68, 0.28)');
- newStepValue += getTimeGivenProgression([0, 0], [1, 0], [0.68, 0.28], [1, 1], stepValue)[0];
- }
- else {
- newStepValue += getTimeGivenProgression([0, 0], [0.32, 0.72], [0, 1], [1, 1], stepValue)[0];
- }
- this.sbAni.progressEnd(shouldComplete ? 1 : 0, newStepValue, dur);
- }
- else {
- this.gestureOrAnimationInProgress = false;
- }
- }
- render() {
- return hAsync("slot", { key: '188d0abd6c047d235380f07aac81223b757010e8' });
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "swipeGesture": ["swipeGestureChanged"],
- "root": ["rootChanged"]
- }; }
- static get style() { return IonNavStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-nav",
- "$members$": {
- "delegate": [16],
- "swipeGesture": [1028, "swipe-gesture"],
- "animated": [4],
- "animation": [16],
- "rootParams": [16],
- "root": [1],
- "push": [64],
- "insert": [64],
- "insertPages": [64],
- "pop": [64],
- "popTo": [64],
- "popToRoot": [64],
- "removeIndex": [64],
- "setRoot": [64],
- "setPages": [64],
- "setRouteId": [64],
- "getRouteId": [64],
- "getActive": [64],
- "getByIndex": [64],
- "canGoBack": [64],
- "getPrevious": [64],
- "getLength": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const navLink = (el, routerDirection, component, componentProps, routerAnimation) => {
- const nav = el.closest('ion-nav');
- if (nav) {
- if (routerDirection === 'forward') {
- if (component !== undefined) {
- return nav.push(component, componentProps, { skipIfBusy: true, animationBuilder: routerAnimation });
- }
- }
- else if (routerDirection === 'root') {
- if (component !== undefined) {
- return nav.setRoot(component, componentProps, { skipIfBusy: true, animationBuilder: routerAnimation });
- }
- }
- else if (routerDirection === 'back') {
- return nav.pop({ skipIfBusy: true, animationBuilder: routerAnimation });
- }
- }
- return Promise.resolve(false);
- };
- class NavLink {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.onClick = () => {
- return navLink(this.el, this.routerDirection, this.component, this.componentProps, this.routerAnimation);
- };
- this.component = undefined;
- this.componentProps = undefined;
- this.routerDirection = 'forward';
- this.routerAnimation = undefined;
- }
- render() {
- return hAsync(Host, { key: '9ba170d1b10e08e8a6b5e6a30d363871d455a0a9', onClick: this.onClick });
- }
- get el() { return getElement(this); }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-nav-link",
- "$members$": {
- "component": [1],
- "componentProps": [16],
- "routerDirection": [1, "router-direction"],
- "routerAnimation": [16]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const noteIosCss = ":host{color:var(--color);font-family:var(--ion-font-family, inherit);-webkit-box-sizing:border-box;box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-350, var(--ion-text-color-step-650, #a6a6a6));font-size:max(14px, 1rem)}";
- var IonNoteIosStyle0 = noteIosCss;
- const noteMdCss = ":host{color:var(--color);font-family:var(--ion-font-family, inherit);-webkit-box-sizing:border-box;box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));font-size:0.875rem}";
- var IonNoteMdStyle0 = noteMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Note {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '3c3d9b2aa805c0bc1fdc6270a2bbf4dcc1b96c5b', class: createColorClasses$1(this.color, {
- [mode]: true,
- }) }, hAsync("slot", { key: '39e34682009fcb705ecafe51825162734bdf14d3' })));
- }
- static get style() { return {
- ios: IonNoteIosStyle0,
- md: IonNoteMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-note",
- "$members$": {
- "color": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const pickerIosCss$1 = ":host{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:200px;direction:ltr;z-index:0}:host .picker-before,:host .picker-after{position:absolute;width:100%;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:1;pointer-events:none}:host .picker-before{top:0;height:83px}:host .picker-before{inset-inline-start:0}:host .picker-after{top:116px;height:84px}:host .picker-after{inset-inline-start:0}:host .picker-highlight{border-radius:var(--highlight-border-radius, 8px);left:0;right:0;top:50%;bottom:0;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;position:absolute;width:calc(100% - 16px);height:34px;-webkit-transform:translateY(-50%);transform:translateY(-50%);background:var(--highlight-background);z-index:-1}:host input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host ::slotted(ion-picker-column:first-of-type){text-align:start}:host ::slotted(ion-picker-column:last-of-type){text-align:end}:host ::slotted(ion-picker-column:only-child){text-align:center}:host .picker-before{background:-webkit-gradient(linear, left top, left bottom, color-stop(20%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1)), to(rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0.8)));background:linear-gradient(to bottom, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1) 20%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0.8) 100%)}:host .picker-after{background:-webkit-gradient(linear, left bottom, left top, color-stop(20%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1)), to(rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0.8)));background:linear-gradient(to top, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1) 20%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0.8) 100%)}:host .picker-highlight{background:var(--highlight-background, var(--ion-color-step-150, var(--ion-background-color-step-150, #eeeeef)))}";
- var IonPickerIosStyle0 = pickerIosCss$1;
- const pickerMdCss$1 = ":host{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:200px;direction:ltr;z-index:0}:host .picker-before,:host .picker-after{position:absolute;width:100%;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:1;pointer-events:none}:host .picker-before{top:0;height:83px}:host .picker-before{inset-inline-start:0}:host .picker-after{top:116px;height:84px}:host .picker-after{inset-inline-start:0}:host .picker-highlight{border-radius:var(--highlight-border-radius, 8px);left:0;right:0;top:50%;bottom:0;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;position:absolute;width:calc(100% - 16px);height:34px;-webkit-transform:translateY(-50%);transform:translateY(-50%);background:var(--highlight-background);z-index:-1}:host input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host ::slotted(ion-picker-column:first-of-type){text-align:start}:host ::slotted(ion-picker-column:last-of-type){text-align:end}:host ::slotted(ion-picker-column:only-child){text-align:center}:host .picker-before{background:-webkit-gradient(linear, left top, left bottom, color-stop(20%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1)), color-stop(90%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0)));background:linear-gradient(to bottom, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1) 20%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0) 90%)}:host .picker-after{background:-webkit-gradient(linear, left bottom, left top, color-stop(30%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1)), color-stop(90%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0)));background:linear-gradient(to top, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 1) 30%, rgba(var(--fade-background-rgb, var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255))), 0) 90%)}";
- var IonPickerMdStyle0 = pickerMdCss$1;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Picker$1 {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionInputModeChange = createEvent(this, "ionInputModeChange", 7);
- this.useInputMode = false;
- this.isInHighlightBounds = (ev) => {
- const { highlightEl } = this;
- if (!highlightEl) {
- return false;
- }
- const bbox = highlightEl.getBoundingClientRect();
- /**
- * Check to see if the user clicked
- * outside the bounds of the highlight.
- */
- const outsideX = ev.clientX < bbox.left || ev.clientX > bbox.right;
- const outsideY = ev.clientY < bbox.top || ev.clientY > bbox.bottom;
- if (outsideX || outsideY) {
- return false;
- }
- return true;
- };
- /**
- * If we are no longer focused
- * on a picker column, then we should
- * exit input mode. An exception is made
- * for the input in the picker since having
- * that focused means we are still in input mode.
- */
- this.onFocusOut = (ev) => {
- // TODO(FW-2832): type
- const { relatedTarget } = ev;
- if (!relatedTarget || (relatedTarget.tagName !== 'ION-PICKER-COLUMN' && relatedTarget !== this.inputEl)) {
- this.exitInputMode();
- }
- };
- /**
- * When picker columns receive focus
- * the parent picker needs to determine
- * whether to enter/exit input mode.
- */
- this.onFocusIn = (ev) => {
- // TODO(FW-2832): type
- const { target } = ev;
- /**
- * Due to browser differences in how/when focus
- * is dispatched on certain elements, we need to
- * make sure that this function only ever runs when
- * focusing a picker column.
- */
- if (target.tagName !== 'ION-PICKER-COLUMN') {
- return;
- }
- /**
- * If we have actionOnClick
- * then this means the user focused
- * a picker column via mouse or
- * touch (i.e. a PointerEvent). As a result,
- * we should not enter/exit input mode
- * until the click event has fired, which happens
- * after the `focusin` event.
- *
- * Otherwise, the user likely focused
- * the column using their keyboard and
- * we should enter/exit input mode automatically.
- */
- if (!this.actionOnClick) {
- const columnEl = target;
- const allowInput = columnEl.numericInput;
- if (allowInput) {
- this.enterInputMode(columnEl, false);
- }
- else {
- this.exitInputMode();
- }
- }
- };
- /**
- * On click we need to run an actionOnClick
- * function that has been set in onPointerDown
- * so that we enter/exit input mode correctly.
- */
- this.onClick = () => {
- const { actionOnClick } = this;
- if (actionOnClick) {
- actionOnClick();
- this.actionOnClick = undefined;
- }
- };
- /**
- * Clicking a column also focuses the column on
- * certain browsers, so we use onPointerDown
- * to tell the onFocusIn function that users
- * are trying to click the column rather than
- * focus the column using the keyboard. When the
- * user completes the click, the onClick function
- * runs and runs the actionOnClick callback.
- */
- this.onPointerDown = (ev) => {
- const { useInputMode, inputModeColumn, el } = this;
- if (this.isInHighlightBounds(ev)) {
- /**
- * If we were already in
- * input mode, then we should determine
- * if we tapped a particular column and
- * should switch to input mode for
- * that specific column.
- */
- if (useInputMode) {
- /**
- * If we tapped a picker column
- * then we should either switch to input
- * mode for that column or all columns.
- * Otherwise we should exit input mode
- * since we just tapped the highlight and
- * not a column.
- */
- if (ev.target.tagName === 'ION-PICKER-COLUMN') {
- /**
- * If user taps 2 different columns
- * then we should just switch to input mode
- * for the new column rather than switching to
- * input mode for all columns.
- */
- if (inputModeColumn && inputModeColumn === ev.target) {
- this.actionOnClick = () => {
- this.enterInputMode();
- };
- }
- else {
- this.actionOnClick = () => {
- this.enterInputMode(ev.target);
- };
- }
- }
- else {
- this.actionOnClick = () => {
- this.exitInputMode();
- };
- }
- /**
- * If we were not already in
- * input mode, then we should
- * enter input mode for all columns.
- */
- }
- else {
- /**
- * If there is only 1 numeric input column
- * then we should skip multi column input.
- */
- const columns = el.querySelectorAll('ion-picker-column.picker-column-numeric-input');
- const columnEl = columns.length === 1 ? ev.target : undefined;
- this.actionOnClick = () => {
- this.enterInputMode(columnEl);
- };
- }
- return;
- }
- this.actionOnClick = () => {
- this.exitInputMode();
- };
- };
- /**
- * Enters input mode to allow
- * for text entry of numeric values.
- * If on mobile, we focus a hidden input
- * field so that the on screen keyboard
- * is brought up. When tabbing using a
- * keyboard, picker columns receive an outline
- * to indicate they are focused. As a result,
- * we should not focus the hidden input as it
- * would cause the outline to go away, preventing
- * users from having any visual indication of which
- * column is focused.
- */
- this.enterInputMode = (columnEl, focusInput = true) => {
- const { inputEl, el } = this;
- if (!inputEl) {
- return;
- }
- /**
- * Only active input mode if there is at
- * least one column that accepts numeric input.
- */
- const hasInputColumn = el.querySelector('ion-picker-column.picker-column-numeric-input');
- if (!hasInputColumn) {
- return;
- }
- /**
- * If columnEl is undefined then
- * it is assumed that all numeric pickers
- * are eligible for text entry.
- * (i.e. hour and minute columns)
- */
- this.useInputMode = true;
- this.inputModeColumn = columnEl;
- /**
- * Users with a keyboard and mouse can
- * activate input mode where the input is
- * focused as well as when it is not focused,
- * so we need to make sure we clean up any
- * old listeners.
- */
- if (focusInput) {
- if (this.destroyKeypressListener) {
- this.destroyKeypressListener();
- this.destroyKeypressListener = undefined;
- }
- inputEl.focus();
- }
- else {
- // TODO FW-5900 Use keydown instead
- el.addEventListener('keypress', this.onKeyPress);
- this.destroyKeypressListener = () => {
- el.removeEventListener('keypress', this.onKeyPress);
- };
- }
- this.emitInputModeChange();
- };
- this.onKeyPress = (ev) => {
- const { inputEl } = this;
- if (!inputEl) {
- return;
- }
- const parsedValue = parseInt(ev.key, 10);
- /**
- * Only numbers should be allowed
- */
- if (!Number.isNaN(parsedValue)) {
- inputEl.value += ev.key;
- this.onInputChange();
- }
- };
- this.selectSingleColumn = () => {
- const { inputEl, inputModeColumn, singleColumnSearchTimeout } = this;
- if (!inputEl || !inputModeColumn) {
- return;
- }
- const options = Array.from(inputModeColumn.querySelectorAll('ion-picker-column-option')).filter((el) => el.disabled !== true);
- /**
- * If users pause for a bit, the search
- * value should be reset similar to how a
- * <select> behaves. So typing "34", waiting,
- * then typing "5" should select "05".
- */
- if (singleColumnSearchTimeout) {
- clearTimeout(singleColumnSearchTimeout);
- }
- this.singleColumnSearchTimeout = setTimeout(() => {
- inputEl.value = '';
- this.singleColumnSearchTimeout = undefined;
- }, 1000);
- /**
- * For values that are longer than 2 digits long
- * we should shift the value over 1 character
- * to the left. So typing "456" would result in "56".
- * TODO: If we want to support more than just
- * time entry, we should update this value to be
- * the max length of all of the picker items.
- */
- if (inputEl.value.length >= 3) {
- const startIndex = inputEl.value.length - 2;
- const newString = inputEl.value.substring(startIndex);
- inputEl.value = newString;
- this.selectSingleColumn();
- return;
- }
- /**
- * Checking the value of the input gets priority
- * first. For example, if the value of the input
- * is "1" and we entered "2", then the complete value
- * is "12" and we should select hour 12.
- *
- * Regex removes any leading zeros from values like "02",
- * but it keeps a single zero if there are only zeros in the string.
- * 0+(?=[1-9]) --> Match 1 or more zeros that are followed by 1-9
- * 0+(?=0$) --> Match 1 or more zeros that must be followed by one 0 and end.
- */
- const findItemFromCompleteValue = options.find(({ textContent }) => {
- /**
- * Keyboard entry is currently only used inside of Datetime
- * where we guarantee textContent is set.
- * If we end up exposing this feature publicly we should revisit this assumption.
- */
- const parsedText = textContent.replace(/^0+(?=[1-9])|0+(?=0$)/, '');
- return parsedText === inputEl.value;
- });
- if (findItemFromCompleteValue) {
- inputModeColumn.setValue(findItemFromCompleteValue.value);
- return;
- }
- /**
- * If we typed "56" to get minute 56, then typed "7",
- * we should select "07" as "567" is not a valid minute.
- */
- if (inputEl.value.length === 2) {
- const changedCharacter = inputEl.value.substring(inputEl.value.length - 1);
- inputEl.value = changedCharacter;
- this.selectSingleColumn();
- }
- };
- /**
- * Searches a list of column items for a particular
- * value. This is currently used for numeric values.
- * The zeroBehavior can be set to account for leading
- * or trailing zeros when looking at the item text.
- */
- this.searchColumn = (colEl, value, zeroBehavior = 'start') => {
- if (!value) {
- return false;
- }
- const behavior = zeroBehavior === 'start' ? /^0+/ : /0$/;
- value = value.replace(behavior, '');
- const option = Array.from(colEl.querySelectorAll('ion-picker-column-option')).find((el) => {
- return el.disabled !== true && el.textContent.replace(behavior, '') === value;
- });
- if (option) {
- colEl.setValue(option.value);
- }
- return !!option;
- };
- /**
- * Attempts to intelligently search the first and second
- * column as if they're number columns for the provided numbers
- * where the first two numbers are the first column
- * and the last 2 are the last column. Tries to allow for the first
- * number to be ignored for situations where typos occurred.
- */
- this.multiColumnSearch = (firstColumn, secondColumn, input) => {
- if (input.length === 0) {
- return;
- }
- const inputArray = input.split('');
- const hourValue = inputArray.slice(0, 2).join('');
- // Try to find a match for the first two digits in the first column
- const foundHour = this.searchColumn(firstColumn, hourValue);
- // If we have more than 2 digits and found a match for hours,
- // use the remaining digits for the second column (minutes)
- if (inputArray.length > 2 && foundHour) {
- const minuteValue = inputArray.slice(2, 4).join('');
- this.searchColumn(secondColumn, minuteValue);
- }
- // If we couldn't find a match for the two-digit hour, try single digit approaches
- else if (!foundHour && inputArray.length >= 1) {
- // First try the first digit as a single-digit hour
- let singleDigitHour = inputArray[0];
- let singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
- // If that didn't work, try the second digit as a single-digit hour
- // (handles case where user made a typo in the first digit, or they typed over themselves)
- if (!singleDigitFound) {
- inputArray.shift();
- singleDigitHour = inputArray[0];
- singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
- }
- // If we found a single-digit hour and have remaining digits,
- // use up to 2 of the remaining digits for the second column
- if (singleDigitFound && inputArray.length > 1) {
- const remainingDigits = inputArray.slice(1, 3).join('');
- this.searchColumn(secondColumn, remainingDigits);
- }
- }
- };
- this.selectMultiColumn = () => {
- const { inputEl, el } = this;
- if (!inputEl) {
- return;
- }
- const numericPickers = Array.from(el.querySelectorAll('ion-picker-column')).filter((col) => col.numericInput);
- const firstColumn = numericPickers[0];
- const lastColumn = numericPickers[1];
- let value = inputEl.value;
- if (value.length > 4) {
- const startIndex = inputEl.value.length - 4;
- const newString = inputEl.value.substring(startIndex);
- inputEl.value = newString;
- value = newString;
- }
- this.multiColumnSearch(firstColumn, lastColumn, value);
- };
- /**
- * Searches the value of the active column
- * to determine which value users are trying
- * to select
- */
- this.onInputChange = () => {
- const { useInputMode, inputEl, inputModeColumn } = this;
- if (!useInputMode || !inputEl) {
- return;
- }
- if (inputModeColumn) {
- this.selectSingleColumn();
- }
- else {
- this.selectMultiColumn();
- }
- };
- /**
- * Emit ionInputModeChange. Picker columns
- * listen for this event to determine whether
- * or not their column is "active" for text input.
- */
- this.emitInputModeChange = () => {
- const { useInputMode, inputModeColumn } = this;
- this.ionInputModeChange.emit({
- useInputMode,
- inputModeColumn,
- });
- };
- }
- /**
- * When the picker is interacted with
- * we need to prevent touchstart so other
- * gestures do not fire. For example,
- * scrolling on the wheel picker
- * in ion-datetime should not cause
- * a card modal to swipe to close.
- */
- preventTouchStartPropagation(ev) {
- ev.stopPropagation();
- }
- componentWillLoad() {
- getElementRoot(this.el).addEventListener('focusin', this.onFocusIn);
- getElementRoot(this.el).addEventListener('focusout', this.onFocusOut);
- }
- /**
- * @internal
- * Exits text entry mode for the picker
- * This method blurs the hidden input
- * and cause the keyboard to dismiss.
- */
- async exitInputMode() {
- const { inputEl, useInputMode } = this;
- if (!useInputMode || !inputEl) {
- return;
- }
- this.useInputMode = false;
- this.inputModeColumn = undefined;
- inputEl.blur();
- inputEl.value = '';
- if (this.destroyKeypressListener) {
- this.destroyKeypressListener();
- this.destroyKeypressListener = undefined;
- }
- this.emitInputModeChange();
- }
- render() {
- return (hAsync(Host, { key: '28f81e4ed44a633178561757c5199c2c98f94b74', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, hAsync("input", { key: 'abb3d1ad25ef63856af7804111175a4d50008bc0', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
- var _a;
- /**
- * The "Enter" key represents
- * the user submitting their time
- * selection, so we should blur the
- * input (and therefore close the keyboard)
- *
- * Updating the picker's state to no longer
- * be in input mode is handled in the onBlur
- * callback below.
- */
- if (ev.key === 'Enter') {
- (_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.blur();
- }
- }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), hAsync("div", { key: '334a5abdc02e6b127c57177f626d7e4ff5526183', class: "picker-before" }), hAsync("div", { key: 'ffd6271931129e88fc7c820e919d684899e420c5', class: "picker-after" }), hAsync("div", { key: '78d1d95fd09e04f154ea59f24a1cece72c47ed7b', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), hAsync("slot", { key: '0bd5b9f875d3c71f6cbbde2054baeb1b0a2e8cd5' })));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonPickerIosStyle0,
- md: IonPickerMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-picker",
- "$members$": {
- "exitInputMode": [64]
- },
- "$listeners$": [[1, "touchstart", "preventTouchStartPropagation"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- /**
- * iOS Picker Enter Animation
- */
- const iosEnterAnimation$2 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation
- .addElement(baseEl.querySelector('.picker-wrapper'))
- .fromTo('transform', 'translateY(100%)', 'translateY(0%)');
- return baseAnimation
- .addElement(baseEl)
- .easing('cubic-bezier(.36,.66,.04,1)')
- .duration(400)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- /**
- * iOS Picker Leave Animation
- */
- const iosLeaveAnimation$2 = (baseEl) => {
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation
- .addElement(baseEl.querySelector('ion-backdrop'))
- .fromTo('opacity', 'var(--backdrop-opacity)', 0.01);
- wrapperAnimation
- .addElement(baseEl.querySelector('.picker-wrapper'))
- .fromTo('transform', 'translateY(0%)', 'translateY(100%)');
- return baseAnimation
- .addElement(baseEl)
- .easing('cubic-bezier(.36,.66,.04,1)')
- .duration(400)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- const pickerIosCss = ".sc-ion-picker-legacy-ios-h{--border-radius:0;--border-style:solid;--min-width:auto;--width:100%;--max-width:500px;--min-height:auto;--max-height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.sc-ion-picker-legacy-ios-h{inset-inline-start:0}.overlay-hidden.sc-ion-picker-legacy-ios-h{display:none}.picker-wrapper.sc-ion-picker-legacy-ios{border-radius:var(--border-radius);left:0;right:0;bottom:0;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;overflow:hidden;z-index:10}.picker-toolbar.sc-ion-picker-legacy-ios{width:100%;background:transparent;contain:strict;z-index:1}.picker-button.sc-ion-picker-legacy-ios{border:0;font-family:inherit}.picker-button.sc-ion-picker-legacy-ios:active,.picker-button.sc-ion-picker-legacy-ios:focus{outline:none}.picker-columns.sc-ion-picker-legacy-ios{display:-ms-flexbox;display:flex;position:relative;-ms-flex-pack:center;justify-content:center;margin-bottom:var(--ion-safe-area-bottom, 0);contain:strict;overflow:hidden}.picker-above-highlight.sc-ion-picker-legacy-ios,.picker-below-highlight.sc-ion-picker-legacy-ios{display:none;pointer-events:none}.sc-ion-picker-legacy-ios-h{--background:var(--ion-background-color, #fff);--border-width:1px 0 0;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));--height:260px;--backdrop-opacity:var(--ion-backdrop-opacity, 0.26);color:var(--ion-item-color, var(--ion-text-color, #000))}.picker-toolbar.sc-ion-picker-legacy-ios{display:-ms-flexbox;display:flex;height:44px;border-bottom:0.55px solid var(--border-color)}.picker-toolbar-button.sc-ion-picker-legacy-ios{-ms-flex:1;flex:1;text-align:end}.picker-toolbar-button.sc-ion-picker-legacy-ios:last-child .picker-button.sc-ion-picker-legacy-ios{font-weight:600}.picker-toolbar-button.sc-ion-picker-legacy-ios:first-child{font-weight:normal;text-align:start}.picker-button.sc-ion-picker-legacy-ios,.picker-button.ion-activated.sc-ion-picker-legacy-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:1em;padding-inline-start:1em;-webkit-padding-end:1em;padding-inline-end:1em;padding-top:0;padding-bottom:0;height:44px;background:transparent;color:var(--ion-color-primary, #0054e9);font-size:16px}.picker-columns.sc-ion-picker-legacy-ios{height:215px;-webkit-perspective:1000px;perspective:1000px}.picker-above-highlight.sc-ion-picker-legacy-ios{top:0;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);display:block;position:absolute;width:100%;height:81px;border-bottom:1px solid var(--border-color);background:-webkit-gradient(linear, left top, left bottom, color-stop(20%, var(--background, var(--ion-background-color, #fff))), to(rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8)));background:linear-gradient(to bottom, var(--background, var(--ion-background-color, #fff)) 20%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8) 100%);z-index:10}.picker-above-highlight.sc-ion-picker-legacy-ios{inset-inline-start:0}.picker-below-highlight.sc-ion-picker-legacy-ios{top:115px;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);display:block;position:absolute;width:100%;height:119px;border-top:1px solid var(--border-color);background:-webkit-gradient(linear, left bottom, left top, color-stop(30%, var(--background, var(--ion-background-color, #fff))), to(rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8)));background:linear-gradient(to top, var(--background, var(--ion-background-color, #fff)) 30%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8) 100%);z-index:11}.picker-below-highlight.sc-ion-picker-legacy-ios{inset-inline-start:0}";
- var IonPickerLegacyIosStyle0 = pickerIosCss;
- const pickerMdCss = ".sc-ion-picker-legacy-md-h{--border-radius:0;--border-style:solid;--min-width:auto;--width:100%;--max-width:500px;--min-height:auto;--max-height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.sc-ion-picker-legacy-md-h{inset-inline-start:0}.overlay-hidden.sc-ion-picker-legacy-md-h{display:none}.picker-wrapper.sc-ion-picker-legacy-md{border-radius:var(--border-radius);left:0;right:0;bottom:0;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;overflow:hidden;z-index:10}.picker-toolbar.sc-ion-picker-legacy-md{width:100%;background:transparent;contain:strict;z-index:1}.picker-button.sc-ion-picker-legacy-md{border:0;font-family:inherit}.picker-button.sc-ion-picker-legacy-md:active,.picker-button.sc-ion-picker-legacy-md:focus{outline:none}.picker-columns.sc-ion-picker-legacy-md{display:-ms-flexbox;display:flex;position:relative;-ms-flex-pack:center;justify-content:center;margin-bottom:var(--ion-safe-area-bottom, 0);contain:strict;overflow:hidden}.picker-above-highlight.sc-ion-picker-legacy-md,.picker-below-highlight.sc-ion-picker-legacy-md{display:none;pointer-events:none}.sc-ion-picker-legacy-md-h{--background:var(--ion-background-color, #fff);--border-width:0.55px 0 0;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));--height:260px;--backdrop-opacity:var(--ion-backdrop-opacity, 0.26);color:var(--ion-item-color, var(--ion-text-color, #000))}.picker-toolbar.sc-ion-picker-legacy-md{display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;height:44px}.picker-button.sc-ion-picker-legacy-md,.picker-button.ion-activated.sc-ion-picker-legacy-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:1.1em;padding-inline-start:1.1em;-webkit-padding-end:1.1em;padding-inline-end:1.1em;padding-top:0;padding-bottom:0;height:44px;background:transparent;color:var(--ion-color-primary, #0054e9);font-size:14px;font-weight:500;text-transform:uppercase;-webkit-box-shadow:none;box-shadow:none}.picker-columns.sc-ion-picker-legacy-md{height:216px;-webkit-perspective:1800px;perspective:1800px}.picker-above-highlight.sc-ion-picker-legacy-md{top:0;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);position:absolute;width:100%;height:81px;border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));background:-webkit-gradient(linear, left top, left bottom, color-stop(20%, var(--ion-background-color, #fff)), to(rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8)));background:linear-gradient(to bottom, var(--ion-background-color, #fff) 20%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 100%);z-index:10}.picker-above-highlight.sc-ion-picker-legacy-md{inset-inline-start:0}.picker-below-highlight.sc-ion-picker-legacy-md{top:115px;-webkit-transform:translate3d(0, 0, 90px);transform:translate3d(0, 0, 90px);position:absolute;width:100%;height:119px;border-top:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));background:-webkit-gradient(linear, left bottom, left top, color-stop(30%, var(--ion-background-color, #fff)), to(rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8)));background:linear-gradient(to top, var(--ion-background-color, #fff) 30%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 100%);z-index:11}.picker-below-highlight.sc-ion-picker-legacy-md{inset-inline-start:0}";
- var IonPickerLegacyMdStyle0 = pickerMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Picker {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.didPresent = createEvent(this, "ionPickerDidPresent", 7);
- this.willPresent = createEvent(this, "ionPickerWillPresent", 7);
- this.willDismiss = createEvent(this, "ionPickerWillDismiss", 7);
- this.didDismiss = createEvent(this, "ionPickerDidDismiss", 7);
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
- this.delegateController = createDelegateController(this);
- this.lockController = createLockController();
- this.triggerController = createTriggerController();
- this.onBackdropTap = () => {
- this.dismiss(undefined, BACKDROP);
- };
- this.dispatchCancelHandler = (ev) => {
- const role = ev.detail.role;
- if (isCancel(role)) {
- const cancelButton = this.buttons.find((b) => b.role === 'cancel');
- this.callButtonHandler(cancelButton);
- }
- };
- this.presented = false;
- this.overlayIndex = undefined;
- this.delegate = undefined;
- this.hasController = false;
- this.keyboardClose = true;
- this.enterAnimation = undefined;
- this.leaveAnimation = undefined;
- this.buttons = [];
- this.columns = [];
- this.cssClass = undefined;
- this.duration = 0;
- this.showBackdrop = true;
- this.backdropDismiss = true;
- this.animated = true;
- this.htmlAttributes = undefined;
- this.isOpen = false;
- this.trigger = undefined;
- }
- onIsOpenChange(newValue, oldValue) {
- if (newValue === true && oldValue === false) {
- this.present();
- }
- else if (newValue === false && oldValue === true) {
- this.dismiss();
- }
- }
- triggerChanged() {
- const { trigger, el, triggerController } = this;
- if (trigger) {
- triggerController.addClickListener(el, trigger);
- }
- }
- connectedCallback() {
- prepareOverlay(this.el);
- this.triggerChanged();
- }
- disconnectedCallback() {
- this.triggerController.removeClickListener();
- }
- componentWillLoad() {
- var _a;
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
- setOverlayId(this.el);
- }
- }
- componentDidLoad() {
- printIonWarning('[ion-picker-legacy] - ion-picker-legacy and ion-picker-legacy-column have been deprecated in favor of new versions of the ion-picker and ion-picker-column components. These new components display inline with your page content allowing for more presentation flexibility than before.', this.el);
- /**
- * If picker was rendered with isOpen="true"
- * then we should open picker immediately.
- */
- if (this.isOpen === true) {
- raf(() => this.present());
- }
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.triggerChanged();
- }
- /**
- * Present the picker overlay after it has been created.
- */
- async present() {
- const unlock = await this.lockController.lock();
- await this.delegateController.attachViewToDom();
- await present(this, 'pickerEnter', iosEnterAnimation$2, iosEnterAnimation$2, undefined);
- if (this.duration > 0) {
- this.durationTimeout = setTimeout(() => this.dismiss(), this.duration);
- }
- unlock();
- }
- /**
- * Dismiss the picker overlay after it has been presented.
- *
- * @param data Any data to emit in the dismiss events.
- * @param role The role of the element that is dismissing the picker.
- * This can be useful in a button handler for determining which button was
- * clicked to dismiss the picker.
- * Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
- */
- async dismiss(data, role) {
- const unlock = await this.lockController.lock();
- if (this.durationTimeout) {
- clearTimeout(this.durationTimeout);
- }
- const dismissed = await dismiss(this, data, role, 'pickerLeave', iosLeaveAnimation$2, iosLeaveAnimation$2);
- if (dismissed) {
- this.delegateController.removeViewFromDom();
- }
- unlock();
- return dismissed;
- }
- /**
- * Returns a promise that resolves when the picker did dismiss.
- */
- onDidDismiss() {
- return eventMethod(this.el, 'ionPickerDidDismiss');
- }
- /**
- * Returns a promise that resolves when the picker will dismiss.
- */
- onWillDismiss() {
- return eventMethod(this.el, 'ionPickerWillDismiss');
- }
- /**
- * Get the column that matches the specified name.
- *
- * @param name The name of the column.
- */
- getColumn(name) {
- return Promise.resolve(this.columns.find((column) => column.name === name));
- }
- async buttonClick(button) {
- const role = button.role;
- if (isCancel(role)) {
- return this.dismiss(undefined, role);
- }
- const shouldDismiss = await this.callButtonHandler(button);
- if (shouldDismiss) {
- return this.dismiss(this.getSelected(), button.role);
- }
- return Promise.resolve();
- }
- async callButtonHandler(button) {
- if (button) {
- // a handler has been provided, execute it
- // pass the handler the values from the inputs
- const rtn = await safeCall(button.handler, this.getSelected());
- if (rtn === false) {
- // if the return value of the handler is false then do not dismiss
- return false;
- }
- }
- return true;
- }
- getSelected() {
- const selected = {};
- this.columns.forEach((col, index) => {
- const selectedColumn = col.selectedIndex !== undefined ? col.options[col.selectedIndex] : undefined;
- selected[col.name] = {
- text: selectedColumn ? selectedColumn.text : undefined,
- value: selectedColumn ? selectedColumn.value : undefined,
- columnIndex: index,
- };
- });
- return selected;
- }
- render() {
- const { htmlAttributes } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, Object.assign({ key: 'b6b6ca6f9aa74681e6d67f64b366f5965fec2a6d', "aria-modal": "true", tabindex: "-1" }, htmlAttributes, { style: {
- zIndex: `${20000 + this.overlayIndex}`,
- }, class: Object.assign({ [mode]: true,
- // Used internally for styling
- [`picker-${mode}`]: true, 'overlay-hidden': true }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonPickerWillDismiss: this.dispatchCancelHandler }), hAsync("ion-backdrop", { key: '20202ca1d7b6cd5f517a802879b39efb79033cb1', visible: this.showBackdrop, tappable: this.backdropDismiss }), hAsync("div", { key: '72fe76a1e1748593cdf38deab5100087bfa75983', tabindex: "0", "aria-hidden": "true" }), hAsync("div", { key: '921954cfc716f3774aab66677563754ff479a44a', class: "picker-wrapper ion-overlay-wrapper", role: "dialog" }, hAsync("div", { key: '224413950bfcf2a948e58c2554c2a37a4e6d0319', class: "picker-toolbar" }, this.buttons.map((b) => (hAsync("div", { class: buttonWrapperClass(b) }, hAsync("button", { type: "button", onClick: () => this.buttonClick(b), class: buttonClass$1(b) }, b.text))))), hAsync("div", { key: '7e688c2d0705940ec8a9ace493b679e6a9b68860', class: "picker-columns" }, hAsync("div", { key: '0ec2db79a9ca9e2a0b324b6c4b90176a0eb33df3', class: "picker-above-highlight" }), this.presented && this.columns.map((c) => hAsync("ion-picker-legacy-column", { col: c })), hAsync("div", { key: 'b8344f4f342fddc3f773435515567ef8f3accbb0', class: "picker-below-highlight" }))), hAsync("div", { key: '374c7a6b31b0a00ab3913faeea0ec3d6c02274b9', tabindex: "0", "aria-hidden": "true" })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "isOpen": ["onIsOpenChange"],
- "trigger": ["triggerChanged"]
- }; }
- static get style() { return {
- ios: IonPickerLegacyIosStyle0,
- md: IonPickerLegacyMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 34,
- "$tagName$": "ion-picker-legacy",
- "$members$": {
- "overlayIndex": [2, "overlay-index"],
- "delegate": [16],
- "hasController": [4, "has-controller"],
- "keyboardClose": [4, "keyboard-close"],
- "enterAnimation": [16],
- "leaveAnimation": [16],
- "buttons": [16],
- "columns": [16],
- "cssClass": [1, "css-class"],
- "duration": [2],
- "showBackdrop": [4, "show-backdrop"],
- "backdropDismiss": [4, "backdrop-dismiss"],
- "animated": [4],
- "htmlAttributes": [16],
- "isOpen": [4, "is-open"],
- "trigger": [1],
- "presented": [32],
- "present": [64],
- "dismiss": [64],
- "onDidDismiss": [64],
- "onWillDismiss": [64],
- "getColumn": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const buttonWrapperClass = (button) => {
- return {
- [`picker-toolbar-${button.role}`]: button.role !== undefined,
- 'picker-toolbar-button': true,
- };
- };
- const buttonClass$1 = (button) => {
- return Object.assign({ 'picker-button': true, 'ion-activatable': true }, getClassMap(button.cssClass));
- };
- const pickerColumnCss = ":host{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;max-width:100%;height:200px;font-size:22px;text-align:center}.assistive-focusable{left:0;right:0;top:0;bottom:0;position:absolute;z-index:1;pointer-events:none}.assistive-focusable:focus{outline:none}.picker-opts{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;min-width:26px;max-height:200px;outline:none;text-align:inherit;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none}.picker-item-empty{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.picker-opts::-webkit-scrollbar{display:none}::slotted(ion-picker-column-option){display:block;scroll-snap-align:center}.picker-item-empty,:host(:not([disabled])) ::slotted(ion-picker-column-option.option-disabled){scroll-snap-align:none}::slotted([slot=prefix]),::slotted([slot=suffix]){max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}::slotted([slot=prefix]){-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0;padding-bottom:0;-ms-flex-pack:end;justify-content:end}::slotted([slot=suffix]){-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0;padding-bottom:0;-ms-flex-pack:start;justify-content:start}:host(.picker-column-disabled) .picker-opts{overflow-y:hidden}:host(.picker-column-disabled) ::slotted(ion-picker-column-option){cursor:default;opacity:0.4;pointer-events:none}@media (any-hover: hover){:host(:focus) .picker-opts{outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}";
- var IonPickerColumnStyle0 = pickerColumnCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot prefix - Content to show on the left side of the picker options.
- * @slot suffix - Content to show on the right side of the picker options.
- */
- class PickerColumn {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.isScrolling = false;
- this.isColumnVisible = false;
- this.canExitInputMode = true;
- this.updateValueTextOnScroll = false;
- this.centerPickerItemInView = (target, smooth = true, canExitInputMode = true) => {
- const { isColumnVisible, scrollEl } = this;
- if (isColumnVisible && scrollEl) {
- // (Vertical offset from parent) - (three empty picker rows) + (half the height of the target to ensure the scroll triggers)
- const top = target.offsetTop - 3 * target.clientHeight + target.clientHeight / 2;
- if (scrollEl.scrollTop !== top) {
- /**
- * Setting this flag prevents input
- * mode from exiting in the picker column's
- * scroll callback. This is useful when the user manually
- * taps an item or types on the keyboard as both
- * of these can cause a scroll to occur.
- */
- this.canExitInputMode = canExitInputMode;
- this.updateValueTextOnScroll = false;
- scrollEl.scroll({
- top,
- left: 0,
- behavior: smooth ? 'smooth' : undefined,
- });
- }
- }
- };
- this.setPickerItemActiveState = (item, isActive) => {
- if (isActive) {
- item.classList.add(PICKER_ITEM_ACTIVE_CLASS);
- }
- else {
- item.classList.remove(PICKER_ITEM_ACTIVE_CLASS);
- }
- };
- /**
- * When ionInputModeChange is emitted, each column
- * needs to check if it is the one being made available
- * for text entry.
- */
- this.inputModeChange = (ev) => {
- if (!this.numericInput) {
- return;
- }
- const { useInputMode, inputModeColumn } = ev.detail;
- /**
- * If inputModeColumn is undefined then this means
- * all numericInput columns are being selected.
- */
- const isColumnActive = inputModeColumn === undefined || inputModeColumn === this.el;
- if (!useInputMode || !isColumnActive) {
- this.setInputModeActive(false);
- return;
- }
- this.setInputModeActive(true);
- };
- /**
- * Setting isActive will cause a re-render.
- * As a result, we do not want to cause the
- * re-render mid scroll as this will cause
- * the picker column to jump back to
- * whatever value was selected at the
- * start of the scroll interaction.
- */
- this.setInputModeActive = (state) => {
- if (this.isScrolling) {
- this.scrollEndCallback = () => {
- this.isActive = state;
- };
- return;
- }
- this.isActive = state;
- };
- /**
- * When the column scrolls, the component
- * needs to determine which item is centered
- * in the view and will emit an ionChange with
- * the item object.
- */
- this.initializeScrollListener = () => {
- /**
- * The haptics for the wheel picker are
- * an iOS-only feature. As a result, they should
- * be disabled on Android.
- */
- const enableHaptics = isPlatform('ios');
- const { el, scrollEl } = this;
- let timeout;
- let activeEl = this.activeItem;
- const scrollCallback = () => {
- raf(() => {
- var _a;
- if (!scrollEl)
- return;
- if (timeout) {
- clearTimeout(timeout);
- timeout = undefined;
- }
- if (!this.isScrolling) {
- enableHaptics && hapticSelectionStart();
- this.isScrolling = true;
- }
- /**
- * Select item in the center of the column
- * which is the month/year that we want to select
- */
- const bbox = scrollEl.getBoundingClientRect();
- const centerX = bbox.x + bbox.width / 2;
- const centerY = bbox.y + bbox.height / 2;
- /**
- * elementFromPoint returns the top-most element.
- * This means that if an ion-backdrop is overlaying the
- * picker then the appropriate picker column option will
- * not be selected. To account for this, we use elementsFromPoint
- * and use an Array.find to find the appropriate column option
- * at that point.
- *
- * Additionally, the picker column could be used in the
- * Shadow DOM (i.e. in ion-datetime) so we need to make
- * sure we are choosing the correct host otherwise
- * the elements returns by elementsFromPoint will be
- * retargeted. To account for this, we check to see
- * if the picker column has a parent shadow root. If
- * so, we use that shadow root when doing elementsFromPoint.
- * Otherwise, we just use the document.
- */
- const rootNode = el.getRootNode();
- const hasParentShadow = rootNode instanceof ShadowRoot;
- const referenceNode = hasParentShadow ? rootNode : doc;
- /**
- * If the reference node is undefined
- * then it's likely that doc is undefined
- * due to being in an SSR environment.
- */
- if (referenceNode === undefined) {
- return;
- }
- const elementsAtPoint = referenceNode.elementsFromPoint(centerX, centerY);
- /**
- * elementsFromPoint can returns multiple elements
- * so find the relevant picker column option if one exists.
- */
- const newActiveElement = elementsAtPoint.find((el) => el.tagName === 'ION-PICKER-COLUMN-OPTION');
- if (activeEl !== undefined) {
- this.setPickerItemActiveState(activeEl, false);
- }
- if (newActiveElement === undefined || newActiveElement.disabled) {
- return;
- }
- /**
- * If we are selecting a new value,
- * we need to run haptics again.
- */
- if (newActiveElement !== activeEl) {
- enableHaptics && hapticSelectionChanged();
- if (this.canExitInputMode) {
- /**
- * The native iOS wheel picker
- * only dismisses the keyboard
- * once the selected item has changed
- * as a result of a swipe
- * from the user. If `canExitInputMode` is
- * `false` then this means that the
- * scroll is happening as a result of
- * the `value` property programmatically changing
- * either by an application or by the user via the keyboard.
- */
- this.exitInputMode();
- }
- }
- activeEl = newActiveElement;
- this.setPickerItemActiveState(newActiveElement, true);
- /**
- * Set the aria-valuetext even though the value prop has not been updated yet.
- * This enables some screen readers to announce the value as the users drag
- * as opposed to when their release their pointer from the screen.
- *
- * When the value is programmatically updated, we will smoothly scroll
- * to the new option. However, we do not want to update aria-valuetext mid-scroll
- * as that can cause the old value to be briefly set before being set to the
- * correct option. This will cause some screen readers to announce the old value
- * again before announcing the new value. The correct valuetext will be set on render.
- */
- if (this.updateValueTextOnScroll) {
- (_a = this.assistiveFocusable) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-valuetext', this.getOptionValueText(newActiveElement));
- }
- timeout = setTimeout(() => {
- this.isScrolling = false;
- this.updateValueTextOnScroll = true;
- enableHaptics && hapticSelectionEnd();
- /**
- * Certain tasks (such as those that
- * cause re-renders) should only be done
- * once scrolling has finished, otherwise
- * flickering may occur.
- */
- const { scrollEndCallback } = this;
- if (scrollEndCallback) {
- scrollEndCallback();
- this.scrollEndCallback = undefined;
- }
- /**
- * Reset this flag as the
- * next scroll interaction could
- * be a scroll from the user. In this
- * case, we should exit input mode.
- */
- this.canExitInputMode = true;
- this.setValue(newActiveElement.value);
- }, 250);
- });
- };
- /**
- * Wrap this in an raf so that the scroll callback
- * does not fire when component is initially shown.
- */
- raf(() => {
- if (!scrollEl)
- return;
- scrollEl.addEventListener('scroll', scrollCallback);
- this.destroyScrollListener = () => {
- scrollEl.removeEventListener('scroll', scrollCallback);
- };
- });
- };
- /**
- * Tells the parent picker to
- * exit text entry mode. This is only called
- * when the selected item changes during scroll, so
- * we know that the user likely wants to scroll
- * instead of type.
- */
- this.exitInputMode = () => {
- const { parentEl } = this;
- if (parentEl == null)
- return;
- parentEl.exitInputMode();
- /**
- * setInputModeActive only takes
- * effect once scrolling stops to avoid
- * a component re-render while scrolling.
- * However, we want the visual active
- * indicator to go away immediately, so
- * we call classList.remove here.
- */
- this.el.classList.remove('picker-column-active');
- };
- /**
- * Find the next enabled option after the active option.
- * @param stride - How many options to "jump" over in order to select the next option.
- * This can be used to implement PageUp/PageDown behaviors where pressing these keys
- * scrolls the picker by more than 1 option. For example, a stride of 5 means select
- * the enabled option 5 options after the active one. Note that the actual option selected
- * may be past the stride if the option at the stride is disabled.
- */
- this.findNextOption = (stride = 1) => {
- const { activeItem } = this;
- if (!activeItem)
- return null;
- let prevNode = activeItem;
- let node = activeItem.nextElementSibling;
- while (node != null) {
- if (stride > 0) {
- stride--;
- }
- if (node.tagName === 'ION-PICKER-COLUMN-OPTION' && !node.disabled && stride === 0) {
- return node;
- }
- prevNode = node;
- // Use nextElementSibling instead of nextSibling to avoid text/comment nodes
- node = node.nextElementSibling;
- }
- return prevNode;
- };
- /**
- * Find the next enabled option after the active option.
- * @param stride - How many options to "jump" over in order to select the next option.
- * This can be used to implement PageUp/PageDown behaviors where pressing these keys
- * scrolls the picker by more than 1 option. For example, a stride of 5 means select
- * the enabled option 5 options before the active one. Note that the actual option selected
- * may be past the stride if the option at the stride is disabled.
- */
- this.findPreviousOption = (stride = 1) => {
- const { activeItem } = this;
- if (!activeItem)
- return null;
- let nextNode = activeItem;
- let node = activeItem.previousElementSibling;
- while (node != null) {
- if (stride > 0) {
- stride--;
- }
- if (node.tagName === 'ION-PICKER-COLUMN-OPTION' && !node.disabled && stride === 0) {
- return node;
- }
- nextNode = node;
- // Use previousElementSibling instead of previousSibling to avoid text/comment nodes
- node = node.previousElementSibling;
- }
- return nextNode;
- };
- this.onKeyDown = (ev) => {
- /**
- * The below operations should be inverted when running on a mobile device.
- * For example, swiping up will dispatch an "ArrowUp" event. On desktop,
- * this should cause the previous option to be selected. On mobile, swiping
- * up causes a view to scroll down. As a result, swiping up on mobile should
- * cause the next option to be selected. The Home/End operations remain
- * unchanged because those always represent the first/last options, respectively.
- */
- const mobile = isPlatform('mobile');
- let newOption = null;
- switch (ev.key) {
- case 'ArrowDown':
- newOption = mobile ? this.findPreviousOption() : this.findNextOption();
- break;
- case 'ArrowUp':
- newOption = mobile ? this.findNextOption() : this.findPreviousOption();
- break;
- case 'PageUp':
- newOption = mobile ? this.findNextOption(5) : this.findPreviousOption(5);
- break;
- case 'PageDown':
- newOption = mobile ? this.findPreviousOption(5) : this.findNextOption(5);
- break;
- case 'Home':
- /**
- * There is no guarantee that the first child will be an ion-picker-column-option,
- * so we do not use firstElementChild.
- */
- newOption = this.el.querySelector('ion-picker-column-option:first-of-type');
- break;
- case 'End':
- /**
- * There is no guarantee that the last child will be an ion-picker-column-option,
- * so we do not use lastElementChild.
- */
- newOption = this.el.querySelector('ion-picker-column-option:last-of-type');
- break;
- }
- if (newOption !== null) {
- this.setValue(newOption.value);
- // This stops any default browser behavior such as scrolling
- ev.preventDefault();
- }
- };
- /**
- * Utility to generate the correct text for aria-valuetext.
- */
- this.getOptionValueText = (el) => {
- var _a;
- return el ? (_a = el.getAttribute('aria-label')) !== null && _a !== void 0 ? _a : el.innerText : '';
- };
- /**
- * Render an element that overlays the column. This element is for assistive
- * tech to allow users to navigate the column up/down. This element should receive
- * focus as it listens for synthesized keyboard events as required by the
- * slider role: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role
- */
- this.renderAssistiveFocusable = () => {
- const { activeItem } = this;
- const valueText = this.getOptionValueText(activeItem);
- /**
- * When using the picker, the valuetext provides important context that valuenow
- * does not. Additionally, using non-zero valuemin/valuemax values can cause
- * WebKit to incorrectly announce numeric valuetext values (such as a year
- * like "2024") as percentages: https://bugs.webkit.org/show_bug.cgi?id=273126
- */
- return (hAsync("div", { ref: (el) => (this.assistiveFocusable = el), class: "assistive-focusable", role: "slider", tabindex: this.disabled ? undefined : 0, "aria-label": this.ariaLabel, "aria-valuemin": 0, "aria-valuemax": 0, "aria-valuenow": 0, "aria-valuetext": valueText, "aria-orientation": "vertical", onKeyDown: (ev) => this.onKeyDown(ev) }));
- };
- this.ariaLabel = null;
- this.isActive = false;
- this.disabled = false;
- this.value = undefined;
- this.color = 'primary';
- this.numericInput = false;
- }
- ariaLabelChanged(newValue) {
- this.ariaLabel = newValue;
- }
- valueChange() {
- if (this.isColumnVisible) {
- /**
- * Only scroll the active item into view when the picker column
- * is actively visible to the user.
- */
- this.scrollActiveItemIntoView(true);
- }
- }
- /**
- * Only setup scroll listeners
- * when the picker is visible, otherwise
- * the container will have a scroll
- * height of 0px.
- */
- componentWillLoad() {
- /**
- * We cache parentEl in a local variable
- * so we don't need to keep accessing
- * the class variable (which comes with
- * a small performance hit)
- */
- const parentEl = (this.parentEl = this.el.closest('ion-picker'));
- const visibleCallback = (entries) => {
- /**
- * Browsers will sometimes group multiple IO events into a single callback.
- * As a result, we want to grab the last/most recent event in case there are multiple events.
- */
- const ev = entries[entries.length - 1];
- if (ev.isIntersecting) {
- const { activeItem, el } = this;
- this.isColumnVisible = true;
- /**
- * Because this initial call to scrollActiveItemIntoView has to fire before
- * the scroll listener is set up, we need to manage the active class manually.
- */
- const oldActive = getElementRoot(el).querySelector(`.${PICKER_ITEM_ACTIVE_CLASS}`);
- if (oldActive) {
- this.setPickerItemActiveState(oldActive, false);
- }
- this.scrollActiveItemIntoView();
- if (activeItem) {
- this.setPickerItemActiveState(activeItem, true);
- }
- this.initializeScrollListener();
- }
- else {
- this.isColumnVisible = false;
- if (this.destroyScrollListener) {
- this.destroyScrollListener();
- this.destroyScrollListener = undefined;
- }
- }
- };
- /**
- * Set the root to be the parent picker element
- * This causes the IO callback
- * to be fired in WebKit as soon as the element
- * is visible. If we used the default root value
- * then WebKit would only fire the IO callback
- * after any animations (such as a modal transition)
- * finished, and there would potentially be a flicker.
- */
- new IntersectionObserver(visibleCallback, { threshold: 0.001, root: this.parentEl }).observe(this.el);
- if (parentEl !== null) {
- // TODO(FW-2832): type
- parentEl.addEventListener('ionInputModeChange', (ev) => this.inputModeChange(ev));
- }
- }
- componentDidRender() {
- const { el, activeItem, isColumnVisible, value } = this;
- if (isColumnVisible && !activeItem) {
- const firstOption = el.querySelector('ion-picker-column-option');
- /**
- * If the picker column does not have an active item and the current value
- * does not match the first item in the picker column, that means
- * the value is out of bounds. In this case, we assign the value to the
- * first item to match the scroll position of the column.
- *
- */
- if (firstOption !== null && firstOption.value !== value) {
- this.setValue(firstOption.value);
- }
- }
- }
- /** @internal */
- async scrollActiveItemIntoView(smooth = false) {
- const activeEl = this.activeItem;
- if (activeEl) {
- this.centerPickerItemInView(activeEl, smooth, false);
- }
- }
- /**
- * Sets the value prop and fires the ionChange event.
- * This is used when we need to fire ionChange from
- * user-generated events that cannot be caught with normal
- * input/change event listeners.
- * @internal
- */
- async setValue(value) {
- if (this.disabled === true || this.value === value) {
- return;
- }
- this.value = value;
- this.ionChange.emit({ value });
- }
- /**
- * Sets focus on the scrollable container within the picker column.
- * Use this method instead of the global `pickerColumn.focus()`.
- */
- async setFocus() {
- if (this.assistiveFocusable) {
- this.assistiveFocusable.focus();
- }
- }
- connectedCallback() {
- var _a;
- this.ariaLabel = (_a = this.el.getAttribute('aria-label')) !== null && _a !== void 0 ? _a : 'Select a value';
- }
- get activeItem() {
- const { value } = this;
- const options = Array.from(this.el.querySelectorAll('ion-picker-column-option'));
- return options.find((option) => {
- /**
- * If the whole picker column is disabled, the current value should appear active
- * If the current value item is specifically disabled, it should not appear active
- */
- if (!this.disabled && option.disabled) {
- return false;
- }
- return option.value === value;
- });
- }
- render() {
- const { color, disabled, isActive, numericInput } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'a221dc10f1eb7c41637a16d2c7167c16939822fd', class: createColorClasses$1(color, {
- [mode]: true,
- ['picker-column-active']: isActive,
- ['picker-column-numeric-input']: numericInput,
- ['picker-column-disabled']: disabled,
- }) }, this.renderAssistiveFocusable(), hAsync("slot", { key: '81b0656f606856f3dc0a657bf167d81a5011405e', name: "prefix" }), hAsync("div", { key: '71b9de67c04150255dd66592601c9d926db0c31c', "aria-hidden": "true", class: "picker-opts", ref: (el) => {
- this.scrollEl = el;
- },
- /**
- * When an element has an overlay scroll style and
- * a fixed height, Firefox will focus the scrollable
- * container if the content exceeds the container's
- * dimensions.
- *
- * This causes keyboard navigation to focus to this
- * element instead of going to the next element in
- * the tab order.
- *
- * The desired behavior is for the user to be able to
- * focus the assistive focusable element and tab to
- * the next element in the tab order. Instead of tabbing
- * to this element.
- *
- * To prevent this, we set the tabIndex to -1. This
- * will match the behavior of the other browsers.
- */
- tabIndex: -1 }, hAsync("div", { key: 'ebdc2f08c83db0cf17b4be29f28fcb00f529601e', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), hAsync("div", { key: '04ab56fcb8e6a7d6af00204c4560feb99ff34a56', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), hAsync("div", { key: '6cf8f538903faf0fe1e4130f3eaf7b4e2e17cb52', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), hAsync("slot", { key: '1cc392307b70c576be5b81b5226ceba735957f0f' }), hAsync("div", { key: '23e3f28e2a99b9aa8b7c8f68ad9583e3ca63e9e2', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), hAsync("div", { key: '8a0563f09780c3116af0caebe4f40587ec1f041f', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), hAsync("div", { key: '13207e248fc0009f37e0c90a3ee2bac2f130b856', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0")), hAsync("slot", { key: '55ecf2ab5f214f936c2468cbdb7952daf89416b8', name: "suffix" })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "aria-label": ["ariaLabelChanged"],
- "value": ["valueChange"]
- }; }
- static get style() { return IonPickerColumnStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-picker-column",
- "$members$": {
- "disabled": [4],
- "value": [1032],
- "color": [513],
- "numericInput": [4, "numeric-input"],
- "ariaLabel": [32],
- "isActive": [32],
- "scrollActiveItemIntoView": [64],
- "setValue": [64],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const PICKER_ITEM_ACTIVE_CLASS = 'option-active';
- const pickerColumnIosCss = ".picker-col{display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-sizing:content-box;box-sizing:content-box;contain:content}.picker-opts{position:relative;-ms-flex:1;flex:1;max-width:100%}.picker-opt{top:0;display:block;position:absolute;width:100%;border:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;contain:strict;overflow:hidden;will-change:transform}.picker-opt{inset-inline-start:0}.picker-opt.picker-opt-disabled{pointer-events:none}.picker-opt-disabled{opacity:0}.picker-opts-left{-ms-flex-pack:start;justify-content:flex-start}.picker-opts-right{-ms-flex-pack:end;justify-content:flex-end}.picker-opt:active,.picker-opt:focus{outline:none}.picker-prefix{position:relative;-ms-flex:1;flex:1;text-align:end;white-space:nowrap}.picker-suffix{position:relative;-ms-flex:1;flex:1;text-align:start;white-space:nowrap}.picker-col{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:0;padding-bottom:0;-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.picker-prefix,.picker-suffix,.picker-opts{top:77px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;color:inherit;font-size:20px;line-height:42px;pointer-events:none}.picker-opt{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-transform-origin:center center;transform-origin:center center;height:46px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;background:transparent;color:inherit;font-size:20px;line-height:42px;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:auto}:host-context([dir=rtl]) .picker-opt{-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}[dir=rtl] .picker-opt{-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}@supports selector(:dir(rtl)){.picker-opt:dir(rtl){-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}}";
- var IonPickerLegacyColumnIosStyle0 = pickerColumnIosCss;
- const pickerColumnMdCss = ".picker-col{display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-sizing:content-box;box-sizing:content-box;contain:content}.picker-opts{position:relative;-ms-flex:1;flex:1;max-width:100%}.picker-opt{top:0;display:block;position:absolute;width:100%;border:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;contain:strict;overflow:hidden;will-change:transform}.picker-opt{inset-inline-start:0}.picker-opt.picker-opt-disabled{pointer-events:none}.picker-opt-disabled{opacity:0}.picker-opts-left{-ms-flex-pack:start;justify-content:flex-start}.picker-opts-right{-ms-flex-pack:end;justify-content:flex-end}.picker-opt:active,.picker-opt:focus{outline:none}.picker-prefix{position:relative;-ms-flex:1;flex:1;text-align:end;white-space:nowrap}.picker-suffix{position:relative;-ms-flex:1;flex:1;text-align:start;white-space:nowrap}.picker-col{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.picker-prefix,.picker-suffix,.picker-opts{top:77px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;color:inherit;font-size:22px;line-height:42px;pointer-events:none}.picker-opt{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;height:43px;-webkit-transition-timing-function:ease-out;transition-timing-function:ease-out;background:transparent;color:inherit;font-size:22px;line-height:42px;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:auto}.picker-prefix,.picker-suffix,.picker-opt.picker-opt-selected{color:var(--ion-color-primary, #0054e9)}";
- var IonPickerLegacyColumnMdStyle0 = pickerColumnMdCss;
- /**
- * @internal
- */
- class PickerColumnCmp {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionPickerColChange = createEvent(this, "ionPickerColChange", 7);
- this.optHeight = 0;
- this.rotateFactor = 0;
- this.scaleFactor = 1;
- this.velocity = 0;
- this.y = 0;
- this.noAnimate = true;
- // `colDidChange` is a flag that gets set when the column is changed
- // dynamically. When this flag is set, the column will refresh
- // after the component re-renders to incorporate the new column data.
- // This is necessary because `this.refresh` queries for the option elements,
- // so it needs to wait for the latest elements to be available in the DOM.
- // Ex: column is created with 3 options. User updates the column data
- // to have 5 options. The column will still think it only has 3 options.
- this.colDidChange = false;
- this.col = undefined;
- }
- colChanged() {
- this.colDidChange = true;
- }
- async connectedCallback() {
- let pickerRotateFactor = 0;
- let pickerScaleFactor = 0.81;
- const mode = getIonMode$1(this);
- if (mode === 'ios') {
- pickerRotateFactor = -0.46;
- pickerScaleFactor = 1;
- }
- this.rotateFactor = pickerRotateFactor;
- this.scaleFactor = pickerScaleFactor;
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: this.el,
- gestureName: 'picker-swipe',
- gesturePriority: 100,
- threshold: 0,
- passive: false,
- onStart: (ev) => this.onStart(ev),
- onMove: (ev) => this.onMove(ev),
- onEnd: (ev) => this.onEnd(ev),
- });
- this.gesture.enable();
- // Options have not been initialized yet
- // Animation must be disabled through the `noAnimate` flag
- // Otherwise, the options will render
- // at the top of the column and transition down
- this.tmrId = setTimeout(() => {
- this.noAnimate = false;
- // After initialization, `refresh()` will be called
- // At this point, animation will be enabled. The options will
- // animate as they are being selected.
- this.refresh(true);
- }, 250);
- }
- componentDidLoad() {
- this.onDomChange();
- }
- componentDidUpdate() {
- // Options may have changed since last update.
- if (this.colDidChange) {
- // Animation must be disabled through the `onDomChange` parameter.
- // Otherwise, the recently added options will render
- // at the top of the column and transition down
- this.onDomChange(true, false);
- this.colDidChange = false;
- }
- }
- disconnectedCallback() {
- if (this.rafId !== undefined)
- cancelAnimationFrame(this.rafId);
- if (this.tmrId)
- clearTimeout(this.tmrId);
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- }
- emitColChange() {
- this.ionPickerColChange.emit(this.col);
- }
- setSelected(selectedIndex, duration) {
- // if there is a selected index, then figure out it's y position
- // if there isn't a selected index, then just use the top y position
- const y = selectedIndex > -1 ? -(selectedIndex * this.optHeight) : 0;
- this.velocity = 0;
- // set what y position we're at
- if (this.rafId !== undefined)
- cancelAnimationFrame(this.rafId);
- this.update(y, duration, true);
- this.emitColChange();
- }
- update(y, duration, saveY) {
- if (!this.optsEl) {
- return;
- }
- // ensure we've got a good round number :)
- let translateY = 0;
- let translateZ = 0;
- const { col, rotateFactor } = this;
- const prevSelected = col.selectedIndex;
- const selectedIndex = (col.selectedIndex = this.indexForY(-y));
- const durationStr = duration === 0 ? '' : duration + 'ms';
- const scaleStr = `scale(${this.scaleFactor})`;
- const children = this.optsEl.children;
- for (let i = 0; i < children.length; i++) {
- const button = children[i];
- const opt = col.options[i];
- const optOffset = i * this.optHeight + y;
- let transform = '';
- if (rotateFactor !== 0) {
- const rotateX = optOffset * rotateFactor;
- if (Math.abs(rotateX) <= 90) {
- translateY = 0;
- translateZ = 90;
- transform = `rotateX(${rotateX}deg) `;
- }
- else {
- translateY = -9999;
- }
- }
- else {
- translateZ = 0;
- translateY = optOffset;
- }
- const selected = selectedIndex === i;
- transform += `translate3d(0px,${translateY}px,${translateZ}px) `;
- if (this.scaleFactor !== 1 && !selected) {
- transform += scaleStr;
- }
- // Update transition duration
- if (this.noAnimate) {
- opt.duration = 0;
- button.style.transitionDuration = '';
- }
- else if (duration !== opt.duration) {
- opt.duration = duration;
- button.style.transitionDuration = durationStr;
- }
- // Update transform
- if (transform !== opt.transform) {
- opt.transform = transform;
- }
- button.style.transform = transform;
- /**
- * Ensure that the select column
- * item has the selected class
- */
- opt.selected = selected;
- if (selected) {
- button.classList.add(PICKER_OPT_SELECTED);
- }
- else {
- button.classList.remove(PICKER_OPT_SELECTED);
- }
- }
- this.col.prevSelected = prevSelected;
- if (saveY) {
- this.y = y;
- }
- if (this.lastIndex !== selectedIndex) {
- // have not set a last index yet
- hapticSelectionChanged();
- this.lastIndex = selectedIndex;
- }
- }
- decelerate() {
- if (this.velocity !== 0) {
- // still decelerating
- this.velocity *= DECELERATION_FRICTION;
- // do not let it go slower than a velocity of 1
- this.velocity = this.velocity > 0 ? Math.max(this.velocity, 1) : Math.min(this.velocity, -1);
- let y = this.y + this.velocity;
- if (y > this.minY) {
- // whoops, it's trying to scroll up farther than the options we have!
- y = this.minY;
- this.velocity = 0;
- }
- else if (y < this.maxY) {
- // gahh, it's trying to scroll down farther than we can!
- y = this.maxY;
- this.velocity = 0;
- }
- this.update(y, 0, true);
- const notLockedIn = Math.round(y) % this.optHeight !== 0 || Math.abs(this.velocity) > 1;
- if (notLockedIn) {
- // isn't locked in yet, keep decelerating until it is
- this.rafId = requestAnimationFrame(() => this.decelerate());
- }
- else {
- this.velocity = 0;
- this.emitColChange();
- hapticSelectionEnd();
- }
- }
- else if (this.y % this.optHeight !== 0) {
- // needs to still get locked into a position so options line up
- const currentPos = Math.abs(this.y % this.optHeight);
- // create a velocity in the direction it needs to scroll
- this.velocity = currentPos > this.optHeight / 2 ? 1 : -1;
- this.decelerate();
- }
- }
- indexForY(y) {
- return Math.min(Math.max(Math.abs(Math.round(y / this.optHeight)), 0), this.col.options.length - 1);
- }
- onStart(detail) {
- // We have to prevent default in order to block scrolling under the picker
- // but we DO NOT have to stop propagation, since we still want
- // some "click" events to capture
- if (detail.event.cancelable) {
- detail.event.preventDefault();
- }
- detail.event.stopPropagation();
- hapticSelectionStart();
- // reset everything
- if (this.rafId !== undefined)
- cancelAnimationFrame(this.rafId);
- const options = this.col.options;
- let minY = options.length - 1;
- let maxY = 0;
- for (let i = 0; i < options.length; i++) {
- if (!options[i].disabled) {
- minY = Math.min(minY, i);
- maxY = Math.max(maxY, i);
- }
- }
- this.minY = -(minY * this.optHeight);
- this.maxY = -(maxY * this.optHeight);
- }
- onMove(detail) {
- if (detail.event.cancelable) {
- detail.event.preventDefault();
- }
- detail.event.stopPropagation();
- // update the scroll position relative to pointer start position
- let y = this.y + detail.deltaY;
- if (y > this.minY) {
- // scrolling up higher than scroll area
- y = Math.pow(y, 0.8);
- this.bounceFrom = y;
- }
- else if (y < this.maxY) {
- // scrolling down below scroll area
- y += Math.pow(this.maxY - y, 0.9);
- this.bounceFrom = y;
- }
- else {
- this.bounceFrom = 0;
- }
- this.update(y, 0, false);
- }
- onEnd(detail) {
- if (this.bounceFrom > 0) {
- // bounce back up
- this.update(this.minY, 100, true);
- this.emitColChange();
- return;
- }
- else if (this.bounceFrom < 0) {
- // bounce back down
- this.update(this.maxY, 100, true);
- this.emitColChange();
- return;
- }
- this.velocity = clamp(-MAX_PICKER_SPEED, detail.velocityY * 23, MAX_PICKER_SPEED);
- if (this.velocity === 0 && detail.deltaY === 0) {
- const opt = detail.event.target.closest('.picker-opt');
- if (opt === null || opt === void 0 ? void 0 : opt.hasAttribute('opt-index')) {
- this.setSelected(parseInt(opt.getAttribute('opt-index'), 10), TRANSITION_DURATION);
- }
- }
- else {
- this.y += detail.deltaY;
- if (Math.abs(detail.velocityY) < 0.05) {
- const isScrollingUp = detail.deltaY > 0;
- const optHeightFraction = (Math.abs(this.y) % this.optHeight) / this.optHeight;
- if (isScrollingUp && optHeightFraction > 0.5) {
- this.velocity = Math.abs(this.velocity) * -1;
- }
- else if (!isScrollingUp && optHeightFraction <= 0.5) {
- this.velocity = Math.abs(this.velocity);
- }
- }
- this.decelerate();
- }
- }
- refresh(forceRefresh, animated) {
- var _a;
- let min = this.col.options.length - 1;
- let max = 0;
- const options = this.col.options;
- for (let i = 0; i < options.length; i++) {
- if (!options[i].disabled) {
- min = Math.min(min, i);
- max = Math.max(max, i);
- }
- }
- /**
- * Only update selected value if column has a
- * velocity of 0. If it does not, then the
- * column is animating might land on
- * a value different than the value at
- * selectedIndex
- */
- if (this.velocity !== 0) {
- return;
- }
- const selectedIndex = clamp(min, (_a = this.col.selectedIndex) !== null && _a !== void 0 ? _a : 0, max);
- if (this.col.prevSelected !== selectedIndex || forceRefresh) {
- const y = selectedIndex * this.optHeight * -1;
- const duration = animated ? TRANSITION_DURATION : 0;
- this.velocity = 0;
- this.update(y, duration, true);
- }
- }
- onDomChange(forceRefresh, animated) {
- const colEl = this.optsEl;
- if (colEl) {
- // DOM READ
- // We perfom a DOM read over a rendered item, this needs to happen after the first render or after the the column has changed
- this.optHeight = colEl.firstElementChild ? colEl.firstElementChild.clientHeight : 0;
- }
- this.refresh(forceRefresh, animated);
- }
- render() {
- const col = this.col;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '88a3c9397c9ac92dd814074c8ae6ecf8e3420a2c', class: Object.assign({ [mode]: true, 'picker-col': true, 'picker-opts-left': this.col.align === 'left', 'picker-opts-right': this.col.align === 'right' }, getClassMap(col.cssClass)), style: {
- 'max-width': this.col.columnWidth,
- } }, col.prefix && (hAsync("div", { key: '4491a705d15337e6f45f3cf6fd21af5242474729', class: "picker-prefix", style: { width: col.prefixWidth } }, col.prefix)), hAsync("div", { key: 'b0dd4b7a7a4c1edc4b73e7fb134ac85264072365', class: "picker-opts", style: { maxWidth: col.optionsWidth }, ref: (el) => (this.optsEl = el) }, col.options.map((o, index) => (hAsync("button", { "aria-label": o.ariaLabel, class: { 'picker-opt': true, 'picker-opt-disabled': !!o.disabled }, "opt-index": index }, o.text)))), col.suffix && (hAsync("div", { key: 'c16419ce6481d60fc3ba6b8d102a4edf0ede02aa', class: "picker-suffix", style: { width: col.suffixWidth } }, col.suffix))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "col": ["colChanged"]
- }; }
- static get style() { return {
- ios: IonPickerLegacyColumnIosStyle0,
- md: IonPickerLegacyColumnMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 32,
- "$tagName$": "ion-picker-legacy-column",
- "$members$": {
- "col": [16]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const PICKER_OPT_SELECTED = 'picker-opt-selected';
- const DECELERATION_FRICTION = 0.97;
- const MAX_PICKER_SPEED = 90;
- const TRANSITION_DURATION = 150;
- const pickerColumnOptionIosCss = "button{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden}:host(.option-disabled){opacity:0.4}:host(.option-disabled) button{cursor:default}";
- var IonPickerColumnOptionIosStyle0 = pickerColumnOptionIosCss;
- const pickerColumnOptionMdCss = "button{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden}:host(.option-disabled){opacity:0.4}:host(.option-disabled) button{cursor:default}:host(.option-active){color:var(--ion-color-base)}";
- var IonPickerColumnOptionMdStyle0 = pickerColumnOptionMdCss;
- class PickerColumnOption {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- /**
- * We keep track of the parent picker column
- * so we can update the value of it when
- * clicking an enable option.
- */
- this.pickerColumn = null;
- this.ariaLabel = null;
- this.disabled = false;
- this.value = undefined;
- this.color = 'primary';
- }
- /**
- * The aria-label of the option has changed after the
- * first render and needs to be updated within the component.
- *
- * @param ariaLbl The new aria-label value.
- */
- onAriaLabelChange(ariaLbl) {
- this.ariaLabel = ariaLbl;
- }
- componentWillLoad() {
- const inheritedAttributes = inheritAttributes$1(this.el, ['aria-label']);
- /**
- * The initial value of `aria-label` needs to be set for
- * the first render.
-
- */
- this.ariaLabel = inheritedAttributes['aria-label'] || null;
- }
- connectedCallback() {
- this.pickerColumn = this.el.closest('ion-picker-column');
- }
- disconnectedCallback() {
- this.pickerColumn = null;
- }
- /**
- * The column options can load at any time
- * so the options needs to tell the
- * parent picker column when it is loaded
- * so the picker column can ensure it is
- * centered in the view.
- *
- * We intentionally run this for every
- * option. If we only ran this from
- * the selected option then if the newly
- * loaded options were not selected then
- * scrollActiveItemIntoView would not be called.
- */
- componentDidLoad() {
- const { pickerColumn } = this;
- if (pickerColumn !== null) {
- pickerColumn.scrollActiveItemIntoView();
- }
- }
- /**
- * When an option is clicked, update the
- * parent picker column value. This
- * component will handle centering the option
- * in the column view.
- */
- onClick() {
- const { pickerColumn } = this;
- if (pickerColumn !== null) {
- pickerColumn.setValue(this.value);
- }
- }
- render() {
- const { color, disabled, ariaLabel } = this;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'c1353e99c2aa19c0e3ddbe433557ed18e72e1c66', class: createColorClasses$1(color, {
- [mode]: true,
- ['option-disabled']: disabled,
- }) }, hAsync("button", { key: 'b4ee62ecf7458a07a56e8aa494485766a87a3fcb', tabindex: "-1", "aria-label": ariaLabel, disabled: disabled, onClick: () => this.onClick() }, hAsync("slot", { key: '9ab1e4700c27103b676670a4b3521c183c6ab83d' }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "aria-label": ["onAriaLabelChange"]
- }; }
- static get style() { return {
- ios: IonPickerColumnOptionIosStyle0,
- md: IonPickerColumnOptionMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-picker-column-option",
- "$members$": {
- "disabled": [4],
- "value": [8],
- "color": [513],
- "ariaLabel": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- /**
- * Returns the dimensions of the popover
- * arrow on `ios` mode. If arrow is disabled
- * returns (0, 0).
- */
- const getArrowDimensions = (arrowEl) => {
- if (!arrowEl) {
- return { arrowWidth: 0, arrowHeight: 0 };
- }
- const { width, height } = arrowEl.getBoundingClientRect();
- return { arrowWidth: width, arrowHeight: height };
- };
- /**
- * Returns the recommended dimensions of the popover
- * that takes into account whether or not the width
- * should match the trigger width.
- */
- const getPopoverDimensions = (size, contentEl, triggerEl) => {
- const contentDimentions = contentEl.getBoundingClientRect();
- const contentHeight = contentDimentions.height;
- let contentWidth = contentDimentions.width;
- if (size === 'cover' && triggerEl) {
- const triggerDimensions = triggerEl.getBoundingClientRect();
- contentWidth = triggerDimensions.width;
- }
- return {
- contentWidth,
- contentHeight,
- };
- };
- const configureDismissInteraction = (triggerEl, triggerAction, popoverEl, parentPopoverEl) => {
- let dismissCallbacks = [];
- const root = getElementRoot(parentPopoverEl);
- const parentContentEl = root.querySelector('.popover-content');
- switch (triggerAction) {
- case 'hover':
- dismissCallbacks = [
- {
- /**
- * Do not use mouseover here
- * as this will causes the event to
- * be dispatched on each underlying
- * element rather than on the popover
- * content as a whole.
- */
- eventName: 'mouseenter',
- callback: (ev) => {
- /**
- * Do not dismiss the popover is we
- * are hovering over its trigger.
- * This would be easier if we used mouseover
- * but this would cause the event to be dispatched
- * more often than we would like, potentially
- * causing performance issues.
- */
- const element = document.elementFromPoint(ev.clientX, ev.clientY);
- if (element === triggerEl) {
- return;
- }
- popoverEl.dismiss(undefined, undefined, false);
- },
- },
- ];
- break;
- case 'context-menu':
- case 'click':
- default:
- dismissCallbacks = [
- {
- eventName: 'click',
- callback: (ev) => {
- /**
- * Do not dismiss the popover is we
- * are hovering over its trigger.
- */
- const target = ev.target;
- const closestTrigger = target.closest('[data-ion-popover-trigger]');
- if (closestTrigger === triggerEl) {
- /**
- * stopPropagation here so if the
- * popover has dismissOnSelect="true"
- * the popover does not dismiss since
- * we just clicked a trigger element.
- */
- ev.stopPropagation();
- return;
- }
- popoverEl.dismiss(undefined, undefined, false);
- },
- },
- ];
- break;
- }
- dismissCallbacks.forEach(({ eventName, callback }) => parentContentEl.addEventListener(eventName, callback));
- return () => {
- dismissCallbacks.forEach(({ eventName, callback }) => parentContentEl.removeEventListener(eventName, callback));
- };
- };
- /**
- * Configures the triggerEl to respond
- * to user interaction based upon the triggerAction
- * prop that devs have defined.
- */
- const configureTriggerInteraction = (triggerEl, triggerAction, popoverEl) => {
- let triggerCallbacks = [];
- /**
- * Based upon the kind of trigger interaction
- * the user wants, we setup the correct event
- * listeners.
- */
- switch (triggerAction) {
- case 'hover':
- let hoverTimeout;
- triggerCallbacks = [
- {
- eventName: 'mouseenter',
- callback: async (ev) => {
- ev.stopPropagation();
- if (hoverTimeout) {
- clearTimeout(hoverTimeout);
- }
- /**
- * Hovering over a trigger should not
- * immediately open the next popover.
- */
- hoverTimeout = setTimeout(() => {
- raf(() => {
- popoverEl.presentFromTrigger(ev);
- hoverTimeout = undefined;
- });
- }, 100);
- },
- },
- {
- eventName: 'mouseleave',
- callback: (ev) => {
- if (hoverTimeout) {
- clearTimeout(hoverTimeout);
- }
- /**
- * If mouse is over another popover
- * that is not this popover then we should
- * close this popover.
- */
- const target = ev.relatedTarget;
- if (!target) {
- return;
- }
- if (target.closest('ion-popover') !== popoverEl) {
- popoverEl.dismiss(undefined, undefined, false);
- }
- },
- },
- {
- /**
- * stopPropagation here prevents the popover
- * from dismissing when dismiss-on-select="true".
- */
- eventName: 'click',
- callback: (ev) => ev.stopPropagation(),
- },
- {
- eventName: 'ionPopoverActivateTrigger',
- callback: (ev) => popoverEl.presentFromTrigger(ev, true),
- },
- ];
- break;
- case 'context-menu':
- triggerCallbacks = [
- {
- eventName: 'contextmenu',
- callback: (ev) => {
- /**
- * Prevents the platform context
- * menu from appearing.
- */
- ev.preventDefault();
- popoverEl.presentFromTrigger(ev);
- },
- },
- {
- eventName: 'click',
- callback: (ev) => ev.stopPropagation(),
- },
- {
- eventName: 'ionPopoverActivateTrigger',
- callback: (ev) => popoverEl.presentFromTrigger(ev, true),
- },
- ];
- break;
- case 'click':
- default:
- triggerCallbacks = [
- {
- /**
- * Do not do a stopPropagation() here
- * because if you had two click triggers
- * then clicking the first trigger and then
- * clicking the second trigger would not cause
- * the first popover to dismiss.
- */
- eventName: 'click',
- callback: (ev) => popoverEl.presentFromTrigger(ev),
- },
- {
- eventName: 'ionPopoverActivateTrigger',
- callback: (ev) => popoverEl.presentFromTrigger(ev, true),
- },
- ];
- break;
- }
- triggerCallbacks.forEach(({ eventName, callback }) => triggerEl.addEventListener(eventName, callback));
- triggerEl.setAttribute('data-ion-popover-trigger', 'true');
- return () => {
- triggerCallbacks.forEach(({ eventName, callback }) => triggerEl.removeEventListener(eventName, callback));
- triggerEl.removeAttribute('data-ion-popover-trigger');
- };
- };
- /**
- * Returns the index of an ion-item in an array of ion-items.
- */
- const getIndexOfItem = (items, item) => {
- if (!item || item.tagName !== 'ION-ITEM') {
- return -1;
- }
- return items.findIndex((el) => el === item);
- };
- /**
- * Given an array of elements and a currently focused ion-item
- * returns the next ion-item relative to the focused one or
- * undefined.
- */
- const getNextItem = (items, currentItem) => {
- const currentItemIndex = getIndexOfItem(items, currentItem);
- return items[currentItemIndex + 1];
- };
- /**
- * Given an array of elements and a currently focused ion-item
- * returns the previous ion-item relative to the focused one or
- * undefined.
- */
- const getPrevItem = (items, currentItem) => {
- const currentItemIndex = getIndexOfItem(items, currentItem);
- return items[currentItemIndex - 1];
- };
- /** Focus the internal button of the ion-item */
- const focusItem = (item) => {
- const root = getElementRoot(item);
- const button = root.querySelector('button');
- if (button) {
- raf(() => button.focus());
- }
- };
- /**
- * Returns `true` if `el` has been designated
- * as a trigger element for an ion-popover.
- */
- const isTriggerElement = (el) => el.hasAttribute('data-ion-popover-trigger');
- const configureKeyboardInteraction = (popoverEl) => {
- const callback = async (ev) => {
- var _a;
- const activeElement = document.activeElement;
- let items = [];
- const targetTagName = (_a = ev.target) === null || _a === void 0 ? void 0 : _a.tagName;
- /**
- * Only handle custom keyboard interactions for the host popover element
- * and children ion-item elements.
- */
- if (targetTagName !== 'ION-POPOVER' && targetTagName !== 'ION-ITEM') {
- return;
- }
- /**
- * Complex selectors with :not() are :not supported
- * in older versions of Chromium so we need to do a
- * try/catch here so errors are not thrown.
- */
- try {
- /**
- * Select all ion-items that are not children of child popovers.
- * i.e. only select ion-item elements that are part of this popover
- */
- items = Array.from(popoverEl.querySelectorAll('ion-item:not(ion-popover ion-popover *):not([disabled])'));
- /* eslint-disable-next-line */
- }
- catch (_b) { }
- switch (ev.key) {
- /**
- * If we are in a child popover
- * then pressing the left arrow key
- * should close this popover and move
- * focus to the popover that presented
- * this one.
- */
- case 'ArrowLeft':
- const parentPopover = await popoverEl.getParentPopover();
- if (parentPopover) {
- popoverEl.dismiss(undefined, undefined, false);
- }
- break;
- /**
- * ArrowDown should move focus to the next focusable ion-item.
- */
- case 'ArrowDown':
- // Disable movement/scroll with keyboard
- ev.preventDefault();
- const nextItem = getNextItem(items, activeElement);
- if (nextItem !== undefined) {
- focusItem(nextItem);
- }
- break;
- /**
- * ArrowUp should move focus to the previous focusable ion-item.
- */
- case 'ArrowUp':
- // Disable movement/scroll with keyboard
- ev.preventDefault();
- const prevItem = getPrevItem(items, activeElement);
- if (prevItem !== undefined) {
- focusItem(prevItem);
- }
- break;
- /**
- * Home should move focus to the first focusable ion-item.
- */
- case 'Home':
- ev.preventDefault();
- const firstItem = items[0];
- if (firstItem !== undefined) {
- focusItem(firstItem);
- }
- break;
- /**
- * End should move focus to the last focusable ion-item.
- */
- case 'End':
- ev.preventDefault();
- const lastItem = items[items.length - 1];
- if (lastItem !== undefined) {
- focusItem(lastItem);
- }
- break;
- /**
- * ArrowRight, Spacebar, or Enter should activate
- * the currently focused trigger item to open a
- * popover if the element is a trigger item.
- */
- case 'ArrowRight':
- case ' ':
- case 'Enter':
- if (activeElement && isTriggerElement(activeElement)) {
- const rightEvent = new CustomEvent('ionPopoverActivateTrigger');
- activeElement.dispatchEvent(rightEvent);
- }
- break;
- }
- };
- popoverEl.addEventListener('keydown', callback);
- return () => popoverEl.removeEventListener('keydown', callback);
- };
- /**
- * Positions a popover by taking into account
- * the reference point, preferred side, alignment
- * and viewport dimensions.
- */
- const getPopoverPosition = (isRTL, contentWidth, contentHeight, arrowWidth, arrowHeight, reference, side, align, defaultPosition, triggerEl, event) => {
- var _a;
- let referenceCoordinates = {
- top: 0,
- left: 0,
- width: 0,
- height: 0,
- };
- /**
- * Calculate position relative to the
- * x-y coordinates in the event that
- * was passed in
- */
- switch (reference) {
- case 'event':
- if (!event) {
- return defaultPosition;
- }
- const mouseEv = event;
- referenceCoordinates = {
- top: mouseEv.clientY,
- left: mouseEv.clientX,
- width: 1,
- height: 1,
- };
- break;
- /**
- * Calculate position relative to the bounding
- * box on either the trigger element
- * specified via the `trigger` prop or
- * the target specified on the event
- * that was passed in.
- */
- case 'trigger':
- default:
- const customEv = event;
- /**
- * ionShadowTarget is used when we need to align the
- * popover with an element inside of the shadow root
- * of an Ionic component. Ex: Presenting a popover
- * by clicking on the collapsed indicator inside
- * of `ion-breadcrumb` and centering it relative
- * to the indicator rather than `ion-breadcrumb`
- * as a whole.
- */
- const actualTriggerEl = (triggerEl ||
- ((_a = customEv === null || customEv === void 0 ? void 0 : customEv.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) ||
- (customEv === null || customEv === void 0 ? void 0 : customEv.target));
- if (!actualTriggerEl) {
- return defaultPosition;
- }
- const triggerBoundingBox = actualTriggerEl.getBoundingClientRect();
- referenceCoordinates = {
- top: triggerBoundingBox.top,
- left: triggerBoundingBox.left,
- width: triggerBoundingBox.width,
- height: triggerBoundingBox.height,
- };
- break;
- }
- /**
- * Get top/left offset that would allow
- * popover to be positioned on the
- * preferred side of the reference.
- */
- const coordinates = calculatePopoverSide(side, referenceCoordinates, contentWidth, contentHeight, arrowWidth, arrowHeight, isRTL);
- /**
- * Get the top/left adjustments that
- * would allow the popover content
- * to have the correct alignment.
- */
- const alignedCoordinates = calculatePopoverAlign(align, side, referenceCoordinates, contentWidth, contentHeight);
- const top = coordinates.top + alignedCoordinates.top;
- const left = coordinates.left + alignedCoordinates.left;
- const { arrowTop, arrowLeft } = calculateArrowPosition(side, arrowWidth, arrowHeight, top, left, contentWidth, contentHeight, isRTL);
- const { originX, originY } = calculatePopoverOrigin(side, align, isRTL);
- return { top, left, referenceCoordinates, arrowTop, arrowLeft, originX, originY };
- };
- /**
- * Determines the transform-origin
- * of the popover animation so that it
- * is in line with what the side and alignment
- * prop values are. Currently only used
- * with the MD animation.
- */
- const calculatePopoverOrigin = (side, align, isRTL) => {
- switch (side) {
- case 'top':
- return { originX: getOriginXAlignment(align), originY: 'bottom' };
- case 'bottom':
- return { originX: getOriginXAlignment(align), originY: 'top' };
- case 'left':
- return { originX: 'right', originY: getOriginYAlignment(align) };
- case 'right':
- return { originX: 'left', originY: getOriginYAlignment(align) };
- case 'start':
- return { originX: isRTL ? 'left' : 'right', originY: getOriginYAlignment(align) };
- case 'end':
- return { originX: isRTL ? 'right' : 'left', originY: getOriginYAlignment(align) };
- }
- };
- const getOriginXAlignment = (align) => {
- switch (align) {
- case 'start':
- return 'left';
- case 'center':
- return 'center';
- case 'end':
- return 'right';
- }
- };
- const getOriginYAlignment = (align) => {
- switch (align) {
- case 'start':
- return 'top';
- case 'center':
- return 'center';
- case 'end':
- return 'bottom';
- }
- };
- /**
- * Calculates where the arrow positioning
- * should be relative to the popover content.
- */
- const calculateArrowPosition = (side, arrowWidth, arrowHeight, top, left, contentWidth, contentHeight, isRTL) => {
- /**
- * Note: When side is left, right, start, or end, the arrow is
- * been rotated using a `transform`, so to move the arrow up or down
- * by its dimension, you need to use `arrowWidth`.
- */
- const leftPosition = {
- arrowTop: top + contentHeight / 2 - arrowWidth / 2,
- arrowLeft: left + contentWidth - arrowWidth / 2,
- };
- /**
- * Move the arrow to the left by arrowWidth and then
- * again by half of its width because we have rotated
- * the arrow using a transform.
- */
- const rightPosition = { arrowTop: top + contentHeight / 2 - arrowWidth / 2, arrowLeft: left - arrowWidth * 1.5 };
- switch (side) {
- case 'top':
- return { arrowTop: top + contentHeight, arrowLeft: left + contentWidth / 2 - arrowWidth / 2 };
- case 'bottom':
- return { arrowTop: top - arrowHeight, arrowLeft: left + contentWidth / 2 - arrowWidth / 2 };
- case 'left':
- return leftPosition;
- case 'right':
- return rightPosition;
- case 'start':
- return isRTL ? rightPosition : leftPosition;
- case 'end':
- return isRTL ? leftPosition : rightPosition;
- default:
- return { arrowTop: 0, arrowLeft: 0 };
- }
- };
- /**
- * Calculates the required top/left
- * values needed to position the popover
- * content on the side specified in the
- * `side` prop.
- */
- const calculatePopoverSide = (side, triggerBoundingBox, contentWidth, contentHeight, arrowWidth, arrowHeight, isRTL) => {
- const sideLeft = {
- top: triggerBoundingBox.top,
- left: triggerBoundingBox.left - contentWidth - arrowWidth,
- };
- const sideRight = {
- top: triggerBoundingBox.top,
- left: triggerBoundingBox.left + triggerBoundingBox.width + arrowWidth,
- };
- switch (side) {
- case 'top':
- return {
- top: triggerBoundingBox.top - contentHeight - arrowHeight,
- left: triggerBoundingBox.left,
- };
- case 'right':
- return sideRight;
- case 'bottom':
- return {
- top: triggerBoundingBox.top + triggerBoundingBox.height + arrowHeight,
- left: triggerBoundingBox.left,
- };
- case 'left':
- return sideLeft;
- case 'start':
- return isRTL ? sideRight : sideLeft;
- case 'end':
- return isRTL ? sideLeft : sideRight;
- }
- };
- /**
- * Calculates the required top/left
- * offset values needed to provide the
- * correct alignment regardless while taking
- * into account the side the popover is on.
- */
- const calculatePopoverAlign = (align, side, triggerBoundingBox, contentWidth, contentHeight) => {
- switch (align) {
- case 'center':
- return calculatePopoverCenterAlign(side, triggerBoundingBox, contentWidth, contentHeight);
- case 'end':
- return calculatePopoverEndAlign(side, triggerBoundingBox, contentWidth, contentHeight);
- case 'start':
- default:
- return { top: 0, left: 0 };
- }
- };
- /**
- * Calculate the end alignment for
- * the popover. If side is on the x-axis
- * then the align values refer to the top
- * and bottom margins of the content.
- * If side is on the y-axis then the
- * align values refer to the left and right
- * margins of the content.
- */
- const calculatePopoverEndAlign = (side, triggerBoundingBox, contentWidth, contentHeight) => {
- switch (side) {
- case 'start':
- case 'end':
- case 'left':
- case 'right':
- return {
- top: -(contentHeight - triggerBoundingBox.height),
- left: 0,
- };
- case 'top':
- case 'bottom':
- default:
- return {
- top: 0,
- left: -(contentWidth - triggerBoundingBox.width),
- };
- }
- };
- /**
- * Calculate the center alignment for
- * the popover. If side is on the x-axis
- * then the align values refer to the top
- * and bottom margins of the content.
- * If side is on the y-axis then the
- * align values refer to the left and right
- * margins of the content.
- */
- const calculatePopoverCenterAlign = (side, triggerBoundingBox, contentWidth, contentHeight) => {
- switch (side) {
- case 'start':
- case 'end':
- case 'left':
- case 'right':
- return {
- top: -(contentHeight / 2 - triggerBoundingBox.height / 2),
- left: 0,
- };
- case 'top':
- case 'bottom':
- default:
- return {
- top: 0,
- left: -(contentWidth / 2 - triggerBoundingBox.width / 2),
- };
- }
- };
- /**
- * Adjusts popover positioning coordinates
- * such that popover does not appear offscreen
- * or overlapping safe area bounds.
- */
- const calculateWindowAdjustment = (side, coordTop, coordLeft, bodyPadding, bodyWidth, bodyHeight, contentWidth, contentHeight, safeAreaMargin, contentOriginX, contentOriginY, triggerCoordinates, coordArrowTop = 0, coordArrowLeft = 0, arrowHeight = 0) => {
- let arrowTop = coordArrowTop;
- const arrowLeft = coordArrowLeft;
- let left = coordLeft;
- let top = coordTop;
- let bottom;
- let originX = contentOriginX;
- let originY = contentOriginY;
- let checkSafeAreaLeft = false;
- let checkSafeAreaRight = false;
- const triggerTop = triggerCoordinates
- ? triggerCoordinates.top + triggerCoordinates.height
- : bodyHeight / 2 - contentHeight / 2;
- const triggerHeight = triggerCoordinates ? triggerCoordinates.height : 0;
- let addPopoverBottomClass = false;
- /**
- * Adjust popover so it does not
- * go off the left of the screen.
- */
- if (left < bodyPadding + safeAreaMargin) {
- left = bodyPadding;
- checkSafeAreaLeft = true;
- originX = 'left';
- /**
- * Adjust popover so it does not
- * go off the right of the screen.
- */
- }
- else if (contentWidth + bodyPadding + left + safeAreaMargin > bodyWidth) {
- checkSafeAreaRight = true;
- left = bodyWidth - contentWidth - bodyPadding;
- originX = 'right';
- }
- /**
- * Adjust popover so it does not
- * go off the top of the screen.
- * If popover is on the left or the right of
- * the trigger, then we should not adjust top
- * margins.
- */
- if (triggerTop + triggerHeight + contentHeight > bodyHeight && (side === 'top' || side === 'bottom')) {
- if (triggerTop - contentHeight > 0) {
- /**
- * While we strive to align the popover with the trigger
- * on smaller screens this is not always possible. As a result,
- * we adjust the popover up so that it does not hang
- * off the bottom of the screen. However, we do not want to move
- * the popover up so much that it goes off the top of the screen.
- *
- * We chose 12 here so that the popover position looks a bit nicer as
- * it is not right up against the edge of the screen.
- */
- top = Math.max(12, triggerTop - contentHeight - triggerHeight - (arrowHeight - 1));
- arrowTop = top + contentHeight;
- originY = 'bottom';
- addPopoverBottomClass = true;
- /**
- * If not enough room for popover to appear
- * above trigger, then cut it off.
- */
- }
- else {
- bottom = bodyPadding;
- }
- }
- return {
- top,
- left,
- bottom,
- originX,
- originY,
- checkSafeAreaLeft,
- checkSafeAreaRight,
- arrowTop,
- arrowLeft,
- addPopoverBottomClass,
- };
- };
- const shouldShowArrow = (side, didAdjustBounds = false, ev, trigger) => {
- /**
- * If no event provided and
- * we do not have a trigger,
- * then this popover was likely
- * presented via the popoverController
- * or users called `present` manually.
- * In this case, the arrow should not be
- * shown as we do not have a reference.
- */
- if (!ev && !trigger) {
- return false;
- }
- /**
- * If popover is on the left or the right
- * of a trigger, but we needed to adjust the
- * popover due to screen bounds, then we should
- * hide the arrow as it will never be pointing
- * at the trigger.
- */
- if (side !== 'top' && side !== 'bottom' && didAdjustBounds) {
- return false;
- }
- return true;
- };
- const POPOVER_IOS_BODY_PADDING = 5;
- /**
- * iOS Popover Enter Animation
- */
- // TODO(FW-2832): types
- const iosEnterAnimation$1 = (baseEl, opts) => {
- var _a;
- const { event: ev, size, trigger, reference, side, align } = opts;
- const doc = baseEl.ownerDocument;
- const isRTL = doc.dir === 'rtl';
- const bodyWidth = doc.defaultView.innerWidth;
- const bodyHeight = doc.defaultView.innerHeight;
- const root = getElementRoot(baseEl);
- const contentEl = root.querySelector('.popover-content');
- const arrowEl = root.querySelector('.popover-arrow');
- const referenceSizeEl = trigger || ((_a = ev === null || ev === void 0 ? void 0 : ev.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) || (ev === null || ev === void 0 ? void 0 : ev.target);
- const { contentWidth, contentHeight } = getPopoverDimensions(size, contentEl, referenceSizeEl);
- const { arrowWidth, arrowHeight } = getArrowDimensions(arrowEl);
- const defaultPosition = {
- top: bodyHeight / 2 - contentHeight / 2,
- left: bodyWidth / 2 - contentWidth / 2,
- originX: isRTL ? 'right' : 'left',
- originY: 'top',
- };
- const results = getPopoverPosition(isRTL, contentWidth, contentHeight, arrowWidth, arrowHeight, reference, side, align, defaultPosition, trigger, ev);
- const padding = size === 'cover' ? 0 : POPOVER_IOS_BODY_PADDING;
- const margin = size === 'cover' ? 0 : 25;
- const { originX, originY, top, left, bottom, checkSafeAreaLeft, checkSafeAreaRight, arrowTop, arrowLeft, addPopoverBottomClass, } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, margin, results.originX, results.originY, results.referenceCoordinates, results.arrowTop, results.arrowLeft, arrowHeight);
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const contentAnimation = createAnimation();
- backdropAnimation
- .addElement(root.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- // In Chromium, if the wrapper animates, the backdrop filter doesn't work.
- // The Chromium team stated that this behavior is expected and not a bug. The element animating opacity creates a backdrop root for the backdrop-filter.
- // To get around this, instead of animating the wrapper, animate both the arrow and content.
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1148826
- contentAnimation
- .addElement(root.querySelector('.popover-arrow'))
- .addElement(root.querySelector('.popover-content'))
- .fromTo('opacity', 0.01, 1);
- // TODO(FW-4376) Ensure that arrow also blurs when translucent
- return baseAnimation
- .easing('ease')
- .duration(100)
- .beforeAddWrite(() => {
- if (size === 'cover') {
- baseEl.style.setProperty('--width', `${contentWidth}px`);
- }
- if (addPopoverBottomClass) {
- baseEl.classList.add('popover-bottom');
- }
- if (bottom !== undefined) {
- contentEl.style.setProperty('bottom', `${bottom}px`);
- }
- const safeAreaLeft = ' + var(--ion-safe-area-left, 0)';
- const safeAreaRight = ' - var(--ion-safe-area-right, 0)';
- let leftValue = `${left}px`;
- if (checkSafeAreaLeft) {
- leftValue = `${left}px${safeAreaLeft}`;
- }
- if (checkSafeAreaRight) {
- leftValue = `${left}px${safeAreaRight}`;
- }
- contentEl.style.setProperty('top', `calc(${top}px + var(--offset-y, 0))`);
- contentEl.style.setProperty('left', `calc(${leftValue} + var(--offset-x, 0))`);
- contentEl.style.setProperty('transform-origin', `${originY} ${originX}`);
- if (arrowEl !== null) {
- const didAdjustBounds = results.top !== top || results.left !== left;
- const showArrow = shouldShowArrow(side, didAdjustBounds, ev, trigger);
- if (showArrow) {
- arrowEl.style.setProperty('top', `calc(${arrowTop}px + var(--offset-y, 0))`);
- arrowEl.style.setProperty('left', `calc(${arrowLeft}px + var(--offset-x, 0))`);
- }
- else {
- arrowEl.style.setProperty('display', 'none');
- }
- }
- })
- .addAnimation([backdropAnimation, contentAnimation]);
- };
- /**
- * iOS Popover Leave Animation
- */
- const iosLeaveAnimation$1 = (baseEl) => {
- const root = getElementRoot(baseEl);
- const contentEl = root.querySelector('.popover-content');
- const arrowEl = root.querySelector('.popover-arrow');
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const contentAnimation = createAnimation();
- backdropAnimation.addElement(root.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- contentAnimation
- .addElement(root.querySelector('.popover-arrow'))
- .addElement(root.querySelector('.popover-content'))
- .fromTo('opacity', 0.99, 0);
- return baseAnimation
- .easing('ease')
- .afterAddWrite(() => {
- baseEl.style.removeProperty('--width');
- baseEl.classList.remove('popover-bottom');
- contentEl.style.removeProperty('top');
- contentEl.style.removeProperty('left');
- contentEl.style.removeProperty('bottom');
- contentEl.style.removeProperty('transform-origin');
- if (arrowEl) {
- arrowEl.style.removeProperty('top');
- arrowEl.style.removeProperty('left');
- arrowEl.style.removeProperty('display');
- }
- })
- .duration(300)
- .addAnimation([backdropAnimation, contentAnimation]);
- };
- const POPOVER_MD_BODY_PADDING = 12;
- /**
- * Md Popover Enter Animation
- */
- // TODO(FW-2832): types
- const mdEnterAnimation$1 = (baseEl, opts) => {
- var _a;
- const { event: ev, size, trigger, reference, side, align } = opts;
- const doc = baseEl.ownerDocument;
- const isRTL = doc.dir === 'rtl';
- const bodyWidth = doc.defaultView.innerWidth;
- const bodyHeight = doc.defaultView.innerHeight;
- const root = getElementRoot(baseEl);
- const contentEl = root.querySelector('.popover-content');
- const referenceSizeEl = trigger || ((_a = ev === null || ev === void 0 ? void 0 : ev.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) || (ev === null || ev === void 0 ? void 0 : ev.target);
- const { contentWidth, contentHeight } = getPopoverDimensions(size, contentEl, referenceSizeEl);
- const defaultPosition = {
- top: bodyHeight / 2 - contentHeight / 2,
- left: bodyWidth / 2 - contentWidth / 2,
- originX: isRTL ? 'right' : 'left',
- originY: 'top',
- };
- const results = getPopoverPosition(isRTL, contentWidth, contentHeight, 0, 0, reference, side, align, defaultPosition, trigger, ev);
- const padding = size === 'cover' ? 0 : POPOVER_MD_BODY_PADDING;
- const { originX, originY, top, left, bottom } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, 0, results.originX, results.originY, results.referenceCoordinates);
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- const contentAnimation = createAnimation();
- const viewportAnimation = createAnimation();
- backdropAnimation
- .addElement(root.querySelector('ion-backdrop'))
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
- .beforeStyles({
- 'pointer-events': 'none',
- })
- .afterClearStyles(['pointer-events']);
- wrapperAnimation.addElement(root.querySelector('.popover-wrapper')).duration(150).fromTo('opacity', 0.01, 1);
- contentAnimation
- .addElement(contentEl)
- .beforeStyles({
- top: `calc(${top}px + var(--offset-y, 0px))`,
- left: `calc(${left}px + var(--offset-x, 0px))`,
- 'transform-origin': `${originY} ${originX}`,
- })
- .beforeAddWrite(() => {
- if (bottom !== undefined) {
- contentEl.style.setProperty('bottom', `${bottom}px`);
- }
- })
- .fromTo('transform', 'scale(0.8)', 'scale(1)');
- viewportAnimation.addElement(root.querySelector('.popover-viewport')).fromTo('opacity', 0.01, 1);
- return baseAnimation
- .easing('cubic-bezier(0.36,0.66,0.04,1)')
- .duration(300)
- .beforeAddWrite(() => {
- if (size === 'cover') {
- baseEl.style.setProperty('--width', `${contentWidth}px`);
- }
- if (originY === 'bottom') {
- baseEl.classList.add('popover-bottom');
- }
- })
- .addAnimation([backdropAnimation, wrapperAnimation, contentAnimation, viewportAnimation]);
- };
- /**
- * Md Popover Leave Animation
- */
- const mdLeaveAnimation$1 = (baseEl) => {
- const root = getElementRoot(baseEl);
- const contentEl = root.querySelector('.popover-content');
- const baseAnimation = createAnimation();
- const backdropAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- backdropAnimation.addElement(root.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
- wrapperAnimation.addElement(root.querySelector('.popover-wrapper')).fromTo('opacity', 0.99, 0);
- return baseAnimation
- .easing('ease')
- .afterAddWrite(() => {
- baseEl.style.removeProperty('--width');
- baseEl.classList.remove('popover-bottom');
- contentEl.style.removeProperty('top');
- contentEl.style.removeProperty('left');
- contentEl.style.removeProperty('bottom');
- contentEl.style.removeProperty('transform-origin');
- })
- .duration(150)
- .addAnimation([backdropAnimation, wrapperAnimation]);
- };
- const popoverIosCss = ":host{--background:var(--ion-background-color, #fff);--min-width:0;--min-height:0;--max-width:auto;--height:auto;--offset-x:0px;--offset-y:0px;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);z-index:1001}:host(.popover-nested){pointer-events:none}:host(.popover-nested) .popover-wrapper{pointer-events:auto}:host(.overlay-hidden){display:none}.popover-wrapper{z-index:10}.popover-content{display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:auto;z-index:10}::slotted(.popover-viewport){--ion-safe-area-top:0px;--ion-safe-area-right:0px;--ion-safe-area-bottom:0px;--ion-safe-area-left:0px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host(.popover-nested.popover-side-left){--offset-x:5px}:host(.popover-nested.popover-side-right){--offset-x:-5px}:host(.popover-nested.popover-side-start){--offset-x:5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-start),:host-context([dir=rtl]).popover-nested.popover-side-start{--offset-x:-5px}@supports selector(:dir(rtl)){:host(.popover-nested.popover-side-start:dir(rtl)){--offset-x:-5px}}:host(.popover-nested.popover-side-end){--offset-x:-5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-end),:host-context([dir=rtl]).popover-nested.popover-side-end{--offset-x:5px}@supports selector(:dir(rtl)){:host(.popover-nested.popover-side-end:dir(rtl)){--offset-x:5px}}:host{--width:200px;--max-height:90%;--box-shadow:none;--backdrop-opacity:var(--ion-backdrop-opacity, 0.08)}:host(.popover-desktop){--box-shadow:0px 4px 16px 0px rgba(0, 0, 0, 0.12)}.popover-content{border-radius:10px}:host(.popover-desktop) .popover-content{border:0.5px solid var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}.popover-arrow{display:block;position:absolute;width:20px;height:10px;overflow:hidden;z-index:11}.popover-arrow::after{top:3px;border-radius:3px;position:absolute;width:14px;height:14px;-webkit-transform:rotate(45deg);transform:rotate(45deg);background:var(--background);content:\"\";z-index:10}.popover-arrow::after{inset-inline-start:3px}:host(.popover-bottom) .popover-arrow{top:auto;bottom:-10px}:host(.popover-bottom) .popover-arrow::after{top:-6px}:host(.popover-side-left) .popover-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}:host(.popover-side-right) .popover-arrow{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}:host(.popover-side-top) .popover-arrow{-webkit-transform:rotate(180deg);transform:rotate(180deg)}:host(.popover-side-start) .popover-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}:host-context([dir=rtl]):host(.popover-side-start) .popover-arrow,:host-context([dir=rtl]).popover-side-start .popover-arrow{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}@supports selector(:dir(rtl)){:host(.popover-side-start:dir(rtl)) .popover-arrow{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}}:host(.popover-side-end) .popover-arrow{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}:host-context([dir=rtl]):host(.popover-side-end) .popover-arrow,:host-context([dir=rtl]).popover-side-end .popover-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}@supports selector(:dir(rtl)){:host(.popover-side-end:dir(rtl)) .popover-arrow{-webkit-transform:rotate(90deg);transform:rotate(90deg)}}.popover-arrow,.popover-content{opacity:0}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.popover-translucent) .popover-content,:host(.popover-translucent) .popover-arrow::after{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}";
- var IonPopoverIosStyle0 = popoverIosCss;
- const popoverMdCss = ":host{--background:var(--ion-background-color, #fff);--min-width:0;--min-height:0;--max-width:auto;--height:auto;--offset-x:0px;--offset-y:0px;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);z-index:1001}:host(.popover-nested){pointer-events:none}:host(.popover-nested) .popover-wrapper{pointer-events:auto}:host(.overlay-hidden){display:none}.popover-wrapper{z-index:10}.popover-content{display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:auto;z-index:10}::slotted(.popover-viewport){--ion-safe-area-top:0px;--ion-safe-area-right:0px;--ion-safe-area-bottom:0px;--ion-safe-area-left:0px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host(.popover-nested.popover-side-left){--offset-x:5px}:host(.popover-nested.popover-side-right){--offset-x:-5px}:host(.popover-nested.popover-side-start){--offset-x:5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-start),:host-context([dir=rtl]).popover-nested.popover-side-start{--offset-x:-5px}@supports selector(:dir(rtl)){:host(.popover-nested.popover-side-start:dir(rtl)){--offset-x:-5px}}:host(.popover-nested.popover-side-end){--offset-x:-5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-end),:host-context([dir=rtl]).popover-nested.popover-side-end{--offset-x:5px}@supports selector(:dir(rtl)){:host(.popover-nested.popover-side-end:dir(rtl)){--offset-x:5px}}:host{--width:250px;--max-height:90%;--box-shadow:0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}.popover-content{border-radius:4px;-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]) .popover-content{-webkit-transform-origin:right top;transform-origin:right top}[dir=rtl] .popover-content{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.popover-content:dir(rtl){-webkit-transform-origin:right top;transform-origin:right top}}.popover-viewport{-webkit-transition-delay:100ms;transition-delay:100ms}.popover-wrapper{opacity:0}";
- var IonPopoverMdStyle0 = popoverMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - Content is placed inside of the `.popover-content` element.
- *
- * @part backdrop - The `ion-backdrop` element.
- * @part arrow - The arrow that points to the reference element. Only applies on `ios` mode.
- * @part content - The wrapper element for the default slot.
- */
- class Popover {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.didPresent = createEvent(this, "ionPopoverDidPresent", 7);
- this.willPresent = createEvent(this, "ionPopoverWillPresent", 7);
- this.willDismiss = createEvent(this, "ionPopoverWillDismiss", 7);
- this.didDismiss = createEvent(this, "ionPopoverDidDismiss", 7);
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
- this.ionMount = createEvent(this, "ionMount", 7);
- this.parentPopover = null;
- this.coreDelegate = CoreDelegate();
- this.lockController = createLockController();
- this.inline = false;
- this.focusDescendantOnPresent = false;
- this.onBackdropTap = () => {
- this.dismiss(undefined, BACKDROP);
- };
- this.onLifecycle = (modalEvent) => {
- const el = this.usersElement;
- const name = LIFECYCLE_MAP[modalEvent.type];
- if (el && name) {
- const event = new CustomEvent(name, {
- bubbles: false,
- cancelable: false,
- detail: modalEvent.detail,
- });
- el.dispatchEvent(event);
- }
- };
- this.configureTriggerInteraction = () => {
- const { trigger, triggerAction, el, destroyTriggerInteraction } = this;
- if (destroyTriggerInteraction) {
- destroyTriggerInteraction();
- }
- if (trigger === undefined) {
- return;
- }
- const triggerEl = (this.triggerEl = trigger !== undefined ? document.getElementById(trigger) : null);
- if (!triggerEl) {
- printIonWarning(`[ion-popover] - A trigger element with the ID "${trigger}" was not found in the DOM. The trigger element must be in the DOM when the "trigger" property is set on ion-popover.`, this.el);
- return;
- }
- this.destroyTriggerInteraction = configureTriggerInteraction(triggerEl, triggerAction, el);
- };
- this.configureKeyboardInteraction = () => {
- const { destroyKeyboardInteraction, el } = this;
- if (destroyKeyboardInteraction) {
- destroyKeyboardInteraction();
- }
- this.destroyKeyboardInteraction = configureKeyboardInteraction(el);
- };
- this.configureDismissInteraction = () => {
- const { destroyDismissInteraction, parentPopover, triggerAction, triggerEl, el } = this;
- if (!parentPopover || !triggerEl) {
- return;
- }
- if (destroyDismissInteraction) {
- destroyDismissInteraction();
- }
- this.destroyDismissInteraction = configureDismissInteraction(triggerEl, triggerAction, el, parentPopover);
- };
- this.presented = false;
- this.hasController = false;
- this.delegate = undefined;
- this.overlayIndex = undefined;
- this.enterAnimation = undefined;
- this.leaveAnimation = undefined;
- this.component = undefined;
- this.componentProps = undefined;
- this.keyboardClose = true;
- this.cssClass = undefined;
- this.backdropDismiss = true;
- this.event = undefined;
- this.showBackdrop = true;
- this.translucent = false;
- this.animated = true;
- this.htmlAttributes = undefined;
- this.triggerAction = 'click';
- this.trigger = undefined;
- this.size = 'auto';
- this.dismissOnSelect = false;
- this.reference = 'trigger';
- this.side = 'bottom';
- this.alignment = undefined;
- this.arrow = true;
- this.isOpen = false;
- this.keyboardEvents = false;
- this.focusTrap = true;
- this.keepContentsMounted = false;
- }
- onTriggerChange() {
- this.configureTriggerInteraction();
- }
- onIsOpenChange(newValue, oldValue) {
- if (newValue === true && oldValue === false) {
- this.present();
- }
- else if (newValue === false && oldValue === true) {
- this.dismiss();
- }
- }
- connectedCallback() {
- const { configureTriggerInteraction, el } = this;
- prepareOverlay(el);
- configureTriggerInteraction();
- }
- disconnectedCallback() {
- const { destroyTriggerInteraction } = this;
- if (destroyTriggerInteraction) {
- destroyTriggerInteraction();
- }
- }
- componentWillLoad() {
- var _a, _b;
- const { el } = this;
- const popoverId = (_b = (_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : setOverlayId(el);
- this.parentPopover = el.closest(`ion-popover:not(#${popoverId})`);
- if (this.alignment === undefined) {
- this.alignment = getIonMode$1(this) === 'ios' ? 'center' : 'start';
- }
- }
- componentDidLoad() {
- const { parentPopover, isOpen } = this;
- /**
- * If popover was rendered with isOpen="true"
- * then we should open popover immediately.
- */
- if (isOpen === true) {
- raf(() => this.present());
- }
- if (parentPopover) {
- addEventListener$1(parentPopover, 'ionPopoverWillDismiss', () => {
- this.dismiss(undefined, undefined, false);
- });
- }
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.configureTriggerInteraction();
- }
- /**
- * When opening a popover from a trigger, we should not be
- * modifying the `event` prop from inside the component.
- * Additionally, when pressing the "Right" arrow key, we need
- * to shift focus to the first descendant in the newly presented
- * popover.
- *
- * @internal
- */
- async presentFromTrigger(event, focusDescendant = false) {
- this.focusDescendantOnPresent = focusDescendant;
- await this.present(event);
- this.focusDescendantOnPresent = false;
- }
- /**
- * Determines whether or not an overlay
- * is being used inline or via a controller/JS
- * and returns the correct delegate.
- * By default, subsequent calls to getDelegate
- * will use a cached version of the delegate.
- * This is useful for calling dismiss after
- * present so that the correct delegate is given.
- */
- getDelegate(force = false) {
- if (this.workingDelegate && !force) {
- return {
- delegate: this.workingDelegate,
- inline: this.inline,
- };
- }
- /**
- * If using overlay inline
- * we potentially need to use the coreDelegate
- * so that this works in vanilla JS apps.
- * If a developer has presented this component
- * via a controller, then we can assume
- * the component is already in the
- * correct place.
- */
- const parentEl = this.el.parentNode;
- const inline = (this.inline = parentEl !== null && !this.hasController);
- const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
- return { inline, delegate };
- }
- /**
- * Present the popover overlay after it has been created.
- * Developers can pass a mouse, touch, or pointer event
- * to position the popover relative to where that event
- * was dispatched.
- */
- async present(event) {
- const unlock = await this.lockController.lock();
- if (this.presented) {
- unlock();
- return;
- }
- const { el } = this;
- const { inline, delegate } = this.getDelegate(true);
- /**
- * Emit ionMount so JS Frameworks have an opportunity
- * to add the child component to the DOM. The child
- * component will be assigned to this.usersElement below.
- */
- this.ionMount.emit();
- this.usersElement = await attachComponent(delegate, el, this.component, ['popover-viewport'], this.componentProps, inline);
- if (!this.keyboardEvents) {
- this.configureKeyboardInteraction();
- }
- this.configureDismissInteraction();
- /**
- * When using the lazy loaded build of Stencil, we need to wait
- * for every Stencil component instance to be ready before presenting
- * otherwise there can be a flash of unstyled content. With the
- * custom elements bundle we need to wait for the JS framework
- * mount the inner contents of the overlay otherwise WebKit may
- * get the transition incorrect.
- */
- if (hasLazyBuild(el)) {
- await deepReady(this.usersElement);
- /**
- * If keepContentsMounted="true" then the
- * JS Framework has already mounted the inner
- * contents so there is no need to wait.
- * Otherwise, we need to wait for the JS
- * Framework to mount the inner contents
- * of this component.
- */
- }
- else if (!this.keepContentsMounted) {
- await waitForMount();
- }
- await present(this, 'popoverEnter', iosEnterAnimation$1, mdEnterAnimation$1, {
- event: event || this.event,
- size: this.size,
- trigger: this.triggerEl,
- reference: this.reference,
- side: this.side,
- align: this.alignment,
- });
- /**
- * If popover is nested and was
- * presented using the "Right" arrow key,
- * we need to move focus to the first
- * descendant inside of the popover.
- */
- if (this.focusDescendantOnPresent) {
- focusFirstDescendant(el);
- }
- unlock();
- }
- /**
- * Dismiss the popover overlay after it has been presented.
- *
- * @param data Any data to emit in the dismiss events.
- * @param role The role of the element that is dismissing the popover. For example, 'cancel' or 'backdrop'.
- * @param dismissParentPopover If `true`, dismissing this popover will also dismiss
- * a parent popover if this popover is nested. Defaults to `true`.
- *
- * This is a no-op if the overlay has not been presented yet. If you want
- * to remove an overlay from the DOM that was never presented, use the
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
- */
- async dismiss(data, role, dismissParentPopover = true) {
- const unlock = await this.lockController.lock();
- const { destroyKeyboardInteraction, destroyDismissInteraction } = this;
- if (dismissParentPopover && this.parentPopover) {
- this.parentPopover.dismiss(data, role, dismissParentPopover);
- }
- const shouldDismiss = await dismiss(this, data, role, 'popoverLeave', iosLeaveAnimation$1, mdLeaveAnimation$1, this.event);
- if (shouldDismiss) {
- if (destroyKeyboardInteraction) {
- destroyKeyboardInteraction();
- this.destroyKeyboardInteraction = undefined;
- }
- if (destroyDismissInteraction) {
- destroyDismissInteraction();
- this.destroyDismissInteraction = undefined;
- }
- /**
- * If using popover inline
- * we potentially need to use the coreDelegate
- * so that this works in vanilla JS apps
- */
- const { delegate } = this.getDelegate();
- await detachComponent(delegate, this.usersElement);
- }
- unlock();
- return shouldDismiss;
- }
- /**
- * @internal
- */
- async getParentPopover() {
- return this.parentPopover;
- }
- /**
- * Returns a promise that resolves when the popover did dismiss.
- */
- onDidDismiss() {
- return eventMethod(this.el, 'ionPopoverDidDismiss');
- }
- /**
- * Returns a promise that resolves when the popover will dismiss.
- */
- onWillDismiss() {
- return eventMethod(this.el, 'ionPopoverWillDismiss');
- }
- render() {
- const mode = getIonMode$1(this);
- const { onLifecycle, parentPopover, dismissOnSelect, side, arrow, htmlAttributes, focusTrap } = this;
- const desktop = isPlatform('desktop');
- const enableArrow = arrow && !parentPopover;
- return (hAsync(Host, Object.assign({ key: 'ff24e8d9677711248a36994cce568e74ba151499', "aria-modal": "true", "no-router": true, tabindex: "-1" }, htmlAttributes, { style: {
- zIndex: `${20000 + this.overlayIndex}`,
- }, class: Object.assign(Object.assign({}, getClassMap(this.cssClass)), { [mode]: true, 'popover-translucent': this.translucent, 'overlay-hidden': true, 'popover-desktop': desktop, [`popover-side-${side}`]: true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false, 'popover-nested': !!parentPopover }), onIonPopoverDidPresent: onLifecycle, onIonPopoverWillPresent: onLifecycle, onIonPopoverWillDismiss: onLifecycle, onIonPopoverDidDismiss: onLifecycle, onIonBackdropTap: this.onBackdropTap }), !parentPopover && hAsync("ion-backdrop", { key: 'aca68b4002a08b0e563a976a867141162c20f8b4', tappable: this.backdropDismiss, visible: this.showBackdrop, part: "backdrop" }), hAsync("div", { key: '62d21d1eab5c6d675d49932559ffb161747e5fec', class: "popover-wrapper ion-overlay-wrapper", onClick: dismissOnSelect ? () => this.dismiss() : undefined }, enableArrow && hAsync("div", { key: '1b46cc77d5302637fc979353483bb5fd780fd1d3', class: "popover-arrow", part: "arrow" }), hAsync("div", { key: 'a5657bff26e46d1959b71eb0992e7dc8fcae86f1', class: "popover-content", part: "content" }, hAsync("slot", { key: 'e1a98007226a46b51109e7004c4d338ca1bc0f9e' })))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "trigger": ["onTriggerChange"],
- "triggerAction": ["onTriggerChange"],
- "isOpen": ["onIsOpenChange"]
- }; }
- static get style() { return {
- ios: IonPopoverIosStyle0,
- md: IonPopoverMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-popover",
- "$members$": {
- "hasController": [4, "has-controller"],
- "delegate": [16],
- "overlayIndex": [2, "overlay-index"],
- "enterAnimation": [16],
- "leaveAnimation": [16],
- "component": [1],
- "componentProps": [16],
- "keyboardClose": [4, "keyboard-close"],
- "cssClass": [1, "css-class"],
- "backdropDismiss": [4, "backdrop-dismiss"],
- "event": [8],
- "showBackdrop": [4, "show-backdrop"],
- "translucent": [4],
- "animated": [4],
- "htmlAttributes": [16],
- "triggerAction": [1, "trigger-action"],
- "trigger": [1],
- "size": [1],
- "dismissOnSelect": [4, "dismiss-on-select"],
- "reference": [1],
- "side": [1],
- "alignment": [1025],
- "arrow": [4],
- "isOpen": [4, "is-open"],
- "keyboardEvents": [4, "keyboard-events"],
- "focusTrap": [4, "focus-trap"],
- "keepContentsMounted": [4, "keep-contents-mounted"],
- "presented": [32],
- "presentFromTrigger": [64],
- "present": [64],
- "dismiss": [64],
- "getParentPopover": [64],
- "onDidDismiss": [64],
- "onWillDismiss": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const LIFECYCLE_MAP = {
- ionPopoverDidPresent: 'ionViewDidEnter',
- ionPopoverWillPresent: 'ionViewWillEnter',
- ionPopoverWillDismiss: 'ionViewWillLeave',
- ionPopoverDidDismiss: 'ionViewDidLeave',
- };
- const progressBarIosCss = ":host{--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.3);--progress-background:var(--ion-color-primary, #0054e9);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:-webkit-transform 150ms linear;transition:-webkit-transform 150ms linear;transition:transform 150ms linear;transition:transform 150ms linear, -webkit-transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;-webkit-animation:primary-indeterminate-translate 2s infinite linear;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{-webkit-animation:primary-indeterminate-scale 2s infinite linear;animation:primary-indeterminate-scale 2s infinite linear;-webkit-animation-play-state:inherit;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;-webkit-animation:secondary-indeterminate-translate 2s infinite linear;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{-webkit-animation:secondary-indeterminate-scale 2s infinite linear;animation:secondary-indeterminate-scale 2s infinite linear;-webkit-animation-play-state:inherit;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--background) 0%, var(--background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;-webkit-animation:buffering 450ms infinite linear;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{-webkit-animation-play-state:paused;animation-play-state:paused}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@-webkit-keyframes primary-indeterminate-translate{0%{-webkit-transform:translateX(0);transform:translateX(0)}20%{-webkit-animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);-webkit-transform:translateX(0);transform:translateX(0)}59.15%{-webkit-animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);-webkit-transform:translateX(83.67142%);transform:translateX(83.67142%)}100%{-webkit-transform:translateX(200.611057%);transform:translateX(200.611057%)}}@keyframes primary-indeterminate-translate{0%{-webkit-transform:translateX(0);transform:translateX(0)}20%{-webkit-animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);-webkit-transform:translateX(0);transform:translateX(0)}59.15%{-webkit-animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);-webkit-transform:translateX(83.67142%);transform:translateX(83.67142%)}100%{-webkit-transform:translateX(200.611057%);transform:translateX(200.611057%)}}@-webkit-keyframes primary-indeterminate-scale{0%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}36.65%{-webkit-animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}69.15%{-webkit-animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);-webkit-transform:scaleX(0.661479);transform:scaleX(0.661479)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@keyframes primary-indeterminate-scale{0%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}36.65%{-webkit-animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}69.15%{-webkit-animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);-webkit-transform:scaleX(0.661479);transform:scaleX(0.661479)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@-webkit-keyframes secondary-indeterminate-translate{0%{-webkit-animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);-webkit-transform:translateX(0);transform:translateX(0)}25%{-webkit-animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);-webkit-transform:translateX(37.651913%);transform:translateX(37.651913%)}48.35%{-webkit-animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);-webkit-transform:translateX(84.386165%);transform:translateX(84.386165%)}100%{-webkit-transform:translateX(160.277782%);transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-translate{0%{-webkit-animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);-webkit-transform:translateX(0);transform:translateX(0)}25%{-webkit-animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);-webkit-transform:translateX(37.651913%);transform:translateX(37.651913%)}48.35%{-webkit-animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);-webkit-transform:translateX(84.386165%);transform:translateX(84.386165%)}100%{-webkit-transform:translateX(160.277782%);transform:translateX(160.277782%)}}@-webkit-keyframes secondary-indeterminate-scale{0%{-webkit-animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}19.15%{-webkit-animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);-webkit-transform:scaleX(0.457104);transform:scaleX(0.457104)}44.15%{-webkit-animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);-webkit-transform:scaleX(0.72796);transform:scaleX(0.72796)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@keyframes secondary-indeterminate-scale{0%{-webkit-animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}19.15%{-webkit-animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);-webkit-transform:scaleX(0.457104);transform:scaleX(0.457104)}44.15%{-webkit-animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);-webkit-transform:scaleX(0.72796);transform:scaleX(0.72796)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@-webkit-keyframes buffering{to{-webkit-transform:translateX(-10px);transform:translateX(-10px)}}@keyframes buffering{to{-webkit-transform:translateX(-10px);transform:translateX(-10px)}}:host{border-radius:9999px;height:4px}:host(.progress-bar-solid){--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}";
- var IonProgressBarIosStyle0 = progressBarIosCss;
- const progressBarMdCss = ":host{--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.3);--progress-background:var(--ion-color-primary, #0054e9);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:-webkit-transform 150ms linear;transition:-webkit-transform 150ms linear;transition:transform 150ms linear;transition:transform 150ms linear, -webkit-transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;-webkit-animation:primary-indeterminate-translate 2s infinite linear;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{-webkit-animation:primary-indeterminate-scale 2s infinite linear;animation:primary-indeterminate-scale 2s infinite linear;-webkit-animation-play-state:inherit;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;-webkit-animation:secondary-indeterminate-translate 2s infinite linear;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{-webkit-animation:secondary-indeterminate-scale 2s infinite linear;animation:secondary-indeterminate-scale 2s infinite linear;-webkit-animation-play-state:inherit;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--background) 0%, var(--background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;-webkit-animation:buffering 450ms infinite linear;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{-webkit-animation-play-state:paused;animation-play-state:paused}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@-webkit-keyframes primary-indeterminate-translate{0%{-webkit-transform:translateX(0);transform:translateX(0)}20%{-webkit-animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);-webkit-transform:translateX(0);transform:translateX(0)}59.15%{-webkit-animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);-webkit-transform:translateX(83.67142%);transform:translateX(83.67142%)}100%{-webkit-transform:translateX(200.611057%);transform:translateX(200.611057%)}}@keyframes primary-indeterminate-translate{0%{-webkit-transform:translateX(0);transform:translateX(0)}20%{-webkit-animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);-webkit-transform:translateX(0);transform:translateX(0)}59.15%{-webkit-animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);-webkit-transform:translateX(83.67142%);transform:translateX(83.67142%)}100%{-webkit-transform:translateX(200.611057%);transform:translateX(200.611057%)}}@-webkit-keyframes primary-indeterminate-scale{0%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}36.65%{-webkit-animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}69.15%{-webkit-animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);-webkit-transform:scaleX(0.661479);transform:scaleX(0.661479)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@keyframes primary-indeterminate-scale{0%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}36.65%{-webkit-animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}69.15%{-webkit-animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);-webkit-transform:scaleX(0.661479);transform:scaleX(0.661479)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@-webkit-keyframes secondary-indeterminate-translate{0%{-webkit-animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);-webkit-transform:translateX(0);transform:translateX(0)}25%{-webkit-animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);-webkit-transform:translateX(37.651913%);transform:translateX(37.651913%)}48.35%{-webkit-animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);-webkit-transform:translateX(84.386165%);transform:translateX(84.386165%)}100%{-webkit-transform:translateX(160.277782%);transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-translate{0%{-webkit-animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);-webkit-transform:translateX(0);transform:translateX(0)}25%{-webkit-animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);-webkit-transform:translateX(37.651913%);transform:translateX(37.651913%)}48.35%{-webkit-animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);-webkit-transform:translateX(84.386165%);transform:translateX(84.386165%)}100%{-webkit-transform:translateX(160.277782%);transform:translateX(160.277782%)}}@-webkit-keyframes secondary-indeterminate-scale{0%{-webkit-animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}19.15%{-webkit-animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);-webkit-transform:scaleX(0.457104);transform:scaleX(0.457104)}44.15%{-webkit-animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);-webkit-transform:scaleX(0.72796);transform:scaleX(0.72796)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@keyframes secondary-indeterminate-scale{0%{-webkit-animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}19.15%{-webkit-animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);-webkit-transform:scaleX(0.457104);transform:scaleX(0.457104)}44.15%{-webkit-animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);-webkit-transform:scaleX(0.72796);transform:scaleX(0.72796)}100%{-webkit-transform:scaleX(0.08);transform:scaleX(0.08)}}@-webkit-keyframes buffering{to{-webkit-transform:translateX(-10px);transform:translateX(-10px)}}@keyframes buffering{to{-webkit-transform:translateX(-10px);transform:translateX(-10px)}}:host{height:4px}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}";
- var IonProgressBarMdStyle0 = progressBarMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part progress - The progress bar that shows the current value when `type` is `"determinate"` and slides back and forth when `type` is `"indeterminate"`.
- * @part stream - The animated circles that appear while buffering. This only shows when `buffer` is set and `type` is `"determinate"`.
- * @part track - The track bar behind the progress bar. If the `buffer` property is set and `type` is `"determinate"` the track will be the
- * width of the `buffer` value.
- */
- class ProgressBar {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.type = 'determinate';
- this.reversed = false;
- this.value = 0;
- this.buffer = 1;
- this.color = undefined;
- }
- render() {
- const { color, type, reversed, value, buffer } = this;
- const paused = config.getBoolean('_testing');
- const mode = getIonMode$1(this);
- // If the progress is displayed as a solid bar.
- const progressSolid = buffer === 1;
- return (hAsync(Host, { key: 'd60eeaa18aaee607e083c0ef9d0de8178d47c4cd', role: "progressbar", "aria-valuenow": type === 'determinate' ? value : null, "aria-valuemin": "0", "aria-valuemax": "1", class: createColorClasses$1(color, {
- [mode]: true,
- [`progress-bar-${type}`]: true,
- 'progress-paused': paused,
- 'progress-bar-reversed': document.dir === 'rtl' ? !reversed : reversed,
- 'progress-bar-solid': progressSolid,
- }) }, type === 'indeterminate' ? renderIndeterminate() : renderProgress(value, buffer)));
- }
- static get style() { return {
- ios: IonProgressBarIosStyle0,
- md: IonProgressBarMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-progress-bar",
- "$members$": {
- "type": [1],
- "reversed": [4],
- "value": [2],
- "buffer": [2],
- "color": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const renderIndeterminate = () => {
- return (hAsync("div", { part: "track", class: "progress-buffer-bar" }, hAsync("div", { class: "indeterminate-bar-primary" }, hAsync("span", { part: "progress", class: "progress-indeterminate" })), hAsync("div", { class: "indeterminate-bar-secondary" }, hAsync("span", { part: "progress", class: "progress-indeterminate" }))));
- };
- const renderProgress = (value, buffer) => {
- const finalValue = clamp(0, value, 1);
- const finalBuffer = clamp(0, buffer, 1);
- return [
- hAsync("div", { part: "progress", class: "progress", style: { transform: `scaleX(${finalValue})` } }),
- /**
- * Buffer circles with two container to move
- * the circles behind the buffer progress
- * with respecting the animation.
- * When finalBuffer === 1, we use display: none
- * instead of removing the element to avoid flickering.
- */
- hAsync("div", { class: { 'buffer-circles-container': true, 'ion-hide': finalBuffer === 1 }, style: { transform: `translateX(${finalBuffer * 100}%)` } }, hAsync("div", { class: "buffer-circles-container", style: { transform: `translateX(-${finalBuffer * 100}%)` } }, hAsync("div", { part: "stream", class: "buffer-circles" }))),
- hAsync("div", { part: "track", class: "progress-buffer-bar", style: { transform: `scaleX(${finalBuffer})` } }),
- ];
- };
- const radioIosCss = ":host{--inner-border-radius:50%;display:inline-block;position:relative;max-width:100%;min-height:inherit;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.radio-disabled){pointer-events:none}.radio-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{-webkit-box-sizing:border-box;box-sizing:border-box}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0;width:100%;height:100%}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}.radio-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;min-height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.radio-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.radio-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host(.radio-justify-space-between) .radio-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.radio-justify-start) .radio-wrapper{-ms-flex-pack:start;justify-content:start}:host(.radio-justify-end) .radio-wrapper{-ms-flex-pack:end;justify-content:end}:host(.radio-alignment-start) .radio-wrapper{-ms-flex-align:start;align-items:start}:host(.radio-alignment-center) .radio-wrapper{-ms-flex-align:center;align-items:center}:host(.radio-justify-space-between),:host(.radio-justify-start),:host(.radio-justify-end),:host(.radio-alignment-start),:host(.radio-alignment-center){display:block}:host(.radio-label-placement-start) .radio-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.radio-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-end) .radio-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.radio-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.radio-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px}:host(.radio-label-placement-stacked) .radio-wrapper{-ms-flex-direction:column;flex-direction:column}:host(.radio-label-placement-stacked) .label-text-wrapper{-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host(.radio-label-placement-stacked.radio-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.radio-label-placement-stacked.radio-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).radio-label-placement-stacked.radio-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.radio-label-placement-stacked.radio-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.radio-label-placement-stacked.radio-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.radio-label-placement-stacked.radio-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).radio-label-placement-stacked.radio-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.radio-label-placement-stacked.radio-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host{--color-checked:var(--ion-color-primary, #0054e9)}:host(.ion-color.radio-checked) .radio-inner{border-color:var(--ion-color-base)}.item-radio.item-ios ion-label{-webkit-margin-start:0;margin-inline-start:0}.radio-inner{width:33%;height:50%}:host(.radio-checked) .radio-inner{-webkit-transform:rotate(45deg);transform:rotate(45deg);border-width:0.125rem;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--color-checked)}:host(.radio-disabled){opacity:0.3}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);top:-8px;display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #1a65eb);content:\"\";opacity:0.2}:host(.ion-focused) .radio-icon::after{inset-inline-start:-9px}.native-wrapper .radio-icon{width:0.9375rem;height:1.5rem}";
- var IonRadioIosStyle0 = radioIosCss;
- const radioMdCss = ":host{--inner-border-radius:50%;display:inline-block;position:relative;max-width:100%;min-height:inherit;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.radio-disabled){pointer-events:none}.radio-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{-webkit-box-sizing:border-box;box-sizing:border-box}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0;width:100%;height:100%}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}.radio-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;min-height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.radio-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.radio-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host(.radio-justify-space-between) .radio-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.radio-justify-start) .radio-wrapper{-ms-flex-pack:start;justify-content:start}:host(.radio-justify-end) .radio-wrapper{-ms-flex-pack:end;justify-content:end}:host(.radio-alignment-start) .radio-wrapper{-ms-flex-align:start;align-items:start}:host(.radio-alignment-center) .radio-wrapper{-ms-flex-align:center;align-items:center}:host(.radio-justify-space-between),:host(.radio-justify-start),:host(.radio-justify-end),:host(.radio-alignment-start),:host(.radio-alignment-center){display:block}:host(.radio-label-placement-start) .radio-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.radio-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-end) .radio-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.radio-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.radio-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px}:host(.radio-label-placement-stacked) .radio-wrapper{-ms-flex-direction:column;flex-direction:column}:host(.radio-label-placement-stacked) .label-text-wrapper{-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host(.radio-label-placement-stacked.radio-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.radio-label-placement-stacked.radio-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).radio-label-placement-stacked.radio-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.radio-label-placement-stacked.radio-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.radio-label-placement-stacked.radio-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.radio-label-placement-stacked.radio-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).radio-label-placement-stacked.radio-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.radio-label-placement-stacked.radio-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host{--color:rgb(var(--ion-text-color-rgb, 0, 0, 0), 0.6);--color-checked:var(--ion-color-primary, #0054e9);--border-width:0.125rem;--border-style:solid;--border-radius:50%}:host(.ion-color) .radio-inner{background:var(--ion-color-base)}:host(.ion-color.radio-checked) .radio-icon{border-color:var(--ion-color-base)}.radio-icon{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--color)}.radio-inner{border-radius:var(--inner-border-radius);width:calc(50% + var(--border-width));height:calc(50% + var(--border-width));-webkit-transform:scale3d(0, 0, 0);transform:scale3d(0, 0, 0);-webkit-transition:-webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);background:var(--color-checked)}:host(.radio-checked) .radio-icon{border-color:var(--color-checked)}:host(.radio-checked) .radio-inner{-webkit-transform:scale3d(1, 1, 1);transform:scale3d(1, 1, 1)}:host(.radio-disabled) .label-text-wrapper{opacity:0.38}:host(.radio-disabled) .native-wrapper{opacity:0.63}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #1a65eb);content:\"\";opacity:0.2}.native-wrapper .radio-icon{width:1.25rem;height:1.25rem}";
- var IonRadioMdStyle0 = radioMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - The label text to associate with the radio. Use the "labelPlacement" property to control where the label is placed relative to the radio.
- *
- * @part container - The container for the radio mark.
- * @part label - The label text describing the radio.
- * @part mark - The checkmark or dot used to indicate the checked state.
- */
- class Radio {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.inputId = `ion-rb-${radioButtonIds++}`;
- this.radioGroup = null;
- this.updateState = () => {
- if (this.radioGroup) {
- const { compareWith, value: radioGroupValue } = this.radioGroup;
- this.checked = isOptionSelected(radioGroupValue, this.value, compareWith);
- }
- };
- this.onClick = () => {
- const { radioGroup, checked, disabled } = this;
- if (disabled) {
- return;
- }
- /**
- * The modern control does not use a native input
- * inside of the radio host, so we cannot rely on the
- * ev.preventDefault() behavior above. If the radio
- * is checked and the parent radio group allows for empty
- * selection, then we can set the checked state to false.
- * Otherwise, the checked state should always be set
- * to true because the checked state cannot be toggled.
- */
- if (checked && (radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.allowEmptySelection)) {
- this.checked = false;
- }
- else {
- this.checked = true;
- }
- };
- this.onFocus = () => {
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.ionBlur.emit();
- };
- this.checked = false;
- this.buttonTabindex = -1;
- this.color = undefined;
- this.name = this.inputId;
- this.disabled = false;
- this.value = undefined;
- this.labelPlacement = 'start';
- this.justify = undefined;
- this.alignment = undefined;
- }
- valueChanged() {
- /**
- * The new value of the radio may
- * match the radio group's value,
- * so we see if it should be checked.
- */
- this.updateState();
- }
- componentDidLoad() {
- /**
- * The value may be `undefined` if it
- * gets set before the radio is
- * rendered. This ensures that the radio
- * is checked if the value matches. This
- * happens most often when Angular is
- * rendering the radio.
- */
- this.updateState();
- }
- /** @internal */
- async setFocus(ev) {
- if (ev !== undefined) {
- ev.stopPropagation();
- ev.preventDefault();
- }
- this.el.focus();
- }
- /** @internal */
- async setButtonTabindex(value) {
- this.buttonTabindex = value;
- }
- connectedCallback() {
- if (this.value === undefined) {
- this.value = this.inputId;
- }
- const radioGroup = (this.radioGroup = this.el.closest('ion-radio-group'));
- if (radioGroup) {
- this.updateState();
- addEventListener$1(radioGroup, 'ionValueChange', this.updateState);
- }
- }
- disconnectedCallback() {
- const radioGroup = this.radioGroup;
- if (radioGroup) {
- removeEventListener(radioGroup, 'ionValueChange', this.updateState);
- this.radioGroup = null;
- }
- }
- get hasLabel() {
- return this.el.textContent !== '';
- }
- renderRadioControl() {
- return (hAsync("div", { class: "radio-icon", part: "container" }, hAsync("div", { class: "radio-inner", part: "mark" }), hAsync("div", { class: "radio-ripple" })));
- }
- render() {
- const { checked, disabled, color, el, justify, labelPlacement, hasLabel, buttonTabindex, alignment } = this;
- const mode = getIonMode$1(this);
- const inItem = hostContext('ion-item', el);
- return (hAsync(Host, { key: '8badd4aec277addc0793e14df21f73bb345e99b7', onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick, class: createColorClasses$1(color, {
- [mode]: true,
- 'in-item': inItem,
- 'radio-checked': checked,
- 'radio-disabled': disabled,
- [`radio-justify-${justify}`]: justify !== undefined,
- [`radio-alignment-${alignment}`]: alignment !== undefined,
- [`radio-label-placement-${labelPlacement}`]: true,
- // Focus and active styling should not apply when the radio is in an item
- 'ion-activatable': !inItem,
- 'ion-focusable': !inItem,
- }), role: "radio", "aria-checked": checked ? 'true' : 'false', "aria-disabled": disabled ? 'true' : null, tabindex: buttonTabindex }, hAsync("label", { key: '8765b847edc93a1b5a16506e155ed03da807bb10', class: "radio-wrapper" }, hAsync("div", { key: '3d568a0192a32d4f0b8a920019c79ff02639b5c9', class: {
- 'label-text-wrapper': true,
- 'label-text-wrapper-hidden': !hasLabel,
- }, part: "label" }, hAsync("slot", { key: '331f3dc2ce5f6ed8f124fc4560f92e0f7c668a85' })), hAsync("div", { key: '473bd4aaf448753e385f2dda3fddc9f56379aa19', class: "native-wrapper" }, this.renderRadioControl()))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["valueChanged"]
- }; }
- static get style() { return {
- ios: IonRadioIosStyle0,
- md: IonRadioMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-radio",
- "$members$": {
- "color": [513],
- "name": [1],
- "disabled": [4],
- "value": [8],
- "labelPlacement": [1, "label-placement"],
- "justify": [1],
- "alignment": [1],
- "checked": [32],
- "buttonTabindex": [32],
- "setFocus": [64],
- "setButtonTabindex": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- let radioButtonIds = 0;
- const radioGroupIosCss = "ion-radio-group{vertical-align:top}.radio-group-wrapper{display:inline}.radio-group-top{line-height:1.5}.radio-group-top .error-text{display:none;color:var(--ion-color-danger, #c5000f)}.radio-group-top .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}.ion-touched.ion-invalid .radio-group-top .error-text{display:block}.ion-touched.ion-invalid .radio-group-top .helper-text{display:none}ion-list .radio-group-top{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}";
- var IonRadioGroupIosStyle0 = radioGroupIosCss;
- const radioGroupMdCss = "ion-radio-group{vertical-align:top}.radio-group-wrapper{display:inline}.radio-group-top{line-height:1.5}.radio-group-top .error-text{display:none;color:var(--ion-color-danger, #c5000f)}.radio-group-top .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}.ion-touched.ion-invalid .radio-group-top .error-text{display:block}.ion-touched.ion-invalid .radio-group-top .helper-text{display:none}ion-list .radio-group-top{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}";
- var IonRadioGroupMdStyle0 = radioGroupMdCss;
- class RadioGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionValueChange = createEvent(this, "ionValueChange", 7);
- this.inputId = `ion-rg-${radioGroupIds++}`;
- this.helperTextId = `${this.inputId}-helper-text`;
- this.errorTextId = `${this.inputId}-error-text`;
- this.labelId = `${this.inputId}-lbl`;
- this.setRadioTabindex = (value) => {
- const radios = this.getRadios();
- // Get the first radio that is not disabled and the checked one
- const first = radios.find((radio) => !radio.disabled);
- const checked = radios.find((radio) => radio.value === value && !radio.disabled);
- if (!first && !checked) {
- return;
- }
- // If an enabled checked radio exists, set it to be the focusable radio
- // otherwise we default to focus the first radio
- const focusable = checked || first;
- for (const radio of radios) {
- const tabindex = radio === focusable ? 0 : -1;
- radio.setButtonTabindex(tabindex);
- }
- };
- this.onClick = (ev) => {
- ev.preventDefault();
- /**
- * The Radio Group component mandates that only one radio button
- * within the group can be selected at any given time. Since `ion-radio`
- * is a shadow DOM component, it cannot natively perform this behavior
- * using the `name` attribute.
- */
- const selectedRadio = ev.target && ev.target.closest('ion-radio');
- /**
- * Our current disabled prop definition causes Stencil to mark it
- * as optional. While this is not desired, fixing this behavior
- * in Stencil is a significant breaking change, so this effort is
- * being de-risked in STENCIL-917. Until then, we compromise
- * here by checking for falsy `disabled` values instead of strictly
- * checking `disabled === false`.
- */
- if (selectedRadio && !selectedRadio.disabled) {
- const currentValue = this.value;
- const newValue = selectedRadio.value;
- if (newValue !== currentValue) {
- this.value = newValue;
- this.emitValueChange(ev);
- }
- else if (this.allowEmptySelection) {
- this.value = undefined;
- this.emitValueChange(ev);
- }
- }
- };
- this.allowEmptySelection = false;
- this.compareWith = undefined;
- this.name = this.inputId;
- this.value = undefined;
- this.helperText = undefined;
- this.errorText = undefined;
- }
- valueChanged(value) {
- this.setRadioTabindex(value);
- this.ionValueChange.emit({ value });
- }
- componentDidLoad() {
- /**
- * There's an issue when assigning a value to the radio group
- * within the Angular primary content (rendering within the
- * app component template). When the template is isolated to a route,
- * the value is assigned correctly.
- * To address this issue, we need to ensure that the watcher is
- * called after the component has finished loading,
- * allowing the emit to be dispatched correctly.
- */
- this.valueChanged(this.value);
- }
- async connectedCallback() {
- // Get the list header if it exists and set the id
- // this is used to set aria-labelledby
- const header = this.el.querySelector('ion-list-header') || this.el.querySelector('ion-item-divider');
- if (header) {
- const label = (this.label = header.querySelector('ion-label'));
- if (label) {
- this.labelId = label.id = this.name + '-lbl';
- }
- }
- }
- getRadios() {
- return Array.from(this.el.querySelectorAll('ion-radio'));
- }
- /**
- * Emits an `ionChange` event.
- *
- * This API should be called for user committed changes.
- * This API should not be used for external value changes.
- */
- emitValueChange(event) {
- const { value } = this;
- this.ionChange.emit({ value, event });
- }
- onKeydown(ev) {
- // We don't want the value to automatically change/emit when the radio group is part of a select interface
- // as this will cause the interface to close when navigating through the radio group options
- const inSelectInterface = !!this.el.closest('ion-select-popover') || !!this.el.closest('ion-select-modal');
- if (ev.target && !this.el.contains(ev.target)) {
- return;
- }
- // Get all radios inside of the radio group and then
- // filter out disabled radios since we need to skip those
- const radios = this.getRadios().filter((radio) => !radio.disabled);
- // Only move the radio if the current focus is in the radio group
- if (ev.target && radios.includes(ev.target)) {
- const index = radios.findIndex((radio) => radio === ev.target);
- const current = radios[index];
- let next;
- // If hitting arrow down or arrow right, move to the next radio
- // If we're on the last radio, move to the first radio
- if (['ArrowDown', 'ArrowRight'].includes(ev.key)) {
- next = index === radios.length - 1 ? radios[0] : radios[index + 1];
- }
- // If hitting arrow up or arrow left, move to the previous radio
- // If we're on the first radio, move to the last radio
- if (['ArrowUp', 'ArrowLeft'].includes(ev.key)) {
- next = index === 0 ? radios[radios.length - 1] : radios[index - 1];
- }
- if (next && radios.includes(next)) {
- next.setFocus(ev);
- if (!inSelectInterface) {
- this.value = next.value;
- this.emitValueChange(ev);
- }
- }
- // Update the radio group value when a user presses the
- // space bar on top of a selected radio
- if ([' '].includes(ev.key)) {
- const previousValue = this.value;
- this.value = this.allowEmptySelection && this.value !== undefined ? undefined : current.value;
- if (previousValue !== this.value || this.allowEmptySelection) {
- /**
- * Value change should only be emitted if the value is different,
- * such as selecting a new radio with the space bar or if
- * the radio group allows for empty selection and the user
- * is deselecting a checked radio.
- */
- this.emitValueChange(ev);
- }
- // Prevent browsers from jumping
- // to the bottom of the screen
- ev.preventDefault();
- }
- }
- }
- /** @internal */
- async setFocus() {
- const radioToFocus = this.getRadios().find((r) => r.tabIndex !== -1);
- radioToFocus === null || radioToFocus === void 0 ? void 0 : radioToFocus.setFocus();
- }
- /**
- * Renders the helper text or error text values
- */
- renderHintText() {
- const { helperText, errorText, helperTextId, errorTextId } = this;
- const hasHintText = !!helperText || !!errorText;
- if (!hasHintText) {
- return;
- }
- return (hAsync("div", { class: "radio-group-top" }, hAsync("div", { id: helperTextId, class: "helper-text" }, helperText), hAsync("div", { id: errorTextId, class: "error-text" }, errorText)));
- }
- getHintTextID() {
- const { el, helperText, errorText, helperTextId, errorTextId } = this;
- if (el.classList.contains('ion-touched') && el.classList.contains('ion-invalid') && errorText) {
- return errorTextId;
- }
- if (helperText) {
- return helperTextId;
- }
- return undefined;
- }
- render() {
- const { label, labelId, el, name, value } = this;
- const mode = getIonMode$1(this);
- renderHiddenInput(true, el, name, value, false);
- return (hAsync(Host, { key: 'cac92777297029d7fd1b6af264d92850e35dfbba', role: "radiogroup", "aria-labelledby": label ? labelId : null, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === this.errorTextId, onClick: this.onClick, class: mode }, this.renderHintText(), hAsync("div", { key: '6b5c634dba30d54eedc031b077863f3d6a9d9e9b', class: "radio-group-wrapper" }, hAsync("slot", { key: '443edb3ff6f4c59d4c4324c8a19f2d6def47a322' }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["valueChanged"]
- }; }
- static get style() { return {
- ios: IonRadioGroupIosStyle0,
- md: IonRadioGroupMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 36,
- "$tagName$": "ion-radio-group",
- "$members$": {
- "allowEmptySelection": [4, "allow-empty-selection"],
- "compareWith": [1, "compare-with"],
- "name": [1],
- "value": [1032],
- "helperText": [1, "helper-text"],
- "errorText": [1, "error-text"],
- "setFocus": [64]
- },
- "$listeners$": [[4, "keydown", "onKeydown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- let radioGroupIds = 0;
- function getDecimalPlaces(n) {
- if (!isSafeNumber(n))
- return 0;
- if (n % 1 === 0)
- return 0;
- return n.toString().split('.')[1].length;
- }
- /**
- * Fixes floating point rounding errors in a result by rounding
- * to the same specificity, or number of decimal places (*not*
- * significant figures) as provided reference numbers. If multiple
- * references are provided, the highest number of decimal places
- * between them will be used.
- *
- * The main use case is when numbers x and y are added to produce n,
- * but x and y are floats, so n may have rounding errors (such as
- * 3.1000000004 instead of 3.1). As long as only addition/subtraction
- * occurs between x and y, the specificity of the result will never
- * increase, so x and y should be passed in as the references.
- *
- * If multiplication, division, or other operations were used to
- * calculate n, the rounded result may have less specificity than
- * desired. For example, 1 / 3 = 0.33333(...), but
- * roundToMaxDecimalPlaces((1 / 3), 1, 3) will return 0, since both
- * 1 and 3 are whole numbers.
- *
- * Note that extremely precise reference numbers may lead to rounding
- * errors not being trimmed, due to the error result having the same or
- * fewer decimal places as the reference(s). This is acceptable as we
- * would not be able to tell the difference between a rounding error
- * and correct value in this case, but it does mean there is an implicit
- * precision limit. If precision that high is needed, it is recommended
- * to use a third party data type designed to handle floating point
- * errors instead.
- *
- * @param n The number to round.
- * @param references Number(s) used to calculate n, or that should otherwise
- * be used as a reference for the desired specificity.
- */
- function roundToMaxDecimalPlaces(n, ...references) {
- if (!isSafeNumber(n))
- return 0;
- const maxPlaces = Math.max(...references.map((r) => getDecimalPlaces(r)));
- return Number(n.toFixed(maxPlaces));
- }
- const rangeIosCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:-ms-flexbox;display:flex;position:relative;-ms-flex:3;flex:3;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){-ms-flex:initial;flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;-ms-flex:1;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:-webkit-grab;cursor:grab;-ms-touch-action:pan-y;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:-webkit-grabbing;cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box}.range-knob-handle{top:calc((var(--height) - var(--knob-handle-size)) / 2);-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-pack:center;justify-content:center;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}.range-knob-handle{inset-inline-start:0}:host-context([dir=rtl]) .range-knob-handle{left:unset}[dir=rtl] .range-knob-handle{left:unset}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset}}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar-container{border-radius:var(--bar-border-radius);top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height)}.range-bar-container{inset-inline-start:0}:host-context([dir=rtl]) .range-bar-container{left:unset}[dir=rtl] .range-bar-container{left:unset}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset}}.range-bar{border-radius:var(--bar-border-radius);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}.range-knob{border-radius:var(--knob-border-radius);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);-webkit-box-shadow:var(--knob-box-shadow);box-shadow:var(--knob-box-shadow);z-index:2;pointer-events:none}.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset}[dir=rtl] .range-knob{left:unset}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset}}:host(.range-pressed) .range-bar-active{will-change:left, right}:host(.in-item){width:100%}:host([slot=start]),:host([slot=end]){width:auto}:host(.in-item) ::slotted(ion-label){-ms-flex-item-align:center;align-self:center}.range-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit}::slotted([slot=label]){max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center}:host(.range-label-placement-start) .range-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.range-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-end) .range-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.range-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.range-label-placement-stacked) .range-wrapper{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch}:host(.range-label-placement-stacked) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host-context([dir=rtl]):host(.range-label-placement-stacked) .label-text-wrapper,:host-context([dir=rtl]).range-label-placement-stacked .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.range-label-placement-stacked:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.in-item.range-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.range-label-placement-stacked) .native-wrapper{margin-bottom:0px}:host{--knob-border-radius:50%;--knob-background:#ffffff;--knob-box-shadow:0px 0.5px 4px rgba(0, 0, 0, 0.12), 0px 6px 13px rgba(0, 0, 0, 0.12);--knob-size:26px;--bar-height:4px;--bar-background:var(--ion-color-step-900, var(--ion-background-color-step-900, #e6e6e6));--bar-background-active:var(--ion-color-primary, #0054e9);--bar-border-radius:2px;--height:42px}:host(.range-item-start-adjustment){-webkit-padding-start:24px;padding-inline-start:24px}:host(.range-item-end-adjustment){-webkit-padding-end:24px;padding-inline-end:24px}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-tick-active{background:var(--ion-color-base)}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}::slotted([slot=end]){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-has-pin:not(.range-label-placement-stacked)){padding-top:calc(8px + 0.75rem)}:host(.range-has-pin.range-label-placement-stacked) .label-text-wrapper{margin-bottom:calc(8px + 0.75rem)}.range-bar-active{bottom:0;width:auto;background:var(--bar-background-active)}.range-bar-active.has-ticks{border-radius:0;-webkit-margin-start:-2px;margin-inline-start:-2px;-webkit-margin-end:-2px;margin-inline-end:-2px}.range-tick{-webkit-margin-start:-2px;margin-inline-start:-2px;border-radius:0;position:absolute;top:17px;width:4px;height:8px;background:var(--ion-color-step-900, var(--ion-background-color-step-900, #e6e6e6));pointer-events:none}.range-tick-active{background:var(--bar-background-active)}.range-pin{-webkit-transform:translate3d(0, 100%, 0) scale(0.01);transform:translate3d(0, 100%, 0) scale(0.01);-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;min-width:28px;-webkit-transition:-webkit-transform 120ms ease;transition:-webkit-transform 120ms ease;transition:transform 120ms ease;transition:transform 120ms ease, -webkit-transform 120ms ease;background:transparent;color:var(--ion-text-color, #000);font-size:0.75rem;text-align:center}.range-knob-pressed .range-pin,.range-knob-handle.ion-focused .range-pin{-webkit-transform:translate3d(0, calc(-100% + 11px), 0) scale(1);transform:translate3d(0, calc(-100% + 11px), 0) scale(1)}:host(.range-disabled){opacity:0.3}";
- var IonRangeIosStyle0 = rangeIosCss;
- const rangeMdCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:-ms-flexbox;display:flex;position:relative;-ms-flex:3;flex:3;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){-ms-flex:initial;flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;-ms-flex:1;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:-webkit-grab;cursor:grab;-ms-touch-action:pan-y;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:-webkit-grabbing;cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box}.range-knob-handle{top:calc((var(--height) - var(--knob-handle-size)) / 2);-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-pack:center;justify-content:center;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}.range-knob-handle{inset-inline-start:0}:host-context([dir=rtl]) .range-knob-handle{left:unset}[dir=rtl] .range-knob-handle{left:unset}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset}}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar-container{border-radius:var(--bar-border-radius);top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height)}.range-bar-container{inset-inline-start:0}:host-context([dir=rtl]) .range-bar-container{left:unset}[dir=rtl] .range-bar-container{left:unset}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset}}.range-bar{border-radius:var(--bar-border-radius);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}.range-knob{border-radius:var(--knob-border-radius);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);-webkit-box-shadow:var(--knob-box-shadow);box-shadow:var(--knob-box-shadow);z-index:2;pointer-events:none}.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset}[dir=rtl] .range-knob{left:unset}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset}}:host(.range-pressed) .range-bar-active{will-change:left, right}:host(.in-item){width:100%}:host([slot=start]),:host([slot=end]){width:auto}:host(.in-item) ::slotted(ion-label){-ms-flex-item-align:center;align-self:center}.range-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit}::slotted([slot=label]){max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center}:host(.range-label-placement-start) .range-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.range-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-end) .range-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.range-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.range-label-placement-stacked) .range-wrapper{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch}:host(.range-label-placement-stacked) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host-context([dir=rtl]):host(.range-label-placement-stacked) .label-text-wrapper,:host-context([dir=rtl]).range-label-placement-stacked .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.range-label-placement-stacked:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.in-item.range-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.range-label-placement-stacked) .native-wrapper{margin-bottom:0px}:host{--knob-border-radius:50%;--knob-background:var(--bar-background-active);--knob-box-shadow:none;--knob-size:18px;--bar-height:2px;--bar-background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.26);--bar-background-active:var(--ion-color-primary, #0054e9);--bar-border-radius:0;--height:42px;--pin-background:var(--ion-color-primary, #0054e9);--pin-color:var(--ion-color-primary-contrast, #fff)}::slotted(:not(ion-icon)[slot=start]),::slotted(:not(ion-icon)[slot=end]),.native-wrapper{font-size:0.75rem}:host(.range-item-start-adjustment){-webkit-padding-start:18px;padding-inline-start:18px}:host(.range-item-end-adjustment){-webkit-padding-end:18px;padding-inline-end:18px}:host(.ion-color) .range-bar{background:rgba(var(--ion-color-base-rgb), 0.26)}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-knob,:host(.ion-color) .range-knob::before,:host(.ion-color) .range-pin,:host(.ion-color) .range-pin::before,:host(.ion-color) .range-tick{background:var(--ion-color-base);color:var(--ion-color-contrast)}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:14px;margin-inline-end:14px;margin-top:0;margin-bottom:0}::slotted([slot=end]){-webkit-margin-start:14px;margin-inline-start:14px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-has-pin:not(.range-label-placement-stacked)){padding-top:1.75rem}:host(.range-has-pin.range-label-placement-stacked) .label-text-wrapper{margin-bottom:1.75rem}.range-bar-active{bottom:0;width:auto;background:var(--bar-background-active)}.range-knob{-webkit-transform:scale(0.67);transform:scale(0.67);-webkit-transition-duration:120ms;transition-duration:120ms;-webkit-transition-property:background-color, border, -webkit-transform;transition-property:background-color, border, -webkit-transform;transition-property:transform, background-color, border;transition-property:transform, background-color, border, -webkit-transform;-webkit-transition-timing-function:ease;transition-timing-function:ease;z-index:2}.range-knob::before{border-radius:50%;position:absolute;width:var(--knob-size);height:var(--knob-size);-webkit-transform:scale(1);transform:scale(1);-webkit-transition:0.267s cubic-bezier(0, 0, 0.58, 1);transition:0.267s cubic-bezier(0, 0, 0.58, 1);background:var(--knob-background);content:\"\";opacity:0.13;pointer-events:none}.range-knob::before{inset-inline-start:0}.range-tick{position:absolute;top:calc((var(--height) - var(--bar-height)) / 2);width:var(--bar-height);height:var(--bar-height);background:var(--bar-background-active);z-index:1;pointer-events:none}.range-tick-active{background:transparent}.range-pin{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;border-radius:50%;-webkit-transform:translate3d(0, 0, 0) scale(0.01);transform:translate3d(0, 0, 0) scale(0.01);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:1.75rem;height:1.75rem;-webkit-transition:background 120ms ease, -webkit-transform 120ms ease;transition:background 120ms ease, -webkit-transform 120ms ease;transition:transform 120ms ease, background 120ms ease;transition:transform 120ms ease, background 120ms ease, -webkit-transform 120ms ease;background:var(--pin-background);color:var(--pin-color)}.range-pin::before{bottom:-1px;-webkit-margin-start:-13px;margin-inline-start:-13px;border-radius:50% 50% 50% 0;position:absolute;width:26px;height:26px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transition:background 120ms ease;transition:background 120ms ease;background:var(--pin-background);content:\"\";z-index:-1}.range-pin::before{inset-inline-start:50%}:host-context([dir=rtl]) .range-pin::before{left:unset}[dir=rtl] .range-pin::before{left:unset}@supports selector(:dir(rtl)){.range-pin::before:dir(rtl){left:unset}}.range-knob-pressed .range-pin,.range-knob-handle.ion-focused .range-pin{-webkit-transform:translate3d(0, calc(-100% + 4px), 0) scale(1);transform:translate3d(0, calc(-100% + 4px), 0) scale(1)}@media (any-hover: hover){.range-knob-handle:hover .range-knob:before{-webkit-transform:scale(2);transform:scale(2);opacity:0.13}}.range-knob-handle.ion-activated .range-knob:before,.range-knob-handle.ion-focused .range-knob:before,.range-knob-handle.range-knob-pressed .range-knob:before{-webkit-transform:scale(2);transform:scale(2)}.range-knob-handle.ion-focused .range-knob::before{opacity:0.13}.range-knob-handle.ion-activated .range-knob::before,.range-knob-handle.range-knob-pressed .range-knob::before{opacity:0.25}:host(:not(.range-has-pin)) .range-knob-pressed .range-knob,:host(:not(.range-has-pin)) .range-knob-handle.ion-focused .range-knob{-webkit-transform:scale(1);transform:scale(1)}:host(.range-disabled) .range-bar-active,:host(.range-disabled) .range-bar,:host(.range-disabled) .range-tick{background-color:var(--ion-color-step-250, var(--ion-background-color-step-250, #bfbfbf))}:host(.range-disabled) .range-knob{-webkit-transform:scale(0.55);transform:scale(0.55);outline:5px solid #fff;background-color:var(--ion-color-step-250, var(--ion-background-color-step-250, #bfbfbf))}:host(.range-disabled) .label-text-wrapper,:host(.range-disabled) ::slotted([slot=start]),:host(.range-disabled) ::slotted([slot=end]){opacity:0.38}";
- var IonRangeMdStyle0 = rangeMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot label - The label text to associate with the range. Use the "labelPlacement" property to control where the label is placed relative to the range.
- * @slot start - Content is placed to the left of the range slider in LTR, and to the right in RTL.
- * @slot end - Content is placed to the right of the range slider in LTR, and to the left in RTL.
- *
- * @part tick - An inactive tick mark.
- * @part tick-active - An active tick mark.
- * @part pin - The counter that appears above a knob.
- * @part knob - The handle that is used to drag the range.
- * @part bar - The inactive part of the bar.
- * @part bar-active - The active part of the bar.
- * @part label - The label text describing the range.
- */
- class Range {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionInput = createEvent(this, "ionInput", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.ionKnobMoveStart = createEvent(this, "ionKnobMoveStart", 7);
- this.ionKnobMoveEnd = createEvent(this, "ionKnobMoveEnd", 7);
- this.rangeId = `ion-r-${rangeIds++}`;
- this.didLoad = false;
- this.noUpdate = false;
- this.hasFocus = false;
- this.inheritedAttributes = {};
- this.contentEl = null;
- this.initialContentScrollY = true;
- /**
- * Compares two RangeValue inputs to determine if they are different.
- *
- * @param newVal - The new value.
- * @param oldVal - The old value.
- * @returns `true` if the values are different, `false` otherwise.
- */
- this.compareValues = (newVal, oldVal) => {
- if (typeof newVal === 'object' && typeof oldVal === 'object') {
- return newVal.lower !== oldVal.lower || newVal.upper !== oldVal.upper;
- }
- return newVal !== oldVal;
- };
- this.clampBounds = (value) => {
- return clamp(this.min, value, this.max);
- };
- this.ensureValueInBounds = (value) => {
- if (this.dualKnobs) {
- return {
- lower: this.clampBounds(value.lower),
- upper: this.clampBounds(value.upper),
- };
- }
- else {
- return this.clampBounds(value);
- }
- };
- this.setupGesture = async () => {
- const rangeSlider = this.rangeSlider;
- if (rangeSlider) {
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: rangeSlider,
- gestureName: 'range',
- gesturePriority: 100,
- /**
- * Provide a threshold since the drag movement
- * might be a user scrolling the view.
- * If this is true, then the range
- * should not move.
- */
- threshold: 10,
- onStart: () => this.onStart(),
- onMove: (ev) => this.onMove(ev),
- onEnd: (ev) => this.onEnd(ev),
- });
- this.gesture.enable(!this.disabled);
- }
- };
- this.handleKeyboard = (knob, isIncrease) => {
- const { ensureValueInBounds } = this;
- let step = this.step;
- step = step > 0 ? step : 1;
- step = step / (this.max - this.min);
- if (!isIncrease) {
- step *= -1;
- }
- if (knob === 'A') {
- this.ratioA = clamp(0, this.ratioA + step, 1);
- }
- else {
- this.ratioB = clamp(0, this.ratioB + step, 1);
- }
- this.ionKnobMoveStart.emit({ value: ensureValueInBounds(this.value) });
- this.updateValue();
- this.emitValueChange();
- this.ionKnobMoveEnd.emit({ value: ensureValueInBounds(this.value) });
- };
- this.onBlur = () => {
- if (this.hasFocus) {
- this.hasFocus = false;
- this.ionBlur.emit();
- }
- };
- this.onFocus = () => {
- if (!this.hasFocus) {
- this.hasFocus = true;
- this.ionFocus.emit();
- }
- };
- this.ratioA = 0;
- this.ratioB = 0;
- this.pressedKnob = undefined;
- this.color = undefined;
- this.debounce = undefined;
- this.name = this.rangeId;
- this.label = undefined;
- this.dualKnobs = false;
- this.min = 0;
- this.max = 100;
- this.pin = false;
- this.pinFormatter = (value) => Math.round(value);
- this.snaps = false;
- this.step = 1;
- this.ticks = true;
- this.activeBarStart = undefined;
- this.disabled = false;
- this.value = 0;
- this.labelPlacement = 'start';
- }
- debounceChanged() {
- const { ionInput, debounce, originalIonInput } = this;
- /**
- * If debounce is undefined, we have to manually revert the ionInput emitter in case
- * debounce used to be set to a number. Otherwise, the event would stay debounced.
- */
- this.ionInput = debounce === undefined ? originalIonInput !== null && originalIonInput !== void 0 ? originalIonInput : ionInput : debounceEvent(ionInput, debounce);
- }
- minChanged(newValue) {
- if (!isSafeNumber(newValue)) {
- this.min = 0;
- }
- if (!this.noUpdate) {
- this.updateRatio();
- }
- }
- maxChanged(newValue) {
- if (!isSafeNumber(newValue)) {
- this.max = 100;
- }
- if (!this.noUpdate) {
- this.updateRatio();
- }
- }
- stepChanged(newValue) {
- if (!isSafeNumber(newValue)) {
- this.step = 1;
- }
- }
- activeBarStartChanged() {
- const { activeBarStart } = this;
- if (activeBarStart !== undefined) {
- if (activeBarStart > this.max) {
- printIonWarning(`[ion-range] - The value of activeBarStart (${activeBarStart}) is greater than the max (${this.max}). Valid values are greater than or equal to the min value and less than or equal to the max value.`, this.el);
- this.activeBarStart = this.max;
- }
- else if (activeBarStart < this.min) {
- printIonWarning(`[ion-range] - The value of activeBarStart (${activeBarStart}) is less than the min (${this.min}). Valid values are greater than or equal to the min value and less than or equal to the max value.`, this.el);
- this.activeBarStart = this.min;
- }
- }
- }
- disabledChanged() {
- if (this.gesture) {
- this.gesture.enable(!this.disabled);
- }
- }
- valueChanged(newValue, oldValue) {
- const valuesChanged = this.compareValues(newValue, oldValue);
- if (valuesChanged) {
- this.ionInput.emit({ value: this.value });
- }
- if (!this.noUpdate) {
- this.updateRatio();
- }
- }
- componentWillLoad() {
- /**
- * If user has custom ID set then we should
- * not assign the default incrementing ID.
- */
- if (this.el.hasAttribute('id')) {
- this.rangeId = this.el.getAttribute('id');
- }
- this.inheritedAttributes = inheritAriaAttributes(this.el);
- // If min, max, or step are not safe, set them to 0, 100, and 1, respectively.
- // Each watch does this, but not before the initial load.
- this.min = isSafeNumber(this.min) ? this.min : 0;
- this.max = isSafeNumber(this.max) ? this.max : 100;
- this.step = isSafeNumber(this.step) ? this.step : 1;
- }
- componentDidLoad() {
- this.originalIonInput = this.ionInput;
- this.setupGesture();
- this.updateRatio();
- this.didLoad = true;
- }
- connectedCallback() {
- var _a;
- this.updateRatio();
- this.debounceChanged();
- this.disabledChanged();
- this.activeBarStartChanged();
- /**
- * If we have not yet rendered
- * ion-range, then rangeSlider is not defined.
- * But if we are moving ion-range via appendChild,
- * then rangeSlider will be defined.
- */
- if (this.didLoad) {
- this.setupGesture();
- }
- const ionContent = findClosestIonContent(this.el);
- this.contentEl = (_a = ionContent === null || ionContent === void 0 ? void 0 : ionContent.querySelector('.ion-content-scroll-host')) !== null && _a !== void 0 ? _a : ionContent;
- }
- disconnectedCallback() {
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- }
- getValue() {
- var _a;
- const value = (_a = this.value) !== null && _a !== void 0 ? _a : 0;
- if (this.dualKnobs) {
- if (typeof value === 'object') {
- return value;
- }
- return {
- lower: 0,
- upper: value,
- };
- }
- else {
- if (typeof value === 'object') {
- return value.upper;
- }
- return value;
- }
- }
- /**
- * Emits an `ionChange` event.
- *
- * This API should be called for user committed changes.
- * This API should not be used for external value changes.
- */
- emitValueChange() {
- this.value = this.ensureValueInBounds(this.value);
- this.ionChange.emit({ value: this.value });
- }
- /**
- * The value should be updated on touch end or
- * when the component is being dragged.
- * This follows the native behavior of mobile devices.
- *
- * For example: When the user lifts their finger from the
- * screen after tapping the bar or dragging the bar or knob.
- */
- onStart() {
- this.ionKnobMoveStart.emit({ value: this.ensureValueInBounds(this.value) });
- }
- /**
- * The value should be updated while dragging the
- * bar or knob.
- *
- * While the user is dragging, the view
- * should not scroll. This is to prevent the user from
- * feeling disoriented while dragging.
- *
- * The user can scroll on the view if the knob or
- * bar is not being dragged.
- *
- * @param detail The details of the gesture event.
- */
- onMove(detail) {
- const { contentEl, pressedKnob } = this;
- const currentX = detail.currentX;
- /**
- * Since the user is dragging on the bar or knob, the view should not scroll.
- *
- * This only needs to be done once.
- */
- if (contentEl && this.pressedKnob === undefined) {
- this.initialContentScrollY = disableContentScrollY(contentEl);
- }
- /**
- * The `pressedKnob` can be undefined if the user just
- * started dragging the knob.
- *
- * This is necessary to determine which knob the user is dragging,
- * especially when it's a dual knob.
- * Plus, it determines when to apply certain styles.
- *
- * This only needs to be done once since the knob won't change
- * while the user is dragging.
- */
- if (pressedKnob === undefined) {
- this.setPressedKnob(currentX);
- }
- this.update(currentX);
- }
- /**
- * The value should be updated on touch end:
- * - When the user lifts their finger from the screen after
- * tapping the bar.
- *
- * @param detail The details of the gesture or mouse event.
- */
- onEnd(detail) {
- var _a;
- const { contentEl, initialContentScrollY } = this;
- const currentX = (_a = detail.currentX) !== null && _a !== void 0 ? _a : detail.clientX;
- /**
- * The `pressedKnob` can be undefined if the user never
- * dragged the knob. They just tapped on the bar.
- *
- * This is necessary to determine which knob the user is changing,
- * especially when it's a dual knob.
- * Plus, it determines when to apply certain styles.
- */
- if (this.pressedKnob === undefined) {
- this.setPressedKnob(currentX);
- }
- /**
- * The user is no longer dragging the bar or
- * knob (if they were dragging it).
- *
- * The user can now scroll on the view in the next gesture event.
- */
- if (contentEl && this.pressedKnob !== undefined) {
- resetContentScrollY(contentEl, initialContentScrollY);
- }
- // update the active knob's position
- this.update(currentX);
- /**
- * Reset the pressed knob to undefined since the user
- * may start dragging a different knob in the next gesture event.
- */
- this.pressedKnob = undefined;
- this.emitValueChange();
- this.ionKnobMoveEnd.emit({ value: this.ensureValueInBounds(this.value) });
- }
- update(currentX) {
- // figure out where the pointer is currently at
- // update the knob being interacted with
- const rect = this.rect;
- let ratio = clamp(0, (currentX - rect.left) / rect.width, 1);
- if (isRTL$1(this.el)) {
- ratio = 1 - ratio;
- }
- if (this.snaps) {
- // snaps the ratio to the current value
- ratio = valueToRatio(ratioToValue(ratio, this.min, this.max, this.step), this.min, this.max);
- }
- // update which knob is pressed
- if (this.pressedKnob === 'A') {
- this.ratioA = ratio;
- }
- else {
- this.ratioB = ratio;
- }
- // Update input value
- this.updateValue();
- }
- setPressedKnob(currentX) {
- const rect = (this.rect = this.rangeSlider.getBoundingClientRect());
- // figure out which knob they started closer to
- let ratio = clamp(0, (currentX - rect.left) / rect.width, 1);
- if (isRTL$1(this.el)) {
- ratio = 1 - ratio;
- }
- this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
- this.setFocus(this.pressedKnob);
- }
- get valA() {
- return ratioToValue(this.ratioA, this.min, this.max, this.step);
- }
- get valB() {
- return ratioToValue(this.ratioB, this.min, this.max, this.step);
- }
- get ratioLower() {
- if (this.dualKnobs) {
- return Math.min(this.ratioA, this.ratioB);
- }
- const { activeBarStart } = this;
- if (activeBarStart == null) {
- return 0;
- }
- return valueToRatio(activeBarStart, this.min, this.max);
- }
- get ratioUpper() {
- if (this.dualKnobs) {
- return Math.max(this.ratioA, this.ratioB);
- }
- return this.ratioA;
- }
- updateRatio() {
- const value = this.getValue();
- const { min, max } = this;
- if (this.dualKnobs) {
- this.ratioA = valueToRatio(value.lower, min, max);
- this.ratioB = valueToRatio(value.upper, min, max);
- }
- else {
- this.ratioA = valueToRatio(value, min, max);
- }
- }
- updateValue() {
- this.noUpdate = true;
- const { valA, valB } = this;
- this.value = !this.dualKnobs
- ? valA
- : {
- lower: Math.min(valA, valB),
- upper: Math.max(valA, valB),
- };
- this.noUpdate = false;
- }
- setFocus(knob) {
- if (this.el.shadowRoot) {
- const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
- if (knobEl) {
- knobEl.focus();
- }
- }
- }
- /**
- * Returns true if content was passed to the "start" slot
- */
- get hasStartSlotContent() {
- return this.el.querySelector('[slot="start"]') !== null;
- }
- /**
- * Returns true if content was passed to the "end" slot
- */
- get hasEndSlotContent() {
- return this.el.querySelector('[slot="end"]') !== null;
- }
- get hasLabel() {
- return this.label !== undefined || this.el.querySelector('[slot="label"]') !== null;
- }
- renderRangeSlider() {
- var _a;
- const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
- let barStart = `${ratioLower * 100}%`;
- let barEnd = `${100 - ratioUpper * 100}%`;
- const rtl = isRTL$1(this.el);
- const start = rtl ? 'right' : 'left';
- const end = rtl ? 'left' : 'right';
- const tickStyle = (tick) => {
- return {
- [start]: tick[start],
- };
- };
- if (this.dualKnobs === false) {
- /**
- * When the value is less than the activeBarStart or the min value,
- * the knob will display at the start of the active bar.
- */
- if (this.valA < ((_a = this.activeBarStart) !== null && _a !== void 0 ? _a : this.min)) {
- /**
- * Sets the bar positions relative to the upper and lower limits.
- * Converts the ratio values into percentages, used as offsets for left/right styles.
- *
- * The ratioUpper refers to the knob position on the bar.
- * The ratioLower refers to the end position of the active bar (the value).
- */
- barStart = `${ratioUpper * 100}%`;
- barEnd = `${100 - ratioLower * 100}%`;
- }
- else {
- /**
- * Otherwise, the knob will display at the end of the active bar.
- *
- * The ratioLower refers to the start position of the active bar (the value).
- * The ratioUpper refers to the knob position on the bar.
- */
- barStart = `${ratioLower * 100}%`;
- barEnd = `${100 - ratioUpper * 100}%`;
- }
- }
- const barStyle = {
- [start]: barStart,
- [end]: barEnd,
- };
- const ticks = [];
- if (this.snaps && this.ticks) {
- for (let value = min; value <= max; value += step) {
- const ratio = valueToRatio(value, min, max);
- const ratioMin = Math.min(ratioLower, ratioUpper);
- const ratioMax = Math.max(ratioLower, ratioUpper);
- const tick = {
- ratio,
- /**
- * Sets the tick mark as active when the tick is between the min bounds and the knob.
- * When using activeBarStart, the tick mark will be active between the knob and activeBarStart.
- */
- active: ratio >= ratioMin && ratio <= ratioMax,
- };
- tick[start] = `${ratio * 100}%`;
- ticks.push(tick);
- }
- }
- return (hAsync("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
- /**
- * Since the gesture has a threshold, the value
- * won't change until the user has dragged past
- * the threshold. This is to prevent the range
- * from moving when the user is scrolling.
- *
- * This results in the value not being updated
- * and the event emitters not being triggered
- * if the user taps on the range. This is why
- * we need to listen for the "pointerUp" event.
- */
- onPointerUp: (ev) => {
- /**
- * If the user drags the knob on the web
- * version (does not occur on mobile),
- * the "pointerUp" event will be triggered
- * along with the gesture's events.
- * This leads to duplicate events.
- *
- * By checking if the pressedKnob is undefined,
- * we can determine if the "pointerUp" event was
- * triggered by a tap or a drag. If it was
- * dragged, the pressedKnob will be defined.
- */
- if (this.pressedKnob === undefined) {
- this.onStart();
- this.onEnd(ev);
- }
- } }, ticks.map((tick) => (hAsync("div", { style: tickStyle(tick), role: "presentation", class: {
- 'range-tick': true,
- 'range-tick-active': tick.active,
- }, part: tick.active ? 'tick-active' : 'tick' }))), hAsync("div", { class: "range-bar-container" }, hAsync("div", { class: "range-bar", role: "presentation", part: "bar" }), hAsync("div", { class: {
- 'range-bar': true,
- 'range-bar-active': true,
- 'has-ticks': ticks.length > 0,
- }, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
- knob: 'A',
- pressed: pressedKnob === 'A',
- value: this.valA,
- ratio: this.ratioA,
- pin,
- pinFormatter,
- disabled,
- handleKeyboard,
- min,
- max,
- inheritedAttributes,
- }), this.dualKnobs &&
- renderKnob(rtl, {
- knob: 'B',
- pressed: pressedKnob === 'B',
- value: this.valB,
- ratio: this.ratioB,
- pin,
- pinFormatter,
- disabled,
- handleKeyboard,
- min,
- max,
- inheritedAttributes,
- })));
- }
- render() {
- const { disabled, el, hasLabel, rangeId, pin, pressedKnob, labelPlacement, label } = this;
- const inItem = hostContext('ion-item', el);
- /**
- * If there is no start content then the knob at
- * the min value will be cut off by the item margin.
- */
- const hasStartContent = (hasLabel && (labelPlacement === 'start' || labelPlacement === 'fixed')) || this.hasStartSlotContent;
- const needsStartAdjustment = inItem && !hasStartContent;
- /**
- * If there is no end content then the knob at
- * the max value will be cut off by the item margin.
- */
- const hasEndContent = (hasLabel && labelPlacement === 'end') || this.hasEndSlotContent;
- const needsEndAdjustment = inItem && !hasEndContent;
- const mode = getIonMode$1(this);
- renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
- return (hAsync(Host, { key: '3e065039ee048f1f70d97dba5dae98fa1315d867', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'in-item': inItem,
- 'range-disabled': disabled,
- 'range-pressed': pressedKnob !== undefined,
- 'range-has-pin': pin,
- [`range-label-placement-${labelPlacement}`]: true,
- 'range-item-start-adjustment': needsStartAdjustment,
- 'range-item-end-adjustment': needsEndAdjustment,
- }) }, hAsync("label", { key: '27ff22842c9ea79a1b9495302b926f70c9080a95', class: "range-wrapper", id: "range-label" }, hAsync("div", { key: 'da1f9784be02dfe87d2fef34931d8b7f2148189e', class: {
- 'label-text-wrapper': true,
- 'label-text-wrapper-hidden': !hasLabel,
- }, part: "label" }, label !== undefined ? hAsync("div", { class: "label-text" }, label) : hAsync("slot", { name: "label" })), hAsync("div", { key: '4389bf30b08214f5b5917fc30976b38f7bcdd29b', class: "native-wrapper" }, hAsync("slot", { key: 'ad1b2745f8b061ee189617bb5c567e4f1d02250c', name: "start" }), this.renderRangeSlider(), hAsync("slot", { key: 'c6dec9e843e232af2a5f16a0f8ee56439c545d7a', name: "end" })))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "debounce": ["debounceChanged"],
- "min": ["minChanged"],
- "max": ["maxChanged"],
- "step": ["stepChanged"],
- "activeBarStart": ["activeBarStartChanged"],
- "disabled": ["disabledChanged"],
- "value": ["valueChanged"]
- }; }
- static get style() { return {
- ios: IonRangeIosStyle0,
- md: IonRangeMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-range",
- "$members$": {
- "color": [513],
- "debounce": [2],
- "name": [1],
- "label": [1],
- "dualKnobs": [4, "dual-knobs"],
- "min": [2],
- "max": [2],
- "pin": [4],
- "pinFormatter": [16],
- "snaps": [4],
- "step": [2],
- "ticks": [4],
- "activeBarStart": [1026, "active-bar-start"],
- "disabled": [4],
- "value": [1026],
- "labelPlacement": [1, "label-placement"],
- "ratioA": [32],
- "ratioB": [32],
- "pressedKnob": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes }) => {
- const start = rtl ? 'right' : 'left';
- const knobStyle = () => {
- const style = {};
- style[start] = `${ratio * 100}%`;
- return style;
- };
- // The aria label should be preferred over visible text if both are specified
- const ariaLabel = inheritedAttributes['aria-label'];
- return (hAsync("div", { onKeyDown: (ev) => {
- const key = ev.key;
- if (key === 'ArrowLeft' || key === 'ArrowDown') {
- handleKeyboard(knob, false);
- ev.preventDefault();
- ev.stopPropagation();
- }
- else if (key === 'ArrowRight' || key === 'ArrowUp') {
- handleKeyboard(knob, true);
- ev.preventDefault();
- ev.stopPropagation();
- }
- }, class: {
- 'range-knob-handle': true,
- 'range-knob-a': knob === 'A',
- 'range-knob-b': knob === 'B',
- 'range-knob-pressed': pressed,
- 'range-knob-min': value === min,
- 'range-knob-max': value === max,
- 'ion-activatable': true,
- 'ion-focusable': true,
- }, style: knobStyle(), role: "slider", tabindex: disabled ? -1 : 0, "aria-label": ariaLabel !== undefined ? ariaLabel : null, "aria-labelledby": ariaLabel === undefined ? 'range-label' : null, "aria-valuemin": min, "aria-valuemax": max, "aria-disabled": disabled ? 'true' : null, "aria-valuenow": value }, pin && (hAsync("div", { class: "range-pin", role: "presentation", part: "pin" }, pinFormatter(value))), hAsync("div", { class: "range-knob", role: "presentation", part: "knob" })));
- };
- const ratioToValue = (ratio, min, max, step) => {
- let value = (max - min) * ratio;
- if (step > 0) {
- // round to nearest multiple of step, then add min
- value = Math.round(value / step) * step + min;
- }
- const clampedValue = clamp(min, value, max);
- return roundToMaxDecimalPlaces(clampedValue, min, max, step);
- };
- const valueToRatio = (value, min, max) => {
- return clamp(0, (value - min) / (max - min), 1);
- };
- let rangeIds = 0;
- const getRefresherAnimationType = (contentEl) => {
- const previousSibling = contentEl.previousElementSibling;
- const hasHeader = previousSibling !== null && previousSibling.tagName === 'ION-HEADER';
- return hasHeader ? 'translate' : 'scale';
- };
- const createPullingAnimation = (type, pullingSpinner, refresherEl) => {
- return type === 'scale'
- ? createScaleAnimation(pullingSpinner, refresherEl)
- : createTranslateAnimation(pullingSpinner, refresherEl);
- };
- const createBaseAnimation = (pullingRefresherIcon) => {
- const spinner = pullingRefresherIcon.querySelector('ion-spinner');
- const circle = spinner.shadowRoot.querySelector('circle');
- const spinnerArrowContainer = pullingRefresherIcon.querySelector('.spinner-arrow-container');
- const arrowContainer = pullingRefresherIcon.querySelector('.arrow-container');
- const arrow = arrowContainer ? arrowContainer.querySelector('ion-icon') : null;
- const baseAnimation = createAnimation().duration(1000).easing('ease-out');
- const spinnerArrowContainerAnimation = createAnimation()
- .addElement(spinnerArrowContainer)
- .keyframes([
- { offset: 0, opacity: '0.3' },
- { offset: 0.45, opacity: '0.3' },
- { offset: 0.55, opacity: '1' },
- { offset: 1, opacity: '1' },
- ]);
- const circleInnerAnimation = createAnimation()
- .addElement(circle)
- .keyframes([
- { offset: 0, strokeDasharray: '1px, 200px' },
- { offset: 0.2, strokeDasharray: '1px, 200px' },
- { offset: 0.55, strokeDasharray: '100px, 200px' },
- { offset: 1, strokeDasharray: '100px, 200px' },
- ]);
- const circleOuterAnimation = createAnimation()
- .addElement(spinner)
- .keyframes([
- { offset: 0, transform: 'rotate(-90deg)' },
- { offset: 1, transform: 'rotate(210deg)' },
- ]);
- /**
- * Only add arrow animation if present
- * this allows users to customize the spinners
- * without errors being thrown
- */
- if (arrowContainer && arrow) {
- const arrowContainerAnimation = createAnimation()
- .addElement(arrowContainer)
- .keyframes([
- { offset: 0, transform: 'rotate(0deg)' },
- { offset: 0.3, transform: 'rotate(0deg)' },
- { offset: 0.55, transform: 'rotate(280deg)' },
- { offset: 1, transform: 'rotate(400deg)' },
- ]);
- const arrowAnimation = createAnimation()
- .addElement(arrow)
- .keyframes([
- { offset: 0, transform: 'translateX(2px) scale(0)' },
- { offset: 0.3, transform: 'translateX(2px) scale(0)' },
- { offset: 0.55, transform: 'translateX(-1.5px) scale(1)' },
- { offset: 1, transform: 'translateX(-1.5px) scale(1)' },
- ]);
- baseAnimation.addAnimation([arrowContainerAnimation, arrowAnimation]);
- }
- return baseAnimation.addAnimation([spinnerArrowContainerAnimation, circleInnerAnimation, circleOuterAnimation]);
- };
- const createScaleAnimation = (pullingRefresherIcon, refresherEl) => {
- /**
- * Do not take the height of the refresher icon
- * because at this point the DOM has not updated,
- * so the refresher icon is still hidden with
- * display: none.
- * The `ion-refresher` container height
- * is roughly the amount we need to offset
- * the icon by when pulling down.
- */
- const height = refresherEl.clientHeight;
- const spinnerAnimation = createAnimation()
- .addElement(pullingRefresherIcon)
- .keyframes([
- { offset: 0, transform: `scale(0) translateY(-${height}px)` },
- { offset: 1, transform: 'scale(1) translateY(100px)' },
- ]);
- return createBaseAnimation(pullingRefresherIcon).addAnimation([spinnerAnimation]);
- };
- const createTranslateAnimation = (pullingRefresherIcon, refresherEl) => {
- /**
- * Do not take the height of the refresher icon
- * because at this point the DOM has not updated,
- * so the refresher icon is still hidden with
- * display: none.
- * The `ion-refresher` container height
- * is roughly the amount we need to offset
- * the icon by when pulling down.
- */
- const height = refresherEl.clientHeight;
- const spinnerAnimation = createAnimation()
- .addElement(pullingRefresherIcon)
- .keyframes([
- { offset: 0, transform: `translateY(-${height}px)` },
- { offset: 1, transform: 'translateY(100px)' },
- ]);
- return createBaseAnimation(pullingRefresherIcon).addAnimation([spinnerAnimation]);
- };
- const createSnapBackAnimation = (pullingRefresherIcon) => {
- return createAnimation()
- .duration(125)
- .addElement(pullingRefresherIcon)
- .fromTo('transform', 'translateY(var(--ion-pulling-refresher-translate, 100px))', 'translateY(0px)');
- };
- // iOS Native Refresher
- // -----------------------------
- const setSpinnerOpacity = (spinner, opacity) => {
- spinner.style.setProperty('opacity', opacity.toString());
- };
- const handleScrollWhilePulling = (ticks, numTicks, pullAmount) => {
- const max = 1;
- writeTask(() => {
- ticks.forEach((el, i) => {
- /**
- * Compute the opacity of each tick
- * mark as a percentage of the pullAmount
- * offset by max / numTicks so
- * the tick marks are shown staggered.
- */
- const min = i * (max / numTicks);
- const range = max - min;
- const start = pullAmount - min;
- const progression = clamp(0, start / range, 1);
- el.style.setProperty('opacity', progression.toString());
- });
- });
- };
- const handleScrollWhileRefreshing = (spinner, lastVelocityY) => {
- writeTask(() => {
- // If user pulls down quickly, the spinner should spin faster
- spinner.style.setProperty('--refreshing-rotation-duration', lastVelocityY >= 1.0 ? '0.5s' : '2s');
- spinner.style.setProperty('opacity', '1');
- });
- };
- const translateElement = (el, value, duration = 200) => {
- if (!el) {
- return Promise.resolve();
- }
- const trans = transitionEndAsync(el, duration);
- writeTask(() => {
- el.style.setProperty('transition', `${duration}ms all ease-out`);
- if (value === undefined) {
- el.style.removeProperty('transform');
- }
- else {
- el.style.setProperty('transform', `translate3d(0px, ${value}, 0px)`);
- }
- });
- return trans;
- };
- // Utils
- // -----------------------------
- /**
- * In order to use the native iOS refresher the device must support rubber band scrolling.
- * As part of this, we need to exclude Desktop Safari because it has a slightly different rubber band effect that is not compatible with the native refresher in Ionic.
- *
- * We also need to be careful not to include devices that spoof their user agent.
- * For example, when using iOS emulation in Chrome the user agent will be spoofed such that
- * navigator.maxTouchPointer > 0. To work around this,
- * we check to see if the apple-pay-logo is supported as a named image which is only
- * true on Apple devices.
- *
- * We previously checked referencEl.style.webkitOverflowScrolling to explicitly check
- * for rubber band support. However, this property was removed on iPadOS and it's possible
- * that this will be removed on iOS in the future too.
- *
- */
- const supportsRubberBandScrolling = () => {
- return navigator.maxTouchPoints > 0 && CSS.supports('background: -webkit-named-image(apple-pay-logo-black)');
- };
- const shouldUseNativeRefresher = async (referenceEl, mode) => {
- const refresherContent = referenceEl.querySelector('ion-refresher-content');
- if (!refresherContent) {
- return Promise.resolve(false);
- }
- await new Promise((resolve) => componentOnReady(refresherContent, resolve));
- const pullingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-pulling ion-spinner');
- const refreshingSpinner = referenceEl.querySelector('ion-refresher-content .refresher-refreshing ion-spinner');
- return (pullingSpinner !== null &&
- refreshingSpinner !== null &&
- ((mode === 'ios' && supportsRubberBandScrolling()) || mode === 'md'));
- };
- const refresherIosCss = "ion-refresher{top:0;display:none;position:absolute;width:100%;height:60px;pointer-events:none;z-index:-1}ion-refresher{inset-inline-start:0}ion-refresher.refresher-active{display:block}ion-refresher-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;height:100%}.refresher-pulling,.refresher-refreshing{display:none;width:100%}.refresher-pulling-icon,.refresher-refreshing-icon{-webkit-transform-origin:center;transform-origin:center;-webkit-transition:200ms;transition:200ms;font-size:30px;text-align:center}:host-context([dir=rtl]) .refresher-pulling-icon,:host-context([dir=rtl]) .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}[dir=rtl] .refresher-pulling-icon,[dir=rtl] .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}@supports selector(:dir(rtl)){.refresher-pulling-icon:dir(rtl),.refresher-refreshing-icon:dir(rtl){-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}}.refresher-pulling-text,.refresher-refreshing-text{font-size:16px;text-align:center}ion-refresher-content .arrow-container{display:none}.refresher-pulling ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling-icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.refresher-refreshing ion-refresher-content .refresher-refreshing{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-completing ion-refresher-content .refresher-refreshing{display:block}.refresher-completing ion-refresher-content .refresher-refreshing-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-native .refresher-pulling-text,.refresher-native .refresher-refreshing-text{display:none}.refresher-ios .refresher-pulling-icon,.refresher-ios .refresher-refreshing-icon{color:var(--ion-text-color, #000)}.refresher-ios .refresher-pulling-text,.refresher-ios .refresher-refreshing-text{color:var(--ion-text-color, #000)}.refresher-ios .refresher-refreshing .spinner-lines-ios line,.refresher-ios .refresher-refreshing .spinner-lines-small-ios line,.refresher-ios .refresher-refreshing .spinner-crescent circle{stroke:var(--ion-text-color, #000)}.refresher-ios .refresher-refreshing .spinner-bubbles circle,.refresher-ios .refresher-refreshing .spinner-circles circle,.refresher-ios .refresher-refreshing .spinner-dots circle{fill:var(--ion-text-color, #000)}ion-refresher.refresher-native{display:block;z-index:1}ion-refresher.refresher-native ion-spinner{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}.refresher-native .refresher-refreshing ion-spinner{--refreshing-rotation-duration:2s;display:none;-webkit-animation:var(--refreshing-rotation-duration) ease-out refresher-rotate forwards;animation:var(--refreshing-rotation-duration) ease-out refresher-rotate forwards}.refresher-native .refresher-refreshing{display:none;-webkit-animation:250ms linear refresher-pop forwards;animation:250ms linear refresher-pop forwards}.refresher-native ion-spinner{width:32px;height:32px;color:var(--ion-color-step-450, var(--ion-background-color-step-450, #747577))}.refresher-native.refresher-refreshing .refresher-pulling ion-spinner,.refresher-native.refresher-completing .refresher-pulling ion-spinner{display:none}.refresher-native.refresher-refreshing .refresher-refreshing ion-spinner,.refresher-native.refresher-completing .refresher-refreshing ion-spinner{display:block}.refresher-native.refresher-pulling .refresher-pulling ion-spinner{display:block}.refresher-native.refresher-pulling .refresher-refreshing ion-spinner{display:none}.refresher-native.refresher-completing ion-refresher-content .refresher-refreshing-icon{-webkit-transform:scale(0) rotate(180deg);transform:scale(0) rotate(180deg);-webkit-transition:300ms;transition:300ms}@-webkit-keyframes refresher-pop{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}50%{-webkit-transform:scale(1.2);transform:scale(1.2);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes refresher-pop{0%{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}50%{-webkit-transform:scale(1.2);transform:scale(1.2);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes refresher-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}@keyframes refresher-rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}";
- var IonRefresherIosStyle0 = refresherIosCss;
- const refresherMdCss = "ion-refresher{top:0;display:none;position:absolute;width:100%;height:60px;pointer-events:none;z-index:-1}ion-refresher{inset-inline-start:0}ion-refresher.refresher-active{display:block}ion-refresher-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;height:100%}.refresher-pulling,.refresher-refreshing{display:none;width:100%}.refresher-pulling-icon,.refresher-refreshing-icon{-webkit-transform-origin:center;transform-origin:center;-webkit-transition:200ms;transition:200ms;font-size:30px;text-align:center}:host-context([dir=rtl]) .refresher-pulling-icon,:host-context([dir=rtl]) .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}[dir=rtl] .refresher-pulling-icon,[dir=rtl] .refresher-refreshing-icon{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}@supports selector(:dir(rtl)){.refresher-pulling-icon:dir(rtl),.refresher-refreshing-icon:dir(rtl){-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}}.refresher-pulling-text,.refresher-refreshing-text{font-size:16px;text-align:center}ion-refresher-content .arrow-container{display:none}.refresher-pulling ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling{display:block}.refresher-ready ion-refresher-content .refresher-pulling-icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.refresher-refreshing ion-refresher-content .refresher-refreshing{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling{display:block}.refresher-cancelling ion-refresher-content .refresher-pulling-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-completing ion-refresher-content .refresher-refreshing{display:block}.refresher-completing ion-refresher-content .refresher-refreshing-icon{-webkit-transform:scale(0);transform:scale(0)}.refresher-native .refresher-pulling-text,.refresher-native .refresher-refreshing-text{display:none}.refresher-md .refresher-pulling-icon,.refresher-md .refresher-refreshing-icon{color:var(--ion-text-color, #000)}.refresher-md .refresher-pulling-text,.refresher-md .refresher-refreshing-text{color:var(--ion-text-color, #000)}.refresher-md .refresher-refreshing .spinner-lines-md line,.refresher-md .refresher-refreshing .spinner-lines-small-md line,.refresher-md .refresher-refreshing .spinner-crescent circle{stroke:var(--ion-text-color, #000)}.refresher-md .refresher-refreshing .spinner-bubbles circle,.refresher-md .refresher-refreshing .spinner-circles circle,.refresher-md .refresher-refreshing .spinner-dots circle{fill:var(--ion-text-color, #000)}ion-refresher.refresher-native{display:block;z-index:1}ion-refresher.refresher-native ion-spinner{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;width:24px;height:24px;color:var(--ion-color-primary, #0054e9)}ion-refresher.refresher-native .spinner-arrow-container{display:inherit}ion-refresher.refresher-native .arrow-container{display:block;position:absolute;width:24px;height:24px}ion-refresher.refresher-native .arrow-container ion-icon{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;left:0;right:0;bottom:-4px;position:absolute;color:var(--ion-color-primary, #0054e9);font-size:12px}ion-refresher.refresher-native.refresher-pulling ion-refresher-content .refresher-pulling,ion-refresher.refresher-native.refresher-ready ion-refresher-content .refresher-pulling{display:-ms-flexbox;display:flex}ion-refresher.refresher-native.refresher-refreshing ion-refresher-content .refresher-refreshing,ion-refresher.refresher-native.refresher-completing ion-refresher-content .refresher-refreshing,ion-refresher.refresher-native.refresher-cancelling ion-refresher-content .refresher-refreshing{display:-ms-flexbox;display:flex}ion-refresher.refresher-native .refresher-pulling-icon{-webkit-transform:translateY(calc(-100% - 10px));transform:translateY(calc(-100% - 10px))}ion-refresher.refresher-native .refresher-pulling-icon,ion-refresher.refresher-native .refresher-refreshing-icon{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;border-radius:100%;-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;display:-ms-flexbox;display:flex;border:1px solid var(--ion-color-step-200, var(--ion-background-color-step-200, #ececec));background:var(--ion-color-step-250, var(--ion-background-color-step-250, #ffffff));-webkit-box-shadow:0px 1px 6px rgba(0, 0, 0, 0.1);box-shadow:0px 1px 6px rgba(0, 0, 0, 0.1)}";
- var IonRefresherMdStyle0 = refresherMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Refresher {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionRefresh = createEvent(this, "ionRefresh", 7);
- this.ionPull = createEvent(this, "ionPull", 7);
- this.ionStart = createEvent(this, "ionStart", 7);
- this.appliedStyles = false;
- this.didStart = false;
- this.progress = 0;
- this.pointerDown = false;
- this.needsCompletion = false;
- this.didRefresh = false;
- this.contentFullscreen = false;
- this.lastVelocityY = 0;
- this.animations = [];
- this.nativeRefresher = false;
- this.state = 1 /* RefresherState.Inactive */;
- this.pullMin = 60;
- this.pullMax = this.pullMin + 60;
- this.closeDuration = '280ms';
- this.snapbackDuration = '280ms';
- this.pullFactor = 1;
- this.disabled = false;
- }
- disabledChanged() {
- if (this.gesture) {
- this.gesture.enable(!this.disabled);
- }
- }
- async checkNativeRefresher() {
- const useNativeRefresher = await shouldUseNativeRefresher(this.el, getIonMode$1(this));
- if (useNativeRefresher && !this.nativeRefresher) {
- const contentEl = this.el.closest('ion-content');
- this.setupNativeRefresher(contentEl);
- }
- else if (!useNativeRefresher) {
- this.destroyNativeRefresher();
- }
- }
- destroyNativeRefresher() {
- if (this.scrollEl && this.scrollListenerCallback) {
- this.scrollEl.removeEventListener('scroll', this.scrollListenerCallback);
- this.scrollListenerCallback = undefined;
- }
- this.nativeRefresher = false;
- }
- async resetNativeRefresher(el, state) {
- this.state = state;
- if (getIonMode$1(this) === 'ios') {
- await translateElement(el, undefined, 300);
- }
- else {
- await transitionEndAsync(this.el.querySelector('.refresher-refreshing-icon'), 200);
- }
- this.didRefresh = false;
- this.needsCompletion = false;
- this.pointerDown = false;
- this.animations.forEach((ani) => ani.destroy());
- this.animations = [];
- this.progress = 0;
- this.state = 1 /* RefresherState.Inactive */;
- }
- async setupiOSNativeRefresher(pullingSpinner, refreshingSpinner) {
- this.elementToTransform = this.scrollEl;
- const ticks = pullingSpinner.shadowRoot.querySelectorAll('svg');
- let MAX_PULL = this.scrollEl.clientHeight * 0.16;
- const NUM_TICKS = ticks.length;
- writeTask(() => ticks.forEach((el) => el.style.setProperty('animation', 'none')));
- this.scrollListenerCallback = () => {
- // If pointer is not on screen or refresher is not active, ignore scroll
- if (!this.pointerDown && this.state === 1 /* RefresherState.Inactive */) {
- return;
- }
- readTask(() => {
- // PTR should only be active when overflow scrolling at the top
- const scrollTop = this.scrollEl.scrollTop;
- const refresherHeight = this.el.clientHeight;
- if (scrollTop > 0) {
- /**
- * If refresher is refreshing and user tries to scroll
- * progressively fade refresher out/in
- */
- if (this.state === 8 /* RefresherState.Refreshing */) {
- const ratio = clamp(0, scrollTop / (refresherHeight * 0.5), 1);
- writeTask(() => setSpinnerOpacity(refreshingSpinner, 1 - ratio));
- return;
- }
- return;
- }
- if (this.pointerDown) {
- if (!this.didStart) {
- this.didStart = true;
- this.ionStart.emit();
- }
- // emit "pulling" on every move
- if (this.pointerDown) {
- this.ionPull.emit();
- }
- }
- /**
- * We want to delay the start of this gesture by ~30px
- * when initially pulling down so the refresher does not
- * overlap with the content. But when letting go of the
- * gesture before the refresher completes, we want the
- * refresher tick marks to quickly fade out.
- */
- const offset = this.didStart ? 30 : 0;
- const pullAmount = (this.progress = clamp(0, (Math.abs(scrollTop) - offset) / MAX_PULL, 1));
- const shouldShowRefreshingSpinner = this.state === 8 /* RefresherState.Refreshing */ || pullAmount === 1;
- if (shouldShowRefreshingSpinner) {
- if (this.pointerDown) {
- handleScrollWhileRefreshing(refreshingSpinner, this.lastVelocityY);
- }
- if (!this.didRefresh) {
- this.beginRefresh();
- this.didRefresh = true;
- hapticImpact({ style: ImpactStyle.Light });
- /**
- * Translate the content element otherwise when pointer is removed
- * from screen the scroll content will bounce back over the refresher
- */
- if (!this.pointerDown) {
- translateElement(this.elementToTransform, `${refresherHeight}px`);
- }
- }
- }
- else {
- this.state = 2 /* RefresherState.Pulling */;
- handleScrollWhilePulling(ticks, NUM_TICKS, pullAmount);
- }
- });
- };
- this.scrollEl.addEventListener('scroll', this.scrollListenerCallback);
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: this.scrollEl,
- gestureName: 'refresher',
- gesturePriority: 31,
- direction: 'y',
- threshold: 5,
- onStart: () => {
- this.pointerDown = true;
- if (!this.didRefresh) {
- translateElement(this.elementToTransform, '0px');
- }
- /**
- * If the content had `display: none` when
- * the refresher was initialized, its clientHeight
- * will be 0. When the gesture starts, the content
- * will be visible, so try to get the correct
- * client height again. This is most common when
- * using the refresher in an ion-menu.
- */
- if (MAX_PULL === 0) {
- MAX_PULL = this.scrollEl.clientHeight * 0.16;
- }
- },
- onMove: (ev) => {
- this.lastVelocityY = ev.velocityY;
- },
- onEnd: () => {
- this.pointerDown = false;
- this.didStart = false;
- if (this.needsCompletion) {
- this.resetNativeRefresher(this.elementToTransform, 32 /* RefresherState.Completing */);
- this.needsCompletion = false;
- }
- else if (this.didRefresh) {
- readTask(() => translateElement(this.elementToTransform, `${this.el.clientHeight}px`));
- }
- },
- });
- this.disabledChanged();
- }
- async setupMDNativeRefresher(contentEl, pullingSpinner, refreshingSpinner) {
- const circle = getElementRoot(pullingSpinner).querySelector('circle');
- const pullingRefresherIcon = this.el.querySelector('ion-refresher-content .refresher-pulling-icon');
- const refreshingCircle = getElementRoot(refreshingSpinner).querySelector('circle');
- if (circle !== null && refreshingCircle !== null) {
- writeTask(() => {
- circle.style.setProperty('animation', 'none');
- // This lines up the animation on the refreshing spinner with the pulling spinner
- refreshingSpinner.style.setProperty('animation-delay', '-655ms');
- refreshingCircle.style.setProperty('animation-delay', '-655ms');
- });
- }
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: this.scrollEl,
- gestureName: 'refresher',
- gesturePriority: 31,
- direction: 'y',
- threshold: 5,
- canStart: () => this.state !== 8 /* RefresherState.Refreshing */ &&
- this.state !== 32 /* RefresherState.Completing */ &&
- this.scrollEl.scrollTop === 0,
- onStart: (ev) => {
- this.progress = 0;
- ev.data = { animation: undefined, didStart: false, cancelled: false };
- },
- onMove: (ev) => {
- if ((ev.velocityY < 0 && this.progress === 0 && !ev.data.didStart) || ev.data.cancelled) {
- ev.data.cancelled = true;
- return;
- }
- if (!ev.data.didStart) {
- ev.data.didStart = true;
- this.state = 2 /* RefresherState.Pulling */;
- // When ion-refresher is being used with a custom scroll target, the overflow styles need to be applied directly instead of via a css variable
- const { scrollEl } = this;
- const overflowProperty = scrollEl.matches(ION_CONTENT_CLASS_SELECTOR) ? 'overflow' : '--overflow';
- writeTask(() => scrollEl.style.setProperty(overflowProperty, 'hidden'));
- const animationType = getRefresherAnimationType(contentEl);
- const animation = createPullingAnimation(animationType, pullingRefresherIcon, this.el);
- ev.data.animation = animation;
- animation.progressStart(false, 0);
- this.ionStart.emit();
- this.animations.push(animation);
- return;
- }
- // Since we are using an easing curve, slow the gesture tracking down a bit
- this.progress = clamp(0, (ev.deltaY / 180) * 0.5, 1);
- ev.data.animation.progressStep(this.progress);
- this.ionPull.emit();
- },
- onEnd: (ev) => {
- if (!ev.data.didStart) {
- return;
- }
- this.gesture.enable(false);
- const { scrollEl } = this;
- const overflowProperty = scrollEl.matches(ION_CONTENT_CLASS_SELECTOR) ? 'overflow' : '--overflow';
- writeTask(() => scrollEl.style.removeProperty(overflowProperty));
- if (this.progress <= 0.4) {
- ev.data.animation.progressEnd(0, this.progress, 500).onFinish(() => {
- this.animations.forEach((ani) => ani.destroy());
- this.animations = [];
- this.gesture.enable(true);
- this.state = 1 /* RefresherState.Inactive */;
- });
- return;
- }
- const progress = getTimeGivenProgression([0, 0], [0, 0], [1, 1], [1, 1], this.progress)[0];
- const snapBackAnimation = createSnapBackAnimation(pullingRefresherIcon);
- this.animations.push(snapBackAnimation);
- writeTask(async () => {
- pullingRefresherIcon.style.setProperty('--ion-pulling-refresher-translate', `${progress * 100}px`);
- ev.data.animation.progressEnd();
- await snapBackAnimation.play();
- this.beginRefresh();
- ev.data.animation.destroy();
- this.gesture.enable(true);
- });
- },
- });
- this.disabledChanged();
- }
- async setupNativeRefresher(contentEl) {
- if (this.scrollListenerCallback || !contentEl || this.nativeRefresher || !this.scrollEl) {
- return;
- }
- /**
- * If using non-native refresher before make sure
- * we clean up any old CSS. This can happen when
- * a user manually calls the refresh method in a
- * component create callback before the native
- * refresher is setup.
- */
- this.setCss(0, '', false, '');
- this.nativeRefresher = true;
- const pullingSpinner = this.el.querySelector('ion-refresher-content .refresher-pulling ion-spinner');
- const refreshingSpinner = this.el.querySelector('ion-refresher-content .refresher-refreshing ion-spinner');
- if (getIonMode$1(this) === 'ios') {
- this.setupiOSNativeRefresher(pullingSpinner, refreshingSpinner);
- }
- else {
- this.setupMDNativeRefresher(contentEl, pullingSpinner, refreshingSpinner);
- }
- }
- componentDidUpdate() {
- this.checkNativeRefresher();
- }
- async connectedCallback() {
- if (this.el.getAttribute('slot') !== 'fixed') {
- printIonError('[ion-refresher] - Make sure you use: <ion-refresher slot="fixed">');
- return;
- }
- const contentEl = this.el.closest(ION_CONTENT_ELEMENT_SELECTOR);
- if (!contentEl) {
- printIonContentErrorMsg(this.el);
- return;
- }
- /**
- * Waits for the content to be ready before querying the scroll
- * or the background content element.
- */
- componentOnReady(contentEl, async () => {
- const customScrollTarget = contentEl.querySelector(ION_CONTENT_CLASS_SELECTOR);
- /**
- * Query the custom scroll target (if available), first. In refresher implementations,
- * the ion-refresher element will always be a direct child of ion-content (slot="fixed"). By
- * querying the custom scroll target first and falling back to the ion-content element,
- * the correct scroll element will be returned by the implementation.
- */
- this.scrollEl = await getScrollElement(customScrollTarget !== null && customScrollTarget !== void 0 ? customScrollTarget : contentEl);
- /**
- * Query the background content element from the host ion-content element directly.
- */
- this.backgroundContentEl = await contentEl.getBackgroundElement();
- /**
- * Check if the content element is fullscreen to apply the correct styles
- * when the refresher is refreshing. Otherwise, the refresher will be
- * hidden because it is positioned behind the background content element.
- */
- this.contentFullscreen = contentEl.fullscreen;
- if (await shouldUseNativeRefresher(this.el, getIonMode$1(this))) {
- this.setupNativeRefresher(contentEl);
- }
- else {
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: contentEl,
- gestureName: 'refresher',
- gesturePriority: 31,
- direction: 'y',
- threshold: 20,
- passive: false,
- canStart: () => this.canStart(),
- onStart: () => this.onStart(),
- onMove: (ev) => this.onMove(ev),
- onEnd: () => this.onEnd(),
- });
- this.disabledChanged();
- }
- });
- }
- disconnectedCallback() {
- this.destroyNativeRefresher();
- this.scrollEl = undefined;
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- }
- /**
- * Call `complete()` when your async operation has completed.
- * For example, the `refreshing` state is while the app is performing
- * an asynchronous operation, such as receiving more data from an
- * AJAX request. Once the data has been received, you then call this
- * method to signify that the refreshing has completed and to close
- * the refresher. This method also changes the refresher's state from
- * `refreshing` to `completing`.
- */
- async complete() {
- if (this.nativeRefresher) {
- this.needsCompletion = true;
- // Do not reset scroll el until user removes pointer from screen
- if (!this.pointerDown) {
- raf(() => raf(() => this.resetNativeRefresher(this.elementToTransform, 32 /* RefresherState.Completing */)));
- }
- }
- else {
- this.close(32 /* RefresherState.Completing */, '120ms');
- }
- }
- /**
- * Changes the refresher's state from `refreshing` to `cancelling`.
- */
- async cancel() {
- if (this.nativeRefresher) {
- // Do not reset scroll el until user removes pointer from screen
- if (!this.pointerDown) {
- raf(() => raf(() => this.resetNativeRefresher(this.elementToTransform, 16 /* RefresherState.Cancelling */)));
- }
- }
- else {
- this.close(16 /* RefresherState.Cancelling */, '');
- }
- }
- /**
- * A number representing how far down the user has pulled.
- * The number `0` represents the user hasn't pulled down at all. The
- * number `1`, and anything greater than `1`, represents that the user
- * has pulled far enough down that when they let go then the refresh will
- * happen. If they let go and the number is less than `1`, then the
- * refresh will not happen, and the content will return to it's original
- * position.
- */
- getProgress() {
- return Promise.resolve(this.progress);
- }
- canStart() {
- if (!this.scrollEl) {
- return false;
- }
- if (this.state !== 1 /* RefresherState.Inactive */) {
- return false;
- }
- // if the scrollTop is greater than zero then it's
- // not possible to pull the content down yet
- if (this.scrollEl.scrollTop > 0) {
- return false;
- }
- return true;
- }
- onStart() {
- this.progress = 0;
- this.state = 1 /* RefresherState.Inactive */;
- this.memoizeOverflowStyle();
- /**
- * If the content is fullscreen, then we need to
- * set the offset-top style on the background content
- * element to ensure that the refresher is shown.
- */
- if (this.contentFullscreen && this.backgroundContentEl) {
- this.backgroundContentEl.style.setProperty('--offset-top', '0px');
- }
- }
- onMove(detail) {
- if (!this.scrollEl) {
- return;
- }
- // this method can get called like a bazillion times per second,
- // so it's built to be as efficient as possible, and does its
- // best to do any DOM read/writes only when absolutely necessary
- // if multi-touch then get out immediately
- const ev = detail.event;
- if (ev.touches !== undefined && ev.touches.length > 1) {
- return;
- }
- // do nothing if it's actively refreshing
- // or it's in the way of closing
- // or this was never a startY
- if ((this.state & 56 /* RefresherState._BUSY_ */) !== 0) {
- return;
- }
- const pullFactor = Number.isNaN(this.pullFactor) || this.pullFactor < 0 ? 1 : this.pullFactor;
- const deltaY = detail.deltaY * pullFactor;
- // don't bother if they're scrolling up
- // and have not already started dragging
- if (deltaY <= 0) {
- // the current Y is higher than the starting Y
- // so they scrolled up enough to be ignored
- this.progress = 0;
- this.state = 1 /* RefresherState.Inactive */;
- if (this.appliedStyles) {
- // reset the styles only if they were applied
- this.setCss(0, '', false, '');
- return;
- }
- return;
- }
- if (this.state === 1 /* RefresherState.Inactive */) {
- // this refresh is not already actively pulling down
- // get the content's scrollTop
- const scrollHostScrollTop = this.scrollEl.scrollTop;
- // if the scrollTop is greater than zero then it's
- // not possible to pull the content down yet
- if (scrollHostScrollTop > 0) {
- this.progress = 0;
- return;
- }
- // content scrolled all the way to the top, and dragging down
- this.state = 2 /* RefresherState.Pulling */;
- }
- // prevent native scroll events
- if (ev.cancelable) {
- ev.preventDefault();
- }
- // the refresher is actively pulling at this point
- // move the scroll element within the content element
- this.setCss(deltaY, '0ms', true, '');
- if (deltaY === 0) {
- // don't continue if there's no delta yet
- this.progress = 0;
- return;
- }
- const pullMin = this.pullMin;
- // set pull progress
- this.progress = deltaY / pullMin;
- // emit "start" if it hasn't started yet
- if (!this.didStart) {
- this.didStart = true;
- this.ionStart.emit();
- }
- // emit "pulling" on every move
- this.ionPull.emit();
- // do nothing if the delta is less than the pull threshold
- if (deltaY < pullMin) {
- // ensure it stays in the pulling state, cuz its not ready yet
- this.state = 2 /* RefresherState.Pulling */;
- return;
- }
- if (deltaY > this.pullMax) {
- // they pulled farther than the max, so kick off the refresh
- this.beginRefresh();
- return;
- }
- // pulled farther than the pull min!!
- // it is now in the `ready` state!!
- // if they let go then it'll refresh, kerpow!!
- this.state = 4 /* RefresherState.Ready */;
- return;
- }
- onEnd() {
- // only run in a zone when absolutely necessary
- if (this.state === 4 /* RefresherState.Ready */) {
- // they pulled down far enough, so it's ready to refresh
- this.beginRefresh();
- }
- else if (this.state === 2 /* RefresherState.Pulling */) {
- // they were pulling down, but didn't pull down far enough
- // set the content back to it's original location
- // and close the refresher
- // set that the refresh is actively cancelling
- this.cancel();
- }
- else if (this.state === 1 /* RefresherState.Inactive */) {
- /**
- * The pull to refresh gesture was aborted
- * so we should immediately restore any overflow styles
- * that have been modified. Do not call this.cancel
- * because the styles will only be reset after a timeout.
- * If the gesture is aborted then scrolling should be
- * available right away.
- */
- this.restoreOverflowStyle();
- }
- }
- beginRefresh() {
- // assumes we're already back in a zone
- // they pulled down far enough, so it's ready to refresh
- this.state = 8 /* RefresherState.Refreshing */;
- // place the content in a hangout position while it thinks
- this.setCss(this.pullMin, this.snapbackDuration, true, '');
- // emit "refresh" because it was pulled down far enough
- // and they let go to begin refreshing
- this.ionRefresh.emit({
- complete: this.complete.bind(this),
- });
- }
- close(state, delay) {
- // create fallback timer incase something goes wrong with transitionEnd event
- setTimeout(() => {
- var _a;
- this.state = 1 /* RefresherState.Inactive */;
- this.progress = 0;
- this.didStart = false;
- /**
- * Reset any overflow styles so the
- * user can scroll again.
- */
- this.setCss(0, '0ms', false, '', true);
- /**
- * Reset the offset-top style on the background content
- * when the refresher is no longer refreshing and the
- * content is fullscreen.
- *
- * This ensures that the behavior of background content
- * does not change when refreshing is complete.
- */
- if (this.contentFullscreen && this.backgroundContentEl) {
- (_a = this.backgroundContentEl) === null || _a === void 0 ? void 0 : _a.style.removeProperty('--offset-top');
- }
- }, 600);
- // reset the styles on the scroll element
- // set that the refresh is actively cancelling/completing
- this.state = state;
- this.setCss(0, this.closeDuration, true, delay);
- }
- setCss(y, duration, overflowVisible, delay, shouldRestoreOverflowStyle = false) {
- if (this.nativeRefresher) {
- return;
- }
- this.appliedStyles = y > 0;
- writeTask(() => {
- if (this.scrollEl && this.backgroundContentEl) {
- const scrollStyle = this.scrollEl.style;
- const backgroundStyle = this.backgroundContentEl.style;
- scrollStyle.transform = backgroundStyle.transform = y > 0 ? `translateY(${y}px) translateZ(0px)` : '';
- scrollStyle.transitionDuration = backgroundStyle.transitionDuration = duration;
- scrollStyle.transitionDelay = backgroundStyle.transitionDelay = delay;
- scrollStyle.overflow = overflowVisible ? 'hidden' : '';
- }
- /**
- * Reset the overflow styles only once
- * the pull to refresh effect has been closed.
- * This ensures that the gesture is done
- * and the refresh operation has either
- * been aborted or has completed.
- */
- if (shouldRestoreOverflowStyle) {
- this.restoreOverflowStyle();
- }
- });
- }
- memoizeOverflowStyle() {
- if (this.scrollEl) {
- const { overflow, overflowX, overflowY } = this.scrollEl.style;
- this.overflowStyles = {
- overflow: overflow !== null && overflow !== void 0 ? overflow : '',
- overflowX: overflowX !== null && overflowX !== void 0 ? overflowX : '',
- overflowY: overflowY !== null && overflowY !== void 0 ? overflowY : '',
- };
- }
- }
- restoreOverflowStyle() {
- if (this.overflowStyles !== undefined && this.scrollEl !== undefined) {
- const { overflow, overflowX, overflowY } = this.overflowStyles;
- this.scrollEl.style.overflow = overflow;
- this.scrollEl.style.overflowX = overflowX;
- this.scrollEl.style.overflowY = overflowY;
- this.overflowStyles = undefined;
- }
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'c717c16f2ca3e42351848cc8ad37918dec28961d', slot: "fixed", class: {
- [mode]: true,
- // Used internally for styling
- [`refresher-${mode}`]: true,
- 'refresher-native': this.nativeRefresher,
- 'refresher-active': this.state !== 1 /* RefresherState.Inactive */,
- 'refresher-pulling': this.state === 2 /* RefresherState.Pulling */,
- 'refresher-ready': this.state === 4 /* RefresherState.Ready */,
- 'refresher-refreshing': this.state === 8 /* RefresherState.Refreshing */,
- 'refresher-cancelling': this.state === 16 /* RefresherState.Cancelling */,
- 'refresher-completing': this.state === 32 /* RefresherState.Completing */,
- } }));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledChanged"]
- }; }
- static get style() { return {
- ios: IonRefresherIosStyle0,
- md: IonRefresherMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 32,
- "$tagName$": "ion-refresher",
- "$members$": {
- "pullMin": [2, "pull-min"],
- "pullMax": [2, "pull-max"],
- "closeDuration": [1, "close-duration"],
- "snapbackDuration": [1, "snapback-duration"],
- "pullFactor": [2, "pull-factor"],
- "disabled": [4],
- "nativeRefresher": [32],
- "state": [32],
- "complete": [64],
- "cancel": [64],
- "getProgress": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const spinners = {
- bubbles: {
- dur: 1000,
- circles: 9,
- fn: (dur, index, total) => {
- const animationDelay = `${(dur * index) / total - dur}ms`;
- const angle = (2 * Math.PI * index) / total;
- return {
- r: 5,
- style: {
- top: `${32 * Math.sin(angle)}%`,
- left: `${32 * Math.cos(angle)}%`,
- 'animation-delay': animationDelay,
- },
- };
- },
- },
- circles: {
- dur: 1000,
- circles: 8,
- fn: (dur, index, total) => {
- const step = index / total;
- const animationDelay = `${dur * step - dur}ms`;
- const angle = 2 * Math.PI * step;
- return {
- r: 5,
- style: {
- top: `${32 * Math.sin(angle)}%`,
- left: `${32 * Math.cos(angle)}%`,
- 'animation-delay': animationDelay,
- },
- };
- },
- },
- circular: {
- dur: 1400,
- elmDuration: true,
- circles: 1,
- fn: () => {
- return {
- r: 20,
- cx: 48,
- cy: 48,
- fill: 'none',
- viewBox: '24 24 48 48',
- transform: 'translate(0,0)',
- style: {},
- };
- },
- },
- crescent: {
- dur: 750,
- circles: 1,
- fn: () => {
- return {
- r: 26,
- style: {},
- };
- },
- },
- dots: {
- dur: 750,
- circles: 3,
- fn: (_, index) => {
- const animationDelay = -(110 * index) + 'ms';
- return {
- r: 6,
- style: {
- left: `${32 - 32 * index}%`,
- 'animation-delay': animationDelay,
- },
- };
- },
- },
- lines: {
- dur: 1000,
- lines: 8,
- fn: (dur, index, total) => {
- const transform = `rotate(${(360 / total) * index + (index < total / 2 ? 180 : -180)}deg)`;
- const animationDelay = `${(dur * index) / total - dur}ms`;
- return {
- y1: 14,
- y2: 26,
- style: {
- transform: transform,
- 'animation-delay': animationDelay,
- },
- };
- },
- },
- 'lines-small': {
- dur: 1000,
- lines: 8,
- fn: (dur, index, total) => {
- const transform = `rotate(${(360 / total) * index + (index < total / 2 ? 180 : -180)}deg)`;
- const animationDelay = `${(dur * index) / total - dur}ms`;
- return {
- y1: 12,
- y2: 20,
- style: {
- transform: transform,
- 'animation-delay': animationDelay,
- },
- };
- },
- },
- 'lines-sharp': {
- dur: 1000,
- lines: 12,
- fn: (dur, index, total) => {
- const transform = `rotate(${30 * index + (index < 6 ? 180 : -180)}deg)`;
- const animationDelay = `${(dur * index) / total - dur}ms`;
- return {
- y1: 17,
- y2: 29,
- style: {
- transform: transform,
- 'animation-delay': animationDelay,
- },
- };
- },
- },
- 'lines-sharp-small': {
- dur: 1000,
- lines: 12,
- fn: (dur, index, total) => {
- const transform = `rotate(${30 * index + (index < 6 ? 180 : -180)}deg)`;
- const animationDelay = `${(dur * index) / total - dur}ms`;
- return {
- y1: 12,
- y2: 20,
- style: {
- transform: transform,
- 'animation-delay': animationDelay,
- },
- };
- },
- },
- };
- const SPINNERS = spinners;
- class RefresherContent {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
- this.pullingIcon = undefined;
- this.pullingText = undefined;
- this.refreshingSpinner = undefined;
- this.refreshingText = undefined;
- }
- componentWillLoad() {
- if (this.pullingIcon === undefined) {
- /**
- * The native iOS refresher uses a spinner instead of
- * an icon, so we need to see if this device supports
- * the native iOS refresher.
- */
- const hasRubberBandScrolling = supportsRubberBandScrolling();
- const mode = getIonMode$1(this);
- const overflowRefresher = hasRubberBandScrolling ? 'lines' : arrowDown;
- this.pullingIcon = config.get('refreshingIcon', mode === 'ios' && hasRubberBandScrolling ? config.get('spinner', overflowRefresher) : 'circular');
- }
- if (this.refreshingSpinner === undefined) {
- const mode = getIonMode$1(this);
- this.refreshingSpinner = config.get('refreshingSpinner', config.get('spinner', mode === 'ios' ? 'lines' : 'circular'));
- }
- }
- renderPullingText() {
- const { customHTMLEnabled, pullingText } = this;
- if (customHTMLEnabled) {
- return hAsync("div", { class: "refresher-pulling-text", innerHTML: sanitizeDOMString(pullingText) });
- }
- return hAsync("div", { class: "refresher-pulling-text" }, pullingText);
- }
- renderRefreshingText() {
- const { customHTMLEnabled, refreshingText } = this;
- if (customHTMLEnabled) {
- return hAsync("div", { class: "refresher-refreshing-text", innerHTML: sanitizeDOMString(refreshingText) });
- }
- return hAsync("div", { class: "refresher-refreshing-text" }, refreshingText);
- }
- render() {
- const pullingIcon = this.pullingIcon;
- const hasSpinner = pullingIcon != null && SPINNERS[pullingIcon] !== undefined;
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'fb78d7e31f8feb31025e58903eb9de85cb928dbd', class: mode }, hAsync("div", { key: '23f67800f09765ef8fde8cf85a843e19e667f337', class: "refresher-pulling" }, this.pullingIcon && hasSpinner && (hAsync("div", { key: '5a08d3b69762f8b51dcd3dcfbaf3fddb707257fa', class: "refresher-pulling-icon" }, hAsync("div", { key: '42a613b029e092acdff7fe613a429375d89f157e', class: "spinner-arrow-container" }, hAsync("ion-spinner", { key: '2f9cdc75938c4d306de7a717ed67901daef71c2c', name: this.pullingIcon, paused: true }), mode === 'md' && this.pullingIcon === 'circular' && (hAsync("div", { key: '1f8a6347b4a46417ba55286a79f1a41f04bf9c91', class: "arrow-container" }, hAsync("ion-icon", { key: '326713d11d482d420ba5a739ff4528400a37e9ca', icon: caretBackSharp, "aria-hidden": "true" })))))), this.pullingIcon && !hasSpinner && (hAsync("div", { key: 'ab18c7cbea7bcbfa034f90f317652af4d93660ed', class: "refresher-pulling-icon" }, hAsync("ion-icon", { key: 'f488acd54acc8a61b6c5a279f0d7f9a437c370c0', icon: this.pullingIcon, lazy: false, "aria-hidden": "true" }))), this.pullingText !== undefined && this.renderPullingText()), hAsync("div", { key: '914ad6139442dac53af47120ea821fa11c309a38', class: "refresher-refreshing" }, this.refreshingSpinner && (hAsync("div", { key: '7eba732f5e2d72b90399d68a3e89617d8979b3d1', class: "refresher-refreshing-icon" }, hAsync("ion-spinner", { key: '838d66d8bef6f56622c62b1068e7fed29e094302', name: this.refreshingSpinner }))), this.refreshingText !== undefined && this.renderRefreshingText())));
- }
- get el() { return getElement(this); }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-refresher-content",
- "$members$": {
- "pullingIcon": [1025, "pulling-icon"],
- "pullingText": [1, "pulling-text"],
- "refreshingSpinner": [1025, "refreshing-spinner"],
- "refreshingText": [1, "refreshing-text"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const reorderIosCss = ":host([slot]){display:none;line-height:0;z-index:100}.reorder-icon{display:block}::slotted(ion-icon){font-size:dynamic-font(16px)}.reorder-icon{font-size:2.125rem;opacity:0.4}";
- var IonReorderIosStyle0 = reorderIosCss;
- const reorderMdCss = ":host([slot]){display:none;line-height:0;z-index:100}.reorder-icon{display:block}::slotted(ion-icon){font-size:dynamic-font(16px)}.reorder-icon{font-size:1.9375rem;opacity:0.3}";
- var IonReorderMdStyle0 = reorderMdCss;
- /**
- * @part icon - The icon of the reorder handle (uses ion-icon).
- */
- class Reorder {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- onClick(ev) {
- const reorderGroup = this.el.closest('ion-reorder-group');
- ev.preventDefault();
- // Only stop event propagation if the reorder is inside of an enabled
- // reorder group. This allows interaction with clickable children components.
- if (!reorderGroup || !reorderGroup.disabled) {
- ev.stopImmediatePropagation();
- }
- }
- render() {
- const mode = getIonMode$1(this);
- const reorderIcon = mode === 'ios' ? reorderThreeOutline : reorderTwoSharp;
- return (hAsync(Host, { key: '17adf3165f4e09283d5d6434d7cd47bd23519048', class: mode }, hAsync("slot", { key: 'd00d1cd97c689fc5c7b7175a2051cf697fe22871' }, hAsync("ion-icon", { key: 'eec219aebde6083de98358be3e75965c5a5dc3d0', icon: reorderIcon, lazy: false, class: "reorder-icon", part: "icon", "aria-hidden": "true" }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonReorderIosStyle0,
- md: IonReorderMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-reorder",
- "$members$": undefined,
- "$listeners$": [[2, "click", "onClick"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const reorderGroupCss = ".reorder-list-active>*{display:block;-webkit-transition:-webkit-transform 300ms;transition:-webkit-transform 300ms;transition:transform 300ms;transition:transform 300ms, -webkit-transform 300ms;will-change:transform}.reorder-enabled{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.reorder-enabled ion-reorder{display:block;cursor:-webkit-grab;cursor:grab;pointer-events:all;-ms-touch-action:none;touch-action:none}.reorder-selected,.reorder-selected ion-reorder{cursor:-webkit-grabbing;cursor:grabbing}.reorder-selected{position:relative;-webkit-transition:none !important;transition:none !important;-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.4);box-shadow:0 0 10px rgba(0, 0, 0, 0.4);opacity:0.8;z-index:100}.reorder-visible ion-reorder .reorder-icon{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}";
- var IonReorderGroupStyle0 = reorderGroupCss;
- class ReorderGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionItemReorder = createEvent(this, "ionItemReorder", 7);
- this.lastToIndex = -1;
- this.cachedHeights = [];
- this.scrollElTop = 0;
- this.scrollElBottom = 0;
- this.scrollElInitial = 0;
- this.containerTop = 0;
- this.containerBottom = 0;
- this.state = 0 /* ReorderGroupState.Idle */;
- this.disabled = true;
- }
- disabledChanged() {
- if (this.gesture) {
- this.gesture.enable(!this.disabled);
- }
- }
- async connectedCallback() {
- const contentEl = findClosestIonContent(this.el);
- if (contentEl) {
- this.scrollEl = await getScrollElement(contentEl);
- }
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: this.el,
- gestureName: 'reorder',
- gesturePriority: 110,
- threshold: 0,
- direction: 'y',
- passive: false,
- canStart: (detail) => this.canStart(detail),
- onStart: (ev) => this.onStart(ev),
- onMove: (ev) => this.onMove(ev),
- onEnd: () => this.onEnd(),
- });
- this.disabledChanged();
- }
- disconnectedCallback() {
- this.onEnd();
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- }
- /**
- * Completes the reorder operation. Must be called by the `ionItemReorder` event.
- *
- * If a list of items is passed, the list will be reordered and returned in the
- * proper order.
- *
- * If no parameters are passed or if `true` is passed in, the reorder will complete
- * and the item will remain in the position it was dragged to. If `false` is passed,
- * the reorder will complete and the item will bounce back to its original position.
- *
- * @param listOrReorder A list of items to be sorted and returned in the new order or a
- * boolean of whether or not the reorder should reposition the item.
- */
- complete(listOrReorder) {
- return Promise.resolve(this.completeReorder(listOrReorder));
- }
- canStart(ev) {
- if (this.selectedItemEl || this.state !== 0 /* ReorderGroupState.Idle */) {
- return false;
- }
- const target = ev.event.target;
- const reorderEl = target.closest('ion-reorder');
- if (!reorderEl) {
- return false;
- }
- const item = findReorderItem(reorderEl, this.el);
- if (!item) {
- return false;
- }
- ev.data = item;
- return true;
- }
- onStart(ev) {
- ev.event.preventDefault();
- const item = (this.selectedItemEl = ev.data);
- const heights = this.cachedHeights;
- heights.length = 0;
- const el = this.el;
- const children = el.children;
- if (!children || children.length === 0) {
- return;
- }
- let sum = 0;
- for (let i = 0; i < children.length; i++) {
- const child = children[i];
- sum += child.offsetHeight;
- heights.push(sum);
- child.$ionIndex = i;
- }
- const box = el.getBoundingClientRect();
- this.containerTop = box.top;
- this.containerBottom = box.bottom;
- if (this.scrollEl) {
- const scrollBox = this.scrollEl.getBoundingClientRect();
- this.scrollElInitial = this.scrollEl.scrollTop;
- this.scrollElTop = scrollBox.top + AUTO_SCROLL_MARGIN;
- this.scrollElBottom = scrollBox.bottom - AUTO_SCROLL_MARGIN;
- }
- else {
- this.scrollElInitial = 0;
- this.scrollElTop = 0;
- this.scrollElBottom = 0;
- }
- this.lastToIndex = indexForItem(item);
- this.selectedItemHeight = item.offsetHeight;
- this.state = 1 /* ReorderGroupState.Active */;
- item.classList.add(ITEM_REORDER_SELECTED);
- hapticSelectionStart();
- }
- onMove(ev) {
- const selectedItem = this.selectedItemEl;
- if (!selectedItem) {
- return;
- }
- // Scroll if we reach the scroll margins
- const scroll = this.autoscroll(ev.currentY);
- // // Get coordinate
- const top = this.containerTop - scroll;
- const bottom = this.containerBottom - scroll;
- const currentY = Math.max(top, Math.min(ev.currentY, bottom));
- const deltaY = scroll + currentY - ev.startY;
- const normalizedY = currentY - top;
- const toIndex = this.itemIndexForTop(normalizedY);
- if (toIndex !== this.lastToIndex) {
- const fromIndex = indexForItem(selectedItem);
- this.lastToIndex = toIndex;
- hapticSelectionChanged();
- this.reorderMove(fromIndex, toIndex);
- }
- // Update selected item position
- selectedItem.style.transform = `translateY(${deltaY}px)`;
- }
- onEnd() {
- const selectedItemEl = this.selectedItemEl;
- this.state = 2 /* ReorderGroupState.Complete */;
- if (!selectedItemEl) {
- this.state = 0 /* ReorderGroupState.Idle */;
- return;
- }
- const toIndex = this.lastToIndex;
- const fromIndex = indexForItem(selectedItemEl);
- if (toIndex === fromIndex) {
- this.completeReorder();
- }
- else {
- this.ionItemReorder.emit({
- from: fromIndex,
- to: toIndex,
- complete: this.completeReorder.bind(this),
- });
- }
- hapticSelectionEnd();
- }
- completeReorder(listOrReorder) {
- const selectedItemEl = this.selectedItemEl;
- if (selectedItemEl && this.state === 2 /* ReorderGroupState.Complete */) {
- const children = this.el.children;
- const len = children.length;
- const toIndex = this.lastToIndex;
- const fromIndex = indexForItem(selectedItemEl);
- /**
- * insertBefore and setting the transform
- * needs to happen in the same frame otherwise
- * there will be a duplicate transition. This primarily
- * impacts Firefox where insertBefore and transform operations
- * are happening in two separate frames.
- */
- raf(() => {
- if (toIndex !== fromIndex && (listOrReorder === undefined || listOrReorder === true)) {
- const ref = fromIndex < toIndex ? children[toIndex + 1] : children[toIndex];
- this.el.insertBefore(selectedItemEl, ref);
- }
- for (let i = 0; i < len; i++) {
- children[i].style['transform'] = '';
- }
- });
- if (Array.isArray(listOrReorder)) {
- listOrReorder = reorderArray(listOrReorder, fromIndex, toIndex);
- }
- selectedItemEl.style.transition = '';
- selectedItemEl.classList.remove(ITEM_REORDER_SELECTED);
- this.selectedItemEl = undefined;
- this.state = 0 /* ReorderGroupState.Idle */;
- }
- return listOrReorder;
- }
- itemIndexForTop(deltaY) {
- const heights = this.cachedHeights;
- for (let i = 0; i < heights.length; i++) {
- if (heights[i] > deltaY) {
- return i;
- }
- }
- return heights.length - 1;
- }
- /********* DOM WRITE ********* */
- reorderMove(fromIndex, toIndex) {
- const itemHeight = this.selectedItemHeight;
- const children = this.el.children;
- for (let i = 0; i < children.length; i++) {
- const style = children[i].style;
- let value = '';
- if (i > fromIndex && i <= toIndex) {
- value = `translateY(${-itemHeight}px)`;
- }
- else if (i < fromIndex && i >= toIndex) {
- value = `translateY(${itemHeight}px)`;
- }
- style['transform'] = value;
- }
- }
- autoscroll(posY) {
- if (!this.scrollEl) {
- return 0;
- }
- let amount = 0;
- if (posY < this.scrollElTop) {
- amount = -SCROLL_JUMP;
- }
- else if (posY > this.scrollElBottom) {
- amount = SCROLL_JUMP;
- }
- if (amount !== 0) {
- this.scrollEl.scrollBy(0, amount);
- }
- return this.scrollEl.scrollTop - this.scrollElInitial;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '6ca009dd65302a914d459aec638e62977440db20', class: {
- [mode]: true,
- 'reorder-enabled': !this.disabled,
- 'reorder-list-active': this.state !== 0 /* ReorderGroupState.Idle */,
- } }));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledChanged"]
- }; }
- static get style() { return IonReorderGroupStyle0; }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-reorder-group",
- "$members$": {
- "disabled": [4],
- "state": [32],
- "complete": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const indexForItem = (element) => {
- return element['$ionIndex'];
- };
- const findReorderItem = (node, container) => {
- let parent;
- while (node) {
- parent = node.parentElement;
- if (parent === container) {
- return node;
- }
- node = parent;
- }
- return undefined;
- };
- const AUTO_SCROLL_MARGIN = 60;
- const SCROLL_JUMP = 10;
- const ITEM_REORDER_SELECTED = 'reorder-selected';
- const reorderArray = (array, from, to) => {
- const element = array[from];
- array.splice(from, 1);
- array.splice(to, 0, element);
- return array.slice();
- };
- const rippleEffectCss = ":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;-webkit-animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;will-change:transform, opacity;pointer-events:none}.fade-out{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale, 1));transform:translate(var(--translate-end)) scale(var(--final-scale, 1));-webkit-animation:150ms fadeOutAnimation forwards;animation:150ms fadeOutAnimation forwards}@-webkit-keyframes rippleAnimation{from{-webkit-animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transform:scale(1);transform:scale(1)}to{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale, 1));transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@keyframes rippleAnimation{from{-webkit-animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transform:scale(1);transform:scale(1)}to{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale, 1));transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@-webkit-keyframes fadeInAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:0.16}}@keyframes fadeInAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:0.16}}@-webkit-keyframes fadeOutAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0.16}to{opacity:0}}@keyframes fadeOutAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0.16}to{opacity:0}}";
- var IonRippleEffectStyle0 = rippleEffectCss;
- class RippleEffect {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.type = 'bounded';
- }
- /**
- * Adds the ripple effect to the parent element.
- *
- * @param x The horizontal coordinate of where the ripple should start.
- * @param y The vertical coordinate of where the ripple should start.
- */
- async addRipple(x, y) {
- return new Promise((resolve) => {
- readTask(() => {
- const rect = this.el.getBoundingClientRect();
- const width = rect.width;
- const height = rect.height;
- const hypotenuse = Math.sqrt(width * width + height * height);
- const maxDim = Math.max(height, width);
- const maxRadius = this.unbounded ? maxDim : hypotenuse + PADDING;
- const initialSize = Math.floor(maxDim * INITIAL_ORIGIN_SCALE);
- const finalScale = maxRadius / initialSize;
- let posX = x - rect.left;
- let posY = y - rect.top;
- if (this.unbounded) {
- posX = width * 0.5;
- posY = height * 0.5;
- }
- const styleX = posX - initialSize * 0.5;
- const styleY = posY - initialSize * 0.5;
- const moveX = width * 0.5 - posX;
- const moveY = height * 0.5 - posY;
- writeTask(() => {
- const div = document.createElement('div');
- div.classList.add('ripple-effect');
- const style = div.style;
- style.top = styleY + 'px';
- style.left = styleX + 'px';
- style.width = style.height = initialSize + 'px';
- style.setProperty('--final-scale', `${finalScale}`);
- style.setProperty('--translate-end', `${moveX}px, ${moveY}px`);
- const container = this.el.shadowRoot || this.el;
- container.appendChild(div);
- setTimeout(() => {
- resolve(() => {
- removeRipple(div);
- });
- }, 225 + 100);
- });
- });
- });
- }
- get unbounded() {
- return this.type === 'unbounded';
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '40c7f73e7f5f67e29f83e1236a61c6e1c9943c42', role: "presentation", class: {
- [mode]: true,
- unbounded: this.unbounded,
- } }));
- }
- get el() { return getElement(this); }
- static get style() { return IonRippleEffectStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-ripple-effect",
- "$members$": {
- "type": [1],
- "addRipple": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const removeRipple = (ripple) => {
- ripple.classList.add('fade-out');
- setTimeout(() => {
- ripple.remove();
- }, 200);
- };
- const PADDING = 10;
- const INITIAL_ORIGIN_SCALE = 0.5;
- // TODO(FW-2832): types
- class Route {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionRouteDataChanged = createEvent(this, "ionRouteDataChanged", 7);
- this.url = '';
- this.component = undefined;
- this.componentProps = undefined;
- this.beforeLeave = undefined;
- this.beforeEnter = undefined;
- }
- onUpdate(newValue) {
- this.ionRouteDataChanged.emit(newValue);
- }
- onComponentProps(newValue, oldValue) {
- if (newValue === oldValue) {
- return;
- }
- const keys1 = newValue ? Object.keys(newValue) : [];
- const keys2 = oldValue ? Object.keys(oldValue) : [];
- if (keys1.length !== keys2.length) {
- this.onUpdate(newValue);
- return;
- }
- for (const key of keys1) {
- if (newValue[key] !== oldValue[key]) {
- this.onUpdate(newValue);
- return;
- }
- }
- }
- connectedCallback() {
- this.ionRouteDataChanged.emit();
- }
- static get watchers() { return {
- "url": ["onUpdate"],
- "component": ["onUpdate"],
- "componentProps": ["onComponentProps"]
- }; }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-route",
- "$members$": {
- "url": [1],
- "component": [1],
- "componentProps": [16],
- "beforeLeave": [16],
- "beforeEnter": [16]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- class RouteRedirect {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionRouteRedirectChanged = createEvent(this, "ionRouteRedirectChanged", 7);
- this.from = undefined;
- this.to = undefined;
- }
- propDidChange() {
- this.ionRouteRedirectChanged.emit();
- }
- connectedCallback() {
- this.ionRouteRedirectChanged.emit();
- }
- static get watchers() { return {
- "from": ["propDidChange"],
- "to": ["propDidChange"]
- }; }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-route-redirect",
- "$members$": {
- "from": [1],
- "to": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const ROUTER_INTENT_NONE = 'root';
- const ROUTER_INTENT_FORWARD = 'forward';
- const ROUTER_INTENT_BACK = 'back';
- /** Join the non empty segments with "/". */
- const generatePath = (segments) => {
- const path = segments.filter((s) => s.length > 0).join('/');
- return '/' + path;
- };
- const generateUrl = (segments, useHash, queryString) => {
- let url = generatePath(segments);
- if (useHash) {
- url = '#' + url;
- }
- if (queryString !== undefined) {
- url += '?' + queryString;
- }
- return url;
- };
- const writeSegments = (history, root, useHash, segments, direction, state, queryString) => {
- const url = generateUrl([...parsePath(root).segments, ...segments], useHash, queryString);
- if (direction === ROUTER_INTENT_FORWARD) {
- history.pushState(state, '', url);
- }
- else {
- history.replaceState(state, '', url);
- }
- };
- /**
- * Transforms a chain to a list of segments.
- *
- * Notes:
- * - parameter segments of the form :param are replaced with their value,
- * - null is returned when a value is missing for any parameter segment.
- */
- const chainToSegments = (chain) => {
- const segments = [];
- for (const route of chain) {
- for (const segment of route.segments) {
- if (segment[0] === ':') {
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- const param = route.params && route.params[segment.slice(1)];
- if (!param) {
- return null;
- }
- segments.push(param);
- }
- else if (segment !== '') {
- segments.push(segment);
- }
- }
- }
- return segments;
- };
- /**
- * Removes the prefix segments from the path segments.
- *
- * Return:
- * - null when the path segments do not start with the passed prefix,
- * - the path segments after the prefix otherwise.
- */
- const removePrefix = (prefix, segments) => {
- if (prefix.length > segments.length) {
- return null;
- }
- if (prefix.length <= 1 && prefix[0] === '') {
- return segments;
- }
- for (let i = 0; i < prefix.length; i++) {
- if (prefix[i] !== segments[i]) {
- return null;
- }
- }
- if (segments.length === prefix.length) {
- return [''];
- }
- return segments.slice(prefix.length);
- };
- const readSegments = (loc, root, useHash) => {
- const prefix = parsePath(root).segments;
- const pathname = useHash ? loc.hash.slice(1) : loc.pathname;
- const segments = parsePath(pathname).segments;
- return removePrefix(prefix, segments);
- };
- /**
- * Parses the path to:
- * - segments an array of '/' separated parts,
- * - queryString (undefined when no query string).
- */
- const parsePath = (path) => {
- let segments = [''];
- let queryString;
- if (path != null) {
- const qsStart = path.indexOf('?');
- if (qsStart > -1) {
- queryString = path.substring(qsStart + 1);
- path = path.substring(0, qsStart);
- }
- segments = path
- .split('/')
- .map((s) => s.trim())
- .filter((s) => s.length > 0);
- if (segments.length === 0) {
- segments = [''];
- }
- }
- return { segments, queryString };
- };
- const printRoutes = (routes) => {
- console.group(`[ion-core] ROUTES[${routes.length}]`);
- for (const chain of routes) {
- const segments = [];
- chain.forEach((r) => segments.push(...r.segments));
- const ids = chain.map((r) => r.id);
- console.debug(`%c ${generatePath(segments)}`, 'font-weight: bold; padding-left: 20px', '=>\t', `(${ids.join(', ')})`);
- }
- console.groupEnd();
- };
- const printRedirects = (redirects) => {
- console.group(`[ion-core] REDIRECTS[${redirects.length}]`);
- for (const redirect of redirects) {
- if (redirect.to) {
- console.debug('FROM: ', `$c ${generatePath(redirect.from)}`, 'font-weight: bold', ' TO: ', `$c ${generatePath(redirect.to.segments)}`, 'font-weight: bold');
- }
- }
- console.groupEnd();
- };
- /**
- * Activates the passed route chain.
- *
- * There must be exactly one outlet per route entry in the chain.
- *
- * The methods calls setRouteId on each of the outlet with the corresponding route entry in the chain.
- * setRouteId will create or select the view in the outlet.
- */
- const writeNavState = async (root, chain, direction, index, changed = false, animation) => {
- try {
- // find next navigation outlet in the DOM
- const outlet = searchNavNode(root);
- // make sure we can continue interacting the DOM, otherwise abort
- if (index >= chain.length || !outlet) {
- return changed;
- }
- await new Promise((resolve) => componentOnReady(outlet, resolve));
- const route = chain[index];
- const result = await outlet.setRouteId(route.id, route.params, direction, animation);
- // if the outlet changed the page, reset navigation to neutral (no direction)
- // this means nested outlets will not animate
- if (result.changed) {
- direction = ROUTER_INTENT_NONE;
- changed = true;
- }
- // recursively set nested outlets
- changed = await writeNavState(result.element, chain, direction, index + 1, changed, animation);
- // once all nested outlets are visible let's make the parent visible too,
- // using markVisible prevents flickering
- if (result.markVisible) {
- await result.markVisible();
- }
- return changed;
- }
- catch (e) {
- printIonError('[ion-router] - Exception in writeNavState:', e);
- return false;
- }
- };
- /**
- * Recursively walks the outlet in the DOM.
- *
- * The function returns a list of RouteID corresponding to each of the outlet and the last outlet without a RouteID.
- */
- const readNavState = async (root) => {
- const ids = [];
- let outlet;
- let node = root;
- // eslint-disable-next-line no-cond-assign
- while ((outlet = searchNavNode(node))) {
- const id = await outlet.getRouteId();
- if (id) {
- node = id.element;
- id.element = undefined;
- ids.push(id);
- }
- else {
- break;
- }
- }
- return { ids, outlet };
- };
- const waitUntilNavNode = () => {
- if (searchNavNode(document.body)) {
- return Promise.resolve();
- }
- return new Promise((resolve) => {
- window.addEventListener('ionNavWillLoad', () => resolve(), { once: true });
- });
- };
- /** Selector for all the outlets supported by the router. */
- const OUTLET_SELECTOR = ':not([no-router]) ion-nav, :not([no-router]) ion-tabs, :not([no-router]) ion-router-outlet';
- const searchNavNode = (root) => {
- if (!root) {
- return undefined;
- }
- if (root.matches(OUTLET_SELECTOR)) {
- return root;
- }
- const outlet = root.querySelector(OUTLET_SELECTOR);
- return outlet !== null && outlet !== void 0 ? outlet : undefined;
- };
- /**
- * Returns whether the given redirect matches the given path segments.
- *
- * A redirect matches when the segments of the path and redirect.from are equal.
- * Note that segments are only checked until redirect.from contains a '*' which matches any path segment.
- * The path ['some', 'path', 'to', 'page'] matches both ['some', 'path', 'to', 'page'] and ['some', 'path', '*'].
- */
- const matchesRedirect = (segments, redirect) => {
- const { from, to } = redirect;
- if (to === undefined) {
- return false;
- }
- if (from.length > segments.length) {
- return false;
- }
- for (let i = 0; i < from.length; i++) {
- const expected = from[i];
- if (expected === '*') {
- return true;
- }
- if (expected !== segments[i]) {
- return false;
- }
- }
- return from.length === segments.length;
- };
- /** Returns the first redirect matching the path segments or undefined when no match found. */
- const findRouteRedirect = (segments, redirects) => {
- return redirects.find((redirect) => matchesRedirect(segments, redirect));
- };
- const matchesIDs = (ids, chain) => {
- const len = Math.min(ids.length, chain.length);
- let score = 0;
- for (let i = 0; i < len; i++) {
- const routeId = ids[i];
- const routeChain = chain[i];
- // Skip results where the route id does not match the chain at the same index
- if (routeId.id.toLowerCase() !== routeChain.id) {
- break;
- }
- if (routeId.params) {
- const routeIdParams = Object.keys(routeId.params);
- // Only compare routes with the chain that have the same number of parameters.
- if (routeIdParams.length === routeChain.segments.length) {
- // Maps the route's params into a path based on the path variable names,
- // to compare against the route chain format.
- //
- // Before:
- // ```ts
- // {
- // params: {
- // s1: 'a',
- // s2: 'b'
- // }
- // }
- // ```
- //
- // After:
- // ```ts
- // [':s1',':s2']
- // ```
- //
- const pathWithParams = routeIdParams.map((key) => `:${key}`);
- for (let j = 0; j < pathWithParams.length; j++) {
- // Skip results where the path variable is not a match
- if (pathWithParams[j].toLowerCase() !== routeChain.segments[j]) {
- break;
- }
- // Weight path matches for the same index higher.
- score++;
- }
- }
- }
- // Weight id matches
- score++;
- }
- return score;
- };
- /**
- * Matches the segments against the chain.
- *
- * Returns:
- * - null when there is no match,
- * - a chain with the params properties updated with the parameter segments on match.
- */
- const matchesSegments = (segments, chain) => {
- const inputSegments = new RouterSegments(segments);
- let matchesDefault = false;
- let allparams;
- for (let i = 0; i < chain.length; i++) {
- const chainSegments = chain[i].segments;
- if (chainSegments[0] === '') {
- matchesDefault = true;
- }
- else {
- for (const segment of chainSegments) {
- const data = inputSegments.next();
- // data param
- if (segment[0] === ':') {
- if (data === '') {
- return null;
- }
- allparams = allparams || [];
- const params = allparams[i] || (allparams[i] = {});
- params[segment.slice(1)] = data;
- }
- else if (data !== segment) {
- return null;
- }
- }
- matchesDefault = false;
- }
- }
- const matches = matchesDefault ? matchesDefault === (inputSegments.next() === '') : true;
- if (!matches) {
- return null;
- }
- if (allparams) {
- return chain.map((route, i) => ({
- id: route.id,
- segments: route.segments,
- params: mergeParams(route.params, allparams[i]),
- beforeEnter: route.beforeEnter,
- beforeLeave: route.beforeLeave,
- }));
- }
- return chain;
- };
- /**
- * Merges the route parameter objects.
- * Returns undefined when both parameters are undefined.
- */
- const mergeParams = (a, b) => {
- return a || b ? Object.assign(Object.assign({}, a), b) : undefined;
- };
- /**
- * Finds the best match for the ids in the chains.
- *
- * Returns the best match or null when no match is found.
- * When a chain is returned the parameters are updated from the RouteIDs.
- * That is they contain both the componentProps of the <ion-route> and the parameter segment.
- */
- const findChainForIDs = (ids, chains) => {
- let match = null;
- let maxMatches = 0;
- for (const chain of chains) {
- const score = matchesIDs(ids, chain);
- if (score > maxMatches) {
- match = chain;
- maxMatches = score;
- }
- }
- if (match) {
- return match.map((route, i) => {
- var _a;
- return ({
- id: route.id,
- segments: route.segments,
- params: mergeParams(route.params, (_a = ids[i]) === null || _a === void 0 ? void 0 : _a.params),
- });
- });
- }
- return null;
- };
- /**
- * Finds the best match for the segments in the chains.
- *
- * Returns the best match or null when no match is found.
- * When a chain is returned the parameters are updated from the segments.
- * That is they contain both the componentProps of the <ion-route> and the parameter segments.
- */
- const findChainForSegments = (segments, chains) => {
- let match = null;
- let bestScore = 0;
- for (const chain of chains) {
- const matchedChain = matchesSegments(segments, chain);
- if (matchedChain !== null) {
- const score = computePriority(matchedChain);
- if (score > bestScore) {
- bestScore = score;
- match = matchedChain;
- }
- }
- }
- return match;
- };
- /**
- * Computes the priority of a chain.
- *
- * Parameter segments are given a lower priority over fixed segments.
- *
- * Considering the following 2 chains matching the path /path/to/page:
- * - /path/to/:where
- * - /path/to/page
- *
- * The second one will be given a higher priority because "page" is a fixed segment (vs ":where", a parameter segment).
- */
- const computePriority = (chain) => {
- let score = 1;
- let level = 1;
- for (const route of chain) {
- for (const segment of route.segments) {
- if (segment[0] === ':') {
- score += Math.pow(1, level);
- }
- else if (segment !== '') {
- score += Math.pow(2, level);
- }
- level++;
- }
- }
- return score;
- };
- class RouterSegments {
- constructor(segments) {
- this.segments = segments.slice();
- }
- next() {
- if (this.segments.length > 0) {
- return this.segments.shift();
- }
- return '';
- }
- }
- const readProp = (el, prop) => {
- if (prop in el) {
- return el[prop];
- }
- if (el.hasAttribute(prop)) {
- return el.getAttribute(prop);
- }
- return null;
- };
- /**
- * Extracts the redirects (that is <ion-route-redirect> elements inside the root).
- *
- * The redirects are returned as a list of RouteRedirect.
- */
- const readRedirects = (root) => {
- return Array.from(root.children)
- .filter((el) => el.tagName === 'ION-ROUTE-REDIRECT')
- .map((el) => {
- const to = readProp(el, 'to');
- return {
- from: parsePath(readProp(el, 'from')).segments,
- to: to == null ? undefined : parsePath(to),
- };
- });
- };
- /**
- * Extracts all the routes (that is <ion-route> elements inside the root).
- *
- * The routes are returned as a list of chains - the flattened tree.
- */
- const readRoutes = (root) => {
- return flattenRouterTree(readRouteNodes(root));
- };
- /**
- * Reads the route nodes as a tree modeled after the DOM tree of <ion-route> elements.
- *
- * Note: routes without a component are ignored together with their children.
- */
- const readRouteNodes = (node) => {
- return Array.from(node.children)
- .filter((el) => el.tagName === 'ION-ROUTE' && el.component)
- .map((el) => {
- const component = readProp(el, 'component');
- return {
- segments: parsePath(readProp(el, 'url')).segments,
- id: component.toLowerCase(),
- params: el.componentProps,
- beforeLeave: el.beforeLeave,
- beforeEnter: el.beforeEnter,
- children: readRouteNodes(el),
- };
- });
- };
- /**
- * Flattens a RouterTree in a list of chains.
- *
- * Each chain represents a path from the root node to a terminal node.
- */
- const flattenRouterTree = (nodes) => {
- const chains = [];
- for (const node of nodes) {
- flattenNode([], chains, node);
- }
- return chains;
- };
- /** Flattens a route node recursively and push each branch to the chains list. */
- const flattenNode = (chain, chains, node) => {
- chain = [
- ...chain,
- {
- id: node.id,
- segments: node.segments,
- params: node.params,
- beforeLeave: node.beforeLeave,
- beforeEnter: node.beforeEnter,
- },
- ];
- if (node.children.length === 0) {
- chains.push(chain);
- return;
- }
- for (const child of node.children) {
- flattenNode(chain, chains, child);
- }
- };
- class Router {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionRouteWillChange = createEvent(this, "ionRouteWillChange", 7);
- this.ionRouteDidChange = createEvent(this, "ionRouteDidChange", 7);
- this.previousPath = null;
- this.busy = false;
- this.state = 0;
- this.lastState = 0;
- this.root = '/';
- this.useHash = true;
- }
- async componentWillLoad() {
- await waitUntilNavNode();
- const canProceed = await this.runGuards(this.getSegments());
- if (canProceed !== true) {
- if (typeof canProceed === 'object') {
- const { redirect } = canProceed;
- const path = parsePath(redirect);
- this.setSegments(path.segments, ROUTER_INTENT_NONE, path.queryString);
- await this.writeNavStateRoot(path.segments, ROUTER_INTENT_NONE);
- }
- }
- else {
- await this.onRoutesChanged();
- }
- }
- componentDidLoad() {
- window.addEventListener('ionRouteRedirectChanged', debounce(this.onRedirectChanged.bind(this), 10));
- window.addEventListener('ionRouteDataChanged', debounce(this.onRoutesChanged.bind(this), 100));
- }
- async onPopState() {
- const direction = this.historyDirection();
- let segments = this.getSegments();
- const canProceed = await this.runGuards(segments);
- if (canProceed !== true) {
- if (typeof canProceed === 'object') {
- segments = parsePath(canProceed.redirect).segments;
- }
- else {
- return false;
- }
- }
- return this.writeNavStateRoot(segments, direction);
- }
- onBackButton(ev) {
- ev.detail.register(0, (processNextHandler) => {
- this.back();
- processNextHandler();
- });
- }
- /** @internal */
- async canTransition() {
- const canProceed = await this.runGuards();
- if (canProceed !== true) {
- if (typeof canProceed === 'object') {
- return canProceed.redirect;
- }
- else {
- return false;
- }
- }
- return true;
- }
- /**
- * Navigate to the specified path.
- *
- * @param path The path to navigate to.
- * @param direction The direction of the animation. Defaults to `"forward"`.
- */
- async push(path, direction = 'forward', animation) {
- var _a;
- if (path.startsWith('.')) {
- const currentPath = (_a = this.previousPath) !== null && _a !== void 0 ? _a : '/';
- // Convert currentPath to an URL by pre-pending a protocol and a host to resolve the relative path.
- const url = new URL(path, `https://host/${currentPath}`);
- path = url.pathname + url.search;
- }
- let parsedPath = parsePath(path);
- const canProceed = await this.runGuards(parsedPath.segments);
- if (canProceed !== true) {
- if (typeof canProceed === 'object') {
- parsedPath = parsePath(canProceed.redirect);
- }
- else {
- return false;
- }
- }
- this.setSegments(parsedPath.segments, direction, parsedPath.queryString);
- return this.writeNavStateRoot(parsedPath.segments, direction, animation);
- }
- /** Go back to previous page in the window.history. */
- back() {
- window.history.back();
- return Promise.resolve(this.waitPromise);
- }
- /** @internal */
- async printDebug() {
- printRoutes(readRoutes(this.el));
- printRedirects(readRedirects(this.el));
- }
- /** @internal */
- async navChanged(direction) {
- if (this.busy) {
- printIonWarning('[ion-router] - Router is busy, navChanged was cancelled.');
- return false;
- }
- const { ids, outlet } = await readNavState(window.document.body);
- const routes = readRoutes(this.el);
- const chain = findChainForIDs(ids, routes);
- if (!chain) {
- printIonWarning('[ion-router] - No matching URL for', ids.map((i) => i.id));
- return false;
- }
- const segments = chainToSegments(chain);
- if (!segments) {
- printIonWarning('[ion-router] - Router could not match path because some required param is missing.');
- return false;
- }
- this.setSegments(segments, direction);
- await this.safeWriteNavState(outlet, chain, ROUTER_INTENT_NONE, segments, null, ids.length);
- return true;
- }
- /** This handler gets called when a `ion-route-redirect` component is added to the DOM or if the from or to property of such node changes. */
- onRedirectChanged() {
- const segments = this.getSegments();
- if (segments && findRouteRedirect(segments, readRedirects(this.el))) {
- this.writeNavStateRoot(segments, ROUTER_INTENT_NONE);
- }
- }
- /** This handler gets called when a `ion-route` component is added to the DOM or if the from or to property of such node changes. */
- onRoutesChanged() {
- return this.writeNavStateRoot(this.getSegments(), ROUTER_INTENT_NONE);
- }
- historyDirection() {
- var _a;
- const win = window;
- if (win.history.state === null) {
- this.state++;
- win.history.replaceState(this.state, win.document.title, (_a = win.document.location) === null || _a === void 0 ? void 0 : _a.href);
- }
- const state = win.history.state;
- const lastState = this.lastState;
- this.lastState = state;
- if (state > lastState || (state >= lastState && lastState > 0)) {
- return ROUTER_INTENT_FORWARD;
- }
- if (state < lastState) {
- return ROUTER_INTENT_BACK;
- }
- return ROUTER_INTENT_NONE;
- }
- async writeNavStateRoot(segments, direction, animation) {
- if (!segments) {
- printIonError('[ion-router] - URL is not part of the routing set.');
- return false;
- }
- // lookup redirect rule
- const redirects = readRedirects(this.el);
- const redirect = findRouteRedirect(segments, redirects);
- let redirectFrom = null;
- if (redirect) {
- const { segments: toSegments, queryString } = redirect.to;
- this.setSegments(toSegments, direction, queryString);
- redirectFrom = redirect.from;
- segments = toSegments;
- }
- // lookup route chain
- const routes = readRoutes(this.el);
- const chain = findChainForSegments(segments, routes);
- if (!chain) {
- printIonError('[ion-router] - The path does not match any route.');
- return false;
- }
- // write DOM give
- return this.safeWriteNavState(document.body, chain, direction, segments, redirectFrom, 0, animation);
- }
- async safeWriteNavState(node, chain, direction, segments, redirectFrom, index = 0, animation) {
- const unlock = await this.lock();
- let changed = false;
- try {
- changed = await this.writeNavState(node, chain, direction, segments, redirectFrom, index, animation);
- }
- catch (e) {
- printIonError('[ion-router] - Exception in safeWriteNavState:', e);
- }
- unlock();
- return changed;
- }
- async lock() {
- const p = this.waitPromise;
- let resolve;
- this.waitPromise = new Promise((r) => (resolve = r));
- if (p !== undefined) {
- await p;
- }
- return resolve;
- }
- /**
- * Executes the beforeLeave hook of the source route and the beforeEnter hook of the target route if they exist.
- *
- * When the beforeLeave hook does not return true (to allow navigating) then that value is returned early and the beforeEnter is executed.
- * Otherwise the beforeEnterHook hook of the target route is executed.
- */
- async runGuards(to = this.getSegments(), from) {
- if (from === undefined) {
- from = parsePath(this.previousPath).segments;
- }
- if (!to || !from) {
- return true;
- }
- const routes = readRoutes(this.el);
- const fromChain = findChainForSegments(from, routes);
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- const beforeLeaveHook = fromChain && fromChain[fromChain.length - 1].beforeLeave;
- const canLeave = beforeLeaveHook ? await beforeLeaveHook() : true;
- if (canLeave === false || typeof canLeave === 'object') {
- return canLeave;
- }
- const toChain = findChainForSegments(to, routes);
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- const beforeEnterHook = toChain && toChain[toChain.length - 1].beforeEnter;
- return beforeEnterHook ? beforeEnterHook() : true;
- }
- async writeNavState(node, chain, direction, segments, redirectFrom, index = 0, animation) {
- if (this.busy) {
- printIonWarning('[ion-router] - Router is busy, transition was cancelled.');
- return false;
- }
- this.busy = true;
- // generate route event and emit will change
- const routeEvent = this.routeChangeEvent(segments, redirectFrom);
- if (routeEvent) {
- this.ionRouteWillChange.emit(routeEvent);
- }
- const changed = await writeNavState(node, chain, direction, index, false, animation);
- this.busy = false;
- // emit did change
- if (routeEvent) {
- this.ionRouteDidChange.emit(routeEvent);
- }
- return changed;
- }
- setSegments(segments, direction, queryString) {
- this.state++;
- writeSegments(window.history, this.root, this.useHash, segments, direction, this.state, queryString);
- }
- getSegments() {
- return readSegments(window.location, this.root, this.useHash);
- }
- routeChangeEvent(toSegments, redirectFromSegments) {
- const from = this.previousPath;
- const to = generatePath(toSegments);
- this.previousPath = to;
- if (to === from) {
- return null;
- }
- const redirectedFrom = redirectFromSegments ? generatePath(redirectFromSegments) : null;
- return {
- from,
- redirectedFrom,
- to,
- };
- }
- get el() { return getElement(this); }
- static get cmpMeta() { return {
- "$flags$": 0,
- "$tagName$": "ion-router",
- "$members$": {
- "root": [1],
- "useHash": [4, "use-hash"],
- "canTransition": [64],
- "push": [64],
- "back": [64],
- "printDebug": [64],
- "navChanged": [64]
- },
- "$listeners$": [[8, "popstate", "onPopState"], [4, "ionBackButton", "onBackButton"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const routerLinkCss = ":host{--background:transparent;--color:var(--ion-color-primary, #0054e9);background:var(--background);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}a{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit}";
- var IonRouterLinkStyle0 = routerLinkCss;
- class RouterLink {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.onClick = (ev) => {
- openURL(this.href, ev, this.routerDirection, this.routerAnimation);
- };
- this.color = undefined;
- this.href = undefined;
- this.rel = undefined;
- this.routerDirection = 'forward';
- this.routerAnimation = undefined;
- this.target = undefined;
- }
- render() {
- const mode = getIonMode$1(this);
- const attrs = {
- href: this.href,
- rel: this.rel,
- target: this.target,
- };
- return (hAsync(Host, { key: '11183264fb6ae0db9a7a47c71b6862d60001b834', onClick: this.onClick, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'ion-activatable': true,
- }) }, hAsync("a", Object.assign({ key: '3e0e5242161cb0df593d6d573e51b8ba750065a1' }, attrs), hAsync("slot", { key: '5bd808e98a4627bb1236f0d955f4b32971355417' }))));
- }
- static get style() { return IonRouterLinkStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-router-link",
- "$members$": {
- "color": [513],
- "href": [1],
- "rel": [1],
- "routerDirection": [1, "router-direction"],
- "routerAnimation": [16],
- "target": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const routerOutletCss = ":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:layout size style;z-index:0}";
- var IonRouterOutletStyle0 = routerOutletCss;
- class RouterOutlet {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionNavWillLoad = createEvent(this, "ionNavWillLoad", 7);
- this.ionNavWillChange = createEvent(this, "ionNavWillChange", 3);
- this.ionNavDidChange = createEvent(this, "ionNavDidChange", 3);
- this.lockController = createLockController();
- this.gestureOrAnimationInProgress = false;
- this.mode = getIonMode$1(this);
- this.delegate = undefined;
- this.animated = true;
- this.animation = undefined;
- this.swipeHandler = undefined;
- }
- swipeHandlerChanged() {
- if (this.gesture) {
- this.gesture.enable(this.swipeHandler !== undefined);
- }
- }
- async connectedCallback() {
- const onStart = () => {
- this.gestureOrAnimationInProgress = true;
- if (this.swipeHandler) {
- this.swipeHandler.onStart();
- }
- };
- this.gesture = (await Promise.resolve().then(function () { return swipeBack; })).createSwipeBackGesture(this.el, () => !this.gestureOrAnimationInProgress && !!this.swipeHandler && this.swipeHandler.canStart(), () => onStart(), (step) => { var _a; return (_a = this.ani) === null || _a === void 0 ? void 0 : _a.progressStep(step); }, (shouldComplete, step, dur) => {
- if (this.ani) {
- this.ani.onFinish(() => {
- this.gestureOrAnimationInProgress = false;
- if (this.swipeHandler) {
- this.swipeHandler.onEnd(shouldComplete);
- }
- }, { oneTimeCallback: true });
- // Account for rounding errors in JS
- let newStepValue = shouldComplete ? -0.001 : 0.001;
- /**
- * Animation will be reversed here, so need to
- * reverse the easing curve as well
- *
- * Additionally, we need to account for the time relative
- * to the new easing curve, as `stepValue` is going to be given
- * in terms of a linear curve.
- */
- if (!shouldComplete) {
- this.ani.easing('cubic-bezier(1, 0, 0.68, 0.28)');
- newStepValue += getTimeGivenProgression([0, 0], [1, 0], [0.68, 0.28], [1, 1], step)[0];
- }
- else {
- newStepValue += getTimeGivenProgression([0, 0], [0.32, 0.72], [0, 1], [1, 1], step)[0];
- }
- this.ani.progressEnd(shouldComplete ? 1 : 0, newStepValue, dur);
- }
- else {
- this.gestureOrAnimationInProgress = false;
- }
- });
- this.swipeHandlerChanged();
- }
- componentWillLoad() {
- this.ionNavWillLoad.emit();
- }
- disconnectedCallback() {
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- }
- /** @internal */
- async commit(enteringEl, leavingEl, opts) {
- const unlock = await this.lockController.lock();
- let changed = false;
- try {
- changed = await this.transition(enteringEl, leavingEl, opts);
- }
- catch (e) {
- printIonError('[ion-router-outlet] - Exception in commit:', e);
- }
- unlock();
- return changed;
- }
- /** @internal */
- async setRouteId(id, params, direction, animation) {
- const changed = await this.setRoot(id, params, {
- duration: direction === 'root' ? 0 : undefined,
- direction: direction === 'back' ? 'back' : 'forward',
- animationBuilder: animation,
- });
- return {
- changed,
- element: this.activeEl,
- };
- }
- /** @internal */
- async getRouteId() {
- const active = this.activeEl;
- return active
- ? {
- id: active.tagName,
- element: active,
- params: this.activeParams,
- }
- : undefined;
- }
- async setRoot(component, params, opts) {
- if (this.activeComponent === component && shallowEqualStringMap(params, this.activeParams)) {
- return false;
- }
- // attach entering view to DOM
- const leavingEl = this.activeEl;
- const enteringEl = await attachComponent(this.delegate, this.el, component, ['ion-page', 'ion-page-invisible'], params);
- this.activeComponent = component;
- this.activeEl = enteringEl;
- this.activeParams = params;
- // commit animation
- await this.commit(enteringEl, leavingEl, opts);
- await detachComponent(this.delegate, leavingEl);
- return true;
- }
- async transition(enteringEl, leavingEl, opts = {}) {
- if (leavingEl === enteringEl) {
- return false;
- }
- // emit nav will change event
- this.ionNavWillChange.emit();
- const { el, mode } = this;
- const animated = this.animated && config.getBoolean('animated', true);
- const animationBuilder = opts.animationBuilder || this.animation || config.get('navAnimation');
- await transition(Object.assign(Object.assign({ mode,
- animated,
- enteringEl,
- leavingEl, baseEl: el,
- /**
- * We need to wait for all Stencil components
- * to be ready only when using the lazy
- * loaded bundle.
- */
- deepWait: hasLazyBuild(el), progressCallback: opts.progressAnimation
- ? (ani) => {
- /**
- * Because this progress callback is called asynchronously
- * it is possible for the gesture to start and end before
- * the animation is ever set. In that scenario, we should
- * immediately call progressEnd so that the transition promise
- * resolves and the gesture does not get locked up.
- */
- if (ani !== undefined && !this.gestureOrAnimationInProgress) {
- this.gestureOrAnimationInProgress = true;
- ani.onFinish(() => {
- this.gestureOrAnimationInProgress = false;
- if (this.swipeHandler) {
- this.swipeHandler.onEnd(false);
- }
- }, { oneTimeCallback: true });
- /**
- * Playing animation to beginning
- * with a duration of 0 prevents
- * any flickering when the animation
- * is later cleaned up.
- */
- ani.progressEnd(0, 0, 0);
- }
- else {
- this.ani = ani;
- }
- }
- : undefined }, opts), { animationBuilder }));
- // emit nav changed event
- this.ionNavDidChange.emit();
- return true;
- }
- render() {
- return hAsync("slot", { key: 'e34e02b5154172c8d5cdd187b6ea58119b6946eb' });
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "swipeHandler": ["swipeHandlerChanged"]
- }; }
- static get style() { return IonRouterOutletStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-router-outlet",
- "$members$": {
- "mode": [1025],
- "delegate": [16],
- "animated": [4],
- "animation": [16],
- "swipeHandler": [16],
- "commit": [64],
- "setRouteId": [64],
- "getRouteId": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const rowCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}";
- var IonRowStyle0 = rowCss;
- class Row {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- render() {
- return (hAsync(Host, { key: 'a690022e2abdce6946d24264574e4aa0886a8ea5', class: getIonMode$1(this) }, hAsync("slot", { key: 'd1a0e831dd1dbfe7877d3ad01d0a3045a5fb29e3' })));
- }
- static get style() { return IonRowStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-row",
- "$members$": undefined,
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const searchbarIosCss = ".sc-ion-searchbar-ios-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);-webkit-box-sizing:border-box;box-sizing:border-box}.ion-color.sc-ion-searchbar-ios-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:inherit}.searchbar-search-icon.sc-ion-searchbar-ios{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-ios{display:block;position:relative;-ms-flex-negative:1;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-ios{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;min-height:inherit;border:0;outline:none;background:var(--background);font-family:inherit;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbar-input.sc-ion-searchbar-ios::-webkit-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios::-moz-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios:-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios::-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-ios::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-ios>div.sc-ion-searchbar-ios{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbar-clear-button.sc-ion-searchbar-ios:focus{opacity:0.5}.searchbar-has-value.searchbar-should-show-clear.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios{display:block}.searchbar-disabled.sc-ion-searchbar-ios-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-ios-h{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.07);--border-radius:10px;--box-shadow:none;--cancel-button-color:var(--ion-color-primary, #0054e9);--clear-button-color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));--color:var(--ion-text-color, #000);--icon-color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:12px;padding-bottom:12px;min-height:60px;contain:content}.searchbar-input-container.sc-ion-searchbar-ios{min-height:36px}.searchbar-search-icon.sc-ion-searchbar-ios{-webkit-margin-start:calc(50% - 60px);margin-inline-start:calc(50% - 60px);top:0;position:absolute;width:1.375rem;height:100%;contain:strict}.searchbar-search-icon.sc-ion-searchbar-ios{inset-inline-start:5px}.searchbar-input.sc-ion-searchbar-ios{-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:6px;padding-bottom:6px;height:100%;font-size:1.0625rem;font-weight:400;contain:strict}.searchbar-has-value.searchbar-should-show-clear.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{-webkit-padding-start:1.75rem;padding-inline-start:1.75rem;-webkit-padding-end:1.75rem;padding-inline-end:1.75rem}.searchbar-clear-button.sc-ion-searchbar-ios{top:0;background-position:center;position:absolute;width:1.875rem;height:100%;border:0;background-color:transparent}.searchbar-clear-button.sc-ion-searchbar-ios{inset-inline-end:0}.searchbar-clear-icon.sc-ion-searchbar-ios{width:1.125rem;height:100%}.searchbar-cancel-button.sc-ion-searchbar-ios{-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;-ms-flex-negative:0;flex-shrink:0;background-color:transparent;font-size:17px}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{-webkit-margin-start:0;margin-inline-start:0}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{-webkit-padding-start:1.875rem;padding-inline-start:1.875rem}.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{display:block}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{-webkit-transition:all 300ms ease;transition:all 300ms ease}.searchbar-animated.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{opacity:1;pointer-events:auto}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{-webkit-margin-end:-100%;margin-inline-end:-100%;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);-webkit-transition:all 300ms ease;transition:all 300ms ease;opacity:0;pointer-events:none}.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{-webkit-transition-duration:0ms;transition-duration:0ms}.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{color:var(--ion-color-base)}@media (any-hover: hover){.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios:hover{color:var(--ion-color-tint)}}ion-toolbar.sc-ion-searchbar-ios-h,ion-toolbar .sc-ion-searchbar-ios-h{padding-top:1px;padding-bottom:15px;min-height:52px}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color),ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color){color:inherit}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios{color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios{background:rgba(var(--ion-color-contrast-rgb), 0.07);color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}";
- var IonSearchbarIosStyle0 = searchbarIosCss;
- const searchbarMdCss = ".sc-ion-searchbar-md-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);-webkit-box-sizing:border-box;box-sizing:border-box}.ion-color.sc-ion-searchbar-md-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{color:inherit}.searchbar-search-icon.sc-ion-searchbar-md{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-md{display:block;position:relative;-ms-flex-negative:1;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-md{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;min-height:inherit;border:0;outline:none;background:var(--background);font-family:inherit;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbar-input.sc-ion-searchbar-md::-webkit-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md::-moz-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md:-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md::-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-md::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-md>div.sc-ion-searchbar-md{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbar-clear-button.sc-ion-searchbar-md:focus{opacity:0.5}.searchbar-has-value.searchbar-should-show-clear.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md{display:block}.searchbar-disabled.sc-ion-searchbar-md-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-md-h{--background:var(--ion-background-color, #fff);--border-radius:2px;--box-shadow:0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);--cancel-button-color:var(--ion-color-step-900, var(--ion-text-color-step-100, #1a1a1a));--clear-button-color:initial;--color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));--icon-color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;background:inherit}.searchbar-search-icon.sc-ion-searchbar-md{top:11px;width:1.3125rem;height:1.3125rem}.searchbar-search-icon.sc-ion-searchbar-md{inset-inline-start:16px}.searchbar-cancel-button.sc-ion-searchbar-md{top:0;background-color:transparent;font-size:1.5em}.searchbar-cancel-button.sc-ion-searchbar-md{inset-inline-start:9px}.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-cancel-button.sc-ion-searchbar-md{position:absolute}.searchbar-search-icon.ion-activated.sc-ion-searchbar-md,.searchbar-cancel-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-input.sc-ion-searchbar-md{-webkit-padding-start:3.4375rem;padding-inline-start:3.4375rem;-webkit-padding-end:3.4375rem;padding-inline-end:3.4375rem;padding-top:0.375rem;padding-bottom:0.375rem;background-position:left 8px center;height:auto;font-size:1rem;font-weight:400;line-height:30px}[dir=rtl].sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background-position:right 8px center}[dir=rtl].sc-ion-searchbar-md .searchbar-input.sc-ion-searchbar-md{background-position:right 8px center}@supports selector(:dir(rtl)){.searchbar-input.sc-ion-searchbar-md:dir(rtl){background-position:right 8px center}}.searchbar-clear-button.sc-ion-searchbar-md{top:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;position:absolute;height:100%;border:0;background-color:transparent}.searchbar-clear-button.sc-ion-searchbar-md{inset-inline-end:13px}.searchbar-clear-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-clear-icon.sc-ion-searchbar-md{width:1.375rem;height:100%}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md{display:none}ion-toolbar.sc-ion-searchbar-md-h,ion-toolbar .sc-ion-searchbar-md-h{-webkit-padding-start:7px;padding-inline-start:7px;-webkit-padding-end:7px;padding-inline-end:7px;padding-top:3px;padding-bottom:3px}";
- var IonSearchbarMdStyle0 = searchbarMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Searchbar {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionInput = createEvent(this, "ionInput", 7);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionCancel = createEvent(this, "ionCancel", 7);
- this.ionClear = createEvent(this, "ionClear", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionStyle = createEvent(this, "ionStyle", 7);
- this.isCancelVisible = false;
- this.shouldAlignLeft = true;
- this.inputId = `ion-searchbar-${searchbarIds++}`;
- this.inheritedAttributes = {};
- /**
- * Clears the input field and triggers the control change.
- */
- this.onClearInput = async (shouldFocus) => {
- this.ionClear.emit();
- return new Promise((resolve) => {
- // setTimeout() fixes https://github.com/ionic-team/ionic-framework/issues/7527
- // wait for 4 frames
- setTimeout(() => {
- const value = this.getValue();
- if (value !== '') {
- this.value = '';
- this.emitInputChange();
- /**
- * When tapping clear button
- * ensure input is focused after
- * clearing input so users
- * can quickly start typing.
- */
- if (shouldFocus && !this.focused) {
- this.setFocus();
- /**
- * The setFocus call above will clear focusedValue,
- * but ionChange will never have gotten a chance to
- * fire. Manually revert focusedValue so onBlur can
- * compare against what was in the box before the clear.
- */
- this.focusedValue = value;
- }
- }
- resolve();
- }, 16 * 4);
- });
- };
- /**
- * Clears the input field and tells the input to blur since
- * the clearInput function doesn't want the input to blur
- * then calls the custom cancel function if the user passed one in.
- */
- this.onCancelSearchbar = async (ev) => {
- if (ev) {
- ev.preventDefault();
- ev.stopPropagation();
- }
- this.ionCancel.emit();
- // get cached values before clearing the input
- const value = this.getValue();
- const focused = this.focused;
- await this.onClearInput();
- /**
- * If there used to be something in the box, and we weren't focused
- * beforehand (meaning no blur fired that would already handle this),
- * manually fire ionChange.
- */
- if (value && !focused) {
- this.emitValueChange(ev);
- }
- if (this.nativeInput) {
- this.nativeInput.blur();
- }
- };
- /**
- * Update the Searchbar input value when the input changes
- */
- this.onInput = (ev) => {
- const input = ev.target;
- if (input) {
- this.value = input.value;
- }
- this.emitInputChange(ev);
- };
- this.onChange = (ev) => {
- this.emitValueChange(ev);
- };
- /**
- * Sets the Searchbar to not focused and checks if it should align left
- * based on whether there is a value in the searchbar or not.
- */
- this.onBlur = (ev) => {
- this.focused = false;
- this.ionBlur.emit();
- this.positionElements();
- if (this.focusedValue !== this.value) {
- this.emitValueChange(ev);
- }
- this.focusedValue = undefined;
- };
- /**
- * Sets the Searchbar to focused and active on input focus.
- */
- this.onFocus = () => {
- this.focused = true;
- this.focusedValue = this.value;
- this.ionFocus.emit();
- this.positionElements();
- };
- this.focused = false;
- this.noAnimate = true;
- this.color = undefined;
- this.animated = false;
- this.autocapitalize = 'off';
- this.autocomplete = 'off';
- this.autocorrect = 'off';
- this.cancelButtonIcon = config.get('backButtonIcon', arrowBackSharp);
- this.cancelButtonText = 'Cancel';
- this.clearIcon = undefined;
- this.debounce = undefined;
- this.disabled = false;
- this.inputmode = undefined;
- this.enterkeyhint = undefined;
- this.maxlength = undefined;
- this.minlength = undefined;
- this.name = this.inputId;
- this.placeholder = 'Search';
- this.searchIcon = undefined;
- this.showCancelButton = 'never';
- this.showClearButton = 'always';
- this.spellcheck = false;
- this.type = 'search';
- this.value = '';
- }
- /**
- * lang and dir are globally enumerated attributes.
- * As a result, creating these as properties
- * can have unintended side effects. Instead, we
- * listen for attribute changes and inherit them
- * to the inner `<input>` element.
- */
- onLangChanged(newValue) {
- this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { lang: newValue });
- }
- onDirChanged(newValue) {
- this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { dir: newValue });
- }
- debounceChanged() {
- const { ionInput, debounce, originalIonInput } = this;
- /**
- * If debounce is undefined, we have to manually revert the ionInput emitter in case
- * debounce used to be set to a number. Otherwise, the event would stay debounced.
- */
- this.ionInput = debounce === undefined ? originalIonInput !== null && originalIonInput !== void 0 ? originalIonInput : ionInput : debounceEvent(ionInput, debounce);
- }
- valueChanged() {
- const inputEl = this.nativeInput;
- const value = this.getValue();
- if (inputEl && inputEl.value !== value) {
- inputEl.value = value;
- }
- }
- showCancelButtonChanged() {
- requestAnimationFrame(() => {
- this.positionElements();
- });
- }
- connectedCallback() {
- this.emitStyle();
- }
- componentWillLoad() {
- this.inheritedAttributes = Object.assign({}, inheritAttributes$1(this.el, ['lang', 'dir']));
- }
- componentDidLoad() {
- this.originalIonInput = this.ionInput;
- this.positionElements();
- this.debounceChanged();
- setTimeout(() => {
- this.noAnimate = false;
- }, 300);
- }
- emitStyle() {
- this.ionStyle.emit({
- searchbar: true,
- });
- }
- /**
- * Sets focus on the native `input` in `ion-searchbar`. Use this method instead of the global
- * `input.focus()`.
- *
- * Developers who wish to focus an input when a page enters
- * should call `setFocus()` in the `ionViewDidEnter()` lifecycle method.
- *
- * Developers who wish to focus an input when an overlay is presented
- * should call `setFocus` after `didPresent` has resolved.
- *
- * See [managing focus](/docs/developing/managing-focus) for more information.
- */
- async setFocus() {
- if (this.nativeInput) {
- this.nativeInput.focus();
- }
- }
- /**
- * Returns the native `<input>` element used under the hood.
- */
- async getInputElement() {
- /**
- * If this gets called in certain early lifecycle hooks (ex: Vue onMounted),
- * nativeInput won't be defined yet with the custom elements build, so wait for it to load in.
- */
- if (!this.nativeInput) {
- await new Promise((resolve) => componentOnReady(this.el, resolve));
- }
- return Promise.resolve(this.nativeInput);
- }
- /**
- * Emits an `ionChange` event.
- *
- * This API should be called for user committed changes.
- * This API should not be used for external value changes.
- */
- emitValueChange(event) {
- const { value } = this;
- // Checks for both null and undefined values
- const newValue = value == null ? value : value.toString();
- // Emitting a value change should update the internal state for tracking the focused value
- this.focusedValue = newValue;
- this.ionChange.emit({ value: newValue, event });
- }
- /**
- * Emits an `ionInput` event.
- */
- emitInputChange(event) {
- const { value } = this;
- this.ionInput.emit({ value, event });
- }
- /**
- * Positions the input search icon, placeholder, and the cancel button
- * based on the input value and if it is focused. (ios only)
- */
- positionElements() {
- const value = this.getValue();
- const prevAlignLeft = this.shouldAlignLeft;
- const mode = getIonMode$1(this);
- const shouldAlignLeft = !this.animated || value.trim() !== '' || !!this.focused;
- this.shouldAlignLeft = shouldAlignLeft;
- if (mode !== 'ios') {
- return;
- }
- if (prevAlignLeft !== shouldAlignLeft) {
- this.positionPlaceholder();
- }
- if (this.animated) {
- this.positionCancelButton();
- }
- }
- /**
- * Positions the input placeholder
- */
- positionPlaceholder() {
- const inputEl = this.nativeInput;
- if (!inputEl) {
- return;
- }
- const rtl = isRTL$1(this.el);
- const iconEl = (this.el.shadowRoot || this.el).querySelector('.searchbar-search-icon');
- if (this.shouldAlignLeft) {
- inputEl.removeAttribute('style');
- iconEl.removeAttribute('style');
- }
- else {
- // Create a dummy span to get the placeholder width
- const doc = document;
- const tempSpan = doc.createElement('span');
- tempSpan.innerText = this.placeholder || '';
- doc.body.appendChild(tempSpan);
- // Get the width of the span then remove it
- raf(() => {
- const textWidth = tempSpan.offsetWidth;
- tempSpan.remove();
- // Calculate the input padding
- const inputLeft = 'calc(50% - ' + textWidth / 2 + 'px)';
- // Calculate the icon margin
- /**
- * We take the icon width to account
- * for any text scales applied to the icon
- * such as Dynamic Type on iOS as well as 8px
- * of padding.
- */
- const iconLeft = 'calc(50% - ' + (textWidth / 2 + iconEl.clientWidth + 8) + 'px)';
- // Set the input padding start and icon margin start
- if (rtl) {
- inputEl.style.paddingRight = inputLeft;
- iconEl.style.marginRight = iconLeft;
- }
- else {
- inputEl.style.paddingLeft = inputLeft;
- iconEl.style.marginLeft = iconLeft;
- }
- });
- }
- }
- /**
- * Show the iOS Cancel button on focus, hide it offscreen otherwise
- */
- positionCancelButton() {
- const rtl = isRTL$1(this.el);
- const cancelButton = (this.el.shadowRoot || this.el).querySelector('.searchbar-cancel-button');
- const shouldShowCancel = this.shouldShowCancelButton();
- if (cancelButton !== null && shouldShowCancel !== this.isCancelVisible) {
- const cancelStyle = cancelButton.style;
- this.isCancelVisible = shouldShowCancel;
- if (shouldShowCancel) {
- if (rtl) {
- cancelStyle.marginLeft = '0';
- }
- else {
- cancelStyle.marginRight = '0';
- }
- }
- else {
- const offset = cancelButton.offsetWidth;
- if (offset > 0) {
- if (rtl) {
- cancelStyle.marginLeft = -offset + 'px';
- }
- else {
- cancelStyle.marginRight = -offset + 'px';
- }
- }
- }
- }
- }
- getValue() {
- return this.value || '';
- }
- hasValue() {
- return this.getValue() !== '';
- }
- /**
- * Determines whether or not the cancel button should be visible onscreen.
- * Cancel button should be shown if one of two conditions applies:
- * 1. `showCancelButton` is set to `always`.
- * 2. `showCancelButton` is set to `focus`, and the searchbar has been focused.
- */
- shouldShowCancelButton() {
- if (this.showCancelButton === 'never' || (this.showCancelButton === 'focus' && !this.focused)) {
- return false;
- }
- return true;
- }
- /**
- * Determines whether or not the clear button should be visible onscreen.
- * Clear button should be shown if one of two conditions applies:
- * 1. `showClearButton` is set to `always`.
- * 2. `showClearButton` is set to `focus`, and the searchbar has been focused.
- */
- shouldShowClearButton() {
- if (this.showClearButton === 'never' || (this.showClearButton === 'focus' && !this.focused)) {
- return false;
- }
- return true;
- }
- render() {
- const { cancelButtonText, autocapitalize } = this;
- const animated = this.animated && config.getBoolean('animated', true);
- const mode = getIonMode$1(this);
- const clearIcon = this.clearIcon || (mode === 'ios' ? closeCircle : closeSharp);
- const searchIcon = this.searchIcon || (mode === 'ios' ? searchOutline : searchSharp);
- const shouldShowCancelButton = this.shouldShowCancelButton();
- const cancelButton = this.showCancelButton !== 'never' && (hAsync("button", { key: '989f3e84c472ada6e66dd9b249d0d268bf17ce26', "aria-label": cancelButtonText, "aria-hidden": shouldShowCancelButton ? undefined : 'true', type: "button", tabIndex: mode === 'ios' && !shouldShowCancelButton ? -1 : undefined, onMouseDown: this.onCancelSearchbar, onTouchStart: this.onCancelSearchbar, class: "searchbar-cancel-button" }, hAsync("div", { key: '7d335d4fde33822dc79d26b748ba2e98db7494bb', "aria-hidden": "true" }, mode === 'md' ? (hAsync("ion-icon", { "aria-hidden": "true", mode: mode, icon: this.cancelButtonIcon, lazy: false })) : (cancelButtonText))));
- return (hAsync(Host, { key: 'd1a1972725e949fb102c91487aaa7b9d10c2d718', role: "search", "aria-disabled": this.disabled ? 'true' : null, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'searchbar-animated': animated,
- 'searchbar-disabled': this.disabled,
- 'searchbar-no-animate': animated && this.noAnimate,
- 'searchbar-has-value': this.hasValue(),
- 'searchbar-left-aligned': this.shouldAlignLeft,
- 'searchbar-has-focus': this.focused,
- 'searchbar-should-show-clear': this.shouldShowClearButton(),
- 'searchbar-should-show-cancel': this.shouldShowCancelButton(),
- }) }, hAsync("div", { key: 'add53640b2994cb6b2bf02792dafe51aba6b1684', class: "searchbar-input-container" }, hAsync("input", Object.assign({ key: '160cc36459a4a652e7f41ccd14dcdc782278779e', "aria-label": "search text", disabled: this.disabled, ref: (el) => (this.nativeInput = el), class: "searchbar-input", inputMode: this.inputmode, enterKeyHint: this.enterkeyhint, name: this.name, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, minLength: this.minlength, maxLength: this.maxlength, placeholder: this.placeholder, type: this.type, value: this.getValue(), autoCapitalize: autocapitalize === 'default' ? undefined : autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, spellcheck: this.spellcheck }, this.inheritedAttributes)), mode === 'md' && cancelButton, hAsync("ion-icon", { key: '8825fd13af0d2dea451ccc0e00ae7b5021dc01c4', "aria-hidden": "true", mode: mode, icon: searchIcon, lazy: false, class: "searchbar-search-icon" }), hAsync("button", { key: '8a7b56da278b9ca5c4f5a4ee9c01924fd5ae29d8', "aria-label": "reset", type: "button", "no-blur": true, class: "searchbar-clear-button", onPointerDown: (ev) => {
- /**
- * This prevents mobile browsers from
- * blurring the input when the clear
- * button is activated.
- */
- ev.preventDefault();
- }, onClick: () => this.onClearInput(true) }, hAsync("ion-icon", { key: '24c55274516ab012d8c25f03525c6cdb9409e52f', "aria-hidden": "true", mode: mode, icon: clearIcon, lazy: false, class: "searchbar-clear-icon" }))), mode === 'ios' && cancelButton));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "lang": ["onLangChanged"],
- "dir": ["onDirChanged"],
- "debounce": ["debounceChanged"],
- "value": ["valueChanged"],
- "showCancelButton": ["showCancelButtonChanged"]
- }; }
- static get style() { return {
- ios: IonSearchbarIosStyle0,
- md: IonSearchbarMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 34,
- "$tagName$": "ion-searchbar",
- "$members$": {
- "color": [513],
- "animated": [4],
- "autocapitalize": [1],
- "autocomplete": [1],
- "autocorrect": [1],
- "cancelButtonIcon": [1, "cancel-button-icon"],
- "cancelButtonText": [1, "cancel-button-text"],
- "clearIcon": [1, "clear-icon"],
- "debounce": [2],
- "disabled": [4],
- "inputmode": [1],
- "enterkeyhint": [1],
- "maxlength": [2],
- "minlength": [2],
- "name": [1],
- "placeholder": [1],
- "searchIcon": [1, "search-icon"],
- "showCancelButton": [1, "show-cancel-button"],
- "showClearButton": [1, "show-clear-button"],
- "spellcheck": [4],
- "type": [1],
- "value": [1025],
- "focused": [32],
- "noAnimate": [32],
- "setFocus": [64],
- "getInputElement": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- let searchbarIds = 0;
- const segmentIosCss = ":host{--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:grid;grid-auto-columns:1fr;position:relative;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:center;justify-content:center;width:100%;background:var(--background);font-family:var(--ion-font-family, inherit);text-align:center;contain:paint;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.segment-scrollable){-ms-flex-pack:start;justify-content:start;width:auto;overflow-x:auto;grid-auto-columns:minmax(-webkit-min-content, 1fr);grid-auto-columns:minmax(min-content, 1fr)}:host(.segment-scrollable::-webkit-scrollbar){display:none}:host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.065);border-radius:8px;overflow:hidden;z-index:0}:host(.ion-color){background:rgba(var(--ion-color-base-rgb), 0.065)}:host(.in-toolbar){-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;width:auto}:host(.in-toolbar:not(.ion-color)){background:var(--ion-toolbar-segment-background, var(--background))}:host(.in-toolbar-color:not(.ion-color)){background:rgba(var(--ion-color-contrast-rgb), 0.11)}";
- var IonSegmentIosStyle0 = segmentIosCss;
- const segmentMdCss = ":host{--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:grid;grid-auto-columns:1fr;position:relative;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:center;justify-content:center;width:100%;background:var(--background);font-family:var(--ion-font-family, inherit);text-align:center;contain:paint;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.segment-scrollable){-ms-flex-pack:start;justify-content:start;width:auto;overflow-x:auto;grid-auto-columns:minmax(-webkit-min-content, 1fr);grid-auto-columns:minmax(min-content, 1fr)}:host(.segment-scrollable::-webkit-scrollbar){display:none}:host{--background:transparent;grid-auto-columns:minmax(auto, 360px)}:host(.in-toolbar){min-height:var(--min-height)}:host(.segment-scrollable) ::slotted(ion-segment-button){min-width:auto}";
- var IonSegmentMdStyle0 = segmentMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Segment {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionSelect = createEvent(this, "ionSelect", 7);
- this.ionStyle = createEvent(this, "ionStyle", 7);
- this.segmentViewEl = null;
- this.onClick = (ev) => {
- const current = ev.target;
- const previous = this.checked;
- // If the current element is a segment then that means
- // the user tried to swipe to a segment button and
- // click a segment button at the same time so we should
- // not update the checked segment button
- if (current.tagName === 'ION-SEGMENT') {
- return;
- }
- this.value = current.value;
- if (current !== previous) {
- this.emitValueChange();
- }
- if (this.segmentViewEl) {
- this.updateSegmentView();
- if (this.scrollable && previous) {
- this.checkButton(previous, current);
- }
- }
- else if (this.scrollable || !this.swipeGesture) {
- if (previous) {
- this.checkButton(previous, current);
- }
- else {
- this.setCheckedClasses();
- }
- }
- };
- this.onSlottedItemsChange = () => {
- /**
- * When the slotted segment buttons change we need to
- * ensure that the new segment buttons are checked if
- * the value matches the segment button value.
- */
- this.valueChanged(this.value);
- };
- this.getSegmentButton = (selector) => {
- var _a, _b;
- const buttons = this.getButtons().filter((button) => !button.disabled);
- const currIndex = buttons.findIndex((button) => button === document.activeElement);
- switch (selector) {
- case 'first':
- return buttons[0];
- case 'last':
- return buttons[buttons.length - 1];
- case 'next':
- return (_a = buttons[currIndex + 1]) !== null && _a !== void 0 ? _a : buttons[0];
- case 'previous':
- return (_b = buttons[currIndex - 1]) !== null && _b !== void 0 ? _b : buttons[buttons.length - 1];
- default:
- return null;
- }
- };
- this.activated = false;
- this.color = undefined;
- this.disabled = false;
- this.scrollable = false;
- this.swipeGesture = true;
- this.value = undefined;
- this.selectOnFocus = false;
- }
- colorChanged(value, oldValue) {
- /**
- * If color is set after not having
- * previously been set (or vice versa),
- * we need to emit style so the segment-buttons
- * can apply their color classes properly.
- */
- if ((oldValue === undefined && value !== undefined) || (oldValue !== undefined && value === undefined)) {
- this.emitStyle();
- }
- }
- swipeGestureChanged() {
- this.gestureChanged();
- }
- valueChanged(value, oldValue) {
- // Force a value to exist if we're using a segment view
- if (this.segmentViewEl && value === undefined) {
- this.value = this.getButtons()[0].value;
- return;
- }
- if (oldValue !== undefined && value !== undefined) {
- const buttons = this.getButtons();
- const previous = buttons.find((button) => button.value === oldValue);
- const current = buttons.find((button) => button.value === value);
- if (previous && current) {
- if (!this.segmentViewEl) {
- this.checkButton(previous, current);
- }
- else if (this.triggerScrollOnValueChange !== false) {
- this.updateSegmentView();
- }
- }
- }
- else if (value !== undefined && oldValue === undefined && this.segmentViewEl) {
- this.updateSegmentView();
- }
- /**
- * `ionSelect` is emitted every time the value changes (internal or external changes).
- * Used by `ion-segment-button` to determine if the button should be checked.
- */
- this.ionSelect.emit({ value });
- // The scroll listener should handle scrolling the active button into view as needed
- if (!this.segmentViewEl) {
- this.scrollActiveButtonIntoView();
- }
- this.triggerScrollOnValueChange = undefined;
- }
- disabledChanged() {
- this.gestureChanged();
- if (!this.segmentViewEl) {
- const buttons = this.getButtons();
- for (const button of buttons) {
- button.disabled = this.disabled;
- }
- }
- else {
- this.segmentViewEl.disabled = this.disabled;
- }
- }
- gestureChanged() {
- if (this.gesture) {
- this.gesture.enable(!this.scrollable && !this.disabled && this.swipeGesture);
- }
- }
- connectedCallback() {
- this.emitStyle();
- this.segmentViewEl = this.getSegmentView();
- }
- disconnectedCallback() {
- this.segmentViewEl = null;
- }
- componentWillLoad() {
- this.emitStyle();
- }
- async componentDidLoad() {
- this.segmentViewEl = this.getSegmentView();
- this.setCheckedClasses();
- /**
- * We need to wait for the buttons to all be rendered
- * before we can scroll.
- */
- raf(() => {
- /**
- * When the segment loads for the first
- * time we just want to snap the active button into
- * place instead of scroll. Smooth scrolling should only
- * happen when the user interacts with the segment.
- */
- this.scrollActiveButtonIntoView(false);
- });
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: this.el,
- gestureName: 'segment',
- gesturePriority: 100,
- threshold: 0,
- passive: false,
- onStart: (ev) => this.onStart(ev),
- onMove: (ev) => this.onMove(ev),
- onEnd: (ev) => this.onEnd(ev),
- });
- this.gestureChanged();
- if (this.disabled) {
- this.disabledChanged();
- }
- // Update segment view based on the initial value,
- // but do not animate the scroll
- this.updateSegmentView(false);
- }
- onStart(detail) {
- this.valueBeforeGesture = this.value;
- this.activate(detail);
- }
- onMove(detail) {
- this.setNextIndex(detail);
- }
- onEnd(detail) {
- this.setActivated(false);
- this.setNextIndex(detail, true);
- detail.event.stopImmediatePropagation();
- const value = this.value;
- if (value !== undefined) {
- if (this.valueBeforeGesture !== value) {
- this.emitValueChange();
- this.updateSegmentView();
- }
- }
- this.valueBeforeGesture = undefined;
- }
- /**
- * Emits an `ionChange` event.
- *
- * This API should be called for user committed changes.
- * This API should not be used for external value changes.
- */
- emitValueChange() {
- const { value } = this;
- this.ionChange.emit({ value });
- }
- getButtons() {
- return Array.from(this.el.querySelectorAll('ion-segment-button'));
- }
- get checked() {
- return this.getButtons().find((button) => button.value === this.value);
- }
- /*
- * Activate both the segment and the buttons
- * due to a bug with ::slotted in Safari
- */
- setActivated(activated) {
- const buttons = this.getButtons();
- buttons.forEach((button) => {
- button.classList.toggle('segment-button-activated', activated);
- });
- this.activated = activated;
- }
- activate(detail) {
- const clicked = detail.event.target;
- const buttons = this.getButtons();
- const checked = buttons.find((button) => button.value === this.value);
- // Make sure we are only checking for activation on a segment button
- // since disabled buttons will get the click on the segment
- if (clicked.tagName !== 'ION-SEGMENT-BUTTON') {
- return;
- }
- // If there are no checked buttons, set the current button to checked
- if (!checked) {
- this.value = clicked.value;
- this.setCheckedClasses();
- }
- // If the gesture began on the clicked button with the indicator
- // then we should activate the indicator
- if (this.value === clicked.value) {
- this.setActivated(true);
- }
- }
- getIndicator(button) {
- const root = button.shadowRoot || button;
- return root.querySelector('.segment-button-indicator');
- }
- checkButton(previous, current) {
- const previousIndicator = this.getIndicator(previous);
- const currentIndicator = this.getIndicator(current);
- if (previousIndicator === null || currentIndicator === null) {
- return;
- }
- const previousClientRect = previousIndicator.getBoundingClientRect();
- const currentClientRect = currentIndicator.getBoundingClientRect();
- const widthDelta = previousClientRect.width / currentClientRect.width;
- const xPosition = previousClientRect.left - currentClientRect.left;
- // Scale the indicator width to match the previous indicator width
- // and translate it on top of the previous indicator
- const transform = `translate3d(${xPosition}px, 0, 0) scaleX(${widthDelta})`;
- writeTask(() => {
- // Remove the transition before positioning on top of the previous indicator
- currentIndicator.classList.remove('segment-button-indicator-animated');
- currentIndicator.style.setProperty('transform', transform);
- // Force a repaint to ensure the transform happens
- currentIndicator.getBoundingClientRect();
- // Add the transition to move the indicator into place
- currentIndicator.classList.add('segment-button-indicator-animated');
- // Remove the transform to slide the indicator back to the button clicked
- currentIndicator.style.setProperty('transform', '');
- this.scrollActiveButtonIntoView(true);
- });
- this.value = current.value;
- this.setCheckedClasses();
- }
- setCheckedClasses() {
- const buttons = this.getButtons();
- const index = buttons.findIndex((button) => button.value === this.value);
- const next = index + 1;
- for (const button of buttons) {
- button.classList.remove('segment-button-after-checked');
- }
- if (next < buttons.length) {
- buttons[next].classList.add('segment-button-after-checked');
- }
- }
- getSegmentView() {
- const buttons = this.getButtons();
- // Get the first button with a contentId
- const firstContentId = buttons.find((button) => button.contentId);
- // Get the segment content with an id matching the button's contentId
- const segmentContent = document.querySelector(`ion-segment-content[id="${firstContentId === null || firstContentId === void 0 ? void 0 : firstContentId.contentId}"]`);
- // Return the segment view for that matching segment content
- return segmentContent === null || segmentContent === void 0 ? void 0 : segmentContent.closest('ion-segment-view');
- }
- handleSegmentViewScroll(ev) {
- const { scrollRatio, isManualScroll } = ev.detail;
- if (!isManualScroll) {
- return;
- }
- const dispatchedFrom = ev.target;
- const segmentViewEl = this.segmentViewEl;
- const segmentEl = this.el;
- // Only update the indicator if the event was dispatched from the correct segment view
- if (ev.composedPath().includes(segmentViewEl) || (dispatchedFrom === null || dispatchedFrom === void 0 ? void 0 : dispatchedFrom.contains(segmentEl))) {
- const buttons = this.getButtons();
- // If no buttons are found or there is no value set then do nothing
- if (!buttons.length)
- return;
- const index = buttons.findIndex((button) => button.value === this.value);
- const current = buttons[index];
- const nextIndex = Math.round(scrollRatio * (buttons.length - 1));
- if (this.lastNextIndex === undefined || this.lastNextIndex !== nextIndex) {
- this.lastNextIndex = nextIndex;
- this.triggerScrollOnValueChange = false;
- this.checkButton(current, buttons[nextIndex]);
- this.emitValueChange();
- }
- }
- }
- /**
- * Finds the related segment view and sets its current content
- * based on the selected segment button. This method
- * should be called on initial load of the segment,
- * after the gesture is completed (if dragging between segments)
- * and when a segment button is clicked directly.
- */
- updateSegmentView(smoothScroll = true) {
- const buttons = this.getButtons();
- const button = buttons.find((btn) => btn.value === this.value);
- // If the button does not have a contentId then there is
- // no associated segment view to update
- if (!(button === null || button === void 0 ? void 0 : button.contentId)) {
- return;
- }
- const segmentView = this.segmentViewEl;
- if (segmentView) {
- segmentView.setContent(button.contentId, smoothScroll);
- }
- }
- scrollActiveButtonIntoView(smoothScroll = true) {
- const { scrollable, value, el } = this;
- if (scrollable) {
- const buttons = this.getButtons();
- const activeButton = buttons.find((button) => button.value === value);
- if (activeButton !== undefined) {
- const scrollContainerBox = el.getBoundingClientRect();
- const activeButtonBox = activeButton.getBoundingClientRect();
- /**
- * Subtract the active button x position from the scroll
- * container x position. This will give us the x position
- * of the active button within the scroll container.
- */
- const activeButtonLeft = activeButtonBox.x - scrollContainerBox.x;
- /**
- * If we just used activeButtonLeft, then the active button
- * would be aligned with the left edge of the scroll container.
- * Instead, we want the segment button to be centered. As a result,
- * we subtract half of the scroll container width. This will position
- * the left edge of the active button at the midpoint of the scroll container.
- * We then add half of the active button width. This will position the active
- * button such that the midpoint of the active button is at the midpoint of the
- * scroll container.
- */
- const centeredX = activeButtonLeft - scrollContainerBox.width / 2 + activeButtonBox.width / 2;
- /**
- * newScrollPosition is the absolute scroll position that the
- * container needs to move to in order to center the active button.
- * It is calculated by adding the current scroll position
- * (scrollLeft) to the offset needed to center the button
- * (centeredX).
- */
- const newScrollPosition = el.scrollLeft + centeredX;
- /**
- * We intentionally use scrollTo here instead of scrollIntoView
- * to avoid a WebKit bug where accelerated animations break
- * when using scrollIntoView. Using scrollIntoView will cause the
- * segment container to jump during the transition and then snap into place.
- * This is because scrollIntoView can potentially cause parent element
- * containers to also scroll. scrollTo does not have this same behavior, so
- * we use this API instead.
- *
- * scrollTo is used instead of scrollBy because there is a
- * Webkit bug that causes scrollBy to not work smoothly when
- * the active button is near the edge of the scroll container.
- * This leads to the buttons to jump around during the transition.
- *
- * Note that if there is not enough scrolling space to center the element
- * within the scroll container, the browser will attempt
- * to center by as much as it can.
- */
- el.scrollTo({
- top: 0,
- left: newScrollPosition,
- behavior: smoothScroll ? 'smooth' : 'instant',
- });
- }
- }
- }
- setNextIndex(detail, isEnd = false) {
- const rtl = isRTL$1(this.el);
- const activated = this.activated;
- const buttons = this.getButtons();
- const index = buttons.findIndex((button) => button.value === this.value);
- const previous = buttons[index];
- let current;
- let nextIndex;
- if (index === -1) {
- return;
- }
- // Get the element that the touch event started on in case
- // it was the checked button, then we will move the indicator
- const rect = previous.getBoundingClientRect();
- const left = rect.left;
- const width = rect.width;
- // Get the element that the gesture is on top of based on the currentX of the
- // gesture event and the Y coordinate of the starting element, since the gesture
- // can move up and down off of the segment
- const currentX = detail.currentX;
- const previousY = rect.top + rect.height / 2;
- /**
- * Segment can be used inside the shadow dom
- * so doing document.elementFromPoint would never
- * return a segment button in that instance.
- * We use getRootNode to which will return the parent
- * shadow root if used inside a shadow component and
- * returns document otherwise.
- */
- const root = this.el.getRootNode();
- const nextEl = root.elementFromPoint(currentX, previousY);
- const decreaseIndex = rtl ? currentX > left + width : currentX < left;
- const increaseIndex = rtl ? currentX < left : currentX > left + width;
- // If the indicator is currently activated then we have started the gesture
- // on top of the checked button so we need to slide the indicator
- // by checking the button next to it as we move
- if (activated && !isEnd) {
- // Decrease index, move left in LTR & right in RTL
- if (decreaseIndex) {
- const newIndex = index - 1;
- if (newIndex >= 0) {
- nextIndex = newIndex;
- }
- // Increase index, moves right in LTR & left in RTL
- }
- else if (increaseIndex) {
- if (activated && !isEnd) {
- const newIndex = index + 1;
- if (newIndex < buttons.length) {
- nextIndex = newIndex;
- }
- }
- }
- if (nextIndex !== undefined && !buttons[nextIndex].disabled) {
- current = buttons[nextIndex];
- }
- }
- // If the indicator is not activated then we will just set the indicator
- // to the element where the gesture ended
- if (!activated && isEnd) {
- current = nextEl;
- }
- if (current != null) {
- /**
- * If current element is ion-segment then that means
- * user tried to select a disabled ion-segment-button,
- * and we should not update the ripple.
- */
- if (current.tagName === 'ION-SEGMENT') {
- return false;
- }
- if (previous !== current) {
- this.checkButton(previous, current);
- }
- }
- return true;
- }
- emitStyle() {
- this.ionStyle.emit({
- segment: true,
- });
- }
- onKeyDown(ev) {
- const rtl = isRTL$1(this.el);
- let keyDownSelectsButton = this.selectOnFocus;
- let current;
- switch (ev.key) {
- case 'ArrowRight':
- ev.preventDefault();
- current = rtl ? this.getSegmentButton('previous') : this.getSegmentButton('next');
- break;
- case 'ArrowLeft':
- ev.preventDefault();
- current = rtl ? this.getSegmentButton('next') : this.getSegmentButton('previous');
- break;
- case 'Home':
- ev.preventDefault();
- current = this.getSegmentButton('first');
- break;
- case 'End':
- ev.preventDefault();
- current = this.getSegmentButton('last');
- break;
- case ' ':
- case 'Enter':
- ev.preventDefault();
- current = document.activeElement;
- keyDownSelectsButton = true;
- }
- if (!current) {
- return;
- }
- if (keyDownSelectsButton) {
- const previous = this.checked;
- this.checkButton(previous || current, current);
- if (current !== previous) {
- this.emitValueChange();
- }
- }
- current.setFocus();
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'a64e39352050b516f7dc82ce95a4bcff8431d1d0', role: "tablist", onClick: this.onClick, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- 'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
- 'segment-activated': this.activated,
- 'segment-disabled': this.disabled,
- 'segment-scrollable': this.scrollable,
- }) }, hAsync("slot", { key: 'bb3f3ec30e59e0461fa620d8961ab730cc802a4e', onSlotchange: this.onSlottedItemsChange })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "color": ["colorChanged"],
- "swipeGesture": ["swipeGestureChanged"],
- "value": ["valueChanged"],
- "disabled": ["disabledChanged"]
- }; }
- static get style() { return {
- ios: IonSegmentIosStyle0,
- md: IonSegmentMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-segment",
- "$members$": {
- "color": [513],
- "disabled": [4],
- "scrollable": [4],
- "swipeGesture": [4, "swipe-gesture"],
- "value": [1032],
- "selectOnFocus": [4, "select-on-focus"],
- "activated": [32]
- },
- "$listeners$": [[16, "ionSegmentViewScroll", "handleSegmentViewScroll"], [0, "keydown", "onKeyDown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const segmentButtonIosCss = ":host{--color:initial;--color-hover:var(--color);--color-checked:var(--color);--color-disabled:var(--color);--padding-start:0;--padding-end:0;--padding-top:0;--padding-bottom:0;border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:column;flex-direction:column;height:auto;background:var(--background);color:var(--color);text-decoration:none;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;grid-row:1;-webkit-font-kerning:none;font-kerning:none}.button-native{border-radius:0;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;-webkit-margin-start:var(--margin-start);margin-inline-start:var(--margin-start);-webkit-margin-end:var(--margin-end);margin-inline-end:var(--margin-end);margin-top:var(--margin-top);margin-bottom:var(--margin-bottom);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;min-width:inherit;max-width:inherit;height:auto;min-height:inherit;max-height:inherit;-webkit-transition:var(--transition);transition:var(--transition);border:none;outline:none;background:transparent;contain:content;pointer-events:none;overflow:hidden;z-index:2}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:inherit;flex-flow:inherit;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.segment-button-checked){background:var(--background-checked);color:var(--color-checked)}:host(.segment-button-disabled){cursor:default;pointer-events:none}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(:focus){outline:none}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.segment-button-checked:hover) .button-native{color:var(--color-checked)}}::slotted(ion-icon){-ms-flex-negative:0;flex-shrink:0;-ms-flex-order:-1;order:-1;pointer-events:none}::slotted(ion-label){display:block;-ms-flex-item-align:center;align-self:center;max-width:100%;line-height:22px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;pointer-events:none}:host(.segment-button-layout-icon-top) .button-native{-ms-flex-direction:column;flex-direction:column}:host(.segment-button-layout-icon-start) .button-native{-ms-flex-direction:row;flex-direction:row}:host(.segment-button-layout-icon-end) .button-native{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.segment-button-layout-icon-bottom) .button-native{-ms-flex-direction:column-reverse;flex-direction:column-reverse}:host(.segment-button-layout-icon-hide) ::slotted(ion-icon){display:none}:host(.segment-button-layout-label-hide) ::slotted(ion-label){display:none}ion-ripple-effect{color:var(--ripple-color, var(--color-checked))}.segment-button-indicator{-webkit-transform-origin:left;transform-origin:left;position:absolute;opacity:0;-webkit-box-sizing:border-box;box-sizing:border-box;will-change:transform, opacity;pointer-events:none}.segment-button-indicator-background{width:100%;height:var(--indicator-height);-webkit-transform:var(--indicator-transform);transform:var(--indicator-transform);-webkit-box-shadow:var(--indicator-box-shadow);box-shadow:var(--indicator-box-shadow);pointer-events:none}.segment-button-indicator-animated{-webkit-transition:var(--indicator-transition);transition:var(--indicator-transition)}:host(.segment-button-checked) .segment-button-indicator{opacity:1}@media (prefers-reduced-motion: reduce){.segment-button-indicator-background{-webkit-transform:none;transform:none}.segment-button-indicator-animated{-webkit-transition:none;transition:none}}:host{--background:none;--background-checked:none;--background-hover:none;--background-hover-opacity:0;--background-focused:none;--background-focused-opacity:0;--border-radius:7px;--border-width:1px;--border-color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.12);--border-style:solid;--indicator-box-shadow:0 0 5px rgba(0, 0, 0, 0.16);--indicator-color:var(--ion-color-step-350, var(--ion-background-color-step-350, var(--ion-background-color, #fff)));--indicator-height:100%;--indicator-transition:transform 260ms cubic-bezier(0.4, 0, 0.2, 1);--indicator-transform:none;--transition:100ms all linear;--padding-top:0;--padding-end:13px;--padding-bottom:0;--padding-start:13px;margin-top:2px;margin-bottom:2px;position:relative;-ms-flex-direction:row;flex-direction:row;min-width:70px;min-height:28px;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);font-size:13px;font-weight:450;line-height:37px}:host::before{margin-left:0;margin-right:0;margin-top:5px;margin-bottom:5px;-webkit-transition:160ms opacity ease-in-out;transition:160ms opacity ease-in-out;-webkit-transition-delay:100ms;transition-delay:100ms;border-left:var(--border-width) var(--border-style) var(--border-color);content:\"\";opacity:1;will-change:opacity}:host(:first-of-type)::before{border-left-color:transparent}:host(.segment-button-disabled){opacity:0.3}::slotted(ion-icon){font-size:24px}:host(.segment-button-layout-icon-start) ::slotted(ion-label){-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:0;margin-inline-end:0}:host(.segment-button-layout-icon-end) ::slotted(ion-label){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:2px;margin-inline-end:2px}.segment-button-indicator{-webkit-padding-start:2px;padding-inline-start:2px;-webkit-padding-end:2px;padding-inline-end:2px;left:0;right:0;top:0;bottom:0}.segment-button-indicator-background{border-radius:var(--border-radius);background:var(--indicator-color)}.segment-button-indicator-background{-webkit-transition:var(--indicator-transition);transition:var(--indicator-transition)}:host(.segment-button-checked)::before,:host(.segment-button-after-checked)::before{opacity:0}:host(.segment-button-checked){z-index:-1}:host(.segment-button-activated){--indicator-transform:scale(0.95)}:host(.ion-focused) .button-native{opacity:0.7}@media (any-hover: hover){:host(:hover) .button-native{opacity:0.5}:host(.segment-button-checked:hover) .button-native{opacity:1}}:host(.in-segment-color){background:none;color:var(--ion-text-color, #000)}:host(.in-segment-color) .segment-button-indicator-background{background:var(--ion-color-step-350, var(--ion-background-color-step-350, var(--ion-background-color, #fff)))}@media (any-hover: hover){:host(.in-segment-color:hover) .button-native,:host(.in-segment-color.segment-button-checked:hover) .button-native{color:var(--ion-text-color, #000)}}:host(.in-toolbar:not(.in-segment-color)){--background-checked:var(--ion-toolbar-segment-background-checked, none);--color:var(--ion-toolbar-segment-color, var(--ion-toolbar-color), initial);--color-checked:var(--ion-toolbar-segment-color-checked, var(--ion-toolbar-color), initial);--indicator-color:var(--ion-toolbar-segment-indicator-color, var(--ion-color-step-350, var(--ion-background-color-step-350, var(--ion-background-color, #fff))))}:host(.in-toolbar-color) .segment-button-indicator-background{background:var(--ion-color-contrast)}:host(.in-toolbar-color:not(.in-segment-color)) .button-native{color:var(--ion-color-contrast)}:host(.in-toolbar-color.segment-button-checked:not(.in-segment-color)) .button-native{color:var(--ion-color-base)}@media (any-hover: hover){:host(.in-toolbar-color:not(.in-segment-color):hover) .button-native{color:var(--ion-color-contrast)}:host(.in-toolbar-color.segment-button-checked:not(.in-segment-color):hover) .button-native{color:var(--ion-color-base)}}";
- var IonSegmentButtonIosStyle0 = segmentButtonIosCss;
- const segmentButtonMdCss = ":host{--color:initial;--color-hover:var(--color);--color-checked:var(--color);--color-disabled:var(--color);--padding-start:0;--padding-end:0;--padding-top:0;--padding-bottom:0;border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:column;flex-direction:column;height:auto;background:var(--background);color:var(--color);text-decoration:none;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;grid-row:1;-webkit-font-kerning:none;font-kerning:none}.button-native{border-radius:0;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;-webkit-margin-start:var(--margin-start);margin-inline-start:var(--margin-start);-webkit-margin-end:var(--margin-end);margin-inline-end:var(--margin-end);margin-top:var(--margin-top);margin-bottom:var(--margin-bottom);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;min-width:inherit;max-width:inherit;height:auto;min-height:inherit;max-height:inherit;-webkit-transition:var(--transition);transition:var(--transition);border:none;outline:none;background:transparent;contain:content;pointer-events:none;overflow:hidden;z-index:2}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:inherit;flex-flow:inherit;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.segment-button-checked){background:var(--background-checked);color:var(--color-checked)}:host(.segment-button-disabled){cursor:default;pointer-events:none}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(:focus){outline:none}@media (any-hover: hover){:host(:hover) .button-native{color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.segment-button-checked:hover) .button-native{color:var(--color-checked)}}::slotted(ion-icon){-ms-flex-negative:0;flex-shrink:0;-ms-flex-order:-1;order:-1;pointer-events:none}::slotted(ion-label){display:block;-ms-flex-item-align:center;align-self:center;max-width:100%;line-height:22px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;pointer-events:none}:host(.segment-button-layout-icon-top) .button-native{-ms-flex-direction:column;flex-direction:column}:host(.segment-button-layout-icon-start) .button-native{-ms-flex-direction:row;flex-direction:row}:host(.segment-button-layout-icon-end) .button-native{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.segment-button-layout-icon-bottom) .button-native{-ms-flex-direction:column-reverse;flex-direction:column-reverse}:host(.segment-button-layout-icon-hide) ::slotted(ion-icon){display:none}:host(.segment-button-layout-label-hide) ::slotted(ion-label){display:none}ion-ripple-effect{color:var(--ripple-color, var(--color-checked))}.segment-button-indicator{-webkit-transform-origin:left;transform-origin:left;position:absolute;opacity:0;-webkit-box-sizing:border-box;box-sizing:border-box;will-change:transform, opacity;pointer-events:none}.segment-button-indicator-background{width:100%;height:var(--indicator-height);-webkit-transform:var(--indicator-transform);transform:var(--indicator-transform);-webkit-box-shadow:var(--indicator-box-shadow);box-shadow:var(--indicator-box-shadow);pointer-events:none}.segment-button-indicator-animated{-webkit-transition:var(--indicator-transition);transition:var(--indicator-transition)}:host(.segment-button-checked) .segment-button-indicator{opacity:1}@media (prefers-reduced-motion: reduce){.segment-button-indicator-background{-webkit-transform:none;transform:none}.segment-button-indicator-animated{-webkit-transition:none;transition:none}}:host{--background:none;--background-checked:none;--background-hover:var(--color-checked);--background-focused:var(--color-checked);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04;--color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.6);--color-checked:var(--ion-color-primary, #0054e9);--indicator-box-shadow:none;--indicator-color:var(--color-checked);--indicator-height:2px;--indicator-transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1);--indicator-transform:none;--padding-top:0;--padding-end:16px;--padding-bottom:0;--padding-start:16px;--transition:color 0.15s linear 0s, opacity 0.15s linear 0s;min-width:90px;min-height:48px;border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);font-size:14px;font-weight:500;letter-spacing:0.06em;line-height:40px;text-transform:uppercase}:host(.segment-button-disabled){opacity:0.3}:host(.in-segment-color){background:none;color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.6)}:host(.in-segment-color) ion-ripple-effect{color:var(--ion-color-base)}:host(.in-segment-color) .segment-button-indicator-background{background:var(--ion-color-base)}:host(.in-segment-color.segment-button-checked) .button-native{color:var(--ion-color-base)}:host(.in-segment-color.ion-focused) .button-native::after{background:var(--ion-color-base)}@media (any-hover: hover){:host(.in-segment-color:hover) .button-native{color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.6)}:host(.in-segment-color:hover) .button-native::after{background:var(--ion-color-base)}:host(.in-segment-color.segment-button-checked:hover) .button-native{color:var(--ion-color-base)}}:host(.in-toolbar:not(.in-segment-color)){--background:var(--ion-toolbar-segment-background, none);--background-checked:var(--ion-toolbar-segment-background-checked, none);--color:var(--ion-toolbar-segment-color, rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.6));--color-checked:var(--ion-toolbar-segment-color-checked, var(--ion-color-primary, #0054e9));--indicator-color:var(--ion-toolbar-segment-color-checked, var(--color-checked))}:host(.in-toolbar-color:not(.in-segment-color)) .button-native{color:rgba(var(--ion-color-contrast-rgb), 0.6)}:host(.in-toolbar-color.segment-button-checked:not(.in-segment-color)) .button-native{color:var(--ion-color-contrast)}@media (any-hover: hover){:host(.in-toolbar-color:not(.in-segment-color)) .button-native::after{background:var(--ion-color-contrast)}}::slotted(ion-icon){margin-top:12px;margin-bottom:12px;font-size:24px}::slotted(ion-label){margin-top:12px;margin-bottom:12px}:host(.segment-button-layout-icon-top) ::slotted(ion-label),:host(.segment-button-layout-icon-bottom) ::slotted(ion-icon){margin-top:0}:host(.segment-button-layout-icon-top) ::slotted(ion-icon),:host(.segment-button-layout-icon-bottom) ::slotted(ion-label){margin-bottom:0}:host(.segment-button-layout-icon-start) ::slotted(ion-label){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:0;margin-inline-end:0}:host(.segment-button-layout-icon-end) ::slotted(ion-label){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px}:host(.segment-button-has-icon-only) ::slotted(ion-icon){margin-top:12px;margin-bottom:12px}:host(.segment-button-has-label-only) ::slotted(ion-label){margin-top:12px;margin-bottom:12px}.segment-button-indicator{left:0;right:0;bottom:0}.segment-button-indicator-background{background:var(--indicator-color)}:host(.in-toolbar:not(.in-segment-color)) .segment-button-indicator-background{background:var(--ion-toolbar-segment-indicator-color, var(--indicator-color))}:host(.in-toolbar-color:not(.in-segment-color)) .segment-button-indicator-background{background:var(--ion-color-contrast)}";
- var IonSegmentButtonMdStyle0 = segmentButtonMdCss;
- let ids = 0;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part native - The native HTML button element that wraps all child elements.
- * @part indicator - The indicator displayed on the checked segment button.
- * @part indicator-background - The background element for the indicator displayed on the checked segment button.
- */
- class SegmentButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.segmentEl = null;
- this.inheritedAttributes = {};
- this.updateStyle = () => {
- };
- this.updateState = () => {
- const { segmentEl } = this;
- if (segmentEl) {
- this.checked = segmentEl.value === this.value;
- if (segmentEl.disabled) {
- this.disabled = true;
- }
- }
- };
- this.checked = false;
- this.contentId = undefined;
- this.disabled = false;
- this.layout = 'icon-top';
- this.type = 'button';
- this.value = 'ion-sb-' + ids++;
- }
- valueChanged() {
- this.updateState();
- }
- connectedCallback() {
- const segmentEl = (this.segmentEl = this.el.closest('ion-segment'));
- if (segmentEl) {
- this.updateState();
- addEventListener$1(segmentEl, 'ionSelect', this.updateState);
- addEventListener$1(segmentEl, 'ionStyle', this.updateStyle);
- }
- // Prevent buttons from being disabled when associated with segment content
- if (this.contentId && this.disabled) {
- printIonWarning(`[ion-segment-button] - Segment buttons cannot be disabled when associated with an <ion-segment-content>.`);
- this.disabled = false;
- }
- }
- disconnectedCallback() {
- const segmentEl = this.segmentEl;
- if (segmentEl) {
- removeEventListener(segmentEl, 'ionSelect', this.updateState);
- removeEventListener(segmentEl, 'ionStyle', this.updateStyle);
- this.segmentEl = null;
- }
- }
- componentWillLoad() {
- this.inheritedAttributes = Object.assign({}, inheritAttributes$1(this.el, ['aria-label']));
- // Return if there is no contentId defined
- if (!this.contentId)
- return;
- // Attempt to find the Segment Content by its contentId
- const segmentContent = document.getElementById(this.contentId);
- // If no associated Segment Content exists, log an error and return
- if (!segmentContent) {
- printIonError(`[ion-segment-button] - Unable to find Segment Content with id="${this.contentId}".`);
- return;
- }
- // Ensure the found element is a valid ION-SEGMENT-CONTENT
- if (segmentContent.tagName !== 'ION-SEGMENT-CONTENT') {
- printIonError(`[ion-segment-button] - Element with id="${this.contentId}" is not an <ion-segment-content> element.`);
- return;
- }
- }
- get hasLabel() {
- return !!this.el.querySelector('ion-label');
- }
- get hasIcon() {
- return !!this.el.querySelector('ion-icon');
- }
- /**
- * @internal
- * Focuses the native <button> element
- * inside of ion-segment-button.
- */
- async setFocus() {
- const { nativeEl } = this;
- if (nativeEl !== undefined) {
- nativeEl.focus();
- }
- }
- render() {
- const { checked, type, disabled, hasIcon, hasLabel, layout, segmentEl } = this;
- const mode = getIonMode$1(this);
- const hasSegmentColor = () => (segmentEl === null || segmentEl === void 0 ? void 0 : segmentEl.color) !== undefined;
- return (hAsync(Host, { key: 'd79dad80db69123510c6d52bbf4424558600c14a', class: {
- [mode]: true,
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- 'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
- 'in-segment': hostContext('ion-segment', this.el),
- 'in-segment-color': hasSegmentColor(),
- 'segment-button-has-label': hasLabel,
- 'segment-button-has-icon': hasIcon,
- 'segment-button-has-label-only': hasLabel && !hasIcon,
- 'segment-button-has-icon-only': hasIcon && !hasLabel,
- 'segment-button-disabled': disabled,
- 'segment-button-checked': checked,
- [`segment-button-layout-${layout}`]: true,
- 'ion-activatable': true,
- 'ion-activatable-instant': true,
- 'ion-focusable': true,
- } }, hAsync("button", Object.assign({ key: '781fd7fef443a2fbd404b8a399d1203794759a69', "aria-selected": checked ? 'true' : 'false', role: "tab", ref: (el) => (this.nativeEl = el), type: type, class: "button-native", part: "native", disabled: disabled }, this.inheritedAttributes), hAsync("span", { key: '64df08f60ea17481183f8ad284884b9979eaeb24', class: "button-inner" }, hAsync("slot", { key: '2b7ef328023ab5ccc0adc6f865e5e7121467eeb8' })), mode === 'md' && hAsync("ion-ripple-effect", { key: '1fd5e6179227925a03b6c3b5258bbf4ea99bfef1' })), hAsync("div", { key: 'dbcedad6988b0eadeebe02bdafdedb8eb37af19c', part: "indicator", class: "segment-button-indicator segment-button-indicator-animated" }, hAsync("div", { key: 'f4f1789f66bdfa2de5445bc0d292116a93bad7cc', part: "indicator-background", class: "segment-button-indicator-background" }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["valueChanged"]
- }; }
- static get style() { return {
- ios: IonSegmentButtonIosStyle0,
- md: IonSegmentButtonMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-segment-button",
- "$members$": {
- "contentId": [513, "content-id"],
- "disabled": [1028],
- "layout": [1],
- "type": [1],
- "value": [8],
- "checked": [32],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["contentId", "content-id"]]
- }; }
- }
- const segmentContentCss = ":host{scroll-snap-align:center;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none;}:host::-webkit-scrollbar{display:none}";
- var IonSegmentContentStyle0 = segmentContentCss;
- class SegmentContent {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- render() {
- return (hAsync(Host, { key: '64b3965b14c749e77e9ce13b59f349d971e245c8' }, hAsync("slot", { key: '2d0bed34f9bc93f92e713cb51e42220f3cecd8f5' })));
- }
- static get style() { return IonSegmentContentStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-segment-content",
- "$members$": undefined,
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const segmentViewIosCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";
- var IonSegmentViewIosStyle0 = segmentViewIosCss;
- const segmentViewMdCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";
- var IonSegmentViewMdStyle0 = segmentViewMdCss;
- class SegmentView {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionSegmentViewScroll = createEvent(this, "ionSegmentViewScroll", 7);
- this.scrollEndTimeout = null;
- this.isTouching = false;
- this.disabled = false;
- this.isManualScroll = undefined;
- }
- handleScroll(ev) {
- var _a;
- const { scrollLeft, scrollWidth, clientWidth } = ev.target;
- const scrollRatio = scrollLeft / (scrollWidth - clientWidth);
- this.ionSegmentViewScroll.emit({
- scrollRatio,
- isManualScroll: (_a = this.isManualScroll) !== null && _a !== void 0 ? _a : true,
- });
- // Reset the timeout to check for scroll end
- this.resetScrollEndTimeout();
- }
- /**
- * Handle touch start event to know when the user is actively dragging the segment view.
- */
- handleScrollStart() {
- if (this.scrollEndTimeout) {
- clearTimeout(this.scrollEndTimeout);
- this.scrollEndTimeout = null;
- }
- this.isTouching = true;
- }
- /**
- * Handle touch end event to know when the user is no longer dragging the segment view.
- */
- handleTouchEnd() {
- this.isTouching = false;
- }
- /**
- * Reset the scroll end detection timer. This is called on every scroll event.
- */
- resetScrollEndTimeout() {
- if (this.scrollEndTimeout) {
- clearTimeout(this.scrollEndTimeout);
- this.scrollEndTimeout = null;
- }
- this.scrollEndTimeout = setTimeout(() => {
- this.checkForScrollEnd();
- },
- // Setting this to a lower value may result in inconsistencies in behavior
- // across browsers (particularly Firefox).
- // Ideally, all of this logic is removed once the scroll end event is
- // supported on all browsers (https://caniuse.com/?search=scrollend)
- 100);
- }
- /**
- * Check if the scroll has ended and the user is not actively touching.
- * If the conditions are met (active content is enabled and no active touch),
- * reset the scroll position and emit the scroll end event.
- */
- checkForScrollEnd() {
- // Only emit scroll end event if the active content is not disabled and
- // the user is not touching the segment view
- if (!this.isTouching) {
- this.isManualScroll = undefined;
- }
- }
- /**
- * @internal
- *
- * This method is used to programmatically set the displayed segment content
- * in the segment view. Calling this method will update the `value` of the
- * corresponding segment button.
- *
- * @param id: The id of the segment content to display.
- * @param smoothScroll: Whether to animate the scroll transition.
- */
- async setContent(id, smoothScroll = true) {
- const contents = this.getSegmentContents();
- const index = contents.findIndex((content) => content.id === id);
- if (index === -1)
- return;
- this.isManualScroll = false;
- this.resetScrollEndTimeout();
- const contentWidth = this.el.offsetWidth;
- this.el.scrollTo({
- top: 0,
- left: index * contentWidth,
- behavior: smoothScroll ? 'smooth' : 'instant',
- });
- }
- getSegmentContents() {
- return Array.from(this.el.querySelectorAll('ion-segment-content'));
- }
- render() {
- const { disabled, isManualScroll } = this;
- return (hAsync(Host, { key: 'fa528d2d9ae0f00fc3067defe2a047dce77c814a', class: {
- 'segment-view-disabled': disabled,
- 'segment-view-scroll-disabled': isManualScroll === false,
- } }, hAsync("slot", { key: '74dc8b4d073caeff1bab272d11b9ea3e1a215954' })));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonSegmentViewIosStyle0,
- md: IonSegmentViewMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-segment-view",
- "$members$": {
- "disabled": [4],
- "isManualScroll": [32],
- "setContent": [64]
- },
- "$listeners$": [[1, "scroll", "handleScroll"], [1, "touchstart", "handleScrollStart"], [1, "touchend", "handleTouchEnd"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const selectIosCss = ":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--placeholder-color:currentColor;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);--background:transparent;--border-style:solid;--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;width:100%;min-height:44px;font-family:var(--ion-font-family, inherit);white-space:nowrap;cursor:pointer;z-index:2}:host(.select-label-placement-floating),:host(.select-label-placement-stacked){min-height:56px}:host(.ion-color){--highlight-color-focused:var(--ion-color-base)}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0}:host(.select-disabled){pointer-events:none}:host(.has-focus) button{border:2px solid #5e9ed6}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0;position:relative;-ms-flex-negative:0;flex-shrink:0}:host(.in-item-color) .select-icon{color:inherit}:host(.select-label-placement-stacked) .select-icon,:host(.select-label-placement-floating) .select-icon{position:absolute;height:100%}:host(.select-ltr.select-label-placement-stacked) .select-icon,:host(.select-ltr.select-label-placement-floating) .select-icon{right:var(--padding-end, 0)}:host(.select-rtl.select-label-placement-stacked) .select-icon,:host(.select-rtl.select-label-placement-floating) .select-icon{left:var(--padding-start, 0)}.select-text{-ms-flex:1;flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:inherit;overflow:hidden}.select-wrapper{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;min-height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;background:var(--background);line-height:normal;cursor:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}.select-wrapper .select-placeholder{-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1)}.select-wrapper-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;overflow:hidden}:host(.select-label-placement-stacked) .select-wrapper-inner,:host(.select-label-placement-floating) .select-wrapper-inner{-ms-flex-positive:1;flex-grow:1}:host(.ion-touched.ion-invalid){--highlight-color:var(--highlight-color-invalid)}:host(.ion-valid){--highlight-color:var(--highlight-color-valid)}.select-bottom{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:5px;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;border-top:var(--border-width) var(--border-style) var(--border-color);font-size:0.75rem;white-space:normal}:host(.has-focus.ion-valid),:host(.select-expanded.ion-valid),:host(.ion-touched.ion-invalid),:host(.select-expanded.ion-touched.ion-invalid){--border-color:var(--highlight-color)}.select-bottom .error-text{display:none;color:var(--highlight-color-invalid)}.select-bottom .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}:host(.ion-touched.ion-invalid) .select-bottom .error-text{display:block}:host(.ion-touched.ion-invalid) .select-bottom .helper-text{display:none}.label-text-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;max-width:200px;-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);pointer-events:none}.label-text,::slotted([slot=label]){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden,.select-outline-notch-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);overflow:hidden}:host(.select-justify-space-between) .select-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.select-justify-start) .select-wrapper{-ms-flex-pack:start;justify-content:start}:host(.select-justify-end) .select-wrapper{-ms-flex-pack:end;justify-content:end}:host(.select-label-placement-start) .select-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.select-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.select-label-placement-end) .select-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.select-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.select-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.select-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.select-label-placement-stacked) .select-wrapper,:host(.select-label-placement-floating) .select-wrapper{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:start}:host(.select-label-placement-stacked) .label-text-wrapper,:host(.select-label-placement-floating) .label-text-wrapper{max-width:100%}:host(.select-ltr.select-label-placement-stacked) .label-text-wrapper,:host(.select-ltr.select-label-placement-floating) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host(.select-rtl.select-label-placement-stacked) .label-text-wrapper,:host(.select-rtl.select-label-placement-floating) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}:host(.select-label-placement-stacked) .native-wrapper,:host(.select-label-placement-floating) .native-wrapper{margin-left:0;margin-right:0;margin-top:1px;margin-bottom:0;-ms-flex-positive:1;flex-grow:1;width:100%}:host(.select-label-placement-floating) .label-text-wrapper{-webkit-transform:translateY(100%) scale(1);transform:translateY(100%) scale(1)}:host(.select-label-placement-floating:not(.label-floating)) .native-wrapper .select-placeholder{opacity:0}:host(.select-expanded.select-label-placement-floating) .native-wrapper .select-placeholder,:host(.has-focus.select-label-placement-floating) .native-wrapper .select-placeholder,:host(.has-value.select-label-placement-floating) .native-wrapper .select-placeholder{opacity:1}:host(.label-floating) .label-text-wrapper{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75);max-width:calc(100% / 0.75)}::slotted([slot=start]),::slotted([slot=end]){-ms-flex-negative:0;flex-shrink:0}::slotted([slot=start]:last-of-type){-webkit-margin-end:16px;margin-inline-end:16px;-webkit-margin-start:0;margin-inline-start:0}::slotted([slot=end]:first-of-type){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host{--border-width:0.55px;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));--highlight-height:0px}.select-icon{width:1.125rem;height:1.125rem;color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959))}:host(.select-label-placement-stacked) .select-wrapper-inner,:host(.select-label-placement-floating) .select-wrapper-inner{width:calc(100% - 1.125rem - 4px)}:host(.select-disabled){opacity:0.3}::slotted(ion-button[slot=start].button-has-icon-only),::slotted(ion-button[slot=end].button-has-icon-only){--border-radius:50%;--padding-start:0;--padding-end:0;--padding-top:0;--padding-bottom:0;aspect-ratio:1}";
- var IonSelectIosStyle0 = selectIosCss;
- const selectMdCss = ":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--placeholder-color:currentColor;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);--background:transparent;--border-style:solid;--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;width:100%;min-height:44px;font-family:var(--ion-font-family, inherit);white-space:nowrap;cursor:pointer;z-index:2}:host(.select-label-placement-floating),:host(.select-label-placement-stacked){min-height:56px}:host(.ion-color){--highlight-color-focused:var(--ion-color-base)}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0}:host(.select-disabled){pointer-events:none}:host(.has-focus) button{border:2px solid #5e9ed6}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0;position:relative;-ms-flex-negative:0;flex-shrink:0}:host(.in-item-color) .select-icon{color:inherit}:host(.select-label-placement-stacked) .select-icon,:host(.select-label-placement-floating) .select-icon{position:absolute;height:100%}:host(.select-ltr.select-label-placement-stacked) .select-icon,:host(.select-ltr.select-label-placement-floating) .select-icon{right:var(--padding-end, 0)}:host(.select-rtl.select-label-placement-stacked) .select-icon,:host(.select-rtl.select-label-placement-floating) .select-icon{left:var(--padding-start, 0)}.select-text{-ms-flex:1;flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:inherit;overflow:hidden}.select-wrapper{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;min-height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;background:var(--background);line-height:normal;cursor:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}.select-wrapper .select-placeholder{-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1)}.select-wrapper-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;overflow:hidden}:host(.select-label-placement-stacked) .select-wrapper-inner,:host(.select-label-placement-floating) .select-wrapper-inner{-ms-flex-positive:1;flex-grow:1}:host(.ion-touched.ion-invalid){--highlight-color:var(--highlight-color-invalid)}:host(.ion-valid){--highlight-color:var(--highlight-color-valid)}.select-bottom{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:5px;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;border-top:var(--border-width) var(--border-style) var(--border-color);font-size:0.75rem;white-space:normal}:host(.has-focus.ion-valid),:host(.select-expanded.ion-valid),:host(.ion-touched.ion-invalid),:host(.select-expanded.ion-touched.ion-invalid){--border-color:var(--highlight-color)}.select-bottom .error-text{display:none;color:var(--highlight-color-invalid)}.select-bottom .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}:host(.ion-touched.ion-invalid) .select-bottom .error-text{display:block}:host(.ion-touched.ion-invalid) .select-bottom .helper-text{display:none}.label-text-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;max-width:200px;-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);pointer-events:none}.label-text,::slotted([slot=label]){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden,.select-outline-notch-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);overflow:hidden}:host(.select-justify-space-between) .select-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.select-justify-start) .select-wrapper{-ms-flex-pack:start;justify-content:start}:host(.select-justify-end) .select-wrapper{-ms-flex-pack:end;justify-content:end}:host(.select-label-placement-start) .select-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.select-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.select-label-placement-end) .select-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.select-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.select-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.select-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.select-label-placement-stacked) .select-wrapper,:host(.select-label-placement-floating) .select-wrapper{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:start}:host(.select-label-placement-stacked) .label-text-wrapper,:host(.select-label-placement-floating) .label-text-wrapper{max-width:100%}:host(.select-ltr.select-label-placement-stacked) .label-text-wrapper,:host(.select-ltr.select-label-placement-floating) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host(.select-rtl.select-label-placement-stacked) .label-text-wrapper,:host(.select-rtl.select-label-placement-floating) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}:host(.select-label-placement-stacked) .native-wrapper,:host(.select-label-placement-floating) .native-wrapper{margin-left:0;margin-right:0;margin-top:1px;margin-bottom:0;-ms-flex-positive:1;flex-grow:1;width:100%}:host(.select-label-placement-floating) .label-text-wrapper{-webkit-transform:translateY(100%) scale(1);transform:translateY(100%) scale(1)}:host(.select-label-placement-floating:not(.label-floating)) .native-wrapper .select-placeholder{opacity:0}:host(.select-expanded.select-label-placement-floating) .native-wrapper .select-placeholder,:host(.has-focus.select-label-placement-floating) .native-wrapper .select-placeholder,:host(.has-value.select-label-placement-floating) .native-wrapper .select-placeholder{opacity:1}:host(.label-floating) .label-text-wrapper{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75);max-width:calc(100% / 0.75)}::slotted([slot=start]),::slotted([slot=end]){-ms-flex-negative:0;flex-shrink:0}::slotted([slot=start]:last-of-type){-webkit-margin-end:16px;margin-inline-end:16px;-webkit-margin-start:0;margin-inline-start:0}::slotted([slot=end]:first-of-type){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.select-fill-solid){--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--border-color:var(--ion-color-step-500, var(--ion-background-color-step-500, gray));--border-radius:4px;--padding-start:16px;--padding-end:16px;min-height:56px}:host(.select-fill-solid) .select-wrapper{border-bottom:var(--border-width) var(--border-style) var(--border-color)}:host(.select-expanded.select-fill-solid.ion-valid),:host(.has-focus.select-fill-solid.ion-valid),:host(.select-fill-solid.ion-touched.ion-invalid){--border-color:var(--highlight-color)}:host(.select-fill-solid) .select-bottom{border-top:none}@media (any-hover: hover){:host(.select-fill-solid:hover){--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6));--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}}:host(.select-fill-solid.select-expanded),:host(.select-fill-solid.has-focus){--background:var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));--border-color:var(--highlight-color)}:host(.select-fill-solid) .select-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0px;border-end-start-radius:0px}:host(.label-floating.select-fill-solid) .label-text-wrapper{max-width:calc(100% / 0.75)}:host(.in-item.select-expanded.select-fill-solid) .select-wrapper .select-icon,:host(.in-item.has-focus.select-fill-solid) .select-wrapper .select-icon,:host(.in-item.has-focus.ion-valid.select-fill-solid) .select-wrapper .select-icon,:host(.in-item.ion-touched.ion-invalid.select-fill-solid) .select-wrapper .select-icon{color:var(--highlight-color)}:host(.select-fill-outline){--border-color:var(--ion-color-step-300, var(--ion-background-color-step-300, #b3b3b3));--border-radius:4px;--padding-start:16px;--padding-end:16px;min-height:56px}:host(.select-fill-outline.select-shape-round){--border-radius:28px;--padding-start:32px;--padding-end:32px}:host(.has-focus.select-fill-outline.ion-valid),:host(.select-fill-outline.ion-touched.ion-invalid){--border-color:var(--highlight-color)}@media (any-hover: hover){:host(.select-fill-outline:hover){--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}}:host(.select-fill-outline.select-expanded),:host(.select-fill-outline.has-focus){--border-width:var(--highlight-height);--border-color:var(--highlight-color)}:host(.select-fill-outline) .select-bottom{border-top:none}:host(.select-fill-outline) .select-wrapper{border-bottom:none}:host(.select-ltr.select-fill-outline.select-label-placement-stacked) .label-text-wrapper,:host(.select-ltr.select-fill-outline.select-label-placement-floating) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host(.select-rtl.select-fill-outline.select-label-placement-stacked) .label-text-wrapper,:host(.select-rtl.select-fill-outline.select-label-placement-floating) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}:host(.select-fill-outline.select-label-placement-stacked) .label-text-wrapper,:host(.select-fill-outline.select-label-placement-floating) .label-text-wrapper{position:absolute;max-width:calc(100% - var(--padding-start) - var(--padding-end))}:host(.select-fill-outline) .label-text-wrapper{position:relative;z-index:1}:host(.label-floating.select-fill-outline) .label-text-wrapper{-webkit-transform:translateY(-32%) scale(0.75);transform:translateY(-32%) scale(0.75);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;max-width:calc((100% - var(--padding-start) - var(--padding-end) - 8px) / 0.75)}:host(.select-fill-outline.select-label-placement-stacked) select,:host(.select-fill-outline.select-label-placement-floating) select{margin-left:0;margin-right:0;margin-top:6px;margin-bottom:6px}:host(.select-fill-outline) .select-outline-container{left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;width:100%;height:100%}:host(.select-fill-outline) .select-outline-start,:host(.select-fill-outline) .select-outline-end{pointer-events:none}:host(.select-fill-outline) .select-outline-start,:host(.select-fill-outline) .select-outline-notch,:host(.select-fill-outline) .select-outline-end{border-top:var(--border-width) var(--border-style) var(--border-color);border-bottom:var(--border-width) var(--border-style) var(--border-color);-webkit-box-sizing:border-box;box-sizing:border-box}:host(.select-fill-outline) .select-outline-notch{max-width:calc(100% - var(--padding-start) - var(--padding-end))}:host(.select-fill-outline) .notch-spacer{-webkit-padding-end:8px;padding-inline-end:8px;font-size:calc(1em * 0.75);opacity:0;pointer-events:none}:host(.select-fill-outline) .select-outline-start{-webkit-border-start:var(--border-width) var(--border-style) var(--border-color);border-inline-start:var(--border-width) var(--border-style) var(--border-color)}:host(.select-fill-outline) .select-outline-start{border-start-start-radius:var(--border-radius);border-start-end-radius:0px;border-end-end-radius:0px;border-end-start-radius:var(--border-radius)}:host(.select-fill-outline) .select-outline-start{width:calc(var(--padding-start) - 4px)}:host(.select-fill-outline) .select-outline-end{-webkit-border-end:var(--border-width) var(--border-style) var(--border-color);border-inline-end:var(--border-width) var(--border-style) var(--border-color)}:host(.select-fill-outline) .select-outline-end{border-start-start-radius:0px;border-start-end-radius:var(--border-radius);border-end-end-radius:var(--border-radius);border-end-start-radius:0px}:host(.select-fill-outline) .select-outline-end{-ms-flex-positive:1;flex-grow:1}:host(.label-floating.select-fill-outline) .select-outline-notch{border-top:none}:host(.in-item.select-expanded.select-fill-outline) .select-wrapper .select-icon,:host(.in-item.has-focus.select-fill-outline) .select-wrapper .select-icon,:host(.in-item.has-focus.ion-valid.select-fill-outline) .select-wrapper .select-icon,:host(.in-item.ion-touched.ion-invalid.select-fill-outline) .select-wrapper .select-icon{color:var(--highlight-color)}:host{--border-width:1px;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));--highlight-height:2px}:host(.select-label-placement-floating.select-expanded) .label-text-wrapper,:host(.select-label-placement-floating.has-focus) .label-text-wrapper,:host(.select-label-placement-stacked.select-expanded) .label-text-wrapper,:host(.select-label-placement-stacked.has-focus) .label-text-wrapper{color:var(--highlight-color)}:host(.has-focus.select-label-placement-floating.ion-valid) .label-text-wrapper,:host(.select-label-placement-floating.ion-touched.ion-invalid) .label-text-wrapper,:host(.has-focus.select-label-placement-stacked.ion-valid) .label-text-wrapper,:host(.select-label-placement-stacked.ion-touched.ion-invalid) .label-text-wrapper{color:var(--highlight-color)}.select-highlight{bottom:-1px;position:absolute;width:100%;height:var(--highlight-height);-webkit-transform:scale(0);transform:scale(0);-webkit-transition:-webkit-transform 200ms;transition:-webkit-transform 200ms;transition:transform 200ms;transition:transform 200ms, -webkit-transform 200ms;background:var(--highlight-color)}.select-highlight{inset-inline-start:0}:host(.select-expanded) .select-highlight,:host(.has-focus) .select-highlight{-webkit-transform:scale(1);transform:scale(1)}:host(.in-item) .select-highlight{bottom:0}:host(.in-item) .select-highlight{inset-inline-start:0}.select-icon{width:0.8125rem;-webkit-transition:-webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);transition:transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);transition:transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);color:var(--ion-color-step-500, var(--ion-text-color-step-500, gray))}:host(.select-expanded:not(.has-expanded-icon)) .select-icon{-webkit-transform:rotate(180deg);transform:rotate(180deg)}:host(.in-item.select-expanded) .select-wrapper .select-icon,:host(.in-item.has-focus) .select-wrapper .select-icon,:host(.in-item.has-focus.ion-valid) .select-wrapper .select-icon,:host(.in-item.ion-touched.ion-invalid) .select-wrapper .select-icon{color:var(--ion-color-step-500, var(--ion-text-color-step-500, gray))}:host(.select-expanded) .select-wrapper .select-icon,:host(.has-focus.ion-valid) .select-wrapper .select-icon,:host(.ion-touched.ion-invalid) .select-wrapper .select-icon,:host(.has-focus) .select-wrapper .select-icon{color:var(--highlight-color)}:host(.select-shape-round){--border-radius:16px}:host(.select-label-placement-stacked) .select-wrapper-inner,:host(.select-label-placement-floating) .select-wrapper-inner{width:calc(100% - 0.8125rem - 4px)}:host(.select-disabled){opacity:0.38}::slotted(ion-button[slot=start].button-has-icon-only),::slotted(ion-button[slot=end].button-has-icon-only){--border-radius:50%;--padding-start:8px;--padding-end:8px;--padding-top:8px;--padding-bottom:8px;aspect-ratio:1;min-height:40px}";
- var IonSelectMdStyle0 = selectMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot label - The label text to associate with the select. Use the `labelPlacement` property to control where the label is placed relative to the select. Use this if you need to render a label with custom HTML.
- * @slot start - Content to display at the leading edge of the select.
- * @slot end - Content to display at the trailing edge of the select.
- *
- * @part placeholder - The text displayed in the select when there is no value.
- * @part text - The displayed value of the select.
- * @part icon - The select icon container.
- * @part container - The container for the selected text or placeholder.
- * @part label - The label text describing the select.
- * @part supporting-text - Supporting text displayed beneath the select.
- * @part helper-text - Supporting text displayed beneath the select when the select is valid.
- * @part error-text - Supporting text displayed beneath the select when the select is invalid and touched.
- */
- class Select {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionCancel = createEvent(this, "ionCancel", 7);
- this.ionDismiss = createEvent(this, "ionDismiss", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.ionStyle = createEvent(this, "ionStyle", 7);
- this.inputId = `ion-sel-${selectIds++}`;
- this.helperTextId = `${this.inputId}-helper-text`;
- this.errorTextId = `${this.inputId}-error-text`;
- this.inheritedAttributes = {};
- this.onClick = (ev) => {
- const target = ev.target;
- const closestSlot = target.closest('[slot="start"], [slot="end"]');
- if (target === this.el || closestSlot === null) {
- this.setFocus();
- this.open(ev);
- }
- else {
- /**
- * Prevent clicks to the start/end slots from opening the select.
- * We ensure the target isn't this element in case the select is slotted
- * in, for example, an item. This would prevent the select from ever
- * being opened since the element itself has slot="start"/"end".
- *
- * Clicking a slotted element also causes a click
- * on the <label> element (since it wraps the slots).
- * Clicking <label> dispatches another click event on
- * the native form control that then bubbles up to this
- * listener. This additional event targets the host
- * element, so the select overlay is opened.
- *
- * When the slotted elements are clicked (and therefore
- * the ancestor <label> element) we want to prevent the label
- * from dispatching another click event.
- *
- * Do not call stopPropagation() because this will cause
- * click handlers on the slotted elements to never fire in React.
- * When developers do onClick in React a native "click" listener
- * is added on the root element, not the slotted element. When that
- * native click listener fires, React then dispatches the synthetic
- * click event on the slotted element. However, if stopPropagation
- * is called then the native click event will never bubble up
- * to the root element.
- */
- ev.preventDefault();
- }
- };
- this.onFocus = () => {
- this.hasFocus = true;
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.hasFocus = false;
- this.ionBlur.emit();
- };
- /**
- * Stops propagation when the label is clicked,
- * otherwise, two clicks will be triggered.
- */
- this.onLabelClick = (ev) => {
- // Only stop propagation if the click was directly on the label
- // and not on the input or other child elements
- if (ev.target === ev.currentTarget) {
- ev.stopPropagation();
- }
- };
- this.isExpanded = false;
- this.hasFocus = false;
- this.cancelText = 'Cancel';
- this.color = undefined;
- this.compareWith = undefined;
- this.disabled = false;
- this.fill = undefined;
- this.errorText = undefined;
- this.helperText = undefined;
- this.interface = 'alert';
- this.interfaceOptions = {};
- this.justify = undefined;
- this.label = undefined;
- this.labelPlacement = 'start';
- this.multiple = false;
- this.name = this.inputId;
- this.okText = 'OK';
- this.placeholder = undefined;
- this.selectedText = undefined;
- this.toggleIcon = undefined;
- this.expandedIcon = undefined;
- this.shape = undefined;
- this.value = undefined;
- this.required = false;
- }
- styleChanged() {
- this.emitStyle();
- }
- setValue(value) {
- this.value = value;
- this.ionChange.emit({ value });
- }
- async connectedCallback() {
- const { el } = this;
- this.notchController = createNotchController(el, () => this.notchSpacerEl, () => this.labelSlot);
- this.updateOverlayOptions();
- this.emitStyle();
- this.mutationO = watchForOptions(this.el, 'ion-select-option', async () => {
- this.updateOverlayOptions();
- });
- }
- componentWillLoad() {
- this.inheritedAttributes = inheritAttributes$1(this.el, ['aria-label']);
- }
- componentDidLoad() {
- /**
- * If any of the conditions that trigger the styleChanged callback
- * are met on component load, it is possible the event emitted
- * prior to a parent web component registering an event listener.
- *
- * To ensure the parent web component receives the event, we
- * emit the style event again after the component has loaded.
- *
- * This is often seen in Angular with the `dist` output target.
- */
- this.emitStyle();
- }
- disconnectedCallback() {
- if (this.mutationO) {
- this.mutationO.disconnect();
- this.mutationO = undefined;
- }
- if (this.notchController) {
- this.notchController.destroy();
- this.notchController = undefined;
- }
- }
- /**
- * Open the select overlay. The overlay is either an alert, action sheet, or popover,
- * depending on the `interface` property on the `ion-select`.
- *
- * @param event The user interface event that called the open.
- */
- async open(event) {
- if (this.disabled || this.isExpanded) {
- return undefined;
- }
- this.isExpanded = true;
- const overlay = (this.overlay = await this.createOverlay(event));
- // Add logic to scroll selected item into view before presenting
- const scrollSelectedIntoView = () => {
- const indexOfSelected = this.childOpts.findIndex((o) => o.value === this.value);
- if (indexOfSelected > -1) {
- const selectedItem = overlay.querySelector(`.select-interface-option:nth-child(${indexOfSelected + 1})`);
- if (selectedItem) {
- /**
- * Browsers such as Firefox do not
- * correctly delegate focus when manually
- * focusing an element with delegatesFocus.
- * We work around this by manually focusing
- * the interactive element.
- * ion-radio and ion-checkbox are the only
- * elements that ion-select-popover uses, so
- * we only need to worry about those two components
- * when focusing.
- */
- const interactiveEl = selectedItem.querySelector('ion-radio, ion-checkbox');
- if (interactiveEl) {
- selectedItem.scrollIntoView({ block: 'nearest' });
- // Needs to be called before `focusVisibleElement` to prevent issue with focus event bubbling
- // and removing `ion-focused` style
- interactiveEl.setFocus();
- }
- focusVisibleElement(selectedItem);
- }
- }
- else {
- /**
- * If no value is set then focus the first enabled option.
- */
- const firstEnabledOption = overlay.querySelector('ion-radio:not(.radio-disabled), ion-checkbox:not(.checkbox-disabled)');
- if (firstEnabledOption) {
- /**
- * Focus the option for the same reason as we do above.
- *
- * Needs to be called before `focusVisibleElement` to prevent issue with focus event bubbling
- * and removing `ion-focused` style
- */
- firstEnabledOption.setFocus();
- focusVisibleElement(firstEnabledOption.closest('ion-item'));
- }
- }
- };
- // For modals and popovers, we can scroll before they're visible
- if (this.interface === 'modal') {
- overlay.addEventListener('ionModalWillPresent', scrollSelectedIntoView, { once: true });
- }
- else if (this.interface === 'popover') {
- overlay.addEventListener('ionPopoverWillPresent', scrollSelectedIntoView, { once: true });
- }
- else {
- /**
- * For alerts and action sheets, we need to wait a frame after willPresent
- * because these overlays don't have their content in the DOM immediately
- * when willPresent fires. By waiting a frame, we ensure the content is
- * rendered and can be properly scrolled into view.
- */
- const scrollAfterRender = () => {
- requestAnimationFrame(() => {
- scrollSelectedIntoView();
- });
- };
- if (this.interface === 'alert') {
- overlay.addEventListener('ionAlertWillPresent', scrollAfterRender, { once: true });
- }
- else if (this.interface === 'action-sheet') {
- overlay.addEventListener('ionActionSheetWillPresent', scrollAfterRender, { once: true });
- }
- }
- overlay.onDidDismiss().then(() => {
- this.overlay = undefined;
- this.isExpanded = false;
- this.ionDismiss.emit();
- this.setFocus();
- });
- await overlay.present();
- return overlay;
- }
- createOverlay(ev) {
- let selectInterface = this.interface;
- if (selectInterface === 'action-sheet' && this.multiple) {
- printIonWarning(`[ion-select] - Interface cannot be "${selectInterface}" with a multi-value select. Using the "alert" interface instead.`);
- selectInterface = 'alert';
- }
- if (selectInterface === 'popover' && !ev) {
- printIonWarning(`[ion-select] - Interface cannot be a "${selectInterface}" without passing an event. Using the "alert" interface instead.`);
- selectInterface = 'alert';
- }
- if (selectInterface === 'action-sheet') {
- return this.openActionSheet();
- }
- if (selectInterface === 'popover') {
- return this.openPopover(ev);
- }
- if (selectInterface === 'modal') {
- return this.openModal();
- }
- return this.openAlert();
- }
- updateOverlayOptions() {
- const overlay = this.overlay;
- if (!overlay) {
- return;
- }
- const childOpts = this.childOpts;
- const value = this.value;
- switch (this.interface) {
- case 'action-sheet':
- overlay.buttons = this.createActionSheetButtons(childOpts, value);
- break;
- case 'popover':
- const popover = overlay.querySelector('ion-select-popover');
- if (popover) {
- popover.options = this.createOverlaySelectOptions(childOpts, value);
- }
- break;
- case 'modal':
- const modal = overlay.querySelector('ion-select-modal');
- if (modal) {
- modal.options = this.createOverlaySelectOptions(childOpts, value);
- }
- break;
- case 'alert':
- const inputType = this.multiple ? 'checkbox' : 'radio';
- overlay.inputs = this.createAlertInputs(childOpts, inputType, value);
- break;
- }
- }
- createActionSheetButtons(data, selectValue) {
- const actionSheetButtons = data.map((option) => {
- const value = getOptionValue(option);
- // Remove hydrated before copying over classes
- const copyClasses = Array.from(option.classList)
- .filter((cls) => cls !== 'hydrated')
- .join(' ');
- const optClass = `${OPTION_CLASS} ${copyClasses}`;
- return {
- role: isOptionSelected(selectValue, value, this.compareWith) ? 'selected' : '',
- text: option.textContent,
- cssClass: optClass,
- handler: () => {
- this.setValue(value);
- },
- };
- });
- // Add "cancel" button
- actionSheetButtons.push({
- text: this.cancelText,
- role: 'cancel',
- handler: () => {
- this.ionCancel.emit();
- },
- });
- return actionSheetButtons;
- }
- createAlertInputs(data, inputType, selectValue) {
- const alertInputs = data.map((option) => {
- const value = getOptionValue(option);
- // Remove hydrated before copying over classes
- const copyClasses = Array.from(option.classList)
- .filter((cls) => cls !== 'hydrated')
- .join(' ');
- const optClass = `${OPTION_CLASS} ${copyClasses}`;
- return {
- type: inputType,
- cssClass: optClass,
- label: option.textContent || '',
- value,
- checked: isOptionSelected(selectValue, value, this.compareWith),
- disabled: option.disabled,
- };
- });
- return alertInputs;
- }
- createOverlaySelectOptions(data, selectValue) {
- const popoverOptions = data.map((option) => {
- const value = getOptionValue(option);
- // Remove hydrated before copying over classes
- const copyClasses = Array.from(option.classList)
- .filter((cls) => cls !== 'hydrated')
- .join(' ');
- const optClass = `${OPTION_CLASS} ${copyClasses}`;
- return {
- text: option.textContent || '',
- cssClass: optClass,
- value,
- checked: isOptionSelected(selectValue, value, this.compareWith),
- disabled: option.disabled,
- handler: (selected) => {
- this.setValue(selected);
- if (!this.multiple) {
- this.close();
- }
- },
- };
- });
- return popoverOptions;
- }
- async openPopover(ev) {
- const { fill, labelPlacement } = this;
- const interfaceOptions = this.interfaceOptions;
- const mode = getIonMode$1(this);
- const showBackdrop = mode === 'md' ? false : true;
- const multiple = this.multiple;
- const value = this.value;
- let event = ev;
- let size = 'auto';
- const hasFloatingOrStackedLabel = labelPlacement === 'floating' || labelPlacement === 'stacked';
- /**
- * The popover should take up the full width
- * when using a fill in MD mode or if the
- * label is floating/stacked.
- */
- if (hasFloatingOrStackedLabel || (mode === 'md' && fill !== undefined)) {
- size = 'cover';
- /**
- * Otherwise the popover
- * should be positioned relative
- * to the native element.
- */
- }
- else {
- event = Object.assign(Object.assign({}, ev), { detail: {
- ionShadowTarget: this.nativeWrapperEl,
- } });
- }
- const popoverOpts = Object.assign(Object.assign({ mode,
- event, alignment: 'center', size,
- showBackdrop }, interfaceOptions), { component: 'ion-select-popover', cssClass: ['select-popover', interfaceOptions.cssClass], componentProps: {
- header: interfaceOptions.header,
- subHeader: interfaceOptions.subHeader,
- message: interfaceOptions.message,
- multiple,
- value,
- options: this.createOverlaySelectOptions(this.childOpts, value),
- } });
- return popoverController.create(popoverOpts);
- }
- async openActionSheet() {
- const mode = getIonMode$1(this);
- const interfaceOptions = this.interfaceOptions;
- const actionSheetOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { buttons: this.createActionSheetButtons(this.childOpts, this.value), cssClass: ['select-action-sheet', interfaceOptions.cssClass] });
- return actionSheetController.create(actionSheetOpts);
- }
- async openAlert() {
- const interfaceOptions = this.interfaceOptions;
- const inputType = this.multiple ? 'checkbox' : 'radio';
- const mode = getIonMode$1(this);
- const alertOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { header: interfaceOptions.header ? interfaceOptions.header : this.labelText, inputs: this.createAlertInputs(this.childOpts, inputType, this.value), buttons: [
- {
- text: this.cancelText,
- role: 'cancel',
- handler: () => {
- this.ionCancel.emit();
- },
- },
- {
- text: this.okText,
- handler: (selectedValues) => {
- this.setValue(selectedValues);
- },
- },
- ], cssClass: [
- 'select-alert',
- interfaceOptions.cssClass,
- this.multiple ? 'multiple-select-alert' : 'single-select-alert',
- ] });
- return alertController.create(alertOpts);
- }
- openModal() {
- const { multiple, value, interfaceOptions } = this;
- const mode = getIonMode$1(this);
- const modalOpts = Object.assign(Object.assign({}, interfaceOptions), { mode, cssClass: ['select-modal', interfaceOptions.cssClass], component: 'ion-select-modal', componentProps: {
- header: interfaceOptions.header,
- multiple,
- value,
- options: this.createOverlaySelectOptions(this.childOpts, value),
- } });
- return modalController.create(modalOpts);
- }
- /**
- * Close the select interface.
- */
- close() {
- if (!this.overlay) {
- return Promise.resolve(false);
- }
- return this.overlay.dismiss();
- }
- hasValue() {
- return this.getText() !== '';
- }
- get childOpts() {
- return Array.from(this.el.querySelectorAll('ion-select-option'));
- }
- /**
- * Returns any plaintext associated with
- * the label (either prop or slot).
- * Note: This will not return any custom
- * HTML. Use the `hasLabel` getter if you
- * want to know if any slotted label content
- * was passed.
- */
- get labelText() {
- const { label } = this;
- if (label !== undefined) {
- return label;
- }
- const { labelSlot } = this;
- if (labelSlot !== null) {
- return labelSlot.textContent;
- }
- return;
- }
- getText() {
- const selectedText = this.selectedText;
- if (selectedText != null && selectedText !== '') {
- return selectedText;
- }
- return generateText(this.childOpts, this.value, this.compareWith);
- }
- setFocus() {
- if (this.focusEl) {
- this.focusEl.focus();
- }
- }
- emitStyle() {
- const { disabled } = this;
- const style = {
- 'interactive-disabled': disabled,
- };
- this.ionStyle.emit(style);
- }
- renderLabel() {
- const { label } = this;
- return (hAsync("div", { class: {
- 'label-text-wrapper': true,
- 'label-text-wrapper-hidden': !this.hasLabel,
- }, part: "label" }, label === undefined ? hAsync("slot", { name: "label" }) : hAsync("div", { class: "label-text" }, label)));
- }
- componentDidRender() {
- var _a;
- (_a = this.notchController) === null || _a === void 0 ? void 0 : _a.calculateNotchWidth();
- }
- /**
- * Gets any content passed into the `label` slot,
- * not the <slot> definition.
- */
- get labelSlot() {
- return this.el.querySelector('[slot="label"]');
- }
- /**
- * Returns `true` if label content is provided
- * either by a prop or a content. If you want
- * to get the plaintext value of the label use
- * the `labelText` getter instead.
- */
- get hasLabel() {
- return this.label !== undefined || this.labelSlot !== null;
- }
- /**
- * Renders the border container
- * when fill="outline".
- */
- renderLabelContainer() {
- const mode = getIonMode$1(this);
- const hasOutlineFill = mode === 'md' && this.fill === 'outline';
- if (hasOutlineFill) {
- /**
- * The outline fill has a special outline
- * that appears around the select and the label.
- * Certain stacked and floating label placements cause the
- * label to translate up and create a "cut out"
- * inside of that border by using the notch-spacer element.
- */
- return [
- hAsync("div", { class: "select-outline-container" }, hAsync("div", { class: "select-outline-start" }), hAsync("div", { class: {
- 'select-outline-notch': true,
- 'select-outline-notch-hidden': !this.hasLabel,
- } }, hAsync("div", { class: "notch-spacer", "aria-hidden": "true", ref: (el) => (this.notchSpacerEl = el) }, this.label)), hAsync("div", { class: "select-outline-end" })),
- this.renderLabel(),
- ];
- }
- /**
- * If not using the outline style,
- * we can render just the label.
- */
- return this.renderLabel();
- }
- /**
- * Renders either the placeholder
- * or the selected values based on
- * the state of the select.
- */
- renderSelectText() {
- const { placeholder } = this;
- const displayValue = this.getText();
- let addPlaceholderClass = false;
- let selectText = displayValue;
- if (selectText === '' && placeholder !== undefined) {
- selectText = placeholder;
- addPlaceholderClass = true;
- }
- const selectTextClasses = {
- 'select-text': true,
- 'select-placeholder': addPlaceholderClass,
- };
- const textPart = addPlaceholderClass ? 'placeholder' : 'text';
- return (hAsync("div", { "aria-hidden": "true", class: selectTextClasses, part: textPart }, selectText));
- }
- /**
- * Renders the chevron icon
- * next to the select text.
- */
- renderSelectIcon() {
- const mode = getIonMode$1(this);
- const { isExpanded, toggleIcon, expandedIcon } = this;
- let icon;
- if (isExpanded && expandedIcon !== undefined) {
- icon = expandedIcon;
- }
- else {
- const defaultIcon = mode === 'ios' ? chevronExpand : caretDownSharp;
- icon = toggleIcon !== null && toggleIcon !== void 0 ? toggleIcon : defaultIcon;
- }
- return hAsync("ion-icon", { class: "select-icon", part: "icon", "aria-hidden": "true", icon: icon });
- }
- get ariaLabel() {
- var _a;
- const { placeholder, inheritedAttributes } = this;
- const displayValue = this.getText();
- // The aria label should be preferred over visible text if both are specified
- const definedLabel = (_a = inheritedAttributes['aria-label']) !== null && _a !== void 0 ? _a : this.labelText;
- /**
- * If developer has specified a placeholder
- * and there is nothing selected, the selectText
- * should have the placeholder value.
- */
- let renderedLabel = displayValue;
- if (renderedLabel === '' && placeholder !== undefined) {
- renderedLabel = placeholder;
- }
- /**
- * If there is a developer-defined label,
- * then we need to concatenate the developer label
- * string with the current current value.
- * The label for the control should be read
- * before the values of the control.
- */
- if (definedLabel !== undefined) {
- renderedLabel = renderedLabel === '' ? definedLabel : `${definedLabel}, ${renderedLabel}`;
- }
- return renderedLabel;
- }
- renderListbox() {
- const { disabled, inputId, isExpanded, required } = this;
- return (hAsync("button", { disabled: disabled, id: inputId, "aria-label": this.ariaLabel, "aria-haspopup": "dialog", "aria-expanded": `${isExpanded}`, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === this.errorTextId, "aria-required": `${required}`, onFocus: this.onFocus, onBlur: this.onBlur, ref: (focusEl) => (this.focusEl = focusEl) }));
- }
- getHintTextID() {
- const { el, helperText, errorText, helperTextId, errorTextId } = this;
- if (el.classList.contains('ion-touched') && el.classList.contains('ion-invalid') && errorText) {
- return errorTextId;
- }
- if (helperText) {
- return helperTextId;
- }
- return undefined;
- }
- /**
- * Renders the helper text or error text values
- */
- renderHintText() {
- const { helperText, errorText, helperTextId, errorTextId } = this;
- return [
- hAsync("div", { id: helperTextId, class: "helper-text", part: "supporting-text helper-text" }, helperText),
- hAsync("div", { id: errorTextId, class: "error-text", part: "supporting-text error-text" }, errorText),
- ];
- }
- /**
- * Responsible for rendering helper text, and error text. This element
- * should only be rendered if hint text is set.
- */
- renderBottomContent() {
- const { helperText, errorText } = this;
- /**
- * undefined and empty string values should
- * be treated as not having helper/error text.
- */
- const hasHintText = !!helperText || !!errorText;
- if (!hasHintText) {
- return;
- }
- return hAsync("div", { class: "select-bottom" }, this.renderHintText());
- }
- render() {
- const { disabled, el, isExpanded, expandedIcon, labelPlacement, justify, placeholder, fill, shape, name, value, hasFocus, } = this;
- const mode = getIonMode$1(this);
- const hasFloatingOrStackedLabel = labelPlacement === 'floating' || labelPlacement === 'stacked';
- const justifyEnabled = !hasFloatingOrStackedLabel && justify !== undefined;
- const rtl = isRTL$1(el) ? 'rtl' : 'ltr';
- const inItem = hostContext('ion-item', this.el);
- const shouldRenderHighlight = mode === 'md' && fill !== 'outline' && !inItem;
- const hasValue = this.hasValue();
- const hasStartEndSlots = el.querySelector('[slot="start"], [slot="end"]') !== null;
- renderHiddenInput(true, el, name, parseValue(value), disabled);
- /**
- * If the label is stacked, it should always sit above the select.
- * For floating labels, the label should move above the select if
- * the select has a value, is open, or has anything in either
- * the start or end slot.
- *
- * If there is content in the start slot, the label would overlap
- * it if not forced to float. This is also applied to the end slot
- * because with the default or solid fills, the select is not
- * vertically centered in the container, but the label is. This
- * causes the slots and label to appear vertically offset from each
- * other when the label isn't floating above the input. This doesn't
- * apply to the outline fill, but this was not accounted for to keep
- * things consistent.
- *
- * TODO(FW-5592): Remove hasStartEndSlots condition
- */
- const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || isExpanded || hasStartEndSlots));
- return (hAsync(Host, { key: '6dd3c92dc3c587960d767c7dd1c142fc20bef8ed', onClick: this.onClick, class: createColorClasses$1(this.color, {
- [mode]: true,
- 'in-item': inItem,
- 'in-item-color': hostContext('ion-item.ion-color', el),
- 'select-disabled': disabled,
- 'select-expanded': isExpanded,
- 'has-expanded-icon': expandedIcon !== undefined,
- 'has-value': hasValue,
- 'label-floating': labelShouldFloat,
- 'has-placeholder': placeholder !== undefined,
- 'has-focus': hasFocus,
- // TODO(FW-6451): Remove `ion-focusable` class in favor of `has-focus`.
- 'ion-focusable': true,
- [`select-${rtl}`]: true,
- [`select-fill-${fill}`]: fill !== undefined,
- [`select-justify-${justify}`]: justifyEnabled,
- [`select-shape-${shape}`]: shape !== undefined,
- [`select-label-placement-${labelPlacement}`]: true,
- }) }, hAsync("label", { key: 'bc80ee471debb20b33d1cf55f55932b621f1744a', class: "select-wrapper", id: "select-label", onClick: this.onLabelClick }, this.renderLabelContainer(), hAsync("div", { key: 'deea85c3a3769e90af0933c522028148ee5781a3', class: "select-wrapper-inner" }, hAsync("slot", { key: 'af8192f4d8d5426b39a00ef2ed96f3c4a9e12908', name: "start" }), hAsync("div", { key: '6c278fc6c56b18e26cae930d375aa1da05af135b', class: "native-wrapper", ref: (el) => (this.nativeWrapperEl = el), part: "container" }, this.renderSelectText(), this.renderListbox()), hAsync("slot", { key: 'c459d54471029872b8b3e63f7dfb6bdb869b4942', name: "end" }), !hasFloatingOrStackedLabel && this.renderSelectIcon()), hasFloatingOrStackedLabel && this.renderSelectIcon(), shouldRenderHighlight && hAsync("div", { key: '718960718fa91163dd4412e1865f476fef089127', class: "select-highlight" })), this.renderBottomContent()));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["styleChanged"],
- "isExpanded": ["styleChanged"],
- "placeholder": ["styleChanged"],
- "value": ["styleChanged"]
- }; }
- static get style() { return {
- ios: IonSelectIosStyle0,
- md: IonSelectMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-select",
- "$members$": {
- "cancelText": [1, "cancel-text"],
- "color": [513],
- "compareWith": [1, "compare-with"],
- "disabled": [4],
- "fill": [1],
- "errorText": [1, "error-text"],
- "helperText": [1, "helper-text"],
- "interface": [1],
- "interfaceOptions": [8, "interface-options"],
- "justify": [1],
- "label": [1],
- "labelPlacement": [1, "label-placement"],
- "multiple": [4],
- "name": [1],
- "okText": [1, "ok-text"],
- "placeholder": [1],
- "selectedText": [1, "selected-text"],
- "toggleIcon": [1, "toggle-icon"],
- "expandedIcon": [1, "expanded-icon"],
- "shape": [1],
- "value": [1032],
- "required": [4],
- "isExpanded": [32],
- "hasFocus": [32],
- "open": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const getOptionValue = (el) => {
- const value = el.value;
- return value === undefined ? el.textContent || '' : value;
- };
- const parseValue = (value) => {
- if (value == null) {
- return undefined;
- }
- if (Array.isArray(value)) {
- return value.join(',');
- }
- return value.toString();
- };
- const generateText = (opts, value, compareWith) => {
- if (value === undefined) {
- return '';
- }
- if (Array.isArray(value)) {
- return value
- .map((v) => textForValue(opts, v, compareWith))
- .filter((opt) => opt !== null)
- .join(', ');
- }
- else {
- return textForValue(opts, value, compareWith) || '';
- }
- };
- const textForValue = (opts, value, compareWith) => {
- const selectOpt = opts.find((opt) => {
- return compareOptions(value, getOptionValue(opt), compareWith);
- });
- return selectOpt ? selectOpt.textContent : null;
- };
- let selectIds = 0;
- const OPTION_CLASS = 'select-interface-option';
- const ionicSelectModalMdCss = ".sc-ion-select-modal-ionic-h{height:100%}ion-list.sc-ion-select-modal-ionic ion-radio.sc-ion-select-modal-ionic::part(container){display:none}ion-list.sc-ion-select-modal-ionic ion-radio.sc-ion-select-modal-ionic::part(label){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-item.sc-ion-select-modal-ionic{--inner-border-width:0}.item-radio-checked.sc-ion-select-modal-ionic{--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08);--background-focused:var(--ion-color-primary, #0054e9);--background-focused-opacity:0.2;--background-hover:var(--ion-color-primary, #0054e9);--background-hover-opacity:0.12}.item-checkbox-checked.sc-ion-select-modal-ionic{--background-activated:var(--ion-item-color, var(--ion-text-color, #000));--background-focused:var(--ion-item-color, var(--ion-text-color, #000));--background-hover:var(--ion-item-color, var(--ion-text-color, #000));--color:var(--ion-color-primary, #0054e9)}";
- var IonSelectModalIonicStyle0 = ionicSelectModalMdCss;
- const selectModalIosCss = ".sc-ion-select-modal-ios-h{height:100%}ion-item.sc-ion-select-modal-ios{--inner-padding-end:0}ion-radio.sc-ion-select-modal-ios::after{bottom:0;position:absolute;width:calc(100% - 0.9375rem - 16px);border-width:0px 0px 0.55px 0px;border-style:solid;border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));content:\"\"}ion-radio.sc-ion-select-modal-ios::after{inset-inline-start:calc(0.9375rem + 16px)}";
- var IonSelectModalIosStyle0 = selectModalIosCss;
- const selectModalMdCss = ".sc-ion-select-modal-md-h{height:100%}ion-list.sc-ion-select-modal-md ion-radio.sc-ion-select-modal-md::part(container){display:none}ion-list.sc-ion-select-modal-md ion-radio.sc-ion-select-modal-md::part(label){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-item.sc-ion-select-modal-md{--inner-border-width:0}.item-radio-checked.sc-ion-select-modal-md{--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08);--background-focused:var(--ion-color-primary, #0054e9);--background-focused-opacity:0.2;--background-hover:var(--ion-color-primary, #0054e9);--background-hover-opacity:0.12}.item-checkbox-checked.sc-ion-select-modal-md{--background-activated:var(--ion-item-color, var(--ion-text-color, #000));--background-focused:var(--ion-item-color, var(--ion-text-color, #000));--background-hover:var(--ion-item-color, var(--ion-text-color, #000));--color:var(--ion-color-primary, #0054e9)}";
- var IonSelectModalMdStyle0 = selectModalMdCss;
- class SelectModal {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.header = undefined;
- this.multiple = undefined;
- this.options = [];
- }
- closeModal() {
- const modal = this.el.closest('ion-modal');
- if (modal) {
- modal.dismiss();
- }
- }
- findOptionFromEvent(ev) {
- const { options } = this;
- return options.find((o) => o.value === ev.target.value);
- }
- getValues(ev) {
- const { multiple, options } = this;
- if (multiple) {
- // this is a modal with checkboxes (multiple value select)
- // return an array of all the checked values
- return options.filter((o) => o.checked).map((o) => o.value);
- }
- // this is a modal with radio buttons (single value select)
- // return the value that was clicked, otherwise undefined
- const option = ev ? this.findOptionFromEvent(ev) : null;
- return option ? option.value : undefined;
- }
- callOptionHandler(ev) {
- const option = this.findOptionFromEvent(ev);
- const values = this.getValues(ev);
- if (option === null || option === void 0 ? void 0 : option.handler) {
- safeCall(option.handler, values);
- }
- }
- setChecked(ev) {
- const { multiple } = this;
- const option = this.findOptionFromEvent(ev);
- // this is a modal with checkboxes (multiple value select)
- // we need to set the checked value for this option
- if (multiple && option) {
- option.checked = ev.detail.checked;
- }
- }
- renderRadioOptions() {
- const checked = this.options.filter((o) => o.checked).map((o) => o.value)[0];
- return (hAsync("ion-radio-group", { value: checked, onIonChange: (ev) => this.callOptionHandler(ev) }, this.options.map((option) => (hAsync("ion-item", { lines: "none", class: Object.assign({
- // TODO FW-4784
- 'item-radio-checked': option.value === checked
- }, getClassMap(option.cssClass)) }, hAsync("ion-radio", { value: option.value, disabled: option.disabled, justify: "start", labelPlacement: "end", onClick: () => this.closeModal(), onKeyUp: (ev) => {
- if (ev.key === ' ') {
- /**
- * Selecting a radio option with keyboard navigation,
- * either through the Enter or Space keys, should
- * dismiss the modal.
- */
- this.closeModal();
- }
- } }, option.text))))));
- }
- renderCheckboxOptions() {
- return this.options.map((option) => (hAsync("ion-item", { class: Object.assign({
- // TODO FW-4784
- 'item-checkbox-checked': option.checked
- }, getClassMap(option.cssClass)) }, hAsync("ion-checkbox", { value: option.value, disabled: option.disabled, checked: option.checked, justify: "start", labelPlacement: "end", onIonChange: (ev) => {
- this.setChecked(ev);
- this.callOptionHandler(ev);
- } }, option.text))));
- }
- render() {
- return (hAsync(Host, { key: '885198a9f21884e3bfb9bf0af53e0ee3ae37b231', class: getIonMode$1(this) }, hAsync("ion-header", { key: 'd8b63726869747ac711e4fda78a50ce46f72970c' }, hAsync("ion-toolbar", { key: '9ab2a4c1480dd74eeae38d7b580a2e87fb71270e' }, this.header !== undefined && hAsync("ion-title", { key: '87a7034385ef57f55cefdd0371dbb66a64827290' }, this.header), hAsync("ion-buttons", { key: '0a35424ea13ca002abc9a43b6138730254f187d0', slot: "end" }, hAsync("ion-button", { key: '238bf40b47128d9aa995d14d9ff9ebcae4f79492', onClick: () => this.closeModal() }, "Close")))), hAsync("ion-content", { key: '4a256f3381f8cabbc7194337b8ae4aa1c3ab1066' }, hAsync("ion-list", { key: 'acd38fc52024632176467ed6a84106a454021544' }, this.multiple === true ? this.renderCheckboxOptions() : this.renderRadioOptions()))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ionic: IonSelectModalIonicStyle0,
- ios: IonSelectModalIosStyle0,
- md: IonSelectModalMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 34,
- "$tagName$": "ion-select-modal",
- "$members$": {
- "header": [1],
- "multiple": [4],
- "options": [16]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const selectOptionCss = ":host{display:none}";
- var IonSelectOptionStyle0 = selectOptionCss;
- class SelectOption {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.inputId = `ion-selopt-${selectOptionIds++}`;
- this.disabled = false;
- this.value = undefined;
- }
- render() {
- return hAsync(Host, { key: '8c96c199ce3a3065de3fe446500f567236e0610a', role: "option", id: this.inputId, class: getIonMode$1(this) });
- }
- get el() { return getElement(this); }
- static get style() { return IonSelectOptionStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-select-option",
- "$members$": {
- "disabled": [4],
- "value": [8]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- let selectOptionIds = 0;
- const selectPopoverIosCss = ".sc-ion-select-popover-ios-h ion-list.sc-ion-select-popover-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list-header.sc-ion-select-popover-ios,ion-label.sc-ion-select-popover-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-select-popover-ios-h{overflow-y:auto}";
- var IonSelectPopoverIosStyle0 = selectPopoverIosCss;
- const selectPopoverMdCss = ".sc-ion-select-popover-md-h ion-list.sc-ion-select-popover-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list-header.sc-ion-select-popover-md,ion-label.sc-ion-select-popover-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-select-popover-md-h{overflow-y:auto}ion-list.sc-ion-select-popover-md ion-radio.sc-ion-select-popover-md::part(container){display:none}ion-list.sc-ion-select-popover-md ion-radio.sc-ion-select-popover-md::part(label){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-item.sc-ion-select-popover-md{--inner-border-width:0}.item-radio-checked.sc-ion-select-popover-md{--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08);--background-focused:var(--ion-color-primary, #0054e9);--background-focused-opacity:0.2;--background-hover:var(--ion-color-primary, #0054e9);--background-hover-opacity:0.12}.item-checkbox-checked.sc-ion-select-popover-md{--background-activated:var(--ion-item-color, var(--ion-text-color, #000));--background-focused:var(--ion-item-color, var(--ion-text-color, #000));--background-hover:var(--ion-item-color, var(--ion-text-color, #000));--color:var(--ion-color-primary, #0054e9)}";
- var IonSelectPopoverMdStyle0 = selectPopoverMdCss;
- /**
- * @internal
- */
- class SelectPopover {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.header = undefined;
- this.subHeader = undefined;
- this.message = undefined;
- this.multiple = undefined;
- this.options = [];
- }
- findOptionFromEvent(ev) {
- const { options } = this;
- return options.find((o) => o.value === ev.target.value);
- }
- /**
- * When an option is selected we need to get the value(s)
- * of the selected option(s) and return it in the option
- * handler
- */
- callOptionHandler(ev) {
- const option = this.findOptionFromEvent(ev);
- const values = this.getValues(ev);
- if (option === null || option === void 0 ? void 0 : option.handler) {
- safeCall(option.handler, values);
- }
- }
- /**
- * Dismisses the host popover that the `ion-select-popover`
- * is rendered within.
- */
- dismissParentPopover() {
- const popover = this.el.closest('ion-popover');
- if (popover) {
- popover.dismiss();
- }
- }
- setChecked(ev) {
- const { multiple } = this;
- const option = this.findOptionFromEvent(ev);
- // this is a popover with checkboxes (multiple value select)
- // we need to set the checked value for this option
- if (multiple && option) {
- option.checked = ev.detail.checked;
- }
- }
- getValues(ev) {
- const { multiple, options } = this;
- if (multiple) {
- // this is a popover with checkboxes (multiple value select)
- // return an array of all the checked values
- return options.filter((o) => o.checked).map((o) => o.value);
- }
- // this is a popover with radio buttons (single value select)
- // return the value that was clicked, otherwise undefined
- const option = this.findOptionFromEvent(ev);
- return option ? option.value : undefined;
- }
- renderOptions(options) {
- const { multiple } = this;
- switch (multiple) {
- case true:
- return this.renderCheckboxOptions(options);
- default:
- return this.renderRadioOptions(options);
- }
- }
- renderCheckboxOptions(options) {
- return options.map((option) => (hAsync("ion-item", { class: Object.assign({
- // TODO FW-4784
- 'item-checkbox-checked': option.checked
- }, getClassMap(option.cssClass)) }, hAsync("ion-checkbox", { value: option.value, disabled: option.disabled, checked: option.checked, justify: "start", labelPlacement: "end", onIonChange: (ev) => {
- this.setChecked(ev);
- this.callOptionHandler(ev);
- } }, option.text))));
- }
- renderRadioOptions(options) {
- const checked = options.filter((o) => o.checked).map((o) => o.value)[0];
- return (hAsync("ion-radio-group", { value: checked, onIonChange: (ev) => this.callOptionHandler(ev) }, options.map((option) => (hAsync("ion-item", { class: Object.assign({
- // TODO FW-4784
- 'item-radio-checked': option.value === checked
- }, getClassMap(option.cssClass)) }, hAsync("ion-radio", { value: option.value, disabled: option.disabled, onClick: () => this.dismissParentPopover(), onKeyUp: (ev) => {
- if (ev.key === ' ') {
- /**
- * Selecting a radio option with keyboard navigation,
- * either through the Enter or Space keys, should
- * dismiss the popover.
- */
- this.dismissParentPopover();
- }
- } }, option.text))))));
- }
- render() {
- const { header, message, options, subHeader } = this;
- const hasSubHeaderOrMessage = subHeader !== undefined || message !== undefined;
- return (hAsync(Host, { key: '542367ab8fb72bfebf7e65630b91017d68827fd6', class: getIonMode$1(this) }, hAsync("ion-list", { key: 'f2f0f37e1365cd7780b02de1a1698700d0df48a7' }, header !== undefined && hAsync("ion-list-header", { key: '4b8800a68e800f19277a44b7074ca24b70218daf' }, header), hasSubHeaderOrMessage && (hAsync("ion-item", { key: '932b7903daf97d5a57d289b7ee49e868bb9b0cf5' }, hAsync("ion-label", { key: 'fc3f1b69aa2a0bc6125d35692dcad3a8a99fd160', class: "ion-text-wrap" }, subHeader !== undefined && hAsync("h3", { key: 'eceab2f47afa95f04b138342b0bdbfa1f50919a8' }, subHeader), message !== undefined && hAsync("p", { key: '70f4e27ad1316318efd0c17efce31e5e45c8fa02' }, message)))), this.renderOptions(options))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonSelectPopoverIosStyle0,
- md: IonSelectPopoverMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 34,
- "$tagName$": "ion-select-popover",
- "$members$": {
- "header": [1],
- "subHeader": [1, "sub-header"],
- "message": [1],
- "multiple": [4],
- "options": [16]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const skeletonTextCss = ":host{--background:rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065);border-radius:var(--border-radius, inherit);display:block;width:100%;height:inherit;margin-top:4px;margin-bottom:4px;background:var(--background);line-height:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}span{display:inline-block}:host(.in-media){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;height:100%}:host(.skeleton-text-animated){position:relative;background:-webkit-gradient(linear, left top, right top, color-stop(8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065)), color-stop(18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135)), color-stop(33%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065)));background:linear-gradient(to right, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135) 18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 33%);background-size:800px 104px;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:shimmer;animation-name:shimmer;-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}@keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}";
- var IonSkeletonTextStyle0 = skeletonTextCss;
- class SkeletonText {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionStyle = createEvent(this, "ionStyle", 7);
- this.animated = false;
- }
- componentWillLoad() {
- this.emitStyle();
- }
- emitStyle() {
- // The emitted property is used by item in order
- // to add the item-skeleton-text class which applies
- // overflow: hidden to its label
- const style = {
- 'skeleton-text': true,
- };
- this.ionStyle.emit(style);
- }
- render() {
- const animated = this.animated && config.getBoolean('animated', true);
- const inMedia = hostContext('ion-avatar', this.el) || hostContext('ion-thumbnail', this.el);
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: 'c193f9a8e8efab5139544f047bdae4b6d421aa86', class: {
- [mode]: true,
- 'skeleton-text-animated': animated,
- 'in-media': inMedia,
- } }, hAsync("span", { key: 'e15db679bd3c359b4df5123efd2f92e5b380fde3' }, "\u00A0")));
- }
- get el() { return getElement(this); }
- static get style() { return IonSkeletonTextStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-skeleton-text",
- "$members$": {
- "animated": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const spinnerCss = ":host{display:inline-block;position:relative;width:28px;height:28px;color:var(--color);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.ion-color){color:var(--ion-color-base)}svg{-webkit-transform-origin:center;transform-origin:center;position:absolute;top:0;left:0;width:100%;height:100%;-webkit-transform:translateZ(0);transform:translateZ(0)}:host-context([dir=rtl]) svg{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}[dir=rtl] svg{-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}@supports selector(:dir(rtl)){svg:dir(rtl){-webkit-transform-origin:calc(100% - center);transform-origin:calc(100% - center)}}:host(.spinner-lines) line,:host(.spinner-lines-small) line{stroke-width:7px}:host(.spinner-lines-sharp) line,:host(.spinner-lines-sharp-small) line{stroke-width:4px}:host(.spinner-lines) line,:host(.spinner-lines-small) line,:host(.spinner-lines-sharp) line,:host(.spinner-lines-sharp-small) line{stroke-linecap:round;stroke:currentColor}:host(.spinner-lines) svg,:host(.spinner-lines-small) svg,:host(.spinner-lines-sharp) svg,:host(.spinner-lines-sharp-small) svg{-webkit-animation:spinner-fade-out 1s linear infinite;animation:spinner-fade-out 1s linear infinite}:host(.spinner-bubbles) svg{-webkit-animation:spinner-scale-out 1s linear infinite;animation:spinner-scale-out 1s linear infinite;fill:currentColor}:host(.spinner-circles) svg{-webkit-animation:spinner-fade-out 1s linear infinite;animation:spinner-fade-out 1s linear infinite;fill:currentColor}:host(.spinner-crescent) circle{fill:transparent;stroke-width:4px;stroke-dasharray:128px;stroke-dashoffset:82px;stroke:currentColor}:host(.spinner-crescent) svg{-webkit-animation:spinner-rotate 1s linear infinite;animation:spinner-rotate 1s linear infinite}:host(.spinner-dots) circle{stroke-width:0;fill:currentColor}:host(.spinner-dots) svg{-webkit-animation:spinner-dots 1s linear infinite;animation:spinner-dots 1s linear infinite}:host(.spinner-circular) svg{-webkit-animation:spinner-circular linear infinite;animation:spinner-circular linear infinite}:host(.spinner-circular) circle{-webkit-animation:spinner-circular-inner ease-in-out infinite;animation:spinner-circular-inner ease-in-out infinite;stroke:currentColor;stroke-dasharray:80px, 200px;stroke-dashoffset:0px;stroke-width:5.6;fill:none}:host(.spinner-paused),:host(.spinner-paused) svg,:host(.spinner-paused) circle{-webkit-animation-play-state:paused;animation-play-state:paused}@-webkit-keyframes spinner-fade-out{0%{opacity:1}100%{opacity:0}}@keyframes spinner-fade-out{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes spinner-scale-out{0%{-webkit-transform:scale(1, 1);transform:scale(1, 1)}100%{-webkit-transform:scale(0, 0);transform:scale(0, 0)}}@keyframes spinner-scale-out{0%{-webkit-transform:scale(1, 1);transform:scale(1, 1)}100%{-webkit-transform:scale(0, 0);transform:scale(0, 0)}}@-webkit-keyframes spinner-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes spinner-dots{0%{-webkit-transform:scale(1, 1);transform:scale(1, 1);opacity:0.9}50%{-webkit-transform:scale(0.4, 0.4);transform:scale(0.4, 0.4);opacity:0.3}100%{-webkit-transform:scale(1, 1);transform:scale(1, 1);opacity:0.9}}@keyframes spinner-dots{0%{-webkit-transform:scale(1, 1);transform:scale(1, 1);opacity:0.9}50%{-webkit-transform:scale(0.4, 0.4);transform:scale(0.4, 0.4);opacity:0.3}100%{-webkit-transform:scale(1, 1);transform:scale(1, 1);opacity:0.9}}@-webkit-keyframes spinner-circular{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner-circular{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes spinner-circular-inner{0%{stroke-dasharray:1px, 200px;stroke-dashoffset:0px}50%{stroke-dasharray:100px, 200px;stroke-dashoffset:-15px}100%{stroke-dasharray:100px, 200px;stroke-dashoffset:-125px}}@keyframes spinner-circular-inner{0%{stroke-dasharray:1px, 200px;stroke-dashoffset:0px}50%{stroke-dasharray:100px, 200px;stroke-dashoffset:-15px}100%{stroke-dasharray:100px, 200px;stroke-dashoffset:-125px}}";
- var IonSpinnerStyle0 = spinnerCss;
- class Spinner {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- this.duration = undefined;
- this.name = undefined;
- this.paused = false;
- }
- getName() {
- const spinnerName = this.name || config.get('spinner');
- const mode = getIonMode$1(this);
- if (spinnerName) {
- return spinnerName;
- }
- return mode === 'ios' ? 'lines' : 'circular';
- }
- render() {
- var _a;
- const self = this;
- const mode = getIonMode$1(self);
- const spinnerName = self.getName();
- const spinner = (_a = SPINNERS[spinnerName]) !== null && _a !== void 0 ? _a : SPINNERS['lines'];
- const duration = typeof self.duration === 'number' && self.duration > 10 ? self.duration : spinner.dur;
- const svgs = [];
- if (spinner.circles !== undefined) {
- for (let i = 0; i < spinner.circles; i++) {
- svgs.push(buildCircle(spinner, duration, i, spinner.circles));
- }
- }
- else if (spinner.lines !== undefined) {
- for (let i = 0; i < spinner.lines; i++) {
- svgs.push(buildLine(spinner, duration, i, spinner.lines));
- }
- }
- return (hAsync(Host, { key: 'e0dfa8a3ee2a0469eb31323f506750bd77d65797', class: createColorClasses$1(self.color, {
- [mode]: true,
- [`spinner-${spinnerName}`]: true,
- 'spinner-paused': self.paused || config.getBoolean('_testing'),
- }), role: "progressbar", style: spinner.elmDuration ? { animationDuration: duration + 'ms' } : {} }, svgs));
- }
- static get style() { return IonSpinnerStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-spinner",
- "$members$": {
- "color": [513],
- "duration": [2],
- "name": [1],
- "paused": [4]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const buildCircle = (spinner, duration, index, total) => {
- const data = spinner.fn(duration, index, total);
- data.style['animation-duration'] = duration + 'ms';
- return (hAsync("svg", { viewBox: data.viewBox || '0 0 64 64', style: data.style }, hAsync("circle", { transform: data.transform || 'translate(32,32)', cx: data.cx, cy: data.cy, r: data.r, style: spinner.elmDuration ? { animationDuration: duration + 'ms' } : {} })));
- };
- const buildLine = (spinner, duration, index, total) => {
- const data = spinner.fn(duration, index, total);
- data.style['animation-duration'] = duration + 'ms';
- return (hAsync("svg", { viewBox: data.viewBox || '0 0 64 64', style: data.style }, hAsync("line", { transform: "translate(32,32)", y1: data.y1, y2: data.y2 })));
- };
- const splitPaneIosCss = ":host{--side-width:100%;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;contain:strict}:host(.split-pane-visible) ::slotted(.split-pane-main){left:0;right:0;top:0;bottom:0;position:relative;-ms-flex:1;flex:1;-webkit-box-shadow:none;box-shadow:none;overflow:hidden;z-index:0}::slotted(.split-pane-side:not(ion-menu)){display:none}:host{--border:0.55px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));--side-min-width:270px;--side-max-width:28%}";
- var IonSplitPaneIosStyle0 = splitPaneIosCss;
- const splitPaneMdCss = ":host{--side-width:100%;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;contain:strict}:host(.split-pane-visible) ::slotted(.split-pane-main){left:0;right:0;top:0;bottom:0;position:relative;-ms-flex:1;flex:1;-webkit-box-shadow:none;box-shadow:none;overflow:hidden;z-index:0}::slotted(.split-pane-side:not(ion-menu)){display:none}:host{--border:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));--side-min-width:270px;--side-max-width:28%}";
- var IonSplitPaneMdStyle0 = splitPaneMdCss;
- const QUERY = {
- xs: '(min-width: 0px)',
- sm: '(min-width: 576px)',
- md: '(min-width: 768px)',
- lg: '(min-width: 992px)',
- xl: '(min-width: 1200px)',
- never: '',
- };
- class SplitPane {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionSplitPaneVisible = createEvent(this, "ionSplitPaneVisible", 7);
- this.visible = false;
- this.contentId = undefined;
- this.disabled = false;
- this.when = QUERY['lg'];
- }
- visibleChanged(visible) {
- this.ionSplitPaneVisible.emit({ visible });
- }
- /**
- * @internal
- */
- async isVisible() {
- return Promise.resolve(this.visible);
- }
- async connectedCallback() {
- // TODO: connectedCallback is fired in CE build
- // before WC is defined. This needs to be fixed in Stencil.
- if (typeof customElements !== 'undefined' && customElements != null) {
- await customElements.whenDefined('ion-split-pane');
- }
- this.styleMainElement();
- this.updateState();
- }
- disconnectedCallback() {
- if (this.rmL) {
- this.rmL();
- this.rmL = undefined;
- }
- }
- updateState() {
- {
- return;
- }
- }
- /**
- * Attempt to find the main content
- * element inside of the split pane.
- * If found, set it as the main node.
- *
- * We assume that the main node
- * is available in the DOM on split
- * pane load.
- */
- styleMainElement() {
- {
- return;
- }
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '098801b5a318e2fc6913fb0d9079b1552927b99b', class: {
- [mode]: true,
- // Used internally for styling
- [`split-pane-${mode}`]: true,
- 'split-pane-visible': this.visible,
- } }, hAsync("slot", { key: '8cbc6a942ecba54fc3c62027d46917db067b65c8' })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "visible": ["visibleChanged"],
- "disabled": ["updateState"],
- "when": ["updateState"]
- }; }
- static get style() { return {
- ios: IonSplitPaneIosStyle0,
- md: IonSplitPaneMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-split-pane",
- "$members$": {
- "contentId": [513, "content-id"],
- "disabled": [4],
- "when": [8],
- "visible": [32],
- "isVisible": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["contentId", "content-id"]]
- }; }
- }
- const tabCss = ":host(.tab-hidden){display:none !important}";
- var IonTabStyle0 = tabCss;
- class Tab {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.loaded = false;
- this.active = false;
- this.delegate = undefined;
- this.tab = undefined;
- this.component = undefined;
- }
- async componentWillLoad() {
- if (this.active) {
- await this.setActive();
- }
- }
- /** Set the active component for the tab */
- async setActive() {
- await this.prepareLazyLoaded();
- this.active = true;
- }
- changeActive(isActive) {
- if (isActive) {
- this.prepareLazyLoaded();
- }
- }
- prepareLazyLoaded() {
- if (!this.loaded && this.component != null) {
- this.loaded = true;
- try {
- return attachComponent(this.delegate, this.el, this.component, ['ion-page']);
- }
- catch (e) {
- printIonError('[ion-tab] - Exception in prepareLazyLoaded:', e);
- }
- }
- return Promise.resolve(undefined);
- }
- render() {
- const { tab, active, component } = this;
- return (hAsync(Host, { key: 'c36c113e74e12b58459df9e3b546ad4856187e90', role: "tabpanel", "aria-hidden": !active ? 'true' : null, "aria-labelledby": `tab-button-${tab}`, class: {
- 'ion-page': component === undefined,
- 'tab-hidden': !active,
- } }, hAsync("slot", { key: '0d7821dac70ba7a12edfb3331988f3df1566cc1a' })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["changeActive"]
- }; }
- static get style() { return IonTabStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-tab",
- "$members$": {
- "active": [1028],
- "delegate": [16],
- "tab": [1],
- "component": [1],
- "setActive": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const tabBarIosCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:auto;padding-right:var(--ion-safe-area-right);padding-bottom:var(--ion-safe-area-bottom, 0);padding-left:var(--ion-safe-area-left);border-top:var(--border);background:var(--background);color:var(--color);text-align:center;contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:10;-webkit-box-sizing:content-box !important;box-sizing:content-box !important}:host(.ion-color) ::slotted(ion-tab-button){--background-focused:var(--ion-color-shade);--color-selected:var(--ion-color-contrast)}:host(.ion-color) ::slotted(.tab-selected){color:var(--ion-color-contrast)}:host(.ion-color),:host(.ion-color) ::slotted(ion-tab-button){color:rgba(var(--ion-color-contrast-rgb), 0.7)}:host(.ion-color),:host(.ion-color) ::slotted(ion-tab-button){background:var(--ion-color-base)}:host(.ion-color) ::slotted(ion-tab-button.ion-focused),:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:var(--background-focused)}:host(.tab-bar-translucent) ::slotted(ion-tab-button){background:transparent}:host([slot=top]){padding-top:var(--ion-safe-area-top, 0);padding-bottom:0;border-top:0;border-bottom:var(--border)}:host(.tab-bar-hidden){display:none !important}:host{--background:var(--ion-tab-bar-background, var(--ion-color-step-50, var(--ion-background-color-step-50, #f7f7f7)));--background-focused:var(--ion-tab-bar-background-focused, #e0e0e0);--border:0.55px solid var(--ion-tab-bar-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.2)))));--color:var(--ion-tab-bar-color, var(--ion-color-step-600, var(--ion-text-color-step-400, #666666)));--color-selected:var(--ion-tab-bar-color-selected, var(--ion-color-primary, #0054e9));height:50px}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.tab-bar-translucent){--background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(210%) blur(20px);backdrop-filter:saturate(210%) blur(20px)}:host(.ion-color.tab-bar-translucent){background:rgba(var(--ion-color-base-rgb), 0.8)}:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.6)}}";
- var IonTabBarIosStyle0 = tabBarIosCss;
- const tabBarMdCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:auto;padding-right:var(--ion-safe-area-right);padding-bottom:var(--ion-safe-area-bottom, 0);padding-left:var(--ion-safe-area-left);border-top:var(--border);background:var(--background);color:var(--color);text-align:center;contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:10;-webkit-box-sizing:content-box !important;box-sizing:content-box !important}:host(.ion-color) ::slotted(ion-tab-button){--background-focused:var(--ion-color-shade);--color-selected:var(--ion-color-contrast)}:host(.ion-color) ::slotted(.tab-selected){color:var(--ion-color-contrast)}:host(.ion-color),:host(.ion-color) ::slotted(ion-tab-button){color:rgba(var(--ion-color-contrast-rgb), 0.7)}:host(.ion-color),:host(.ion-color) ::slotted(ion-tab-button){background:var(--ion-color-base)}:host(.ion-color) ::slotted(ion-tab-button.ion-focused),:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:var(--background-focused)}:host(.tab-bar-translucent) ::slotted(ion-tab-button){background:transparent}:host([slot=top]){padding-top:var(--ion-safe-area-top, 0);padding-bottom:0;border-top:0;border-bottom:var(--border)}:host(.tab-bar-hidden){display:none !important}:host{--background:var(--ion-tab-bar-background, var(--ion-background-color, #fff));--background-focused:var(--ion-tab-bar-background-focused, #e0e0e0);--border:1px solid var(--ion-tab-bar-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.07)))));--color:var(--ion-tab-bar-color, var(--ion-color-step-650, var(--ion-text-color-step-350, #595959)));--color-selected:var(--ion-tab-bar-color-selected, var(--ion-color-primary, #0054e9));height:56px}";
- var IonTabBarMdStyle0 = tabBarMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class TabBar {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionTabBarChanged = createEvent(this, "ionTabBarChanged", 7);
- this.ionTabBarLoaded = createEvent(this, "ionTabBarLoaded", 7);
- this.keyboardCtrl = null;
- this.keyboardVisible = false;
- this.color = undefined;
- this.selectedTab = undefined;
- this.translucent = false;
- }
- selectedTabChanged() {
- if (this.selectedTab !== undefined) {
- this.ionTabBarChanged.emit({
- tab: this.selectedTab,
- });
- }
- }
- componentWillLoad() {
- this.selectedTabChanged();
- }
- async connectedCallback() {
- this.keyboardCtrl = await createKeyboardController(async (keyboardOpen, waitForResize) => {
- /**
- * If the keyboard is hiding, then we need to wait
- * for the webview to resize. Otherwise, the tab bar
- * will flicker before the webview resizes.
- */
- if (keyboardOpen === false && waitForResize !== undefined) {
- await waitForResize;
- }
- this.keyboardVisible = keyboardOpen; // trigger re-render by updating state
- });
- }
- disconnectedCallback() {
- if (this.keyboardCtrl) {
- this.keyboardCtrl.destroy();
- }
- }
- componentDidLoad() {
- this.ionTabBarLoaded.emit();
- }
- render() {
- const { color, translucent, keyboardVisible } = this;
- const mode = getIonMode$1(this);
- const shouldHide = keyboardVisible && this.el.getAttribute('slot') !== 'top';
- return (hAsync(Host, { key: '62303a7f9d8c98ffab51a5900c144c5117b9c543', role: "tablist", "aria-hidden": shouldHide ? 'true' : null, class: createColorClasses$1(color, {
- [mode]: true,
- 'tab-bar-translucent': translucent,
- 'tab-bar-hidden': shouldHide,
- }) }, hAsync("slot", { key: '5771a9828f748c2bd6b5e26758b9723c6b3de5ff' })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "selectedTab": ["selectedTabChanged"]
- }; }
- static get style() { return {
- ios: IonTabBarIosStyle0,
- md: IonTabBarMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-tab-bar",
- "$members$": {
- "color": [513],
- "selectedTab": [1, "selected-tab"],
- "translucent": [4],
- "keyboardVisible": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const tabButtonIosCss = ":host{--ripple-color:var(--color-selected);--background-focused-opacity:1;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:100%;outline:none;background:var(--background);color:var(--color)}.button-native{border-radius:inherit;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:100%;height:100%;border:0;outline:none;background:transparent;text-decoration:none;cursor:pointer;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-user-drag:none}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:inherit;flex-flow:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:100%;height:100%;z-index:1}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){a:hover{color:var(--color-selected)}}:host(.tab-selected){color:var(--color-selected)}:host(.tab-hidden){display:none !important}:host(.tab-disabled){pointer-events:none;opacity:0.4}::slotted(ion-label),::slotted(ion-icon){display:block;-ms-flex-item-align:center;align-self:center;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}::slotted(ion-label){-ms-flex-order:0;order:0}::slotted(ion-icon){-ms-flex-order:-1;order:-1;height:1em}:host(.tab-has-label-only) ::slotted(ion-label){white-space:normal}::slotted(ion-badge){-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;z-index:1}:host(.tab-layout-icon-start){-ms-flex-direction:row;flex-direction:row}:host(.tab-layout-icon-end){-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.tab-layout-icon-bottom){-ms-flex-direction:column-reverse;flex-direction:column-reverse}:host(.tab-layout-icon-hide) ::slotted(ion-icon){display:none}:host(.tab-layout-label-hide) ::slotted(ion-label){display:none}ion-ripple-effect{color:var(--ripple-color)}:host{--padding-top:0;--padding-end:2px;--padding-bottom:0;--padding-start:2px;max-width:240px;font-size:10px}::slotted(ion-badge){-webkit-padding-start:6px;padding-inline-start:6px;-webkit-padding-end:6px;padding-inline-end:6px;padding-top:1px;padding-bottom:1px;top:4px;height:auto;font-size:12px;line-height:16px}::slotted(ion-badge){inset-inline-start:calc(50% + 6px)}::slotted(ion-icon){margin-top:2px;margin-bottom:2px;font-size:24px}::slotted(ion-icon::before){vertical-align:top}::slotted(ion-label){margin-top:0;margin-bottom:1px;min-height:11px;font-weight:500}:host(.tab-has-label-only) ::slotted(ion-label){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:12px;font-size:14px;line-height:1.1}:host(.tab-layout-icon-end) ::slotted(ion-label),:host(.tab-layout-icon-start) ::slotted(ion-label),:host(.tab-layout-icon-hide) ::slotted(ion-label){margin-top:2px;margin-bottom:2px;font-size:14px;line-height:1.1}:host(.tab-layout-icon-end) ::slotted(ion-icon),:host(.tab-layout-icon-start) ::slotted(ion-icon){min-width:24px;height:26px;margin-top:2px;margin-bottom:1px;font-size:24px}:host(.tab-layout-icon-bottom) ::slotted(ion-badge){inset-inline-start:calc(50% + 12px)}:host(.tab-layout-icon-bottom) ::slotted(ion-icon){margin-top:0;margin-bottom:1px}:host(.tab-layout-icon-bottom) ::slotted(ion-label){margin-top:4px}:host(.tab-layout-icon-start) ::slotted(ion-badge),:host(.tab-layout-icon-end) ::slotted(ion-badge){top:10px}:host(.tab-layout-icon-start) ::slotted(ion-badge),:host(.tab-layout-icon-end) ::slotted(ion-badge){inset-inline-start:calc(50% + 35px)}:host(.tab-layout-icon-hide) ::slotted(ion-badge),:host(.tab-has-label-only) ::slotted(ion-badge){top:10px}:host(.tab-layout-icon-hide) ::slotted(ion-badge),:host(.tab-has-label-only) ::slotted(ion-badge){inset-inline-start:calc(50% + 30px)}:host(.tab-layout-label-hide) ::slotted(ion-badge),:host(.tab-has-icon-only) ::slotted(ion-badge){top:10px}:host(.tab-layout-label-hide) ::slotted(ion-icon){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host(.tab-layout-label-hide) ::slotted(ion-icon),:host(.tab-has-icon-only) ::slotted(ion-icon){font-size:30px}";
- var IonTabButtonIosStyle0 = tabButtonIosCss;
- const tabButtonMdCss = ":host{--ripple-color:var(--color-selected);--background-focused-opacity:1;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:100%;outline:none;background:var(--background);color:var(--color)}.button-native{border-radius:inherit;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:100%;height:100%;border:0;outline:none;background:transparent;text-decoration:none;cursor:pointer;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-user-drag:none}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:\"\";opacity:0}.button-inner{display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:inherit;flex-flow:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:100%;height:100%;z-index:1}:host(.ion-focused) .button-native{color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){a:hover{color:var(--color-selected)}}:host(.tab-selected){color:var(--color-selected)}:host(.tab-hidden){display:none !important}:host(.tab-disabled){pointer-events:none;opacity:0.4}::slotted(ion-label),::slotted(ion-icon){display:block;-ms-flex-item-align:center;align-self:center;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}::slotted(ion-label){-ms-flex-order:0;order:0}::slotted(ion-icon){-ms-flex-order:-1;order:-1;height:1em}:host(.tab-has-label-only) ::slotted(ion-label){white-space:normal}::slotted(ion-badge){-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;z-index:1}:host(.tab-layout-icon-start){-ms-flex-direction:row;flex-direction:row}:host(.tab-layout-icon-end){-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.tab-layout-icon-bottom){-ms-flex-direction:column-reverse;flex-direction:column-reverse}:host(.tab-layout-icon-hide) ::slotted(ion-icon){display:none}:host(.tab-layout-label-hide) ::slotted(ion-label){display:none}ion-ripple-effect{color:var(--ripple-color)}:host{--padding-top:0;--padding-end:12px;--padding-bottom:0;--padding-start:12px;max-width:168px;font-size:12px;font-weight:normal;letter-spacing:0.03em}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;text-transform:none}::slotted(ion-icon){margin-left:0;margin-right:0;margin-top:16px;margin-bottom:16px;-webkit-transform-origin:center center;transform-origin:center center;font-size:22px}:host-context([dir=rtl]) ::slotted(ion-icon){-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}[dir=rtl] ::slotted(ion-icon){-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}@supports selector(:dir(rtl)){::slotted(ion-icon):dir(rtl){-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}}::slotted(ion-badge){border-radius:8px;-webkit-padding-start:2px;padding-inline-start:2px;-webkit-padding-end:2px;padding-inline-end:2px;padding-top:3px;padding-bottom:2px;top:8px;min-width:12px;font-size:8px;font-weight:normal}::slotted(ion-badge){inset-inline-start:calc(50% + 6px)}::slotted(ion-badge:empty){display:block;min-width:8px;height:8px}:host(.tab-layout-icon-top) ::slotted(ion-icon){margin-top:6px;margin-bottom:2px}:host(.tab-layout-icon-top) ::slotted(ion-label){margin-top:0;margin-bottom:6px}:host(.tab-layout-icon-bottom) ::slotted(ion-badge){top:8px}:host(.tab-layout-icon-bottom) ::slotted(ion-badge){inset-inline-start:70%}:host(.tab-layout-icon-bottom) ::slotted(ion-icon){margin-top:0;margin-bottom:6px}:host(.tab-layout-icon-bottom) ::slotted(ion-label){margin-top:6px;margin-bottom:0}:host(.tab-layout-icon-start) ::slotted(ion-badge),:host(.tab-layout-icon-end) ::slotted(ion-badge){top:16px}:host(.tab-layout-icon-start) ::slotted(ion-badge),:host(.tab-layout-icon-end) ::slotted(ion-badge){inset-inline-start:80%}:host(.tab-layout-icon-start) ::slotted(ion-icon){-webkit-margin-end:6px;margin-inline-end:6px}:host(.tab-layout-icon-end) ::slotted(ion-icon){-webkit-margin-start:6px;margin-inline-start:6px}:host(.tab-layout-icon-hide) ::slotted(ion-badge),:host(.tab-has-label-only) ::slotted(ion-badge){top:16px}:host(.tab-layout-icon-hide) ::slotted(ion-badge),:host(.tab-has-label-only) ::slotted(ion-badge){inset-inline-start:70%}:host(.tab-layout-icon-hide) ::slotted(ion-label),:host(.tab-has-label-only) ::slotted(ion-label){margin-top:0;margin-bottom:0}:host(.tab-layout-label-hide) ::slotted(ion-badge),:host(.tab-has-icon-only) ::slotted(ion-badge){top:16px}:host(.tab-layout-label-hide) ::slotted(ion-icon),:host(.tab-has-icon-only) ::slotted(ion-icon){margin-top:0;margin-bottom:0;font-size:24px}";
- var IonTabButtonMdStyle0 = tabButtonMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part native - The native HTML anchor element that wraps all child elements.
- */
- class TabButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionTabButtonClick = createEvent(this, "ionTabButtonClick", 7);
- this.inheritedAttributes = {};
- this.onKeyUp = (ev) => {
- if (ev.key === 'Enter' || ev.key === ' ') {
- this.selectTab(ev);
- }
- };
- this.onClick = (ev) => {
- this.selectTab(ev);
- };
- this.disabled = false;
- this.download = undefined;
- this.href = undefined;
- this.rel = undefined;
- this.layout = undefined;
- this.selected = false;
- this.tab = undefined;
- this.target = undefined;
- }
- onTabBarChanged(ev) {
- const dispatchedFrom = ev.target;
- const parent = this.el.parentElement;
- if (ev.composedPath().includes(parent) || (dispatchedFrom === null || dispatchedFrom === void 0 ? void 0 : dispatchedFrom.contains(this.el))) {
- this.selected = this.tab === ev.detail.tab;
- }
- }
- componentWillLoad() {
- this.inheritedAttributes = Object.assign({}, inheritAttributes$1(this.el, ['aria-label']));
- if (this.layout === undefined) {
- this.layout = config.get('tabButtonLayout', 'icon-top');
- }
- }
- selectTab(ev) {
- if (this.tab !== undefined) {
- if (!this.disabled) {
- this.ionTabButtonClick.emit({
- tab: this.tab,
- href: this.href,
- selected: this.selected,
- });
- }
- ev.preventDefault();
- }
- }
- get hasLabel() {
- return !!this.el.querySelector('ion-label');
- }
- get hasIcon() {
- return !!this.el.querySelector('ion-icon');
- }
- render() {
- const { disabled, hasIcon, hasLabel, href, rel, target, layout, selected, tab, inheritedAttributes } = this;
- const mode = getIonMode$1(this);
- const attrs = {
- download: this.download,
- href,
- rel,
- target,
- };
- return (hAsync(Host, { key: 'a86d441d8df350fe991f2f948fc6b6ad007728f7', onClick: this.onClick, onKeyup: this.onKeyUp, id: tab !== undefined ? `tab-button-${tab}` : null, class: {
- [mode]: true,
- 'tab-selected': selected,
- 'tab-disabled': disabled,
- 'tab-has-label': hasLabel,
- 'tab-has-icon': hasIcon,
- 'tab-has-label-only': hasLabel && !hasIcon,
- 'tab-has-icon-only': hasIcon && !hasLabel,
- [`tab-layout-${layout}`]: true,
- 'ion-activatable': true,
- 'ion-selectable': true,
- 'ion-focusable': true,
- } }, hAsync("a", Object.assign({ key: '8dfe1ccff2cf21601c5aea7f7f877c0fbe384e09' }, attrs, { class: "button-native", part: "native", role: "tab", "aria-selected": selected ? 'true' : null, "aria-disabled": disabled ? 'true' : null, tabindex: disabled ? '-1' : undefined }, inheritedAttributes), hAsync("span", { key: '3f557cf6e96e22b9318b4aee19ede810eb7fb720', class: "button-inner" }, hAsync("slot", { key: '836dd090dbe3c2ea97dc263fca7d01dea6ea0eb6' })), mode === 'md' && hAsync("ion-ripple-effect", { key: '488a924fd04602c1b23e03d1a4c84dfa0f2ca03d', type: "unbounded" }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonTabButtonIosStyle0,
- md: IonTabButtonMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-tab-button",
- "$members$": {
- "disabled": [4],
- "download": [1],
- "href": [1],
- "rel": [1],
- "layout": [1025],
- "selected": [1028],
- "tab": [1],
- "target": [1]
- },
- "$listeners$": [[8, "ionTabBarChanged", "onTabBarChanged"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const tabsCss = ":host{left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:100%;height:100%;contain:layout size style;z-index:0}.tabs-inner{position:relative;-ms-flex:1;flex:1;contain:layout size style}";
- var IonTabsStyle0 = tabsCss;
- /**
- * @slot - Content is placed between the named slots if provided without a slot.
- * @slot top - Content is placed at the top of the screen.
- * @slot bottom - Content is placed at the bottom of the screen.
- */
- class Tabs {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionNavWillLoad = createEvent(this, "ionNavWillLoad", 7);
- this.ionTabsWillChange = createEvent(this, "ionTabsWillChange", 3);
- this.ionTabsDidChange = createEvent(this, "ionTabsDidChange", 3);
- this.transitioning = false;
- this.onTabClicked = (ev) => {
- const { href, tab } = ev.detail;
- if (this.useRouter && href !== undefined) {
- const router = document.querySelector('ion-router');
- if (router) {
- router.push(href);
- }
- }
- else {
- this.select(tab);
- }
- };
- this.selectedTab = undefined;
- this.useRouter = false;
- }
- async componentWillLoad() {
- if (!this.useRouter) {
- /**
- * JavaScript and StencilJS use `ion-router`, while
- * the other frameworks use `ion-router-outlet`.
- *
- * If either component is present then tabs will not use
- * a basic tab-based navigation. It will use the history
- * stack or URL updates associated with the router.
- */
- this.useRouter =
- (!!this.el.querySelector('ion-router-outlet') || !!document.querySelector('ion-router')) &&
- !this.el.closest('[no-router]');
- }
- if (!this.useRouter) {
- const tabs = this.tabs;
- if (tabs.length > 0) {
- await this.select(tabs[0]);
- }
- }
- this.ionNavWillLoad.emit();
- }
- componentWillRender() {
- const tabBar = this.el.querySelector('ion-tab-bar');
- if (tabBar) {
- const tab = this.selectedTab ? this.selectedTab.tab : undefined;
- tabBar.selectedTab = tab;
- }
- }
- /**
- * Select a tab by the value of its `tab` property or an element reference. This method is only available for vanilla JavaScript projects. The Angular, React, and Vue implementations of tabs are coupled to each framework's router.
- *
- * @param tab The tab instance to select. If passed a string, it should be the value of the tab's `tab` property.
- */
- async select(tab) {
- const selectedTab = getTab(this.tabs, tab);
- if (!this.shouldSwitch(selectedTab)) {
- return false;
- }
- await this.setActive(selectedTab);
- await this.notifyRouter();
- this.tabSwitch();
- return true;
- }
- /**
- * Get a specific tab by the value of its `tab` property or an element reference. This method is only available for vanilla JavaScript projects. The Angular, React, and Vue implementations of tabs are coupled to each framework's router.
- *
- * @param tab The tab instance to select. If passed a string, it should be the value of the tab's `tab` property.
- */
- async getTab(tab) {
- return getTab(this.tabs, tab);
- }
- /**
- * Get the currently selected tab. This method is only available for vanilla JavaScript projects. The Angular, React, and Vue implementations of tabs are coupled to each framework's router.
- */
- getSelected() {
- return Promise.resolve(this.selectedTab ? this.selectedTab.tab : undefined);
- }
- /** @internal */
- async setRouteId(id) {
- const selectedTab = getTab(this.tabs, id);
- if (!this.shouldSwitch(selectedTab)) {
- return { changed: false, element: this.selectedTab };
- }
- await this.setActive(selectedTab);
- return {
- changed: true,
- element: this.selectedTab,
- markVisible: () => this.tabSwitch(),
- };
- }
- /** @internal */
- async getRouteId() {
- var _a;
- const tabId = (_a = this.selectedTab) === null || _a === void 0 ? void 0 : _a.tab;
- return tabId !== undefined ? { id: tabId, element: this.selectedTab } : undefined;
- }
- setActive(selectedTab) {
- if (this.transitioning) {
- return Promise.reject('transitioning already happening');
- }
- this.transitioning = true;
- this.leavingTab = this.selectedTab;
- this.selectedTab = selectedTab;
- this.ionTabsWillChange.emit({ tab: selectedTab.tab });
- selectedTab.active = true;
- return Promise.resolve();
- }
- tabSwitch() {
- const selectedTab = this.selectedTab;
- const leavingTab = this.leavingTab;
- this.leavingTab = undefined;
- this.transitioning = false;
- if (!selectedTab) {
- return;
- }
- if (leavingTab !== selectedTab) {
- if (leavingTab) {
- leavingTab.active = false;
- }
- this.ionTabsDidChange.emit({ tab: selectedTab.tab });
- }
- }
- notifyRouter() {
- if (this.useRouter) {
- const router = document.querySelector('ion-router');
- if (router) {
- return router.navChanged('forward');
- }
- }
- return Promise.resolve(false);
- }
- shouldSwitch(selectedTab) {
- const leavingTab = this.selectedTab;
- return selectedTab !== undefined && selectedTab !== leavingTab && !this.transitioning;
- }
- get tabs() {
- return Array.from(this.el.querySelectorAll('ion-tab'));
- }
- render() {
- return (hAsync(Host, { key: '20b97196d78c1b3f3faf31618a8a2347e087f06b', onIonTabButtonClick: this.onTabClicked }, hAsync("slot", { key: 'b0823fbae6e47743cfd12c376b365ad7e32cec7c', name: "top" }), hAsync("div", { key: 'eaffd7e4d69ab9489a387e3bbb36e3bab72203a0', class: "tabs-inner" }, hAsync("slot", { key: '20bb66a2937e3ec473aa59c4075ce581b5411677' })), hAsync("slot", { key: '1529dd361f050f52074f51c73b3982ba827dc3a5', name: "bottom" })));
- }
- get el() { return getElement(this); }
- static get style() { return IonTabsStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-tabs",
- "$members$": {
- "useRouter": [1028, "use-router"],
- "selectedTab": [32],
- "select": [64],
- "getTab": [64],
- "getSelected": [64],
- "setRouteId": [64],
- "getRouteId": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const getTab = (tabs, tab) => {
- const tabEl = typeof tab === 'string' ? tabs.find((t) => t.tab === tab) : tab;
- if (!tabEl) {
- printIonError(`[ion-tabs] - Tab with id: "${tabEl}" does not exist`);
- }
- return tabEl;
- };
- const textCss = ":host(.ion-color){color:var(--ion-color-base)}";
- var IonTextStyle0 = textCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- */
- class Text {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.color = undefined;
- }
- render() {
- const mode = getIonMode$1(this);
- return (hAsync(Host, { key: '0c2546ea3f24b0a6bfd606199441d0a4edfa4ca1', class: createColorClasses$1(this.color, {
- [mode]: true,
- }) }, hAsync("slot", { key: 'b7623ccb06f9461090a1f33e9f85886c7a4d5eff' })));
- }
- static get style() { return IonTextStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-text",
- "$members$": {
- "color": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const textareaIosCss = ".sc-ion-textarea-ios-h{--background:initial;--color:initial;--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);--padding-top:0;--padding-end:0;--padding-bottom:8px;--padding-start:0;--border-radius:0;--border-style:solid;--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;width:100%;min-height:44px;color:var(--color);font-family:var(--ion-font-family, inherit);z-index:2;-webkit-box-sizing:border-box;box-sizing:border-box}.textarea-label-placement-floating.sc-ion-textarea-ios-h,.textarea-label-placement-stacked.sc-ion-textarea-ios-h{--padding-top:0px;min-height:56px}[cols].sc-ion-textarea-ios-h:not([auto-grow]){width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.ion-color.sc-ion-textarea-ios-h{--highlight-color-focused:var(--ion-color-base);background:initial}ion-item.sc-ion-textarea-ios-h,ion-item .sc-ion-textarea-ios-h{-ms-flex-item-align:baseline;align-self:baseline}ion-item[slot=start].sc-ion-textarea-ios-h,ion-item [slot=start].sc-ion-textarea-ios-h,ion-item[slot=end].sc-ion-textarea-ios-h,ion-item [slot=end].sc-ion-textarea-ios-h{width:auto}.native-textarea.sc-ion-textarea-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;white-space:pre-wrap;z-index:1;-webkit-box-sizing:border-box;box-sizing:border-box;resize:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.native-textarea.sc-ion-textarea-ios::-webkit-input-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-ios::-moz-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-ios:-ms-input-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-ios::-ms-input-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-ios::placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-ios{color:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-align:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;grid-area:1/1/2/2;word-break:break-word}.cloned-input.sc-ion-textarea-ios{top:0;bottom:0;position:absolute;pointer-events:none}.cloned-input.sc-ion-textarea-ios{inset-inline-start:0}.cloned-input.sc-ion-textarea-ios:disabled{opacity:1}[auto-grow].sc-ion-textarea-ios-h .cloned-input.sc-ion-textarea-ios{height:100%}[auto-grow].sc-ion-textarea-ios-h .native-textarea.sc-ion-textarea-ios{overflow:hidden}.textarea-wrapper.sc-ion-textarea-ios{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:0px;padding-bottom:0px;border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:start;align-items:flex-start;height:inherit;min-height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;background:var(--background);line-height:normal}.native-wrapper.sc-ion-textarea-ios{position:relative;width:100%;height:100%}.has-focus.sc-ion-textarea-ios-h textarea.sc-ion-textarea-ios{caret-color:var(--highlight-color)}.native-wrapper.sc-ion-textarea-ios textarea.sc-ion-textarea-ios{-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom)}.native-wrapper.sc-ion-textarea-ios{display:grid;min-width:inherit;max-width:inherit;min-height:inherit;max-height:inherit;grid-auto-rows:100%}.native-wrapper.sc-ion-textarea-ios::after{white-space:pre-wrap;content:attr(data-replicated-value) \" \";visibility:hidden}.native-wrapper.sc-ion-textarea-ios::after{padding-left:0;padding-right:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:var(--border-radius);color:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-align:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;grid-area:1/1/2/2;word-break:break-word}.textarea-wrapper-inner.sc-ion-textarea-ios{display:-ms-flexbox;display:flex;width:100%;min-height:inherit}.ion-touched.ion-invalid.sc-ion-textarea-ios-h{--highlight-color:var(--highlight-color-invalid)}.ion-valid.sc-ion-textarea-ios-h{--highlight-color:var(--highlight-color-valid)}.textarea-bottom.sc-ion-textarea-ios{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:5px;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;border-top:var(--border-width) var(--border-style) var(--border-color);font-size:0.75rem;white-space:normal}.has-focus.ion-valid.sc-ion-textarea-ios-h,.ion-touched.ion-invalid.sc-ion-textarea-ios-h{--border-color:var(--highlight-color)}.textarea-bottom.sc-ion-textarea-ios .error-text.sc-ion-textarea-ios{display:none;color:var(--highlight-color-invalid)}.textarea-bottom.sc-ion-textarea-ios .helper-text.sc-ion-textarea-ios{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}.ion-touched.ion-invalid.sc-ion-textarea-ios-h .textarea-bottom.sc-ion-textarea-ios .error-text.sc-ion-textarea-ios{display:block}.ion-touched.ion-invalid.sc-ion-textarea-ios-h .textarea-bottom.sc-ion-textarea-ios .helper-text.sc-ion-textarea-ios{display:none}.textarea-bottom.sc-ion-textarea-ios .counter.sc-ion-textarea-ios{-webkit-margin-start:auto;margin-inline-start:auto;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));white-space:nowrap;-webkit-padding-start:16px;padding-inline-start:16px}.label-text-wrapper.sc-ion-textarea-ios{-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);max-width:200px;-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);pointer-events:none}.label-text.sc-ion-textarea-ios,.sc-ion-textarea-ios-s>[slot=label]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden.sc-ion-textarea-ios,.textarea-outline-notch-hidden.sc-ion-textarea-ios{display:none}.textarea-wrapper.sc-ion-textarea-ios textarea.sc-ion-textarea-ios{-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1)}.textarea-label-placement-start.sc-ion-textarea-ios-h .textarea-wrapper.sc-ion-textarea-ios{-ms-flex-direction:row;flex-direction:row}.textarea-label-placement-start.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.textarea-label-placement-end.sc-ion-textarea-ios-h .textarea-wrapper.sc-ion-textarea-ios{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.textarea-label-placement-end.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}.textarea-label-placement-fixed.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.textarea-label-placement-fixed.sc-ion-textarea-ios-h .label-text.sc-ion-textarea-ios{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.textarea-label-placement-stacked.sc-ion-textarea-ios-h .textarea-wrapper.sc-ion-textarea-ios,.textarea-label-placement-floating.sc-ion-textarea-ios-h .textarea-wrapper.sc-ion-textarea-ios{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:start}.textarea-label-placement-stacked.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,.textarea-label-placement-floating.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios{-webkit-transform-origin:left top;transform-origin:left top;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;max-width:100%;z-index:2}[dir=rtl].sc-ion-textarea-ios-h -no-combinator.textarea-label-placement-stacked.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,[dir=rtl] .sc-ion-textarea-ios-h -no-combinator.textarea-label-placement-stacked.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,[dir=rtl].textarea-label-placement-stacked.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,[dir=rtl] .textarea-label-placement-stacked.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,[dir=rtl].sc-ion-textarea-ios-h -no-combinator.textarea-label-placement-floating.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,[dir=rtl] .sc-ion-textarea-ios-h -no-combinator.textarea-label-placement-floating.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,[dir=rtl].textarea-label-placement-floating.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios,[dir=rtl] .textarea-label-placement-floating.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.textarea-label-placement-stacked.sc-ion-textarea-ios-h:dir(rtl) .label-text-wrapper.sc-ion-textarea-ios,.textarea-label-placement-floating.sc-ion-textarea-ios-h:dir(rtl) .label-text-wrapper.sc-ion-textarea-ios{-webkit-transform-origin:right top;transform-origin:right top}}.textarea-label-placement-stacked.sc-ion-textarea-ios-h textarea.sc-ion-textarea-ios,.textarea-label-placement-floating.sc-ion-textarea-ios-h textarea.sc-ion-textarea-ios,.textarea-label-placement-stacked[auto-grow].sc-ion-textarea-ios-h .native-wrapper.sc-ion-textarea-ios::after,.textarea-label-placement-floating[auto-grow].sc-ion-textarea-ios-h .native-wrapper.sc-ion-textarea-ios::after{-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:8px;margin-bottom:0px}.sc-ion-textarea-ios-h.textarea-label-placement-stacked.sc-ion-textarea-ios-s>[slot=start],.sc-ion-textarea-ios-h.textarea-label-placement-stacked .sc-ion-textarea-ios-s>[slot=start],.sc-ion-textarea-ios-h.textarea-label-placement-stacked.sc-ion-textarea-ios-s>[slot=end],.sc-ion-textarea-ios-h.textarea-label-placement-stacked .sc-ion-textarea-ios-s>[slot=end],.sc-ion-textarea-ios-h.textarea-label-placement-floating.sc-ion-textarea-ios-s>[slot=start],.sc-ion-textarea-ios-h.textarea-label-placement-floating .sc-ion-textarea-ios-s>[slot=start],.sc-ion-textarea-ios-h.textarea-label-placement-floating.sc-ion-textarea-ios-s>[slot=end],.sc-ion-textarea-ios-h.textarea-label-placement-floating .sc-ion-textarea-ios-s>[slot=end]{margin-top:8px}.textarea-label-placement-floating.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios{-webkit-transform:translateY(100%) scale(1);transform:translateY(100%) scale(1)}.textarea-label-placement-floating.sc-ion-textarea-ios-h textarea.sc-ion-textarea-ios{opacity:0}.has-focus.textarea-label-placement-floating.sc-ion-textarea-ios-h textarea.sc-ion-textarea-ios,.has-value.textarea-label-placement-floating.sc-ion-textarea-ios-h textarea.sc-ion-textarea-ios{opacity:1}.label-floating.sc-ion-textarea-ios-h .label-text-wrapper.sc-ion-textarea-ios{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75);max-width:calc(100% / 0.75)}.start-slot-wrapper.sc-ion-textarea-ios,.end-slot-wrapper.sc-ion-textarea-ios{padding-left:0;padding-right:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-ms-flex-item-align:start;align-self:start}.sc-ion-textarea-ios-s>[slot=start],.sc-ion-textarea-ios-s>[slot=end]{margin-top:0}.sc-ion-textarea-ios-s>[slot=start]:last-of-type{-webkit-margin-end:16px;margin-inline-end:16px;-webkit-margin-start:0;margin-inline-start:0}.sc-ion-textarea-ios-s>[slot=end]:first-of-type{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}.sc-ion-textarea-ios-h{--border-width:0.55px;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));--padding-top:10px;--padding-end:0px;--padding-bottom:8px;--padding-start:0px;--highlight-height:0px;font-size:inherit}.textarea-disabled.sc-ion-textarea-ios-h{opacity:0.3}.sc-ion-textarea-ios-s>ion-button[slot=start].button-has-icon-only,.sc-ion-textarea-ios-s>ion-button[slot=end].button-has-icon-only{--border-radius:50%;--padding-start:0;--padding-end:0;--padding-top:0;--padding-bottom:0;aspect-ratio:1}";
- var IonTextareaIosStyle0 = textareaIosCss;
- const textareaMdCss = ".sc-ion-textarea-md-h{--background:initial;--color:initial;--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:var(--ion-placeholder-opacity, 0.6);--padding-top:0;--padding-end:0;--padding-bottom:8px;--padding-start:0;--border-radius:0;--border-style:solid;--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;width:100%;min-height:44px;color:var(--color);font-family:var(--ion-font-family, inherit);z-index:2;-webkit-box-sizing:border-box;box-sizing:border-box}.textarea-label-placement-floating.sc-ion-textarea-md-h,.textarea-label-placement-stacked.sc-ion-textarea-md-h{--padding-top:0px;min-height:56px}[cols].sc-ion-textarea-md-h:not([auto-grow]){width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.ion-color.sc-ion-textarea-md-h{--highlight-color-focused:var(--ion-color-base);background:initial}ion-item.sc-ion-textarea-md-h,ion-item .sc-ion-textarea-md-h{-ms-flex-item-align:baseline;align-self:baseline}ion-item[slot=start].sc-ion-textarea-md-h,ion-item [slot=start].sc-ion-textarea-md-h,ion-item[slot=end].sc-ion-textarea-md-h,ion-item [slot=end].sc-ion-textarea-md-h{width:auto}.native-textarea.sc-ion-textarea-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;white-space:pre-wrap;z-index:1;-webkit-box-sizing:border-box;box-sizing:border-box;resize:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.native-textarea.sc-ion-textarea-md::-webkit-input-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md::-moz-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md:-ms-input-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md::-ms-input-placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md::placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md{color:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-align:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;grid-area:1/1/2/2;word-break:break-word}.cloned-input.sc-ion-textarea-md{top:0;bottom:0;position:absolute;pointer-events:none}.cloned-input.sc-ion-textarea-md{inset-inline-start:0}.cloned-input.sc-ion-textarea-md:disabled{opacity:1}[auto-grow].sc-ion-textarea-md-h .cloned-input.sc-ion-textarea-md{height:100%}[auto-grow].sc-ion-textarea-md-h .native-textarea.sc-ion-textarea-md{overflow:hidden}.textarea-wrapper.sc-ion-textarea-md{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:0px;padding-bottom:0px;border-radius:var(--border-radius);display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:start;align-items:flex-start;height:inherit;min-height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;background:var(--background);line-height:normal}.native-wrapper.sc-ion-textarea-md{position:relative;width:100%;height:100%}.has-focus.sc-ion-textarea-md-h textarea.sc-ion-textarea-md{caret-color:var(--highlight-color)}.native-wrapper.sc-ion-textarea-md textarea.sc-ion-textarea-md{-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom)}.native-wrapper.sc-ion-textarea-md{display:grid;min-width:inherit;max-width:inherit;min-height:inherit;max-height:inherit;grid-auto-rows:100%}.native-wrapper.sc-ion-textarea-md::after{white-space:pre-wrap;content:attr(data-replicated-value) \" \";visibility:hidden}.native-wrapper.sc-ion-textarea-md::after{padding-left:0;padding-right:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:var(--border-radius);color:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-align:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;grid-area:1/1/2/2;word-break:break-word}.textarea-wrapper-inner.sc-ion-textarea-md{display:-ms-flexbox;display:flex;width:100%;min-height:inherit}.ion-touched.ion-invalid.sc-ion-textarea-md-h{--highlight-color:var(--highlight-color-invalid)}.ion-valid.sc-ion-textarea-md-h{--highlight-color:var(--highlight-color-valid)}.textarea-bottom.sc-ion-textarea-md{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:5px;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;border-top:var(--border-width) var(--border-style) var(--border-color);font-size:0.75rem;white-space:normal}.has-focus.ion-valid.sc-ion-textarea-md-h,.ion-touched.ion-invalid.sc-ion-textarea-md-h{--border-color:var(--highlight-color)}.textarea-bottom.sc-ion-textarea-md .error-text.sc-ion-textarea-md{display:none;color:var(--highlight-color-invalid)}.textarea-bottom.sc-ion-textarea-md .helper-text.sc-ion-textarea-md{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}.ion-touched.ion-invalid.sc-ion-textarea-md-h .textarea-bottom.sc-ion-textarea-md .error-text.sc-ion-textarea-md{display:block}.ion-touched.ion-invalid.sc-ion-textarea-md-h .textarea-bottom.sc-ion-textarea-md .helper-text.sc-ion-textarea-md{display:none}.textarea-bottom.sc-ion-textarea-md .counter.sc-ion-textarea-md{-webkit-margin-start:auto;margin-inline-start:auto;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));white-space:nowrap;-webkit-padding-start:16px;padding-inline-start:16px}.label-text-wrapper.sc-ion-textarea-md{-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);max-width:200px;-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1);pointer-events:none}.label-text.sc-ion-textarea-md,.sc-ion-textarea-md-s>[slot=label]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden.sc-ion-textarea-md,.textarea-outline-notch-hidden.sc-ion-textarea-md{display:none}.textarea-wrapper.sc-ion-textarea-md textarea.sc-ion-textarea-md{-webkit-transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);transition:opacity 150ms cubic-bezier(0.4, 0, 0.2, 1)}.textarea-label-placement-start.sc-ion-textarea-md-h .textarea-wrapper.sc-ion-textarea-md{-ms-flex-direction:row;flex-direction:row}.textarea-label-placement-start.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.textarea-label-placement-end.sc-ion-textarea-md-h .textarea-wrapper.sc-ion-textarea-md{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.textarea-label-placement-end.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}.textarea-label-placement-fixed.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}.textarea-label-placement-fixed.sc-ion-textarea-md-h .label-text.sc-ion-textarea-md{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.textarea-label-placement-stacked.sc-ion-textarea-md-h .textarea-wrapper.sc-ion-textarea-md,.textarea-label-placement-floating.sc-ion-textarea-md-h .textarea-wrapper.sc-ion-textarea-md{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:start}.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-transform-origin:left top;transform-origin:left top;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;max-width:100%;z-index:2}[dir=rtl].sc-ion-textarea-md-h -no-combinator.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .sc-ion-textarea-md-h -no-combinator.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl].textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl].sc-ion-textarea-md-h -no-combinator.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .sc-ion-textarea-md-h -no-combinator.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl].textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.textarea-label-placement-stacked.sc-ion-textarea-md-h:dir(rtl) .label-text-wrapper.sc-ion-textarea-md,.textarea-label-placement-floating.sc-ion-textarea-md-h:dir(rtl) .label-text-wrapper.sc-ion-textarea-md{-webkit-transform-origin:right top;transform-origin:right top}}.textarea-label-placement-stacked.sc-ion-textarea-md-h textarea.sc-ion-textarea-md,.textarea-label-placement-floating.sc-ion-textarea-md-h textarea.sc-ion-textarea-md,.textarea-label-placement-stacked[auto-grow].sc-ion-textarea-md-h .native-wrapper.sc-ion-textarea-md::after,.textarea-label-placement-floating[auto-grow].sc-ion-textarea-md-h .native-wrapper.sc-ion-textarea-md::after{-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:8px;margin-bottom:0px}.sc-ion-textarea-md-h.textarea-label-placement-stacked.sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-label-placement-stacked .sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-label-placement-stacked.sc-ion-textarea-md-s>[slot=end],.sc-ion-textarea-md-h.textarea-label-placement-stacked .sc-ion-textarea-md-s>[slot=end],.sc-ion-textarea-md-h.textarea-label-placement-floating.sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-label-placement-floating .sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-label-placement-floating.sc-ion-textarea-md-s>[slot=end],.sc-ion-textarea-md-h.textarea-label-placement-floating .sc-ion-textarea-md-s>[slot=end]{margin-top:8px}.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-transform:translateY(100%) scale(1);transform:translateY(100%) scale(1)}.textarea-label-placement-floating.sc-ion-textarea-md-h textarea.sc-ion-textarea-md{opacity:0}.has-focus.textarea-label-placement-floating.sc-ion-textarea-md-h textarea.sc-ion-textarea-md,.has-value.textarea-label-placement-floating.sc-ion-textarea-md-h textarea.sc-ion-textarea-md{opacity:1}.label-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-transform:translateY(50%) scale(0.75);transform:translateY(50%) scale(0.75);max-width:calc(100% / 0.75)}.start-slot-wrapper.sc-ion-textarea-md,.end-slot-wrapper.sc-ion-textarea-md{padding-left:0;padding-right:0;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-ms-flex-item-align:start;align-self:start}.sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-s>[slot=end]{margin-top:0}.sc-ion-textarea-md-s>[slot=start]:last-of-type{-webkit-margin-end:16px;margin-inline-end:16px;-webkit-margin-start:0;margin-inline-start:0}.sc-ion-textarea-md-s>[slot=end]:first-of-type{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}.textarea-fill-solid.sc-ion-textarea-md-h{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--border-color:var(--ion-color-step-500, var(--ion-background-color-step-500, gray));--border-radius:4px;--padding-start:16px;--padding-end:16px;min-height:56px}.textarea-fill-solid.sc-ion-textarea-md-h .textarea-wrapper.sc-ion-textarea-md{border-bottom:var(--border-width) var(--border-style) var(--border-color)}.has-focus.textarea-fill-solid.ion-valid.sc-ion-textarea-md-h,.textarea-fill-solid.ion-touched.ion-invalid.sc-ion-textarea-md-h{--border-color:var(--highlight-color)}.textarea-fill-solid.sc-ion-textarea-md-h .textarea-bottom.sc-ion-textarea-md{border-top:none}@media (any-hover: hover){.textarea-fill-solid.sc-ion-textarea-md-h:hover{--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6));--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}}.textarea-fill-solid.has-focus.sc-ion-textarea-md-h{--background:var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}.textarea-fill-solid.sc-ion-textarea-md-h .textarea-wrapper.sc-ion-textarea-md{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0px;border-end-start-radius:0px}.label-floating.textarea-fill-solid.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{max-width:calc(100% / 0.75)}.textarea-fill-outline.sc-ion-textarea-md-h{--border-color:var(--ion-color-step-300, var(--ion-background-color-step-300, #b3b3b3));--border-radius:4px;--padding-start:16px;--padding-end:16px;min-height:56px}.textarea-fill-outline.textarea-shape-round.sc-ion-textarea-md-h{--border-radius:28px;--padding-start:32px;--padding-end:32px}.has-focus.textarea-fill-outline.ion-valid.sc-ion-textarea-md-h,.textarea-fill-outline.ion-touched.ion-invalid.sc-ion-textarea-md-h{--border-color:var(--highlight-color)}@media (any-hover: hover){.textarea-fill-outline.sc-ion-textarea-md-h:hover{--border-color:var(--ion-color-step-750, var(--ion-background-color-step-750, #404040))}}.textarea-fill-outline.has-focus.sc-ion-textarea-md-h{--border-width:var(--highlight-height);--border-color:var(--highlight-color)}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-bottom.sc-ion-textarea-md{border-top:none}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-wrapper.sc-ion-textarea-md{border-bottom:none}.textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,.textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-transform-origin:left top;transform-origin:left top;position:absolute;max-width:calc(100% - var(--padding-start) - var(--padding-end))}[dir=rtl].sc-ion-textarea-md-h -no-combinator.textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .sc-ion-textarea-md-h -no-combinator.textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl].textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl].sc-ion-textarea-md-h -no-combinator.textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .sc-ion-textarea-md-h -no-combinator.textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl].textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,[dir=rtl] .textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){.textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-h:dir(rtl) .label-text-wrapper.sc-ion-textarea-md,.textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-h:dir(rtl) .label-text-wrapper.sc-ion-textarea-md{-webkit-transform-origin:right top;transform-origin:right top}}.textarea-fill-outline.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{position:relative}.label-floating.textarea-fill-outline.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{-webkit-transform:translateY(-32%) scale(0.75);transform:translateY(-32%) scale(0.75);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;max-width:calc(\n (100% - var(--padding-start) - var(--padding-end) - 8px) / 0.75\n )}.textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-h textarea.sc-ion-textarea-md,.textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-h textarea.sc-ion-textarea-md,.textarea-fill-outline.textarea-label-placement-stacked[auto-grow].sc-ion-textarea-md-h .native-wrapper.sc-ion-textarea-md::after,.textarea-fill-outline.textarea-label-placement-floating[auto-grow].sc-ion-textarea-md-h .native-wrapper.sc-ion-textarea-md::after{-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:12px;margin-bottom:0px}.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-stacked .sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-stacked.sc-ion-textarea-md-s>[slot=end],.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-stacked .sc-ion-textarea-md-s>[slot=end],.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-floating .sc-ion-textarea-md-s>[slot=start],.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-floating.sc-ion-textarea-md-s>[slot=end],.sc-ion-textarea-md-h.textarea-fill-outline.textarea-label-placement-floating .sc-ion-textarea-md-s>[slot=end]{margin-top:12px}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-container.sc-ion-textarea-md{left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;width:100%;height:100%}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-start.sc-ion-textarea-md,.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-end.sc-ion-textarea-md{pointer-events:none}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-start.sc-ion-textarea-md,.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-notch.sc-ion-textarea-md,.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-end.sc-ion-textarea-md{border-top:var(--border-width) var(--border-style) var(--border-color);border-bottom:var(--border-width) var(--border-style) var(--border-color)}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-notch.sc-ion-textarea-md{max-width:calc(100% - var(--padding-start) - var(--padding-end))}.textarea-fill-outline.sc-ion-textarea-md-h .notch-spacer.sc-ion-textarea-md{-webkit-padding-end:8px;padding-inline-end:8px;font-size:calc(1em * 0.75);opacity:0;pointer-events:none;-webkit-box-sizing:content-box;box-sizing:content-box}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-start.sc-ion-textarea-md{border-start-start-radius:var(--border-radius);border-start-end-radius:0px;border-end-end-radius:0px;border-end-start-radius:var(--border-radius);-webkit-border-start:var(--border-width) var(--border-style) var(--border-color);border-inline-start:var(--border-width) var(--border-style) var(--border-color);width:calc(var(--padding-start) - 4px)}.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-end.sc-ion-textarea-md{-webkit-border-end:var(--border-width) var(--border-style) var(--border-color);border-inline-end:var(--border-width) var(--border-style) var(--border-color);border-start-start-radius:0px;border-start-end-radius:var(--border-radius);border-end-end-radius:var(--border-radius);border-end-start-radius:0px;-ms-flex-positive:1;flex-grow:1}.label-floating.textarea-fill-outline.sc-ion-textarea-md-h .textarea-outline-notch.sc-ion-textarea-md{border-top:none}.sc-ion-textarea-md-h{--border-width:1px;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.13)))));--padding-top:18px;--padding-end:0px;--padding-bottom:8px;--padding-start:0px;--highlight-height:2px;font-size:inherit}.textarea-bottom.sc-ion-textarea-md .counter.sc-ion-textarea-md{letter-spacing:0.0333333333em}.textarea-label-placement-floating.has-focus.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,.textarea-label-placement-stacked.has-focus.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{color:var(--highlight-color)}.has-focus.textarea-label-placement-floating.ion-valid.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,.textarea-label-placement-floating.ion-touched.ion-invalid.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,.has-focus.textarea-label-placement-stacked.ion-valid.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md,.textarea-label-placement-stacked.ion-touched.ion-invalid.sc-ion-textarea-md-h .label-text-wrapper.sc-ion-textarea-md{color:var(--highlight-color)}.textarea-disabled.sc-ion-textarea-md-h{opacity:0.38}.textarea-highlight.sc-ion-textarea-md{bottom:-1px;position:absolute;width:100%;height:var(--highlight-height);-webkit-transform:scale(0);transform:scale(0);-webkit-transition:-webkit-transform 200ms;transition:-webkit-transform 200ms;transition:transform 200ms;transition:transform 200ms, -webkit-transform 200ms;background:var(--highlight-color)}.textarea-highlight.sc-ion-textarea-md{inset-inline-start:0}.has-focus.sc-ion-textarea-md-h .textarea-highlight.sc-ion-textarea-md{-webkit-transform:scale(1);transform:scale(1)}.in-item.sc-ion-textarea-md-h .textarea-highlight.sc-ion-textarea-md{bottom:0}.in-item.sc-ion-textarea-md-h .textarea-highlight.sc-ion-textarea-md{inset-inline-start:0}.textarea-shape-round.sc-ion-textarea-md-h{--border-radius:16px}.sc-ion-textarea-md-s>ion-button[slot=start].button-has-icon-only,.sc-ion-textarea-md-s>ion-button[slot=end].button-has-icon-only{--border-radius:50%;--padding-start:8px;--padding-end:8px;--padding-top:8px;--padding-bottom:8px;aspect-ratio:1;min-height:40px}";
- var IonTextareaMdStyle0 = textareaMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot label - The label text to associate with the textarea. Use the `labelPlacement` property to control where the label is placed relative to the textarea. Use this if you need to render a label with custom HTML. (EXPERIMENTAL)
- * @slot start - Content to display at the leading edge of the textarea. (EXPERIMENTAL)
- * @slot end - Content to display at the trailing edge of the textarea. (EXPERIMENTAL)
- */
- class Textarea {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionInput = createEvent(this, "ionInput", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.inputId = `ion-textarea-${textareaIds++}`;
- this.helperTextId = `${this.inputId}-helper-text`;
- this.errorTextId = `${this.inputId}-error-text`;
- /**
- * `true` if the textarea was cleared as a result of the user typing
- * with `clearOnEdit` enabled.
- *
- * Resets when the textarea loses focus.
- */
- this.didTextareaClearOnEdit = false;
- this.inheritedAttributes = {};
- // `Event` type is used instead of `InputEvent`
- // since the types from Stencil are not derived
- // from the element (e.g. textarea and input
- // should be InputEvent, but all other elements
- // should be Event).
- this.onInput = (ev) => {
- const input = ev.target;
- if (input) {
- this.value = input.value || '';
- }
- this.emitInputChange(ev);
- };
- this.onChange = (ev) => {
- this.emitValueChange(ev);
- };
- this.onFocus = (ev) => {
- this.hasFocus = true;
- this.focusedValue = this.value;
- this.ionFocus.emit(ev);
- };
- this.onBlur = (ev) => {
- this.hasFocus = false;
- if (this.focusedValue !== this.value) {
- /**
- * Emits the `ionChange` event when the textarea value
- * is different than the value when the textarea was focused.
- */
- this.emitValueChange(ev);
- }
- this.didTextareaClearOnEdit = false;
- this.ionBlur.emit(ev);
- };
- this.onKeyDown = (ev) => {
- this.checkClearOnEdit(ev);
- };
- /**
- * Stops propagation when the label is clicked,
- * otherwise, two clicks will be triggered.
- */
- this.onLabelClick = (ev) => {
- // Only stop propagation if the click was directly on the label
- // and not on the input or other child elements
- if (ev.target === ev.currentTarget) {
- ev.stopPropagation();
- }
- };
- this.hasFocus = false;
- this.color = undefined;
- this.autocapitalize = 'none';
- this.autofocus = false;
- this.clearOnEdit = false;
- this.debounce = undefined;
- this.disabled = false;
- this.fill = undefined;
- this.inputmode = undefined;
- this.enterkeyhint = undefined;
- this.maxlength = undefined;
- this.minlength = undefined;
- this.name = this.inputId;
- this.placeholder = undefined;
- this.readonly = false;
- this.required = false;
- this.spellcheck = false;
- this.cols = undefined;
- this.rows = undefined;
- this.wrap = undefined;
- this.autoGrow = false;
- this.value = '';
- this.counter = false;
- this.counterFormatter = undefined;
- this.errorText = undefined;
- this.helperText = undefined;
- this.label = undefined;
- this.labelPlacement = 'start';
- this.shape = undefined;
- }
- debounceChanged() {
- const { ionInput, debounce, originalIonInput } = this;
- /**
- * If debounce is undefined, we have to manually revert the ionInput emitter in case
- * debounce used to be set to a number. Otherwise, the event would stay debounced.
- */
- this.ionInput = debounce === undefined ? originalIonInput !== null && originalIonInput !== void 0 ? originalIonInput : ionInput : debounceEvent(ionInput, debounce);
- }
- /**
- * Update the native input element when the value changes
- */
- valueChanged() {
- const nativeInput = this.nativeInput;
- const value = this.getValue();
- if (nativeInput && nativeInput.value !== value) {
- nativeInput.value = value;
- }
- this.runAutoGrow();
- }
- /**
- * dir is a globally enumerated attribute.
- * As a result, creating these as properties
- * can have unintended side effects. Instead, we
- * listen for attribute changes and inherit them
- * to the inner `<textarea>` element.
- */
- onDirChanged(newValue) {
- this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { dir: newValue });
- }
- /**
- * This prevents the native input from emitting the click event.
- * Instead, the click event from the ion-textarea is emitted.
- */
- onClickCapture(ev) {
- const nativeInput = this.nativeInput;
- if (nativeInput && ev.target === nativeInput) {
- ev.stopPropagation();
- this.el.click();
- }
- }
- connectedCallback() {
- const { el } = this;
- this.slotMutationController = createSlotMutationController(el, ['label', 'start', 'end'], () => forceUpdate());
- this.notchController = createNotchController(el, () => this.notchSpacerEl, () => this.labelSlot);
- this.debounceChanged();
- }
- disconnectedCallback() {
- if (this.slotMutationController) {
- this.slotMutationController.destroy();
- this.slotMutationController = undefined;
- }
- if (this.notchController) {
- this.notchController.destroy();
- this.notchController = undefined;
- }
- }
- componentWillLoad() {
- this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el)), inheritAttributes$1(this.el, ['data-form-type', 'title', 'tabindex', 'dir']));
- }
- componentDidLoad() {
- this.originalIonInput = this.ionInput;
- this.runAutoGrow();
- }
- componentDidRender() {
- var _a;
- (_a = this.notchController) === null || _a === void 0 ? void 0 : _a.calculateNotchWidth();
- }
- /**
- * Sets focus on the native `textarea` in `ion-textarea`. Use this method instead of the global
- * `textarea.focus()`.
- *
- * See [managing focus](/docs/developing/managing-focus) for more information.
- */
- async setFocus() {
- if (this.nativeInput) {
- this.nativeInput.focus();
- }
- }
- /**
- * Returns the native `<textarea>` element used under the hood.
- */
- async getInputElement() {
- /**
- * If this gets called in certain early lifecycle hooks (ex: Vue onMounted),
- * nativeInput won't be defined yet with the custom elements build, so wait for it to load in.
- */
- if (!this.nativeInput) {
- await new Promise((resolve) => componentOnReady(this.el, resolve));
- }
- return Promise.resolve(this.nativeInput);
- }
- /**
- * Emits an `ionChange` event.
- *
- * This API should be called for user committed changes.
- * This API should not be used for external value changes.
- */
- emitValueChange(event) {
- const { value } = this;
- // Checks for both null and undefined values
- const newValue = value == null ? value : value.toString();
- // Emitting a value change should update the internal state for tracking the focused value
- this.focusedValue = newValue;
- this.ionChange.emit({ value: newValue, event });
- }
- /**
- * Emits an `ionInput` event.
- */
- emitInputChange(event) {
- const { value } = this;
- this.ionInput.emit({ value, event });
- }
- runAutoGrow() {
- if (this.nativeInput && this.autoGrow) {
- writeTask(() => {
- var _a;
- if (this.textareaWrapper) {
- // Replicated value is an attribute to be used in the stylesheet
- // to set the inner contents of a pseudo element.
- this.textareaWrapper.dataset.replicatedValue = (_a = this.value) !== null && _a !== void 0 ? _a : '';
- }
- });
- }
- }
- /**
- * Check if we need to clear the text input if clearOnEdit is enabled
- */
- checkClearOnEdit(ev) {
- if (!this.clearOnEdit) {
- return;
- }
- /**
- * The following keys do not modify the
- * contents of the input. As a result, pressing
- * them should not edit the textarea.
- *
- * We can't check to see if the value of the textarea
- * was changed because we call checkClearOnEdit
- * in a keydown listener, and the key has not yet
- * been added to the textarea.
- *
- * Unlike ion-input, the "Enter" key does modify the
- * textarea by adding a new line, so "Enter" is not
- * included in the IGNORED_KEYS array.
- */
- const IGNORED_KEYS = ['Tab', 'Shift', 'Meta', 'Alt', 'Control'];
- const pressedIgnoredKey = IGNORED_KEYS.includes(ev.key);
- /**
- * Clear the textarea if the control has not been previously cleared
- * during focus.
- */
- if (!this.didTextareaClearOnEdit && this.hasValue() && !pressedIgnoredKey) {
- this.value = '';
- this.emitInputChange(ev);
- }
- /**
- * Pressing an IGNORED_KEYS first and
- * then an allowed key will cause the input to not
- * be cleared.
- */
- if (!pressedIgnoredKey) {
- this.didTextareaClearOnEdit = true;
- }
- }
- hasValue() {
- return this.getValue() !== '';
- }
- getValue() {
- return this.value || '';
- }
- renderLabel() {
- const { label } = this;
- return (hAsync("div", { class: {
- 'label-text-wrapper': true,
- 'label-text-wrapper-hidden': !this.hasLabel,
- } }, label === undefined ? hAsync("slot", { name: "label" }) : hAsync("div", { class: "label-text" }, label)));
- }
- /**
- * Gets any content passed into the `label` slot,
- * not the <slot> definition.
- */
- get labelSlot() {
- return this.el.querySelector('[slot="label"]');
- }
- /**
- * Returns `true` if label content is provided
- * either by a prop or a content. If you want
- * to get the plaintext value of the label use
- * the `labelText` getter instead.
- */
- get hasLabel() {
- return this.label !== undefined || this.labelSlot !== null;
- }
- /**
- * Renders the border container when fill="outline".
- */
- renderLabelContainer() {
- const mode = getIonMode$1(this);
- const hasOutlineFill = mode === 'md' && this.fill === 'outline';
- if (hasOutlineFill) {
- /**
- * The outline fill has a special outline
- * that appears around the textarea and the label.
- * Certain stacked and floating label placements cause the
- * label to translate up and create a "cut out"
- * inside of that border by using the notch-spacer element.
- */
- return [
- hAsync("div", { class: "textarea-outline-container" }, hAsync("div", { class: "textarea-outline-start" }), hAsync("div", { class: {
- 'textarea-outline-notch': true,
- 'textarea-outline-notch-hidden': !this.hasLabel,
- } }, hAsync("div", { class: "notch-spacer", "aria-hidden": "true", ref: (el) => (this.notchSpacerEl = el) }, this.label)), hAsync("div", { class: "textarea-outline-end" })),
- this.renderLabel(),
- ];
- }
- /**
- * If not using the outline style,
- * we can render just the label.
- */
- return this.renderLabel();
- }
- /**
- * Renders the helper text or error text values
- */
- renderHintText() {
- const { helperText, errorText, helperTextId, errorTextId } = this;
- return [
- hAsync("div", { id: helperTextId, class: "helper-text" }, helperText),
- hAsync("div", { id: errorTextId, class: "error-text" }, errorText),
- ];
- }
- getHintTextID() {
- const { el, helperText, errorText, helperTextId, errorTextId } = this;
- if (el.classList.contains('ion-touched') && el.classList.contains('ion-invalid') && errorText) {
- return errorTextId;
- }
- if (helperText) {
- return helperTextId;
- }
- return undefined;
- }
- renderCounter() {
- const { counter, maxlength, counterFormatter, value } = this;
- if (counter !== true || maxlength === undefined) {
- return;
- }
- return hAsync("div", { class: "counter" }, getCounterText(value, maxlength, counterFormatter));
- }
- /**
- * Responsible for rendering helper text,
- * error text, and counter. This element should only
- * be rendered if hint text is set or counter is enabled.
- */
- renderBottomContent() {
- const { counter, helperText, errorText, maxlength } = this;
- /**
- * undefined and empty string values should
- * be treated as not having helper/error text.
- */
- const hasHintText = !!helperText || !!errorText;
- const hasCounter = counter === true && maxlength !== undefined;
- if (!hasHintText && !hasCounter) {
- return;
- }
- return (hAsync("div", { class: "textarea-bottom" }, this.renderHintText(), this.renderCounter()));
- }
- render() {
- const { inputId, disabled, fill, shape, labelPlacement, el, hasFocus } = this;
- const mode = getIonMode$1(this);
- const value = this.getValue();
- const inItem = hostContext('ion-item', this.el);
- const shouldRenderHighlight = mode === 'md' && fill !== 'outline' && !inItem;
- const hasValue = this.hasValue();
- const hasStartEndSlots = el.querySelector('[slot="start"], [slot="end"]') !== null;
- /**
- * If the label is stacked, it should always sit above the textarea.
- * For floating labels, the label should move above the textarea if
- * the textarea has a value, is focused, or has anything in either
- * the start or end slot.
- *
- * If there is content in the start slot, the label would overlap
- * it if not forced to float. This is also applied to the end slot
- * because with the default or solid fills, the textarea is not
- * vertically centered in the container, but the label is. This
- * causes the slots and label to appear vertically offset from each
- * other when the label isn't floating above the input. This doesn't
- * apply to the outline fill, but this was not accounted for to keep
- * things consistent.
- *
- * TODO(FW-5592): Remove hasStartEndSlots condition
- */
- const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || hasFocus || hasStartEndSlots));
- return (hAsync(Host, { key: '7eb390b79de0d671a785bbb783f97e09169472f9', class: createColorClasses$1(this.color, {
- [mode]: true,
- 'has-value': hasValue,
- 'has-focus': hasFocus,
- 'label-floating': labelShouldFloat,
- [`textarea-fill-${fill}`]: fill !== undefined,
- [`textarea-shape-${shape}`]: shape !== undefined,
- [`textarea-label-placement-${labelPlacement}`]: true,
- 'textarea-disabled': disabled,
- }) }, hAsync("label", { key: 'f5835d8d56fadbd24637fc063a84834064aefc6d', class: "textarea-wrapper", htmlFor: inputId, onClick: this.onLabelClick }, this.renderLabelContainer(), hAsync("div", { key: '7ca9391a0cdcf47991bd529bfd38d06a3f92d6ec', class: "textarea-wrapper-inner" }, hAsync("div", { key: '12e893e7c4b56f5e9f91ff81cdaf8d76f68988fe', class: "start-slot-wrapper" }, hAsync("slot", { key: 'd9ff42e8989eb1462747fe67575f6c3478f4f8b3', name: "start" })), hAsync("div", { key: '0b9f575368c9c4d990761c390c163825eb311963', class: "native-wrapper", ref: (el) => (this.textareaWrapper = el) }, hAsync("textarea", Object.assign({ key: '2c80fc07518265458f27201e15af9578e372fbcf', class: "native-textarea", ref: (el) => (this.nativeInput = el), id: inputId, disabled: disabled, autoCapitalize: this.autocapitalize, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, minLength: this.minlength, maxLength: this.maxlength, name: this.name, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, cols: this.cols, rows: this.rows, wrap: this.wrap, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeyDown, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === this.errorTextId }, this.inheritedAttributes), value)), hAsync("div", { key: '6647296719b79eb3ebe7146f9bfd77a6c37f6c30', class: "end-slot-wrapper" }, hAsync("slot", { key: 'ec3ec3feb6b35ffe11bdcab94b521922b2f7e91f', name: "end" }))), shouldRenderHighlight && hAsync("div", { key: '49e7dca783bc2eee320631859264772be876eaba', class: "textarea-highlight" })), this.renderBottomContent()));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "debounce": ["debounceChanged"],
- "value": ["valueChanged"],
- "dir": ["onDirChanged"]
- }; }
- static get style() { return {
- ios: IonTextareaIosStyle0,
- md: IonTextareaMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 38,
- "$tagName$": "ion-textarea",
- "$members$": {
- "color": [513],
- "autocapitalize": [1],
- "autofocus": [4],
- "clearOnEdit": [4, "clear-on-edit"],
- "debounce": [2],
- "disabled": [4],
- "fill": [1],
- "inputmode": [1],
- "enterkeyhint": [1],
- "maxlength": [2],
- "minlength": [2],
- "name": [1],
- "placeholder": [1],
- "readonly": [4],
- "required": [4],
- "spellcheck": [4],
- "cols": [514],
- "rows": [2],
- "wrap": [1],
- "autoGrow": [516, "auto-grow"],
- "value": [1025],
- "counter": [4],
- "counterFormatter": [16],
- "errorText": [1, "error-text"],
- "helperText": [1, "helper-text"],
- "label": [1],
- "labelPlacement": [1, "label-placement"],
- "shape": [1],
- "hasFocus": [32],
- "setFocus": [64],
- "getInputElement": [64]
- },
- "$listeners$": [[2, "click", "onClickCapture"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"], ["cols", "cols"], ["autoGrow", "auto-grow"]]
- }; }
- }
- let textareaIds = 0;
- const thumbnailCss = ":host{--size:48px;--border-radius:0;border-radius:var(--border-radius);display:block;width:var(--size);height:var(--size)}::slotted(ion-img),::slotted(img){border-radius:var(--border-radius);width:100%;height:100%;-o-object-fit:cover;object-fit:cover;overflow:hidden}";
- var IonThumbnailStyle0 = thumbnailCss;
- class Thumbnail {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- render() {
- return (hAsync(Host, { key: '7f5fd6c056da2d82feb2c3c33f3e6dec898787f5', class: getIonMode$1(this) }, hAsync("slot", { key: 'd15fd2b6cdc03777edc1930be95ad838e1b376c8' })));
- }
- static get style() { return IonThumbnailStyle0; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "ion-thumbnail",
- "$members$": undefined,
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- /**
- * Calculate the CSS top and bottom position of the toast, to be used
- * as starting points for the animation keyframes.
- *
- * The default animations for both MD and iOS
- * use translateY, which calculates from the
- * top edge of the screen. This behavior impacts
- * how we compute the offset when a toast has
- * position='bottom' since we need to calculate from
- * the bottom edge of the screen instead.
- *
- * @param position The value of the toast's position prop.
- * @param positionAnchor The element the toast should be anchored to,
- * if applicable.
- * @param mode The toast component's mode (md, ios, etc).
- * @param toast A reference to the toast element itself.
- */
- function getAnimationPosition(position, positionAnchor, mode, toast) {
- /**
- * Start with a predefined offset from the edge the toast will be
- * positioned relative to, whether on the screen or anchor element.
- */
- let offset;
- if (mode === 'md') {
- offset = position === 'top' ? 8 : -8;
- }
- else {
- offset = position === 'top' ? 10 : -10;
- }
- /**
- * If positionAnchor is defined, add in the distance from the target
- * screen edge to the target anchor edge. For position="top", the
- * bottom anchor edge is targeted. For position="bottom", the top
- * anchor edge is targeted.
- */
- if (positionAnchor && win$1) {
- warnIfAnchorIsHidden(positionAnchor, toast);
- const box = positionAnchor.getBoundingClientRect();
- if (position === 'top') {
- offset += box.bottom;
- }
- else if (position === 'bottom') {
- /**
- * Just box.top is the distance from the top edge of the screen
- * to the top edge of the anchor. We want to calculate from the
- * bottom edge of the screen instead.
- */
- offset -= win$1.innerHeight - box.top;
- }
- /**
- * We don't include safe area here because that should already be
- * accounted for when checking the position of the anchor.
- */
- return {
- top: `${offset}px`,
- bottom: `${offset}px`,
- };
- }
- else {
- return {
- top: `calc(${offset}px + var(--ion-safe-area-top, 0px))`,
- bottom: `calc(${offset}px - var(--ion-safe-area-bottom, 0px))`,
- };
- }
- }
- /**
- * If the anchor element is hidden, getBoundingClientRect()
- * will return all 0s for it, which can cause unexpected
- * results in the position calculation when animating.
- */
- function warnIfAnchorIsHidden(positionAnchor, toast) {
- if (positionAnchor.offsetParent === null) {
- printIonWarning('[ion-toast] - The positionAnchor element for ion-toast was found in the DOM, but appears to be hidden. This may lead to unexpected positioning of the toast.', toast);
- }
- }
- /**
- * Returns the top offset required to place
- * the toast in the middle of the screen.
- * Only needed when position="toast".
- * @param toastHeight - The height of the ion-toast element
- * @param wrapperHeight - The height of the .toast-wrapper element
- * inside the toast's shadow root.
- */
- const getOffsetForMiddlePosition = (toastHeight, wrapperHeight) => {
- return Math.floor(toastHeight / 2 - wrapperHeight / 2);
- };
- /**
- * iOS Toast Enter Animation
- */
- const iosEnterAnimation = (baseEl, opts) => {
- const baseAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- const { position, top, bottom } = opts;
- const root = getElementRoot(baseEl);
- const wrapperEl = root.querySelector('.toast-wrapper');
- wrapperAnimation.addElement(wrapperEl);
- switch (position) {
- case 'top':
- wrapperAnimation.fromTo('transform', 'translateY(-100%)', `translateY(${top})`);
- break;
- case 'middle':
- const topPosition = getOffsetForMiddlePosition(baseEl.clientHeight, wrapperEl.clientHeight);
- wrapperEl.style.top = `${topPosition}px`;
- wrapperAnimation.fromTo('opacity', 0.01, 1);
- break;
- default:
- wrapperAnimation.fromTo('transform', 'translateY(100%)', `translateY(${bottom})`);
- break;
- }
- return baseAnimation.easing('cubic-bezier(.155,1.105,.295,1.12)').duration(400).addAnimation(wrapperAnimation);
- };
- /**
- * iOS Toast Leave Animation
- */
- const iosLeaveAnimation = (baseEl, opts) => {
- const baseAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- const { position, top, bottom } = opts;
- const root = getElementRoot(baseEl);
- const wrapperEl = root.querySelector('.toast-wrapper');
- wrapperAnimation.addElement(wrapperEl);
- switch (position) {
- case 'top':
- wrapperAnimation.fromTo('transform', `translateY(${top})`, 'translateY(-100%)');
- break;
- case 'middle':
- wrapperAnimation.fromTo('opacity', 0.99, 0);
- break;
- default:
- wrapperAnimation.fromTo('transform', `translateY(${bottom})`, 'translateY(100%)');
- break;
- }
- return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(300).addAnimation(wrapperAnimation);
- };
- /**
- * MD Toast Enter Animation
- */
- const mdEnterAnimation = (baseEl, opts) => {
- const baseAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- const { position, top, bottom } = opts;
- const root = getElementRoot(baseEl);
- const wrapperEl = root.querySelector('.toast-wrapper');
- wrapperAnimation.addElement(wrapperEl);
- switch (position) {
- case 'top':
- wrapperEl.style.setProperty('transform', `translateY(${top})`);
- wrapperAnimation.fromTo('opacity', 0.01, 1);
- break;
- case 'middle':
- const topPosition = getOffsetForMiddlePosition(baseEl.clientHeight, wrapperEl.clientHeight);
- wrapperEl.style.top = `${topPosition}px`;
- wrapperAnimation.fromTo('opacity', 0.01, 1);
- break;
- default:
- wrapperEl.style.setProperty('transform', `translateY(${bottom})`);
- wrapperAnimation.fromTo('opacity', 0.01, 1);
- break;
- }
- return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(400).addAnimation(wrapperAnimation);
- };
- /**
- * md Toast Leave Animation
- */
- const mdLeaveAnimation = (baseEl) => {
- const baseAnimation = createAnimation();
- const wrapperAnimation = createAnimation();
- const root = getElementRoot(baseEl);
- const wrapperEl = root.querySelector('.toast-wrapper');
- wrapperAnimation.addElement(wrapperEl).fromTo('opacity', 0.99, 0);
- return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(300).addAnimation(wrapperAnimation);
- };
- /**
- * Create a gesture that allows the Toast
- * to be swiped to dismiss.
- * @param el - The Toast element
- * @param toastPosition - The last computed position of the Toast. This is computed in the "present" method.
- * @param onDismiss - A callback to fire when the Toast was swiped to dismiss.
- */
- const createSwipeToDismissGesture = (el, toastPosition, onDismiss) => {
- /**
- * Users should swipe on the visible toast wrapper
- * rather than on ion-toast which covers the entire screen.
- * When testing the class instance the inner wrapper will not
- * be defined. As a result, we use a placeholder element in those environments.
- */
- const wrapperEl = getElementRoot(el).querySelector('.toast-wrapper');
- const hostElHeight = el.clientHeight;
- const wrapperElBox = wrapperEl.getBoundingClientRect();
- /**
- * The maximum amount that
- * the toast can be swiped. This should
- * account for the wrapper element's height
- * too so the toast can be swiped offscreen
- * completely.
- */
- let MAX_SWIPE_DISTANCE = 0;
- /**
- * The step value at which a toast
- * is eligible for dismissing via gesture.
- */
- const DISMISS_THRESHOLD = 0.5;
- /**
- * The middle position Toast starts 50% of the way
- * through the animation, so we need to use this
- * as the starting point for our step values.
- */
- const STEP_OFFSET = el.position === 'middle' ? 0.5 : 0;
- /**
- * When the Toast is at the top users will be
- * swiping up. As a result, the delta values will be
- * negative numbers which will result in negative steps
- * and thresholds. As a result, we need to make those numbers
- * positive.
- */
- const INVERSION_FACTOR = el.position === 'top' ? -1 : 1;
- /**
- * The top offset that places the
- * toast in the middle of the screen.
- * Only needed when position="middle".
- */
- const topPosition = getOffsetForMiddlePosition(hostElHeight, wrapperElBox.height);
- const SWIPE_UP_DOWN_KEYFRAMES = [
- { offset: 0, transform: `translateY(-${topPosition + wrapperElBox.height}px)` },
- { offset: 0.5, transform: `translateY(0px)` },
- { offset: 1, transform: `translateY(${topPosition + wrapperElBox.height}px)` },
- ];
- const swipeAnimation = createAnimation('toast-swipe-to-dismiss-animation')
- .addElement(wrapperEl)
- /**
- * The specific value here does not actually
- * matter. We just need this to be a positive
- * value so the animation does not jump
- * to the end when the user beings to drag.
- */
- .duration(100);
- switch (el.position) {
- case 'middle':
- MAX_SWIPE_DISTANCE = hostElHeight + wrapperElBox.height;
- swipeAnimation.keyframes(SWIPE_UP_DOWN_KEYFRAMES);
- /**
- * Toast can be swiped up or down but
- * should start in the middle of the screen.
- */
- swipeAnimation.progressStart(true, 0.5);
- break;
- case 'top':
- /**
- * The bottom edge of the wrapper
- * includes the distance between the top
- * of the screen and the top of the wrapper
- * as well as the wrapper height so the wrapper
- * can be dragged fully offscreen.
- */
- MAX_SWIPE_DISTANCE = wrapperElBox.bottom;
- swipeAnimation.keyframes([
- { offset: 0, transform: `translateY(${toastPosition.top})` },
- { offset: 1, transform: 'translateY(-100%)' },
- ]);
- swipeAnimation.progressStart(true, 0);
- break;
- case 'bottom':
- default:
- /**
- * This computes the distance between the
- * top of the wrapper and the bottom of the
- * screen including the height of the wrapper
- * element so it can be dragged fully offscreen.
- */
- MAX_SWIPE_DISTANCE = hostElHeight - wrapperElBox.top;
- swipeAnimation.keyframes([
- { offset: 0, transform: `translateY(${toastPosition.bottom})` },
- { offset: 1, transform: 'translateY(100%)' },
- ]);
- swipeAnimation.progressStart(true, 0);
- break;
- }
- const computeStep = (delta) => {
- return (delta * INVERSION_FACTOR) / MAX_SWIPE_DISTANCE;
- };
- const onMove = (detail) => {
- const step = STEP_OFFSET + computeStep(detail.deltaY);
- swipeAnimation.progressStep(step);
- };
- const onEnd = (detail) => {
- const velocity = detail.velocityY;
- const threshold = ((detail.deltaY + velocity * 1000) / MAX_SWIPE_DISTANCE) * INVERSION_FACTOR;
- /**
- * Disable the gesture for the remainder of the animation.
- * It will be re-enabled if the toast animates back to
- * its initial presented position.
- */
- gesture.enable(false);
- let shouldDismiss = true;
- let playTo = 1;
- let step = 0;
- let remainingDistance = 0;
- if (el.position === 'middle') {
- /**
- * A middle positioned Toast appears
- * in the middle of the screen (at animation offset 0.5).
- * As a result, the threshold will be calculated relative
- * to this starting position. In other words at animation offset 0.5
- * the threshold will be 0. We want the middle Toast to be eligible
- * for dismiss when the user has swiped either half way up or down the
- * screen. As a result, we divide DISMISS_THRESHOLD in half. We also
- * consider when the threshold is a negative in the event the
- * user drags up (since the deltaY will also be negative).
- */
- shouldDismiss = threshold >= DISMISS_THRESHOLD / 2 || threshold <= -DISMISS_THRESHOLD / 2;
- /**
- * Since we are replacing the keyframes
- * below the animation always starts from
- * the beginning of the new keyframes.
- * Similarly, we are always playing to
- * the end of the new keyframes.
- */
- playTo = 1;
- step = 0;
- /**
- * The Toast should animate from wherever its
- * current position is to the desired end state.
- *
- * To begin, we get the current position of the
- * Toast for its starting state.
- */
- const wrapperElBox = wrapperEl.getBoundingClientRect();
- const startOffset = wrapperElBox.top - topPosition;
- const startPosition = `${startOffset}px`;
- /**
- * If the deltaY is negative then the user is swiping
- * up, so the Toast should animate to the top of the screen.
- * If the deltaY is positive then the user is swiping
- * down, so the Toast should animate to the bottom of the screen.
- * We also account for when the deltaY is 0, but realistically
- * that should never happen because it means the user did not drag
- * the toast.
- */
- const offsetFactor = detail.deltaY <= 0 ? -1 : 1;
- const endOffset = (topPosition + wrapperElBox.height) * offsetFactor;
- /**
- * If the Toast should dismiss
- * then we need to figure out which edge of
- * the screen it should animate towards.
- * By default, the Toast will come
- * back to its default state in the
- * middle of the screen.
- */
- const endPosition = shouldDismiss ? `${endOffset}px` : '0px';
- const KEYFRAMES = [
- { offset: 0, transform: `translateY(${startPosition})` },
- { offset: 1, transform: `translateY(${endPosition})` },
- ];
- swipeAnimation.keyframes(KEYFRAMES);
- /**
- * Compute the remaining amount of pixels the
- * toast needs to move to be fully dismissed.
- */
- remainingDistance = endOffset - startOffset;
- }
- else {
- shouldDismiss = threshold >= DISMISS_THRESHOLD;
- playTo = shouldDismiss ? 1 : 0;
- step = computeStep(detail.deltaY);
- /**
- * Compute the remaining amount of pixels the
- * toast needs to move to be fully dismissed.
- */
- const remainingStepAmount = shouldDismiss ? 1 - step : step;
- remainingDistance = remainingStepAmount * MAX_SWIPE_DISTANCE;
- }
- /**
- * The animation speed should depend on how quickly
- * the user flicks the toast across the screen. However,
- * it should be no slower than 200ms.
- * We use Math.abs on the remainingDistance because that value
- * can be negative when swiping up on a middle position toast.
- */
- const duration = Math.min(Math.abs(remainingDistance) / Math.abs(velocity), 200);
- swipeAnimation
- .onFinish(() => {
- if (shouldDismiss) {
- onDismiss();
- swipeAnimation.destroy();
- }
- else {
- if (el.position === 'middle') {
- /**
- * If the toast snapped back to
- * the middle of the screen we need
- * to reset the keyframes
- * so the toast can be swiped
- * up or down again.
- */
- swipeAnimation.keyframes(SWIPE_UP_DOWN_KEYFRAMES).progressStart(true, 0.5);
- }
- else {
- swipeAnimation.progressStart(true, 0);
- }
- /**
- * If the toast did not dismiss then
- * the user should be able to swipe again.
- */
- gesture.enable(true);
- }
- /**
- * This must be a one time callback
- * otherwise a new callback will
- * be added every time onEnd runs.
- */
- }, { oneTimeCallback: true })
- .progressEnd(playTo, step, duration);
- };
- const gesture = createGesture({
- el: wrapperEl,
- gestureName: 'toast-swipe-to-dismiss',
- gesturePriority: OVERLAY_GESTURE_PRIORITY,
- /**
- * Toast only supports vertical swipes.
- * This needs to be updated if we later
- * support horizontal swipes.
- */
- direction: 'y',
- onMove,
- onEnd,
- });
- return gesture;
- };
- const toastIosCss = ":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}:host{inset-inline-start:0}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);pointer-events:auto}.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}.toast-wrapper.toast-top{-webkit-transform:translate3d(0, -100%, 0);transform:translate3d(0, -100%, 0);top:0}.toast-wrapper.toast-bottom{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);bottom:0}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.toast-layout-baseline .toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-content{min-width:0}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-layout-stacked .toast-button-group{-ms-flex-pack:end;justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--border-radius:14px;--button-color:var(--ion-color-primary, #0054e9);--color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));--max-width:700px;--max-height:478px;--start:10px;--end:10px;font-size:clamp(14px, 0.875rem, 43.4px)}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;z-index:10}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.toast-translucent) .toast-wrapper{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}:host(.ion-color.toast-translucent) .toast-wrapper{background:rgba(var(--ion-color-base-rgb), 0.8)}}.toast-wrapper.toast-middle{opacity:0.01}.toast-content{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:15px;padding-bottom:15px}.toast-header{margin-bottom:2px;font-weight:500}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;min-height:44px;-webkit-transition:background-color, opacity 100ms linear;transition:background-color, opacity 100ms linear;border:0;background-color:transparent;font-family:var(--ion-font-family);font-size:clamp(17px, 1.0625rem, 21.998px);font-weight:500;overflow:hidden}.toast-button.ion-activated{opacity:0.4}@media (any-hover: hover){.toast-button:hover{opacity:0.6}}";
- var IonToastIosStyle0 = toastIosCss;
- const toastMdCss = ":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}:host{inset-inline-start:0}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);pointer-events:auto}.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}.toast-wrapper.toast-top{-webkit-transform:translate3d(0, -100%, 0);transform:translate3d(0, -100%, 0);top:0}.toast-wrapper.toast-bottom{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);bottom:0}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.toast-layout-baseline .toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-content{min-width:0}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-layout-stacked .toast-button-group{-ms-flex-pack:end;justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-800, var(--ion-background-color-step-800, #333333));--border-radius:4px;--box-shadow:0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);--button-color:var(--ion-color-primary, #0054e9);--color:var(--ion-color-step-50, var(--ion-text-color-step-950, #f2f2f2));--max-width:700px;--start:8px;--end:8px;font-size:0.875rem}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;opacity:0.01;z-index:10}.toast-content{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:14px;padding-bottom:14px}.toast-header{margin-bottom:2px;font-weight:500;line-height:1.25rem}.toast-message{line-height:1.25rem}.toast-layout-baseline .toast-button-group-start{-webkit-margin-start:8px;margin-inline-start:8px}.toast-layout-stacked .toast-button-group-start{-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px}.toast-layout-baseline .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px}.toast-layout-stacked .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px;margin-bottom:8px}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;position:relative;background-color:transparent;font-family:var(--ion-font-family);font-size:0.875rem;font-weight:500;letter-spacing:0.84px;text-transform:uppercase;overflow:hidden}.toast-button-cancel{color:var(--ion-color-step-100, var(--ion-text-color-step-900, #e6e6e6))}.toast-button-icon-only{border-radius:50%;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px;padding-top:9px;padding-bottom:9px;width:36px;height:36px}@media (any-hover: hover){.toast-button:hover{background-color:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08)}.toast-button-cancel:hover{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.08)}}";
- var IonToastMdStyle0 = toastMdCss;
- // TODO(FW-2832): types
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @part button - Any button element that is displayed inside of the toast.
- * @part button cancel - Any button element with role "cancel" that is displayed inside of the toast.
- * @part container - The element that wraps all child elements.
- * @part header - The header text of the toast.
- * @part message - The body text of the toast.
- * @part icon - The icon that appears next to the toast content.
- */
- class Toast {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.didPresent = createEvent(this, "ionToastDidPresent", 7);
- this.willPresent = createEvent(this, "ionToastWillPresent", 7);
- this.willDismiss = createEvent(this, "ionToastWillDismiss", 7);
- this.didDismiss = createEvent(this, "ionToastDidDismiss", 7);
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
- this.delegateController = createDelegateController(this);
- this.lockController = createLockController();
- this.triggerController = createTriggerController();
- this.customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
- this.presented = false;
- this.dispatchCancelHandler = (ev) => {
- const role = ev.detail.role;
- if (isCancel(role)) {
- const cancelButton = this.getButtons().find((b) => b.role === 'cancel');
- this.callButtonHandler(cancelButton);
- }
- };
- /**
- * Create a new swipe gesture so Toast
- * can be swiped to dismiss.
- */
- this.createSwipeGesture = (toastPosition) => {
- const gesture = (this.gesture = createSwipeToDismissGesture(this.el, toastPosition, () => {
- /**
- * If the gesture completed then
- * we should dismiss the toast.
- */
- this.dismiss(undefined, GESTURE);
- }));
- gesture.enable(true);
- };
- /**
- * Destroy an existing swipe gesture
- * so Toast can no longer be swiped to dismiss.
- */
- this.destroySwipeGesture = () => {
- const { gesture } = this;
- if (gesture === undefined) {
- return;
- }
- gesture.destroy();
- this.gesture = undefined;
- };
- /**
- * Returns `true` if swipeGesture
- * is configured to a value that enables the swipe behavior.
- * Returns `false` otherwise.
- */
- this.prefersSwipeGesture = () => {
- const { swipeGesture } = this;
- return swipeGesture === 'vertical';
- };
- this.revealContentToScreenReader = false;
- this.overlayIndex = undefined;
- this.delegate = undefined;
- this.hasController = false;
- this.color = undefined;
- this.enterAnimation = undefined;
- this.leaveAnimation = undefined;
- this.cssClass = undefined;
- this.duration = config.getNumber('toastDuration', 0);
- this.header = undefined;
- this.layout = 'baseline';
- this.message = undefined;
- this.keyboardClose = false;
- this.position = 'bottom';
- this.positionAnchor = undefined;
- this.buttons = undefined;
- this.translucent = false;
- this.animated = true;
- this.icon = undefined;
- this.htmlAttributes = undefined;
- this.swipeGesture = undefined;
- this.isOpen = false;
- this.trigger = undefined;
- }
- swipeGestureChanged() {
- /**
- * If the Toast is presented, then we need to destroy
- * any actives gestures before a new gesture is potentially
- * created below.
- *
- * If the Toast is dismissed, then no gesture should be available
- * since the Toast is not visible. This case should never
- * happen since the "dismiss" method handles destroying
- * any active swipe gestures, but we keep this code
- * around to handle the first case.
- */
- this.destroySwipeGesture();
- /**
- * A new swipe gesture should only be created
- * if the Toast is presented. If the Toast is not
- * yet presented then the "present" method will
- * handle calling the swipe gesture setup function.
- */
- if (this.presented && this.prefersSwipeGesture()) {
- /**
- * If the Toast is presented then
- * lastPresentedPosition is defined.
- */
- this.createSwipeGesture(this.lastPresentedPosition);
- }
- }
- onIsOpenChange(newValue, oldValue) {
- if (newValue === true && oldValue === false) {
- this.present();
- }
- else if (newValue === false && oldValue === true) {
- this.dismiss();
- }
- }
- triggerChanged() {
- const { trigger, el, triggerController } = this;
- if (trigger) {
- triggerController.addClickListener(el, trigger);
- }
- }
- connectedCallback() {
- prepareOverlay(this.el);
- this.triggerChanged();
- }
- disconnectedCallback() {
- this.triggerController.removeClickListener();
- }
- componentWillLoad() {
- var _a;
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
- setOverlayId(this.el);
- }
- }
- componentDidLoad() {
- /**
- * If toast was rendered with isOpen="true"
- * then we should open toast immediately.
- */
- if (this.isOpen === true) {
- raf(() => this.present());
- }
- /**
- * When binding values in frameworks such as Angular
- * it is possible for the value to be set after the Web Component
- * initializes but before the value watcher is set up in Stencil.
- * As a result, the watcher callback may not be fired.
- * We work around this by manually calling the watcher
- * callback when the component has loaded and the watcher
- * is configured.
- */
- this.triggerChanged();
- }
- /**
- * Present the toast overlay after it has been created.
- */
- async present() {
- const unlock = await this.lockController.lock();
- await this.delegateController.attachViewToDom();
- const { el, position } = this;
- const anchor = this.getAnchorElement();
- const animationPosition = getAnimationPosition(position, anchor, getIonMode$1(this), el);
- /**
- * Cache the calculated position of the toast, so we can re-use it
- * in the dismiss animation.
- */
- this.lastPresentedPosition = animationPosition;
- await present(this, 'toastEnter', iosEnterAnimation, mdEnterAnimation, {
- position,
- top: animationPosition.top,
- bottom: animationPosition.bottom,
- });
- /**
- * Content is revealed to screen readers after
- * the transition to avoid jank since this
- * state updates will cause a re-render.
- */
- this.revealContentToScreenReader = true;
- if (this.duration > 0) {
- this.durationTimeout = setTimeout(() => this.dismiss(undefined, 'timeout'), this.duration);
- }
- /**
- * If the Toast has a swipe gesture then we can
- * create the gesture so users can swipe the
- * presented Toast.
- */
- if (this.prefersSwipeGesture()) {
- this.createSwipeGesture(animationPosition);
- }
- unlock();
- }
- /**
- * Dismiss the toast overlay after it has been presented.
- *
- * @param data Any data to emit in the dismiss events.
- * @param role The role of the element that is dismissing the toast.
- * This can be useful in a button handler for determining which button was
- * clicked to dismiss the toast.
- * Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
- *
- * This is a no-op if the overlay has not been presented yet. If you want
- * to remove an overlay from the DOM that was never presented, use the
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
- */
- async dismiss(data, role) {
- var _a, _b;
- const unlock = await this.lockController.lock();
- const { durationTimeout, position, lastPresentedPosition } = this;
- if (durationTimeout) {
- clearTimeout(durationTimeout);
- }
- const dismissed = await dismiss(this, data, role, 'toastLeave', iosLeaveAnimation, mdLeaveAnimation,
- /**
- * Fetch the cached position that was calculated back in the present
- * animation. We always want to animate the dismiss from the same
- * position the present stopped at, so the animation looks continuous.
- */
- {
- position,
- top: (_a = lastPresentedPosition === null || lastPresentedPosition === void 0 ? void 0 : lastPresentedPosition.top) !== null && _a !== void 0 ? _a : '',
- bottom: (_b = lastPresentedPosition === null || lastPresentedPosition === void 0 ? void 0 : lastPresentedPosition.bottom) !== null && _b !== void 0 ? _b : '',
- });
- if (dismissed) {
- this.delegateController.removeViewFromDom();
- this.revealContentToScreenReader = false;
- }
- this.lastPresentedPosition = undefined;
- /**
- * If the Toast has a swipe gesture then we can
- * safely destroy it now that it is dismissed.
- */
- this.destroySwipeGesture();
- unlock();
- return dismissed;
- }
- /**
- * Returns a promise that resolves when the toast did dismiss.
- */
- onDidDismiss() {
- return eventMethod(this.el, 'ionToastDidDismiss');
- }
- /**
- * Returns a promise that resolves when the toast will dismiss.
- */
- onWillDismiss() {
- return eventMethod(this.el, 'ionToastWillDismiss');
- }
- getButtons() {
- const buttons = this.buttons
- ? this.buttons.map((b) => {
- return typeof b === 'string' ? { text: b } : b;
- })
- : [];
- return buttons;
- }
- /**
- * Returns the element specified by the positionAnchor prop,
- * or undefined if prop's value is an ID string and the element
- * is not found in the DOM.
- */
- getAnchorElement() {
- const { position, positionAnchor, el } = this;
- /**
- * If positionAnchor is undefined then
- * no anchor should be used when presenting the toast.
- */
- if (positionAnchor === undefined) {
- return;
- }
- if (position === 'middle' && positionAnchor !== undefined) {
- printIonWarning('[ion-toast] - The positionAnchor property is ignored when using position="middle".', this.el);
- return undefined;
- }
- if (typeof positionAnchor === 'string') {
- /**
- * If the anchor is defined as an ID, find the element.
- * We do this on every present so the toast doesn't need
- * to account for the surrounding DOM changing since the
- * last time it was presented.
- */
- const foundEl = document.getElementById(positionAnchor);
- if (foundEl === null) {
- printIonWarning(`[ion-toast] - An anchor element with an ID of "${positionAnchor}" was not found in the DOM.`, el);
- return undefined;
- }
- return foundEl;
- }
- if (positionAnchor instanceof HTMLElement) {
- return positionAnchor;
- }
- printIonWarning('[ion-toast] - Invalid positionAnchor value:', positionAnchor, el);
- return undefined;
- }
- async buttonClick(button) {
- const role = button.role;
- if (isCancel(role)) {
- return this.dismiss(undefined, role);
- }
- const shouldDismiss = await this.callButtonHandler(button);
- if (shouldDismiss) {
- return this.dismiss(undefined, role);
- }
- return Promise.resolve();
- }
- async callButtonHandler(button) {
- if (button === null || button === void 0 ? void 0 : button.handler) {
- // a handler has been provided, execute it
- // pass the handler the values from the inputs
- try {
- const rtn = await safeCall(button.handler);
- if (rtn === false) {
- // if the return value of the handler is false then do not dismiss
- return false;
- }
- }
- catch (e) {
- printIonError('[ion-toast] - Exception in callButtonHandler:', e);
- }
- }
- return true;
- }
- renderButtons(buttons, side) {
- if (buttons.length === 0) {
- return;
- }
- const mode = getIonMode$1(this);
- const buttonGroupsClasses = {
- 'toast-button-group': true,
- [`toast-button-group-${side}`]: true,
- };
- return (hAsync("div", { class: buttonGroupsClasses }, buttons.map((b) => (hAsync("button", Object.assign({}, b.htmlAttributes, { type: "button", class: buttonClass(b), tabIndex: 0, onClick: () => this.buttonClick(b), part: buttonPart(b) }), hAsync("div", { class: "toast-button-inner" }, b.icon && (hAsync("ion-icon", { "aria-hidden": "true", icon: b.icon, slot: b.text === undefined ? 'icon-only' : undefined, class: "toast-button-icon" })), b.text), mode === 'md' && (hAsync("ion-ripple-effect", { type: b.icon !== undefined && b.text === undefined ? 'unbounded' : 'bounded' })))))));
- }
- /**
- * Render the `message` property.
- * @param key - A key to give the element a stable identity. This is used to improve compatibility with screen readers.
- * @param ariaHidden - If "true" then content will be hidden from screen readers.
- */
- renderToastMessage(key, ariaHidden = null) {
- const { customHTMLEnabled, message } = this;
- if (customHTMLEnabled) {
- return (hAsync("div", { key: key, "aria-hidden": ariaHidden, class: "toast-message", part: "message", innerHTML: sanitizeDOMString(message) }));
- }
- return (hAsync("div", { key: key, "aria-hidden": ariaHidden, class: "toast-message", part: "message" }, message));
- }
- /**
- * Render the `header` property.
- * @param key - A key to give the element a stable identity. This is used to improve compatibility with screen readers.
- * @param ariaHidden - If "true" then content will be hidden from screen readers.
- */
- renderHeader(key, ariaHidden = null) {
- return (hAsync("div", { key: key, class: "toast-header", "aria-hidden": ariaHidden, part: "header" }, this.header));
- }
- render() {
- const { layout, el, revealContentToScreenReader, header, message } = this;
- const allButtons = this.getButtons();
- const startButtons = allButtons.filter((b) => b.side === 'start');
- const endButtons = allButtons.filter((b) => b.side !== 'start');
- const mode = getIonMode$1(this);
- const wrapperClass = {
- 'toast-wrapper': true,
- [`toast-${this.position}`]: true,
- [`toast-layout-${layout}`]: true,
- };
- /**
- * Stacked buttons are only meant to be
- * used with one type of button.
- */
- if (layout === 'stacked' && startButtons.length > 0 && endButtons.length > 0) {
- printIonWarning('[ion-toast] - This toast is using start and end buttons with the stacked toast layout. We recommend following the best practice of using either start or end buttons with the stacked toast layout.', el);
- }
- return (hAsync(Host, Object.assign({ key: 'a2216d860255c99337464370dcb12f6125871a50', tabindex: "-1" }, this.htmlAttributes, { style: {
- zIndex: `${60000 + this.overlayIndex}`,
- }, class: createColorClasses$1(this.color, Object.assign(Object.assign({ [mode]: true }, getClassMap(this.cssClass)), { 'overlay-hidden': true, 'toast-translucent': this.translucent })), onIonToastWillDismiss: this.dispatchCancelHandler }), hAsync("div", { key: 'd5adf8bc4c6c52431600033a76c4795689f9b412', class: wrapperClass }, hAsync("div", { key: 'ab694497ae37ceba123217eb48800129b9bebb84', class: "toast-container", part: "container" }, this.renderButtons(startButtons, 'start'), this.icon !== undefined && (hAsync("ion-icon", { key: '224854fa3989ce0eb69416cb5b0cc55fc9f131ea', class: "toast-icon", part: "icon", icon: this.icon, lazy: false, "aria-hidden": "true" })), hAsync("div", { key: 'c8e11fb5bdac202987f5c8613a0ebbd42bda946e', class: "toast-content", role: "status", "aria-atomic": "true", "aria-live": "polite" }, !revealContentToScreenReader && header !== undefined && this.renderHeader('oldHeader', 'true'), !revealContentToScreenReader && message !== undefined && this.renderToastMessage('oldMessage', 'true'), revealContentToScreenReader && header !== undefined && this.renderHeader('header'), revealContentToScreenReader && message !== undefined && this.renderToastMessage('header')), this.renderButtons(endButtons, 'end')))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "swipeGesture": ["swipeGestureChanged"],
- "isOpen": ["onIsOpenChange"],
- "trigger": ["triggerChanged"]
- }; }
- static get style() { return {
- ios: IonToastIosStyle0,
- md: IonToastMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-toast",
- "$members$": {
- "overlayIndex": [2, "overlay-index"],
- "delegate": [16],
- "hasController": [4, "has-controller"],
- "color": [513],
- "enterAnimation": [16],
- "leaveAnimation": [16],
- "cssClass": [1, "css-class"],
- "duration": [2],
- "header": [1],
- "layout": [1],
- "message": [1],
- "keyboardClose": [4, "keyboard-close"],
- "position": [1],
- "positionAnchor": [1, "position-anchor"],
- "buttons": [16],
- "translucent": [4],
- "animated": [4],
- "icon": [1],
- "htmlAttributes": [16],
- "swipeGesture": [1, "swipe-gesture"],
- "isOpen": [4, "is-open"],
- "trigger": [1],
- "revealContentToScreenReader": [32],
- "present": [64],
- "dismiss": [64],
- "onDidDismiss": [64],
- "onWillDismiss": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const buttonClass = (button) => {
- return {
- 'toast-button': true,
- 'toast-button-icon-only': button.icon !== undefined && button.text === undefined,
- [`toast-button-${button.role}`]: button.role !== undefined,
- 'ion-focusable': true,
- 'ion-activatable': true,
- };
- };
- const buttonPart = (button) => {
- return isCancel(button.role) ? 'button cancel' : 'button';
- };
- const toggleIosCss = ":host{-webkit-box-sizing:content-box !important;box-sizing:content-box !important;display:inline-block;position:relative;max-width:100%;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0;width:100%;height:100%}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}:host(.ion-focused) input{border:2px solid #5e9ed6}:host(.toggle-disabled){pointer-events:none}input{display:none}.toggle-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.toggle-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.toggle-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.toggle-bottom{padding-top:4px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75rem;white-space:normal}:host(.toggle-label-placement-stacked) .toggle-bottom{font-size:1rem}.toggle-bottom .error-text{display:none;color:var(--ion-color-danger, #c5000f)}.toggle-bottom .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}:host(.ion-touched.ion-invalid) .toggle-bottom .error-text{display:block}:host(.ion-touched.ion-invalid) .toggle-bottom .helper-text{display:none}:host(.toggle-label-placement-start) .toggle-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.toggle-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-end) .toggle-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse;-ms-flex-pack:start;justify-content:start}:host(.toggle-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.toggle-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.toggle-label-placement-stacked) .toggle-wrapper{-ms-flex-direction:column;flex-direction:column;text-align:center}:host(.toggle-label-placement-stacked) .label-text-wrapper{-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host(.toggle-label-placement-stacked.toggle-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.toggle-label-placement-stacked.toggle-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).toggle-label-placement-stacked.toggle-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.toggle-label-placement-stacked.toggle-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.toggle-label-placement-stacked.toggle-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.toggle-label-placement-stacked.toggle-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).toggle-label-placement-stacked.toggle-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.toggle-label-placement-stacked.toggle-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.toggle-justify-space-between) .toggle-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.toggle-justify-start) .toggle-wrapper{-ms-flex-pack:start;justify-content:start}:host(.toggle-justify-end) .toggle-wrapper{-ms-flex-pack:end;justify-content:end}:host(.toggle-alignment-start) .toggle-wrapper{-ms-flex-align:start;align-items:start}:host(.toggle-alignment-center) .toggle-wrapper{-ms-flex-align:center;align-items:center}:host(.toggle-justify-space-between),:host(.toggle-justify-start),:host(.toggle-justify-end),:host(.toggle-alignment-start),:host(.toggle-alignment-center){display:block}.toggle-icon-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;height:100%;-webkit-transition:var(--handle-transition);transition:var(--handle-transition);will-change:transform}.toggle-icon{border-radius:var(--border-radius);display:block;position:relative;width:100%;height:100%;background:var(--track-background);overflow:inherit}:host(.toggle-checked) .toggle-icon{background:var(--track-background-checked)}.toggle-inner{border-radius:var(--handle-border-radius);position:absolute;left:var(--handle-spacing);width:var(--handle-width);height:var(--handle-height);max-height:var(--handle-max-height);-webkit-transition:var(--handle-transition);transition:var(--handle-transition);background:var(--handle-background);-webkit-box-shadow:var(--handle-box-shadow);box-shadow:var(--handle-box-shadow);contain:strict}:host(.toggle-ltr) .toggle-inner{left:var(--handle-spacing)}:host(.toggle-rtl) .toggle-inner{right:var(--handle-spacing)}:host(.toggle-ltr.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(100% - var(--handle-width)), 0, 0);transform:translate3d(calc(100% - var(--handle-width)), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(-100% + var(--handle-width)), 0, 0);transform:translate3d(calc(-100% + var(--handle-width)), 0, 0)}:host(.toggle-checked) .toggle-inner{background:var(--handle-background-checked)}:host(.toggle-ltr.toggle-checked) .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0)}:host{--track-background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.088);--track-background-checked:var(--ion-color-primary, #0054e9);--border-radius:15.5px;--handle-background:#ffffff;--handle-background-checked:#ffffff;--handle-border-radius:25.5px;--handle-box-shadow:0 3px 4px rgba(0, 0, 0, 0.06), 0 3px 8px rgba(0, 0, 0, 0.06);--handle-height:calc(31px - (2px * 2));--handle-max-height:calc(100% - var(--handle-spacing) * 2);--handle-width:calc(31px - (2px * 2));--handle-spacing:2px;--handle-transition:transform 300ms, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms, right 110ms ease-in-out 80ms}.native-wrapper .toggle-icon{width:51px;height:31px;overflow:hidden}:host(.ion-color.toggle-checked) .toggle-icon{background:var(--ion-color-base)}:host(.toggle-activated) .toggle-switch-icon{opacity:0}.toggle-icon{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);-webkit-transition:background-color 300ms;transition:background-color 300ms}.toggle-inner{will-change:transform}.toggle-switch-icon{position:absolute;top:50%;width:11px;height:11px;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:opacity 300ms, color 300ms;transition:opacity 300ms, color 300ms}.toggle-switch-icon{position:absolute;color:var(--ion-color-dark, #222428)}:host(.toggle-ltr) .toggle-switch-icon{right:6px}:host(.toggle-rtl) .toggle-switch-icon{right:initial;left:6px;}:host(.toggle-checked) .toggle-switch-icon.toggle-switch-icon-checked{color:var(--ion-color-contrast, #fff)}:host(.toggle-checked) .toggle-switch-icon:not(.toggle-switch-icon-checked){opacity:0}.toggle-switch-icon-checked{position:absolute;width:15px;height:15px;-webkit-transform:translateY(-50%) rotate(90deg);transform:translateY(-50%) rotate(90deg)}:host(.toggle-ltr) .toggle-switch-icon-checked{right:initial;left:4px;}:host(.toggle-rtl) .toggle-switch-icon-checked{right:4px}:host(.toggle-activated) .toggle-icon::before,:host(.toggle-checked) .toggle-icon::before{-webkit-transform:scale3d(0, 0, 0);transform:scale3d(0, 0, 0)}:host(.toggle-activated.toggle-checked) .toggle-inner::before{-webkit-transform:scale3d(0, 0, 0);transform:scale3d(0, 0, 0)}:host(.toggle-activated) .toggle-inner{width:calc(var(--handle-width) + 6px)}:host(.toggle-ltr.toggle-activated.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(100% - var(--handle-width) - 6px), 0, 0);transform:translate3d(calc(100% - var(--handle-width) - 6px), 0, 0)}:host(.toggle-rtl.toggle-activated.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(-100% + var(--handle-width) + 6px), 0, 0);transform:translate3d(calc(-100% + var(--handle-width) + 6px), 0, 0)}:host(.toggle-disabled){opacity:0.3}";
- var IonToggleIosStyle0 = toggleIosCss;
- const toggleMdCss = ":host{-webkit-box-sizing:content-box !important;box-sizing:content-box !important;display:inline-block;position:relative;max-width:100%;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){-ms-flex:1 1 0px;flex:1 1 0;width:100%;height:100%}:host([slot=start]),:host([slot=end]){-ms-flex:initial;flex:initial;width:auto}:host(.ion-focused) input{border:2px solid #5e9ed6}:host(.toggle-disabled){pointer-events:none}input{display:none}.toggle-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:inherit;-webkit-transition:background-color 15ms linear;transition:background-color 15ms linear;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.toggle-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.toggle-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.toggle-bottom{padding-top:4px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;font-size:0.75rem;white-space:normal}:host(.toggle-label-placement-stacked) .toggle-bottom{font-size:1rem}.toggle-bottom .error-text{display:none;color:var(--ion-color-danger, #c5000f)}.toggle-bottom .helper-text{display:block;color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d))}:host(.ion-touched.ion-invalid) .toggle-bottom .error-text{display:block}:host(.ion-touched.ion-invalid) .toggle-bottom .helper-text{display:none}:host(.toggle-label-placement-start) .toggle-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.toggle-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-end) .toggle-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse;-ms-flex-pack:start;justify-content:start}:host(.toggle-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.toggle-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.toggle-label-placement-stacked) .toggle-wrapper{-ms-flex-direction:column;flex-direction:column;text-align:center}:host(.toggle-label-placement-stacked) .label-text-wrapper{-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host(.toggle-label-placement-stacked.toggle-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.toggle-label-placement-stacked.toggle-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).toggle-label-placement-stacked.toggle-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.toggle-label-placement-stacked.toggle-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.toggle-label-placement-stacked.toggle-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.toggle-label-placement-stacked.toggle-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).toggle-label-placement-stacked.toggle-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.toggle-label-placement-stacked.toggle-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.toggle-justify-space-between) .toggle-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.toggle-justify-start) .toggle-wrapper{-ms-flex-pack:start;justify-content:start}:host(.toggle-justify-end) .toggle-wrapper{-ms-flex-pack:end;justify-content:end}:host(.toggle-alignment-start) .toggle-wrapper{-ms-flex-align:start;align-items:start}:host(.toggle-alignment-center) .toggle-wrapper{-ms-flex-align:center;align-items:center}:host(.toggle-justify-space-between),:host(.toggle-justify-start),:host(.toggle-justify-end),:host(.toggle-alignment-start),:host(.toggle-alignment-center){display:block}.toggle-icon-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;width:100%;height:100%;-webkit-transition:var(--handle-transition);transition:var(--handle-transition);will-change:transform}.toggle-icon{border-radius:var(--border-radius);display:block;position:relative;width:100%;height:100%;background:var(--track-background);overflow:inherit}:host(.toggle-checked) .toggle-icon{background:var(--track-background-checked)}.toggle-inner{border-radius:var(--handle-border-radius);position:absolute;left:var(--handle-spacing);width:var(--handle-width);height:var(--handle-height);max-height:var(--handle-max-height);-webkit-transition:var(--handle-transition);transition:var(--handle-transition);background:var(--handle-background);-webkit-box-shadow:var(--handle-box-shadow);box-shadow:var(--handle-box-shadow);contain:strict}:host(.toggle-ltr) .toggle-inner{left:var(--handle-spacing)}:host(.toggle-rtl) .toggle-inner{right:var(--handle-spacing)}:host(.toggle-ltr.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(100% - var(--handle-width)), 0, 0);transform:translate3d(calc(100% - var(--handle-width)), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-icon-wrapper{-webkit-transform:translate3d(calc(-100% + var(--handle-width)), 0, 0);transform:translate3d(calc(-100% + var(--handle-width)), 0, 0)}:host(.toggle-checked) .toggle-inner{background:var(--handle-background-checked)}:host(.toggle-ltr.toggle-checked) .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-inner{-webkit-transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0);transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0)}:host{--track-background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.39);--track-background-checked:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.5);--border-radius:14px;--handle-background:#ffffff;--handle-background-checked:var(--ion-color-primary, #0054e9);--handle-border-radius:50%;--handle-box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);--handle-width:20px;--handle-height:20px;--handle-max-height:calc(100% + 6px);--handle-spacing:0;--handle-transition:transform 160ms cubic-bezier(0.4, 0, 0.2, 1), background-color 160ms cubic-bezier(0.4, 0, 0.2, 1)}.native-wrapper .toggle-icon{width:36px;height:14px}:host(.ion-color.toggle-checked) .toggle-icon{background:rgba(var(--ion-color-base-rgb), 0.5)}:host(.ion-color.toggle-checked) .toggle-inner{background:var(--ion-color-base)}:host(.toggle-checked) .toggle-inner{color:var(--ion-color-contrast, #fff)}.toggle-icon{-webkit-transition:background-color 160ms;transition:background-color 160ms}.toggle-inner{will-change:background-color, transform;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:#000}.toggle-inner .toggle-switch-icon{-webkit-padding-start:1px;padding-inline-start:1px;-webkit-padding-end:1px;padding-inline-end:1px;padding-top:1px;padding-bottom:1px;width:100%;height:100%}:host(.toggle-disabled){opacity:0.38}";
- var IonToggleMdStyle0 = toggleMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - The label text to associate with the toggle. Use the "labelPlacement" property to control where the label is placed relative to the toggle.
- *
- * @part track - The background track of the toggle.
- * @part handle - The toggle handle, or knob, used to change the checked state.
- * @part label - The label text describing the toggle.
- * @part supporting-text - Supporting text displayed beneath the toggle label.
- * @part helper-text - Supporting text displayed beneath the toggle label when the toggle is valid.
- * @part error-text - Supporting text displayed beneath the toggle label when the toggle is invalid and touched.
- */
- class Toggle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionChange = createEvent(this, "ionChange", 7);
- this.ionFocus = createEvent(this, "ionFocus", 7);
- this.ionBlur = createEvent(this, "ionBlur", 7);
- this.inputId = `ion-tg-${toggleIds++}`;
- this.inputLabelId = `${this.inputId}-lbl`;
- this.helperTextId = `${this.inputId}-helper-text`;
- this.errorTextId = `${this.inputId}-error-text`;
- this.lastDrag = 0;
- this.inheritedAttributes = {};
- this.didLoad = false;
- this.setupGesture = async () => {
- const { toggleTrack } = this;
- if (toggleTrack) {
- this.gesture = (await Promise.resolve().then(function () { return index; })).createGesture({
- el: toggleTrack,
- gestureName: 'toggle',
- gesturePriority: 100,
- threshold: 5,
- passive: false,
- onStart: () => this.onStart(),
- onMove: (ev) => this.onMove(ev),
- onEnd: (ev) => this.onEnd(ev),
- });
- this.disabledChanged();
- }
- };
- this.onKeyDown = (ev) => {
- if (ev.key === ' ') {
- ev.preventDefault();
- if (!this.disabled) {
- this.toggleChecked();
- }
- }
- };
- this.onClick = (ev) => {
- if (this.disabled) {
- return;
- }
- ev.preventDefault();
- if (this.lastDrag + 300 < Date.now()) {
- this.toggleChecked();
- }
- };
- /**
- * Stops propagation when the display label is clicked,
- * otherwise, two clicks will be triggered.
- */
- this.onDivLabelClick = (ev) => {
- ev.stopPropagation();
- };
- this.onFocus = () => {
- this.ionFocus.emit();
- };
- this.onBlur = () => {
- this.ionBlur.emit();
- };
- this.getSwitchLabelIcon = (mode, checked) => {
- if (mode === 'md') {
- return checked ? checkmarkOutline : removeOutline;
- }
- return checked ? removeOutline : ellipseOutline;
- };
- this.activated = false;
- this.color = undefined;
- this.name = this.inputId;
- this.checked = false;
- this.disabled = false;
- this.errorText = undefined;
- this.helperText = undefined;
- this.value = 'on';
- this.enableOnOffLabels = config.get('toggleOnOffLabels');
- this.labelPlacement = 'start';
- this.justify = undefined;
- this.alignment = undefined;
- this.required = false;
- }
- disabledChanged() {
- if (this.gesture) {
- this.gesture.enable(!this.disabled);
- }
- }
- toggleChecked() {
- const { checked, value } = this;
- const isNowChecked = !checked;
- this.checked = isNowChecked;
- this.setFocus();
- this.ionChange.emit({
- checked: isNowChecked,
- value,
- });
- }
- async connectedCallback() {
- /**
- * If we have not yet rendered
- * ion-toggle, then toggleTrack is not defined.
- * But if we are moving ion-toggle via appendChild,
- * then toggleTrack will be defined.
- */
- if (this.didLoad) {
- this.setupGesture();
- }
- }
- componentDidLoad() {
- this.setupGesture();
- this.didLoad = true;
- }
- disconnectedCallback() {
- if (this.gesture) {
- this.gesture.destroy();
- this.gesture = undefined;
- }
- }
- componentWillLoad() {
- this.inheritedAttributes = Object.assign({}, inheritAriaAttributes(this.el));
- }
- onStart() {
- this.activated = true;
- // touch-action does not work in iOS
- this.setFocus();
- }
- onMove(detail) {
- if (shouldToggle(isRTL$1(this.el), this.checked, detail.deltaX, -10)) {
- this.toggleChecked();
- hapticSelection();
- }
- }
- onEnd(ev) {
- this.activated = false;
- this.lastDrag = Date.now();
- ev.event.preventDefault();
- ev.event.stopImmediatePropagation();
- }
- getValue() {
- return this.value || '';
- }
- setFocus() {
- if (this.focusEl) {
- this.focusEl.focus();
- }
- }
- renderOnOffSwitchLabels(mode, checked) {
- const icon = this.getSwitchLabelIcon(mode, checked);
- return (hAsync("ion-icon", { class: {
- 'toggle-switch-icon': true,
- 'toggle-switch-icon-checked': checked,
- }, icon: icon, "aria-hidden": "true" }));
- }
- renderToggleControl() {
- const mode = getIonMode$1(this);
- const { enableOnOffLabels, checked } = this;
- return (hAsync("div", { class: "toggle-icon", part: "track", ref: (el) => (this.toggleTrack = el) }, enableOnOffLabels &&
- mode === 'ios' && [this.renderOnOffSwitchLabels(mode, true), this.renderOnOffSwitchLabels(mode, false)], hAsync("div", { class: "toggle-icon-wrapper" }, hAsync("div", { class: "toggle-inner", part: "handle" }, enableOnOffLabels && mode === 'md' && this.renderOnOffSwitchLabels(mode, checked)))));
- }
- get hasLabel() {
- return this.el.textContent !== '';
- }
- getHintTextID() {
- const { el, helperText, errorText, helperTextId, errorTextId } = this;
- if (el.classList.contains('ion-touched') && el.classList.contains('ion-invalid') && errorText) {
- return errorTextId;
- }
- if (helperText) {
- return helperTextId;
- }
- return undefined;
- }
- /**
- * Responsible for rendering helper text and error text.
- * This element should only be rendered if hint text is set.
- */
- renderHintText() {
- const { helperText, errorText, helperTextId, errorTextId } = this;
- /**
- * undefined and empty string values should
- * be treated as not having helper/error text.
- */
- const hasHintText = !!helperText || !!errorText;
- if (!hasHintText) {
- return;
- }
- return (hAsync("div", { class: "toggle-bottom" }, hAsync("div", { id: helperTextId, class: "helper-text", part: "supporting-text helper-text" }, helperText), hAsync("div", { id: errorTextId, class: "error-text", part: "supporting-text error-text" }, errorText)));
- }
- render() {
- const { activated, alignment, checked, color, disabled, el, errorTextId, hasLabel, inheritedAttributes, inputId, inputLabelId, justify, labelPlacement, name, required, } = this;
- const mode = getIonMode$1(this);
- const value = this.getValue();
- const rtl = isRTL$1(el) ? 'rtl' : 'ltr';
- renderHiddenInput(true, el, name, checked ? value : '', disabled);
- return (hAsync(Host, { key: 'd9dad2132e9d6cf8e9844fefa009402e1a637ef8', role: "switch", "aria-checked": `${checked}`, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === errorTextId, onClick: this.onClick, "aria-labelledby": hasLabel ? inputLabelId : null, "aria-label": inheritedAttributes['aria-label'] || null, "aria-disabled": disabled ? 'true' : null, tabindex: disabled ? undefined : 0, onKeyDown: this.onKeyDown, class: createColorClasses$1(color, {
- [mode]: true,
- 'in-item': hostContext('ion-item', el),
- 'toggle-activated': activated,
- 'toggle-checked': checked,
- 'toggle-disabled': disabled,
- [`toggle-justify-${justify}`]: justify !== undefined,
- [`toggle-alignment-${alignment}`]: alignment !== undefined,
- [`toggle-label-placement-${labelPlacement}`]: true,
- [`toggle-${rtl}`]: true,
- }) }, hAsync("label", { key: '4becda2f40a735e941ecaba26f14231271e38197', class: "toggle-wrapper", htmlFor: inputId }, hAsync("input", Object.assign({ key: 'c1946dd6aa23dee3562915a7165e012c48b79890', type: "checkbox", role: "switch", "aria-checked": `${checked}`, checked: checked, disabled: disabled, id: inputId, onFocus: () => this.onFocus(), onBlur: () => this.onBlur(), ref: (focusEl) => (this.focusEl = focusEl), required: required }, inheritedAttributes)), hAsync("div", { key: '2493dc0aa587f5f9d9a7d0a388f92928f2db0cf3', class: {
- 'label-text-wrapper': true,
- 'label-text-wrapper-hidden': !hasLabel,
- }, part: "label", id: inputLabelId, onClick: this.onDivLabelClick }, hAsync("slot", { key: '798220850b311a26b081914d5c774b757bde2992' }), this.renderHintText()), hAsync("div", { key: '3c6142c9697b60646f286f6fd59f54609377f7d0', class: "native-wrapper" }, this.renderToggleControl()))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledChanged"]
- }; }
- static get style() { return {
- ios: IonToggleIosStyle0,
- md: IonToggleMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-toggle",
- "$members$": {
- "color": [513],
- "name": [1],
- "checked": [1028],
- "disabled": [4],
- "errorText": [1, "error-text"],
- "helperText": [1, "helper-text"],
- "value": [1],
- "enableOnOffLabels": [4, "enable-on-off-labels"],
- "labelPlacement": [1, "label-placement"],
- "justify": [1],
- "alignment": [1],
- "required": [4],
- "activated": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const shouldToggle = (rtl, checked, deltaX, margin) => {
- if (checked) {
- return (!rtl && margin > deltaX) || (rtl && -margin < deltaX);
- }
- else {
- return (!rtl && -margin < deltaX) || (rtl && margin > deltaX);
- }
- };
- let toggleIds = 0;
- const toolbarIosCss = ":host{--border-width:0;--border-style:solid;--opacity:1;--opacity-scale:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;width:100%;padding-right:var(--ion-safe-area-right);padding-left:var(--ion-safe-area-left);color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;-webkit-box-sizing:border-box;box-sizing:border-box}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:calc(var(--opacity) * var(--opacity-scale));z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-color-step-50, var(--ion-background-color-step-50, #f7f7f7)));--color:var(--ion-toolbar-color, var(--ion-text-color, #000));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, rgba(0, 0, 0, 0.2)))));--padding-top:3px;--padding-bottom:3px;--padding-start:4px;--padding-end:4px;--min-height:44px}.toolbar-content{-ms-flex:1;flex:1;-ms-flex-order:4;order:4;min-width:0}:host(.toolbar-segment) .toolbar-content{display:-ms-inline-flexbox;display:inline-flex}:host(.toolbar-searchbar) .toolbar-container{padding-top:0;padding-bottom:0}:host(.toolbar-searchbar) ::slotted(*){-ms-flex-item-align:start;align-self:start}:host(.toolbar-searchbar) ::slotted(ion-chip){margin-top:3px}::slotted(ion-buttons){min-height:38px}::slotted([slot=start]){-ms-flex-order:2;order:2}::slotted([slot=secondary]){-ms-flex-order:3;order:3}::slotted([slot=primary]){-ms-flex-order:5;order:5;text-align:end}::slotted([slot=end]){-ms-flex-order:6;order:6;text-align:end}:host(.toolbar-title-large) .toolbar-container{-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:start;align-items:flex-start}:host(.toolbar-title-large) .toolbar-content ion-title{-ms-flex:1;flex:1;-ms-flex-order:8;order:8;min-width:100%}";
- var IonToolbarIosStyle0 = toolbarIosCss;
- const toolbarMdCss = ":host{--border-width:0;--border-style:solid;--opacity:1;--opacity-scale:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;width:100%;padding-right:var(--ion-safe-area-right);padding-left:var(--ion-safe-area-left);color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;-webkit-box-sizing:border-box;box-sizing:border-box}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;-webkit-transform:translateZ(0);transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:calc(var(--opacity) * var(--opacity-scale));z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-background-color, #fff));--color:var(--ion-toolbar-color, var(--ion-text-color, #424242));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, var(--ion-background-color-step-150, #c1c4cd))));--padding-top:0;--padding-bottom:0;--padding-start:0;--padding-end:0;--min-height:56px}.toolbar-content{-ms-flex:1;flex:1;-ms-flex-order:3;order:3;min-width:0;max-width:100%}::slotted(.buttons-first-slot){-webkit-margin-start:4px;margin-inline-start:4px}::slotted(.buttons-last-slot){-webkit-margin-end:4px;margin-inline-end:4px}::slotted([slot=start]){-ms-flex-order:2;order:2}::slotted([slot=secondary]){-ms-flex-order:4;order:4}::slotted([slot=primary]){-ms-flex-order:5;order:5;text-align:end}::slotted([slot=end]){-ms-flex-order:6;order:6;text-align:end}";
- var IonToolbarMdStyle0 = toolbarMdCss;
- /**
- * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
- *
- * @slot - Content is placed between the named slots if provided without a slot.
- * @slot start - Content is placed to the left of the toolbar text in LTR, and to the right in RTL.
- * @slot secondary - Content is placed to the left of the toolbar text in `ios` mode, and directly to the right in `md` mode.
- * @slot primary - Content is placed to the right of the toolbar text in `ios` mode, and to the far right in `md` mode.
- * @slot end - Content is placed to the right of the toolbar text in LTR, and to the left in RTL.
- *
- * @part background - The background of the toolbar, covering the entire area behind the toolbar content.
- * @part container - The container that wraps all toolbar content, including the default slot and named slot content.
- * @part content - The container for the default slot, wrapping content provided without a named slot.
- */
- class Toolbar {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.childrenStyles = new Map();
- this.color = undefined;
- }
- componentWillLoad() {
- const buttons = Array.from(this.el.querySelectorAll('ion-buttons'));
- const firstButtons = buttons.find((button) => {
- return button.slot === 'start';
- });
- if (firstButtons) {
- firstButtons.classList.add('buttons-first-slot');
- }
- const buttonsReversed = buttons.reverse();
- const lastButtons = buttonsReversed.find((button) => button.slot === 'end') ||
- buttonsReversed.find((button) => button.slot === 'primary') ||
- buttonsReversed.find((button) => button.slot === 'secondary');
- if (lastButtons) {
- lastButtons.classList.add('buttons-last-slot');
- }
- }
- childrenStyle(ev) {
- ev.stopPropagation();
- const tagName = ev.target.tagName;
- const updatedStyles = ev.detail;
- const newStyles = {};
- const childStyles = this.childrenStyles.get(tagName) || {};
- let hasStyleChange = false;
- Object.keys(updatedStyles).forEach((key) => {
- const childKey = `toolbar-${key}`;
- const newValue = updatedStyles[key];
- if (newValue !== childStyles[childKey]) {
- hasStyleChange = true;
- }
- if (newValue) {
- newStyles[childKey] = true;
- }
- });
- if (hasStyleChange) {
- this.childrenStyles.set(tagName, newStyles);
- }
- }
- render() {
- const mode = getIonMode$1(this);
- const childStyles = {};
- this.childrenStyles.forEach((value) => {
- Object.assign(childStyles, value);
- });
- return (hAsync(Host, { key: '402afe7ce0c97883cedd0e48a5a0492a9bfe76ae', class: Object.assign(Object.assign({}, childStyles), createColorClasses$1(this.color, {
- [mode]: true,
- 'in-toolbar': hostContext('ion-toolbar', this.el),
- })) }, hAsync("div", { key: '2465a6dc8d507ec650538378d1be2abd399c58ad', class: "toolbar-background", part: "background" }), hAsync("div", { key: '6075096afd12303b961e4fe9ad345ef2887573af', class: "toolbar-container", part: "container" }, hAsync("slot", { key: '8b7eec1148cfeb339d87cdf9273f2104703e7601', name: "start" }), hAsync("slot", { key: 'b102d3926cade24faf78b7af78ad5e192c4c0308', name: "secondary" }), hAsync("div", { key: 'c6ab2e978328324c6f9e7892024cbcd8b8987067', class: "toolbar-content", part: "content" }, hAsync("slot", { key: '86f8952c4355a9df5b4bbb95e9d0cafefd272d5b' })), hAsync("slot", { key: '501e43431da6b9dd35b47b79222f948d445f7a78', name: "primary" }), hAsync("slot", { key: '84bf1a15a5e52e8e94df9f479c4ce18004f5ab57', name: "end" }))));
- }
- get el() { return getElement(this); }
- static get style() { return {
- ios: IonToolbarIosStyle0,
- md: IonToolbarMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-toolbar",
- "$members$": {
- "color": [513]
- },
- "$listeners$": [[0, "ionStyle", "childrenStyle"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- const titleIosCss = ":host{--color:initial;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-webkit-transform:translateZ(0);transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{top:0;-webkit-padding-start:90px;padding-inline-start:90px;-webkit-padding-end:90px;padding-inline-end:90px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);position:absolute;width:100%;height:100%;-webkit-transform:translateZ(0);transform:translateZ(0);font-size:min(1.0625rem, 20.4px);font-weight:600;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;pointer-events:none}:host{inset-inline-start:0}:host(.title-small){-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px;padding-top:6px;padding-bottom:16px;position:relative;font-size:min(0.8125rem, 23.4px);font-weight:normal}:host(.title-large){-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:2px;padding-bottom:4px;-webkit-transform-origin:left center;transform-origin:left center;position:static;-ms-flex-align:end;align-items:flex-end;min-width:100%;font-size:min(2.125rem, 61.2px);font-weight:700;text-align:start}:host(.title-large.title-rtl){-webkit-transform-origin:right center;transform-origin:right center}:host(.title-large.ion-cloned-element){--color:var(--ion-text-color, #000);font-family:var(--ion-font-family)}:host(.title-large) .toolbar-title{-webkit-transform-origin:inherit;transform-origin:inherit;width:auto}:host-context([dir=rtl]):host(.title-large) .toolbar-title,:host-context([dir=rtl]).title-large .toolbar-title{-webkit-transform-origin:calc(100% - inherit);transform-origin:calc(100% - inherit)}@supports selector(:dir(rtl)){:host(.title-large:dir(rtl)) .toolbar-title{-webkit-transform-origin:calc(100% - inherit);transform-origin:calc(100% - inherit)}}";
- var IonTitleIosStyle0 = titleIosCss;
- const titleMdCss = ":host{--color:initial;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-webkit-transform:translateZ(0);transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:0;padding-bottom:0;font-size:1.25rem;font-weight:500;letter-spacing:0.0125em}:host(.title-small){width:100%;height:100%;font-size:0.9375rem;font-weight:normal}";
- var IonTitleMdStyle0 = titleMdCss;
- class ToolbarTitle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.ionStyle = createEvent(this, "ionStyle", 7);
- this.color = undefined;
- this.size = undefined;
- }
- sizeChanged() {
- this.emitStyle();
- }
- connectedCallback() {
- this.emitStyle();
- }
- emitStyle() {
- const size = this.getSize();
- this.ionStyle.emit({
- [`title-${size}`]: true,
- });
- }
- getSize() {
- return this.size !== undefined ? this.size : 'default';
- }
- render() {
- const mode = getIonMode$1(this);
- const size = this.getSize();
- return (hAsync(Host, { key: '3f7b19c99961dbb86c0a925218332528b22e6880', class: createColorClasses$1(this.color, {
- [mode]: true,
- [`title-${size}`]: true,
- 'title-rtl': document.dir === 'rtl',
- }) }, hAsync("div", { key: '12054fbdd60e40a15875e442c20143766fc34fc3', class: "toolbar-title" }, hAsync("slot", { key: '9f14fb14a67d4bd1e4536a4d64a637fbe5a151c7' }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "size": ["sizeChanged"]
- }; }
- static get style() { return {
- ios: IonTitleIosStyle0,
- md: IonTitleMdStyle0
- }; }
- static get cmpMeta() { return {
- "$flags$": 41,
- "$tagName$": "ion-title",
- "$members$": {
- "color": [513],
- "size": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["color", "color"]]
- }; }
- }
- registerComponents([
- Accordion,
- AccordionGroup,
- ActionSheet,
- Alert,
- App,
- Avatar,
- BackButton,
- Backdrop,
- Badge,
- Breadcrumb,
- Breadcrumbs,
- Button,
- Buttons,
- Card,
- CardContent,
- CardHeader,
- CardSubtitle,
- CardTitle,
- Checkbox,
- Chip,
- Col,
- Content,
- Datetime,
- DatetimeButton,
- Fab,
- FabButton,
- FabList,
- Footer,
- Grid,
- Header,
- Icon,
- Img,
- InfiniteScroll,
- InfiniteScrollContent,
- Input,
- InputPasswordToggle,
- Item,
- ItemDivider,
- ItemGroup,
- ItemOption,
- ItemOptions,
- ItemSliding,
- Label,
- List,
- ListHeader,
- Loading,
- Menu,
- MenuButton,
- MenuToggle,
- Modal,
- Nav,
- NavLink,
- Note,
- Picker$1,
- Picker,
- PickerColumn,
- PickerColumnCmp,
- PickerColumnOption,
- Popover,
- ProgressBar,
- Radio,
- RadioGroup,
- Range,
- Refresher,
- RefresherContent,
- Reorder,
- ReorderGroup,
- RippleEffect,
- Route,
- RouteRedirect,
- Router,
- RouterLink,
- RouterOutlet,
- Row,
- Searchbar,
- Segment,
- SegmentButton,
- SegmentContent,
- SegmentView,
- Select,
- SelectModal,
- SelectOption,
- SelectPopover,
- SkeletonText,
- Spinner,
- SplitPane,
- Tab,
- TabBar,
- TabButton,
- Tabs,
- Text,
- Textarea,
- Thumbnail,
- Toast,
- Toggle,
- Toolbar,
- ToolbarTitle,
- ]);
- const DURATION = 540;
- // TODO(FW-2832): types
- const getClonedElement = (tagName) => {
- return document.querySelector(`${tagName}.ion-cloned-element`);
- };
- const shadow = (el) => {
- return el.shadowRoot || el;
- };
- const getLargeTitle = (refEl) => {
- const tabs = refEl.tagName === 'ION-TABS' ? refEl : refEl.querySelector('ion-tabs');
- const query = 'ion-content ion-header:not(.header-collapse-condense-inactive) ion-title.title-large';
- if (tabs != null) {
- const activeTab = tabs.querySelector('ion-tab:not(.tab-hidden), .ion-page:not(.ion-page-hidden)');
- return activeTab != null ? activeTab.querySelector(query) : null;
- }
- return refEl.querySelector(query);
- };
- const getBackButton = (refEl, backDirection) => {
- const tabs = refEl.tagName === 'ION-TABS' ? refEl : refEl.querySelector('ion-tabs');
- let buttonsList = [];
- if (tabs != null) {
- const activeTab = tabs.querySelector('ion-tab:not(.tab-hidden), .ion-page:not(.ion-page-hidden)');
- if (activeTab != null) {
- buttonsList = activeTab.querySelectorAll('ion-buttons');
- }
- }
- else {
- buttonsList = refEl.querySelectorAll('ion-buttons');
- }
- for (const buttons of buttonsList) {
- const parentHeader = buttons.closest('ion-header');
- const activeHeader = parentHeader && !parentHeader.classList.contains('header-collapse-condense-inactive');
- const backButton = buttons.querySelector('ion-back-button');
- const buttonsCollapse = buttons.classList.contains('buttons-collapse');
- const startSlot = buttons.slot === 'start' || buttons.slot === '';
- if (backButton !== null && startSlot && ((buttonsCollapse && activeHeader && backDirection) || !buttonsCollapse)) {
- return backButton;
- }
- }
- return null;
- };
- const createLargeTitleTransition = (rootAnimation, rtl, backDirection, enteringEl, leavingEl) => {
- const enteringBackButton = getBackButton(enteringEl, backDirection);
- const leavingLargeTitle = getLargeTitle(leavingEl);
- const enteringLargeTitle = getLargeTitle(enteringEl);
- const leavingBackButton = getBackButton(leavingEl, backDirection);
- const shouldAnimationForward = enteringBackButton !== null && leavingLargeTitle !== null && !backDirection;
- const shouldAnimationBackward = enteringLargeTitle !== null && leavingBackButton !== null && backDirection;
- if (shouldAnimationForward) {
- const leavingLargeTitleBox = leavingLargeTitle.getBoundingClientRect();
- const enteringBackButtonBox = enteringBackButton.getBoundingClientRect();
- const enteringBackButtonTextEl = shadow(enteringBackButton).querySelector('.button-text');
- // Text element not rendered if developers pass text="" to the back button
- const enteringBackButtonTextBox = enteringBackButtonTextEl === null || enteringBackButtonTextEl === void 0 ? void 0 : enteringBackButtonTextEl.getBoundingClientRect();
- const leavingLargeTitleTextEl = shadow(leavingLargeTitle).querySelector('.toolbar-title');
- const leavingLargeTitleTextBox = leavingLargeTitleTextEl.getBoundingClientRect();
- animateLargeTitle(rootAnimation, rtl, backDirection, leavingLargeTitle, leavingLargeTitleBox, leavingLargeTitleTextBox, enteringBackButtonBox, enteringBackButtonTextEl, enteringBackButtonTextBox);
- animateBackButton(rootAnimation, rtl, backDirection, enteringBackButton, enteringBackButtonBox, enteringBackButtonTextEl, enteringBackButtonTextBox, leavingLargeTitle, leavingLargeTitleTextBox);
- }
- else if (shouldAnimationBackward) {
- const enteringLargeTitleBox = enteringLargeTitle.getBoundingClientRect();
- const leavingBackButtonBox = leavingBackButton.getBoundingClientRect();
- const leavingBackButtonTextEl = shadow(leavingBackButton).querySelector('.button-text');
- // Text element not rendered if developers pass text="" to the back button
- const leavingBackButtonTextBox = leavingBackButtonTextEl === null || leavingBackButtonTextEl === void 0 ? void 0 : leavingBackButtonTextEl.getBoundingClientRect();
- const enteringLargeTitleTextEl = shadow(enteringLargeTitle).querySelector('.toolbar-title');
- const enteringLargeTitleTextBox = enteringLargeTitleTextEl.getBoundingClientRect();
- animateLargeTitle(rootAnimation, rtl, backDirection, enteringLargeTitle, enteringLargeTitleBox, enteringLargeTitleTextBox, leavingBackButtonBox, leavingBackButtonTextEl, leavingBackButtonTextBox);
- animateBackButton(rootAnimation, rtl, backDirection, leavingBackButton, leavingBackButtonBox, leavingBackButtonTextEl, leavingBackButtonTextBox, enteringLargeTitle, enteringLargeTitleTextBox);
- }
- return {
- forward: shouldAnimationForward,
- backward: shouldAnimationBackward,
- };
- };
- const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, backButtonBox, backButtonTextEl, backButtonTextBox, largeTitleEl, largeTitleTextBox) => {
- var _a, _b;
- const BACK_BUTTON_START_OFFSET = rtl ? `calc(100% - ${backButtonBox.right + 4}px)` : `${backButtonBox.left - 4}px`;
- const TEXT_ORIGIN_X = rtl ? 'right' : 'left';
- const ICON_ORIGIN_X = rtl ? 'left' : 'right';
- const CONTAINER_ORIGIN_X = rtl ? 'right' : 'left';
- let WIDTH_SCALE = 1;
- let HEIGHT_SCALE = 1;
- let TEXT_START_SCALE = `scale(${HEIGHT_SCALE})`;
- const TEXT_END_SCALE = 'scale(1)';
- if (backButtonTextEl && backButtonTextBox) {
- /**
- * When the title and back button texts match then they should overlap during the
- * page transition. If the texts do not match up then the back button text scale
- * adjusts to not perfectly match the large title text otherwise the proportions
- * will be incorrect. When the texts match we scale both the width and height to
- * account for font weight differences between the title and back button.
- */
- const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
- WIDTH_SCALE = largeTitleTextBox.width / backButtonTextBox.width;
- /**
- * Subtract an offset to account for slight sizing/padding differences between the
- * title and the back button.
- */
- HEIGHT_SCALE = (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET) / backButtonTextBox.height;
- /**
- * Even though we set TEXT_START_SCALE to HEIGHT_SCALE above, we potentially need
- * to re-compute this here since the HEIGHT_SCALE may have changed.
- */
- TEXT_START_SCALE = doTitleAndButtonTextsMatch ? `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})` : `scale(${HEIGHT_SCALE})`;
- }
- const backButtonIconEl = shadow(backButtonEl).querySelector('ion-icon');
- const backButtonIconBox = backButtonIconEl.getBoundingClientRect();
- /**
- * We need to offset the container by the icon dimensions
- * so that the back button text aligns with the large title
- * text. Otherwise, the back button icon will align with the
- * large title text but the back button text will not.
- */
- const CONTAINER_START_TRANSLATE_X = rtl
- ? `${backButtonIconBox.width / 2 - (backButtonIconBox.right - backButtonBox.right)}px`
- : `${backButtonBox.left - backButtonIconBox.width / 2}px`;
- const CONTAINER_END_TRANSLATE_X = rtl ? `-${window.innerWidth - backButtonBox.right}px` : `${backButtonBox.left}px`;
- /**
- * Back button container should be
- * aligned to the top of the title container
- * so the texts overlap as the back button
- * text begins to fade in.
- */
- const CONTAINER_START_TRANSLATE_Y = `${largeTitleTextBox.top}px`;
- /**
- * The cloned back button should align exactly with the
- * real back button on the entering page otherwise there will
- * be a layout shift.
- */
- const CONTAINER_END_TRANSLATE_Y = `${backButtonBox.top}px`;
- /**
- * In the forward direction, the cloned back button
- * container should translate from over the large title
- * to over the back button. In the backward direction,
- * it should translate from over the back button to over
- * the large title.
- */
- const FORWARD_CONTAINER_KEYFRAMES = [
- { offset: 0, transform: `translate3d(${CONTAINER_START_TRANSLATE_X}, ${CONTAINER_START_TRANSLATE_Y}, 0)` },
- { offset: 1, transform: `translate3d(${CONTAINER_END_TRANSLATE_X}, ${CONTAINER_END_TRANSLATE_Y}, 0)` },
- ];
- const BACKWARD_CONTAINER_KEYFRAMES = [
- { offset: 0, transform: `translate3d(${CONTAINER_END_TRANSLATE_X}, ${CONTAINER_END_TRANSLATE_Y}, 0)` },
- { offset: 1, transform: `translate3d(${CONTAINER_START_TRANSLATE_X}, ${CONTAINER_START_TRANSLATE_Y}, 0)` },
- ];
- const CONTAINER_KEYFRAMES = backDirection ? BACKWARD_CONTAINER_KEYFRAMES : FORWARD_CONTAINER_KEYFRAMES;
- /**
- * In the forward direction, the text in the cloned back button
- * should start to be (roughly) the size of the large title
- * and then scale down to be the size of the actual back button.
- * The text should also translate, but that translate is handled
- * by the container keyframes.
- */
- const FORWARD_TEXT_KEYFRAMES = [
- { offset: 0, opacity: 0, transform: TEXT_START_SCALE },
- { offset: 1, opacity: 1, transform: TEXT_END_SCALE },
- ];
- const BACKWARD_TEXT_KEYFRAMES = [
- { offset: 0, opacity: 1, transform: TEXT_END_SCALE },
- { offset: 1, opacity: 0, transform: TEXT_START_SCALE },
- ];
- const TEXT_KEYFRAMES = backDirection ? BACKWARD_TEXT_KEYFRAMES : FORWARD_TEXT_KEYFRAMES;
- /**
- * The icon should scale in/out in the second
- * half of the animation. The icon should also
- * translate, but that translate is handled by the
- * container keyframes.
- */
- const FORWARD_ICON_KEYFRAMES = [
- { offset: 0, opacity: 0, transform: 'scale(0.6)' },
- { offset: 0.6, opacity: 0, transform: 'scale(0.6)' },
- { offset: 1, opacity: 1, transform: 'scale(1)' },
- ];
- const BACKWARD_ICON_KEYFRAMES = [
- { offset: 0, opacity: 1, transform: 'scale(1)' },
- { offset: 0.2, opacity: 0, transform: 'scale(0.6)' },
- { offset: 1, opacity: 0, transform: 'scale(0.6)' },
- ];
- const ICON_KEYFRAMES = backDirection ? BACKWARD_ICON_KEYFRAMES : FORWARD_ICON_KEYFRAMES;
- const enteringBackButtonTextAnimation = createAnimation();
- const enteringBackButtonIconAnimation = createAnimation();
- const enteringBackButtonAnimation = createAnimation();
- const clonedBackButtonEl = getClonedElement('ion-back-button');
- const clonedBackButtonTextEl = shadow(clonedBackButtonEl).querySelector('.button-text');
- const clonedBackButtonIconEl = shadow(clonedBackButtonEl).querySelector('ion-icon');
- clonedBackButtonEl.text = backButtonEl.text;
- clonedBackButtonEl.mode = backButtonEl.mode;
- clonedBackButtonEl.icon = backButtonEl.icon;
- clonedBackButtonEl.color = backButtonEl.color;
- clonedBackButtonEl.disabled = backButtonEl.disabled;
- clonedBackButtonEl.style.setProperty('display', 'block');
- clonedBackButtonEl.style.setProperty('position', 'fixed');
- enteringBackButtonIconAnimation.addElement(clonedBackButtonIconEl);
- enteringBackButtonTextAnimation.addElement(clonedBackButtonTextEl);
- enteringBackButtonAnimation.addElement(clonedBackButtonEl);
- enteringBackButtonAnimation
- .beforeStyles({
- position: 'absolute',
- top: '0px',
- [CONTAINER_ORIGIN_X]: '0px',
- })
- /**
- * The write hooks must be set on this animation as it is guaranteed to run. Other
- * animations such as the back button text animation will not run if the back button
- * has no visible text.
- */
- .beforeAddWrite(() => {
- backButtonEl.style.setProperty('display', 'none');
- clonedBackButtonEl.style.setProperty(TEXT_ORIGIN_X, BACK_BUTTON_START_OFFSET);
- })
- .afterAddWrite(() => {
- backButtonEl.style.setProperty('display', '');
- clonedBackButtonEl.style.setProperty('display', 'none');
- clonedBackButtonEl.style.removeProperty(TEXT_ORIGIN_X);
- })
- .keyframes(CONTAINER_KEYFRAMES);
- enteringBackButtonTextAnimation
- .beforeStyles({
- 'transform-origin': `${TEXT_ORIGIN_X} top`,
- })
- .keyframes(TEXT_KEYFRAMES);
- enteringBackButtonIconAnimation
- .beforeStyles({
- 'transform-origin': `${ICON_ORIGIN_X} center`,
- })
- .keyframes(ICON_KEYFRAMES);
- rootAnimation.addAnimation([
- enteringBackButtonTextAnimation,
- enteringBackButtonIconAnimation,
- enteringBackButtonAnimation,
- ]);
- };
- const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, largeTitleBox, largeTitleTextBox, backButtonBox, backButtonTextEl, backButtonTextBox) => {
- var _a, _b;
- /**
- * The horizontal transform origin for the large title
- */
- const ORIGIN_X = rtl ? 'right' : 'left';
- const TITLE_START_OFFSET = rtl ? `calc(100% - ${largeTitleBox.right}px)` : `${largeTitleBox.left}px`;
- /**
- * The cloned large should align exactly with the
- * real large title on the leaving page otherwise there will
- * be a layout shift.
- */
- const START_TRANSLATE_X = '0px';
- const START_TRANSLATE_Y = `${largeTitleBox.top}px`;
- /**
- * How much to offset the large title translation by.
- * This accounts for differences in sizing between the large
- * title and the back button due to padding and font weight.
- */
- const LARGE_TITLE_TRANSLATION_OFFSET = 8;
- let END_TRANSLATE_X = rtl
- ? `-${window.innerWidth - backButtonBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
- : `${backButtonBox.x + LARGE_TITLE_TRANSLATION_OFFSET}px`;
- /**
- * How much to scale the large title up/down by.
- */
- let HEIGHT_SCALE = 0.5;
- /**
- * The large title always starts full size.
- */
- const START_SCALE = 'scale(1)';
- /**
- * By default, we don't worry about having the large title scaled to perfectly
- * match the back button because we don't know if the back button's text matches
- * the large title's text.
- */
- let END_SCALE = `scale(${HEIGHT_SCALE})`;
- // Text element not rendered if developers pass text="" to the back button
- if (backButtonTextEl && backButtonTextBox) {
- /**
- * The scaled title should (roughly) overlap the back button. This ensures that
- * the back button and title overlap during the animation. Note that since both
- * elements either fade in or fade out over the course of the animation, neither
- * element will be fully visible on top of the other. As a result, the overlap
- * does not need to be perfect, so approximate values are acceptable here.
- */
- END_TRANSLATE_X = rtl
- ? `-${window.innerWidth - backButtonTextBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
- : `${backButtonTextBox.x - LARGE_TITLE_TRANSLATION_OFFSET}px`;
- /**
- * In the forward direction, the large title should start at its normal size and
- * then scale down to be (roughly) the size of the back button on the other view.
- * In the backward direction, the large title should start at (roughly) the size
- * of the back button and then scale up to its original size.
- * Note that since both elements either fade in or fade out over the course of the
- * animation, neither element will be fully visible on top of the other. As a result,
- * the overlap does not need to be perfect, so approximate values are acceptable here.
- */
- /**
- * When the title and back button texts match then they should overlap during the
- * page transition. If the texts do not match up then the large title text scale
- * adjusts to not perfectly match the back button text otherwise the proportions
- * will be incorrect. When the texts match we scale both the width and height to
- * account for font weight differences between the title and back button.
- */
- const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
- const WIDTH_SCALE = backButtonTextBox.width / largeTitleTextBox.width;
- HEIGHT_SCALE = backButtonTextBox.height / (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET);
- /**
- * Even though we set TEXT_START_SCALE to HEIGHT_SCALE above, we potentially need
- * to re-compute this here since the HEIGHT_SCALE may have changed.
- */
- END_SCALE = doTitleAndButtonTextsMatch ? `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})` : `scale(${HEIGHT_SCALE})`;
- }
- /**
- * The midpoints of the back button and the title should align such that the back
- * button and title appear to be centered with each other.
- */
- const backButtonMidPoint = backButtonBox.top + backButtonBox.height / 2;
- const titleMidPoint = (largeTitleBox.height * HEIGHT_SCALE) / 2;
- const END_TRANSLATE_Y = `${backButtonMidPoint - titleMidPoint}px`;
- const BACKWARDS_KEYFRAMES = [
- { offset: 0, opacity: 0, transform: `translate3d(${END_TRANSLATE_X}, ${END_TRANSLATE_Y}, 0) ${END_SCALE}` },
- { offset: 0.1, opacity: 0 },
- { offset: 1, opacity: 1, transform: `translate3d(${START_TRANSLATE_X}, ${START_TRANSLATE_Y}, 0) ${START_SCALE}` },
- ];
- const FORWARDS_KEYFRAMES = [
- {
- offset: 0,
- opacity: 0.99,
- transform: `translate3d(${START_TRANSLATE_X}, ${START_TRANSLATE_Y}, 0) ${START_SCALE}`,
- },
- { offset: 0.6, opacity: 0 },
- { offset: 1, opacity: 0, transform: `translate3d(${END_TRANSLATE_X}, ${END_TRANSLATE_Y}, 0) ${END_SCALE}` },
- ];
- const KEYFRAMES = backDirection ? BACKWARDS_KEYFRAMES : FORWARDS_KEYFRAMES;
- const clonedTitleEl = getClonedElement('ion-title');
- const clonedLargeTitleAnimation = createAnimation();
- clonedTitleEl.innerText = largeTitleEl.innerText;
- clonedTitleEl.size = largeTitleEl.size;
- clonedTitleEl.color = largeTitleEl.color;
- clonedLargeTitleAnimation.addElement(clonedTitleEl);
- clonedLargeTitleAnimation
- .beforeStyles({
- 'transform-origin': `${ORIGIN_X} top`,
- /**
- * Since font size changes will cause
- * the dimension of the large title to change
- * we need to set the cloned title height
- * equal to that of the original large title height.
- */
- height: `${largeTitleBox.height}px`,
- display: '',
- position: 'relative',
- [ORIGIN_X]: TITLE_START_OFFSET,
- })
- .beforeAddWrite(() => {
- largeTitleEl.style.setProperty('opacity', '0');
- })
- .afterAddWrite(() => {
- largeTitleEl.style.setProperty('opacity', '');
- clonedTitleEl.style.setProperty('display', 'none');
- })
- .keyframes(KEYFRAMES);
- rootAnimation.addAnimation(clonedLargeTitleAnimation);
- };
- const iosTransitionAnimation = (navEl, opts) => {
- var _a;
- try {
- const EASING = 'cubic-bezier(0.32,0.72,0,1)';
- const OPACITY = 'opacity';
- const TRANSFORM = 'transform';
- const CENTER = '0%';
- const OFF_OPACITY = 0.8;
- const isRTL = navEl.ownerDocument.dir === 'rtl';
- const OFF_RIGHT = isRTL ? '-99.5%' : '99.5%';
- const OFF_LEFT = isRTL ? '33%' : '-33%';
- const enteringEl = opts.enteringEl;
- const leavingEl = opts.leavingEl;
- const backDirection = opts.direction === 'back';
- const contentEl = enteringEl.querySelector(':scope > ion-content');
- const headerEls = enteringEl.querySelectorAll(':scope > ion-header > *:not(ion-toolbar), :scope > ion-footer > *');
- const enteringToolBarEls = enteringEl.querySelectorAll(':scope > ion-header > ion-toolbar');
- const rootAnimation = createAnimation();
- const enteringContentAnimation = createAnimation();
- rootAnimation
- .addElement(enteringEl)
- .duration(((_a = opts.duration) !== null && _a !== void 0 ? _a : 0) || DURATION)
- .easing(opts.easing || EASING)
- .fill('both')
- .beforeRemoveClass('ion-page-invisible');
- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
- if (leavingEl && navEl !== null && navEl !== undefined) {
- const navDecorAnimation = createAnimation();
- navDecorAnimation.addElement(navEl);
- rootAnimation.addAnimation(navDecorAnimation);
- }
- if (!contentEl && enteringToolBarEls.length === 0 && headerEls.length === 0) {
- enteringContentAnimation.addElement(enteringEl.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs')); // REVIEW
- }
- else {
- enteringContentAnimation.addElement(contentEl); // REVIEW
- enteringContentAnimation.addElement(headerEls);
- }
- rootAnimation.addAnimation(enteringContentAnimation);
- if (backDirection) {
- enteringContentAnimation
- .beforeClearStyles([OPACITY])
- .fromTo('transform', `translateX(${OFF_LEFT})`, `translateX(${CENTER})`)
- .fromTo(OPACITY, OFF_OPACITY, 1);
- }
- else {
- // entering content, forward direction
- enteringContentAnimation
- .beforeClearStyles([OPACITY])
- .fromTo('transform', `translateX(${OFF_RIGHT})`, `translateX(${CENTER})`);
- }
- if (contentEl) {
- const enteringTransitionEffectEl = shadow(contentEl).querySelector('.transition-effect');
- if (enteringTransitionEffectEl) {
- const enteringTransitionCoverEl = enteringTransitionEffectEl.querySelector('.transition-cover');
- const enteringTransitionShadowEl = enteringTransitionEffectEl.querySelector('.transition-shadow');
- const enteringTransitionEffect = createAnimation();
- const enteringTransitionCover = createAnimation();
- const enteringTransitionShadow = createAnimation();
- enteringTransitionEffect
- .addElement(enteringTransitionEffectEl)
- .beforeStyles({ opacity: '1', display: 'block' })
- .afterStyles({ opacity: '', display: '' });
- enteringTransitionCover
- .addElement(enteringTransitionCoverEl) // REVIEW
- .beforeClearStyles([OPACITY])
- .fromTo(OPACITY, 0, 0.1);
- enteringTransitionShadow
- .addElement(enteringTransitionShadowEl) // REVIEW
- .beforeClearStyles([OPACITY])
- .fromTo(OPACITY, 0.03, 0.7);
- enteringTransitionEffect.addAnimation([enteringTransitionCover, enteringTransitionShadow]);
- enteringContentAnimation.addAnimation([enteringTransitionEffect]);
- }
- }
- const enteringContentHasLargeTitle = enteringEl.querySelector('ion-header.header-collapse-condense');
- const { forward, backward } = createLargeTitleTransition(rootAnimation, isRTL, backDirection, enteringEl, leavingEl);
- enteringToolBarEls.forEach((enteringToolBarEl) => {
- const enteringToolBar = createAnimation();
- enteringToolBar.addElement(enteringToolBarEl);
- rootAnimation.addAnimation(enteringToolBar);
- const enteringTitle = createAnimation();
- enteringTitle.addElement(enteringToolBarEl.querySelector('ion-title')); // REVIEW
- const enteringToolBarButtons = createAnimation();
- const buttons = Array.from(enteringToolBarEl.querySelectorAll('ion-buttons,[menuToggle]'));
- const parentHeader = enteringToolBarEl.closest('ion-header');
- const inactiveHeader = parentHeader === null || parentHeader === void 0 ? void 0 : parentHeader.classList.contains('header-collapse-condense-inactive');
- let buttonsToAnimate;
- if (backDirection) {
- buttonsToAnimate = buttons.filter((button) => {
- const isCollapseButton = button.classList.contains('buttons-collapse');
- return (isCollapseButton && !inactiveHeader) || !isCollapseButton;
- });
- }
- else {
- buttonsToAnimate = buttons.filter((button) => !button.classList.contains('buttons-collapse'));
- }
- enteringToolBarButtons.addElement(buttonsToAnimate);
- const enteringToolBarItems = createAnimation();
- enteringToolBarItems.addElement(enteringToolBarEl.querySelectorAll(':scope > *:not(ion-title):not(ion-buttons):not([menuToggle])'));
- const enteringToolBarBg = createAnimation();
- enteringToolBarBg.addElement(shadow(enteringToolBarEl).querySelector('.toolbar-background')); // REVIEW
- const enteringBackButton = createAnimation();
- const backButtonEl = enteringToolBarEl.querySelector('ion-back-button');
- if (backButtonEl) {
- enteringBackButton.addElement(backButtonEl);
- }
- enteringToolBar.addAnimation([
- enteringTitle,
- enteringToolBarButtons,
- enteringToolBarItems,
- enteringToolBarBg,
- enteringBackButton,
- ]);
- enteringToolBarButtons.fromTo(OPACITY, 0.01, 1);
- enteringToolBarItems.fromTo(OPACITY, 0.01, 1);
- if (backDirection) {
- if (!inactiveHeader) {
- enteringTitle
- .fromTo('transform', `translateX(${OFF_LEFT})`, `translateX(${CENTER})`)
- .fromTo(OPACITY, 0.01, 1);
- }
- enteringToolBarItems.fromTo('transform', `translateX(${OFF_LEFT})`, `translateX(${CENTER})`);
- // back direction, entering page has a back button
- enteringBackButton.fromTo(OPACITY, 0.01, 1);
- }
- else {
- // entering toolbar, forward direction
- if (!enteringContentHasLargeTitle) {
- enteringTitle
- .fromTo('transform', `translateX(${OFF_RIGHT})`, `translateX(${CENTER})`)
- .fromTo(OPACITY, 0.01, 1);
- }
- enteringToolBarItems.fromTo('transform', `translateX(${OFF_RIGHT})`, `translateX(${CENTER})`);
- enteringToolBarBg.beforeClearStyles([OPACITY, 'transform']);
- const translucentHeader = parentHeader === null || parentHeader === void 0 ? void 0 : parentHeader.translucent;
- if (!translucentHeader) {
- enteringToolBarBg.fromTo(OPACITY, 0.01, 'var(--opacity)');
- }
- else {
- enteringToolBarBg.fromTo('transform', isRTL ? 'translateX(-100%)' : 'translateX(100%)', 'translateX(0px)');
- }
- // forward direction, entering page has a back button
- if (!forward) {
- enteringBackButton.fromTo(OPACITY, 0.01, 1);
- }
- if (backButtonEl && !forward) {
- const enteringBackBtnText = createAnimation();
- enteringBackBtnText
- .addElement(shadow(backButtonEl).querySelector('.button-text')) // REVIEW
- .fromTo(`transform`, isRTL ? 'translateX(-100px)' : 'translateX(100px)', 'translateX(0px)');
- enteringToolBar.addAnimation(enteringBackBtnText);
- }
- }
- });
- // setup leaving view
- if (leavingEl) {
- const leavingContent = createAnimation();
- const leavingContentEl = leavingEl.querySelector(':scope > ion-content');
- const leavingToolBarEls = leavingEl.querySelectorAll(':scope > ion-header > ion-toolbar');
- const leavingHeaderEls = leavingEl.querySelectorAll(':scope > ion-header > *:not(ion-toolbar), :scope > ion-footer > *');
- if (!leavingContentEl && leavingToolBarEls.length === 0 && leavingHeaderEls.length === 0) {
- leavingContent.addElement(leavingEl.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs')); // REVIEW
- }
- else {
- leavingContent.addElement(leavingContentEl); // REVIEW
- leavingContent.addElement(leavingHeaderEls);
- }
- rootAnimation.addAnimation(leavingContent);
- if (backDirection) {
- // leaving content, back direction
- leavingContent
- .beforeClearStyles([OPACITY])
- .fromTo('transform', `translateX(${CENTER})`, isRTL ? 'translateX(-100%)' : 'translateX(100%)');
- const leavingPage = getIonPageElement(leavingEl);
- rootAnimation.afterAddWrite(() => {
- if (rootAnimation.getDirection() === 'normal') {
- leavingPage.style.setProperty('display', 'none');
- }
- });
- }
- else {
- // leaving content, forward direction
- leavingContent
- .fromTo('transform', `translateX(${CENTER})`, `translateX(${OFF_LEFT})`)
- .fromTo(OPACITY, 1, OFF_OPACITY);
- }
- if (leavingContentEl) {
- const leavingTransitionEffectEl = shadow(leavingContentEl).querySelector('.transition-effect');
- if (leavingTransitionEffectEl) {
- const leavingTransitionCoverEl = leavingTransitionEffectEl.querySelector('.transition-cover');
- const leavingTransitionShadowEl = leavingTransitionEffectEl.querySelector('.transition-shadow');
- const leavingTransitionEffect = createAnimation();
- const leavingTransitionCover = createAnimation();
- const leavingTransitionShadow = createAnimation();
- leavingTransitionEffect
- .addElement(leavingTransitionEffectEl)
- .beforeStyles({ opacity: '1', display: 'block' })
- .afterStyles({ opacity: '', display: '' });
- leavingTransitionCover
- .addElement(leavingTransitionCoverEl) // REVIEW
- .beforeClearStyles([OPACITY])
- .fromTo(OPACITY, 0.1, 0);
- leavingTransitionShadow
- .addElement(leavingTransitionShadowEl) // REVIEW
- .beforeClearStyles([OPACITY])
- .fromTo(OPACITY, 0.7, 0.03);
- leavingTransitionEffect.addAnimation([leavingTransitionCover, leavingTransitionShadow]);
- leavingContent.addAnimation([leavingTransitionEffect]);
- }
- }
- leavingToolBarEls.forEach((leavingToolBarEl) => {
- const leavingToolBar = createAnimation();
- leavingToolBar.addElement(leavingToolBarEl);
- const leavingTitle = createAnimation();
- leavingTitle.addElement(leavingToolBarEl.querySelector('ion-title')); // REVIEW
- const leavingToolBarButtons = createAnimation();
- const buttons = leavingToolBarEl.querySelectorAll('ion-buttons,[menuToggle]');
- const parentHeader = leavingToolBarEl.closest('ion-header');
- const inactiveHeader = parentHeader === null || parentHeader === void 0 ? void 0 : parentHeader.classList.contains('header-collapse-condense-inactive');
- const buttonsToAnimate = Array.from(buttons).filter((button) => {
- const isCollapseButton = button.classList.contains('buttons-collapse');
- return (isCollapseButton && !inactiveHeader) || !isCollapseButton;
- });
- leavingToolBarButtons.addElement(buttonsToAnimate);
- const leavingToolBarItems = createAnimation();
- const leavingToolBarItemEls = leavingToolBarEl.querySelectorAll(':scope > *:not(ion-title):not(ion-buttons):not([menuToggle])');
- if (leavingToolBarItemEls.length > 0) {
- leavingToolBarItems.addElement(leavingToolBarItemEls);
- }
- const leavingToolBarBg = createAnimation();
- leavingToolBarBg.addElement(shadow(leavingToolBarEl).querySelector('.toolbar-background')); // REVIEW
- const leavingBackButton = createAnimation();
- const backButtonEl = leavingToolBarEl.querySelector('ion-back-button');
- if (backButtonEl) {
- leavingBackButton.addElement(backButtonEl);
- }
- leavingToolBar.addAnimation([
- leavingTitle,
- leavingToolBarButtons,
- leavingToolBarItems,
- leavingBackButton,
- leavingToolBarBg,
- ]);
- rootAnimation.addAnimation(leavingToolBar);
- // fade out leaving toolbar items
- leavingBackButton.fromTo(OPACITY, 0.99, 0);
- leavingToolBarButtons.fromTo(OPACITY, 0.99, 0);
- leavingToolBarItems.fromTo(OPACITY, 0.99, 0);
- if (backDirection) {
- if (!inactiveHeader) {
- // leaving toolbar, back direction
- leavingTitle
- .fromTo('transform', `translateX(${CENTER})`, isRTL ? 'translateX(-100%)' : 'translateX(100%)')
- .fromTo(OPACITY, 0.99, 0);
- }
- leavingToolBarItems.fromTo('transform', `translateX(${CENTER})`, isRTL ? 'translateX(-100%)' : 'translateX(100%)');
- leavingToolBarBg.beforeClearStyles([OPACITY, 'transform']);
- // leaving toolbar, back direction, and there's no entering toolbar
- // should just slide out, no fading out
- const translucentHeader = parentHeader === null || parentHeader === void 0 ? void 0 : parentHeader.translucent;
- if (!translucentHeader) {
- leavingToolBarBg.fromTo(OPACITY, 'var(--opacity)', 0);
- }
- else {
- leavingToolBarBg.fromTo('transform', 'translateX(0px)', isRTL ? 'translateX(-100%)' : 'translateX(100%)');
- }
- if (backButtonEl && !backward) {
- const leavingBackBtnText = createAnimation();
- leavingBackBtnText
- .addElement(shadow(backButtonEl).querySelector('.button-text')) // REVIEW
- .fromTo('transform', `translateX(${CENTER})`, `translateX(${(isRTL ? -124 : 124) + 'px'})`);
- leavingToolBar.addAnimation(leavingBackBtnText);
- }
- }
- else {
- // leaving toolbar, forward direction
- if (!inactiveHeader) {
- leavingTitle
- .fromTo('transform', `translateX(${CENTER})`, `translateX(${OFF_LEFT})`)
- .fromTo(OPACITY, 0.99, 0)
- .afterClearStyles([TRANSFORM, OPACITY]);
- }
- leavingToolBarItems
- .fromTo('transform', `translateX(${CENTER})`, `translateX(${OFF_LEFT})`)
- .afterClearStyles([TRANSFORM, OPACITY]);
- leavingBackButton.afterClearStyles([OPACITY]);
- leavingTitle.afterClearStyles([OPACITY]);
- leavingToolBarButtons.afterClearStyles([OPACITY]);
- }
- });
- }
- return rootAnimation;
- }
- catch (err) {
- throw err;
- }
- };
- /**
- * The scale of the back button during the animation
- * is computed based on the scale of the large title
- * and vice versa. However, we need to account for slight
- * variations in the size of the large title due to
- * padding and font weight. This value should be used to subtract
- * a small amount from the large title height when computing scales
- * to get more accurate scale results.
- */
- const LARGE_TITLE_SIZE_OFFSET = 10;
- var ios_transition = /*#__PURE__*/Object.freeze({
- __proto__: null,
- shadow: shadow,
- iosTransitionAnimation: iosTransitionAnimation
- });
- const mdTransitionAnimation = (_, opts) => {
- var _a, _b, _c;
- const OFF_BOTTOM = '40px';
- const CENTER = '0px';
- const backDirection = opts.direction === 'back';
- const enteringEl = opts.enteringEl;
- const leavingEl = opts.leavingEl;
- const ionPageElement = getIonPageElement(enteringEl);
- const enteringToolbarEle = ionPageElement.querySelector('ion-toolbar');
- const rootTransition = createAnimation();
- rootTransition.addElement(ionPageElement).fill('both').beforeRemoveClass('ion-page-invisible');
- // animate the component itself
- if (backDirection) {
- rootTransition.duration(((_a = opts.duration) !== null && _a !== void 0 ? _a : 0) || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
- }
- else {
- rootTransition
- .duration(((_b = opts.duration) !== null && _b !== void 0 ? _b : 0) || 280)
- .easing('cubic-bezier(0.36,0.66,0.04,1)')
- .fromTo('transform', `translateY(${OFF_BOTTOM})`, `translateY(${CENTER})`)
- .fromTo('opacity', 0.01, 1);
- }
- // Animate toolbar if it's there
- if (enteringToolbarEle) {
- const enteringToolBar = createAnimation();
- enteringToolBar.addElement(enteringToolbarEle);
- rootTransition.addAnimation(enteringToolBar);
- }
- // setup leaving view
- if (leavingEl && backDirection) {
- // leaving content
- rootTransition.duration(((_c = opts.duration) !== null && _c !== void 0 ? _c : 0) || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
- const leavingPage = createAnimation();
- leavingPage
- .addElement(getIonPageElement(leavingEl))
- .onFinish((currentStep) => {
- if (currentStep === 1 && leavingPage.elements.length > 0) {
- leavingPage.elements[0].style.setProperty('display', 'none');
- }
- })
- .fromTo('transform', `translateY(${CENTER})`, `translateY(${OFF_BOTTOM})`)
- .fromTo('opacity', 1, 0);
- rootTransition.addAnimation(leavingPage);
- }
- return rootTransition;
- };
- var md_transition = /*#__PURE__*/Object.freeze({
- __proto__: null,
- mdTransitionAnimation: mdTransitionAnimation
- });
- const createSwipeBackGesture = (el, canStartHandler, onStartHandler, onMoveHandler, onEndHandler) => {
- const win = el.ownerDocument.defaultView;
- let rtl = isRTL$1(el);
- /**
- * Determine if a gesture is near the edge
- * of the screen. If true, then the swipe
- * to go back gesture should proceed.
- */
- const isAtEdge = (detail) => {
- const threshold = 50;
- const { startX } = detail;
- if (rtl) {
- return startX >= win.innerWidth - threshold;
- }
- return startX <= threshold;
- };
- const getDeltaX = (detail) => {
- return rtl ? -detail.deltaX : detail.deltaX;
- };
- const getVelocityX = (detail) => {
- return rtl ? -detail.velocityX : detail.velocityX;
- };
- const canStart = (detail) => {
- /**
- * The user's locale can change mid-session,
- * so we need to check text direction at
- * the beginning of every gesture.
- */
- rtl = isRTL$1(el);
- return isAtEdge(detail) && canStartHandler();
- };
- const onMove = (detail) => {
- // set the transition animation's progress
- const delta = getDeltaX(detail);
- const stepValue = delta / win.innerWidth;
- onMoveHandler(stepValue);
- };
- const onEnd = (detail) => {
- // the swipe back gesture has ended
- const delta = getDeltaX(detail);
- const width = win.innerWidth;
- const stepValue = delta / width;
- const velocity = getVelocityX(detail);
- const z = width / 2.0;
- const shouldComplete = velocity >= 0 && (velocity > 0.2 || delta > z);
- const missing = shouldComplete ? 1 - stepValue : stepValue;
- const missingDistance = missing * width;
- let realDur = 0;
- if (missingDistance > 5) {
- const dur = missingDistance / Math.abs(velocity);
- realDur = Math.min(dur, 540);
- }
- onEndHandler(shouldComplete, stepValue <= 0 ? 0.01 : clamp(0, stepValue, 0.9999), realDur);
- };
- return createGesture({
- el,
- gestureName: 'goback-swipe',
- /**
- * Swipe to go back should have priority over other horizontal swipe
- * gestures. These gestures have a priority of 100 which is why 101 was chosen here.
- */
- gesturePriority: 101,
- threshold: 10,
- canStart,
- onStart: onStartHandler,
- onMove,
- onEnd,
- });
- };
- var swipeBack = /*#__PURE__*/Object.freeze({
- __proto__: null,
- createSwipeBackGesture: createSwipeBackGesture
- });
- exports.hydrateApp = hydrateApp;
- /*hydrateAppClosure end*/
- hydrateApp(window, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve);
- }
- hydrateAppClosure($stencilWindow);
- }
- /*
- Stencil Hydrate Runner v4.20.0 | MIT Licensed | https://stenciljs.com
- */
- var __defProp = Object.defineProperty;
- var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
- };
- // src/runtime/runtime-constants.ts
- var CONTENT_REF_ID = "r";
- var ORG_LOCATION_ID = "o";
- var SLOT_NODE_ID = "s";
- var TEXT_NODE_ID = "t";
- var XLINK_NS = "http://www.w3.org/1999/xlink";
- // src/mock-doc/attribute.ts
- var attrHandler = {
- get(obj, prop) {
- if (prop in obj) {
- return obj[prop];
- }
- if (typeof prop !== "symbol" && !isNaN(prop)) {
- return obj.__items[prop];
- }
- return void 0;
- }
- };
- var createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
- var MockAttributeMap = class {
- constructor(caseInsensitive = false) {
- this.caseInsensitive = caseInsensitive;
- this.__items = [];
- }
- get length() {
- return this.__items.length;
- }
- item(index) {
- return this.__items[index] || null;
- }
- setNamedItem(attr) {
- attr.namespaceURI = null;
- this.setNamedItemNS(attr);
- }
- setNamedItemNS(attr) {
- if (attr != null && attr.value != null) {
- attr.value = String(attr.value);
- }
- const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
- if (existingAttr != null) {
- existingAttr.value = attr.value;
- } else {
- this.__items.push(attr);
- }
- }
- getNamedItem(attrName) {
- if (this.caseInsensitive) {
- attrName = attrName.toLowerCase();
- }
- return this.getNamedItemNS(null, attrName);
- }
- getNamedItemNS(namespaceURI, attrName) {
- namespaceURI = getNamespaceURI(namespaceURI);
- return this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null;
- }
- removeNamedItem(attr) {
- this.removeNamedItemNS(attr);
- }
- removeNamedItemNS(attr) {
- for (let i = 0, ii = this.__items.length; i < ii; i++) {
- if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
- this.__items.splice(i, 1);
- break;
- }
- }
- }
- [Symbol.iterator]() {
- let i = 0;
- return {
- next: () => ({
- done: i === this.length,
- value: this.item(i++)
- })
- };
- }
- get [Symbol.toStringTag]() {
- return "MockAttributeMap";
- }
- };
- function getNamespaceURI(namespaceURI) {
- return namespaceURI === XLINK_NS ? null : namespaceURI;
- }
- function cloneAttributes(srcAttrs, sortByName = false) {
- const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
- if (srcAttrs != null) {
- const attrLen = srcAttrs.length;
- if (sortByName && attrLen > 1) {
- const sortedAttrs = [];
- for (let i = 0; i < attrLen; i++) {
- const srcAttr = srcAttrs.item(i);
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
- sortedAttrs.push(dstAttr);
- }
- sortedAttrs.sort(sortAttributes).forEach((attr) => {
- dstAttrs.setNamedItemNS(attr);
- });
- } else {
- for (let i = 0; i < attrLen; i++) {
- const srcAttr = srcAttrs.item(i);
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
- dstAttrs.setNamedItemNS(dstAttr);
- }
- }
- }
- return dstAttrs;
- }
- function sortAttributes(a, b) {
- if (a.name < b.name) return -1;
- if (a.name > b.name) return 1;
- return 0;
- }
- var MockAttr = class {
- constructor(attrName, attrValue, namespaceURI = null) {
- this._name = attrName;
- this._value = String(attrValue);
- this._namespaceURI = namespaceURI;
- }
- get name() {
- return this._name;
- }
- set name(value) {
- this._name = value;
- }
- get value() {
- return this._value;
- }
- set value(value) {
- this._value = String(value);
- }
- get nodeName() {
- return this._name;
- }
- set nodeName(value) {
- this._name = value;
- }
- get nodeValue() {
- return this._value;
- }
- set nodeValue(value) {
- this._value = String(value);
- }
- get namespaceURI() {
- return this._namespaceURI;
- }
- set namespaceURI(namespaceURI) {
- this._namespaceURI = namespaceURI;
- }
- };
- // src/mock-doc/class-list.ts
- var MockClassList = class {
- constructor(elm) {
- this.elm = elm;
- }
- add(...classNames) {
- const clsNames = getItems(this.elm);
- let updated = false;
- classNames.forEach((className) => {
- className = String(className);
- validateClass(className);
- if (clsNames.includes(className) === false) {
- clsNames.push(className);
- updated = true;
- }
- });
- if (updated) {
- this.elm.setAttributeNS(null, "class", clsNames.join(" "));
- }
- }
- remove(...classNames) {
- const clsNames = getItems(this.elm);
- let updated = false;
- classNames.forEach((className) => {
- className = String(className);
- validateClass(className);
- const index = clsNames.indexOf(className);
- if (index > -1) {
- clsNames.splice(index, 1);
- updated = true;
- }
- });
- if (updated) {
- this.elm.setAttributeNS(null, "class", clsNames.filter((c) => c.length > 0).join(" "));
- }
- }
- contains(className) {
- className = String(className);
- return getItems(this.elm).includes(className);
- }
- toggle(className) {
- className = String(className);
- if (this.contains(className) === true) {
- this.remove(className);
- } else {
- this.add(className);
- }
- }
- get length() {
- return getItems(this.elm).length;
- }
- item(index) {
- return getItems(this.elm)[index];
- }
- toString() {
- return getItems(this.elm).join(" ");
- }
- };
- function validateClass(className) {
- if (className === "") {
- throw new Error("The token provided must not be empty.");
- }
- if (/\s/.test(className)) {
- throw new Error(
- `The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`
- );
- }
- }
- function getItems(elm) {
- const className = elm.getAttribute("class");
- if (typeof className === "string" && className.length > 0) {
- return className.trim().split(" ").filter((c) => c.length > 0);
- }
- return [];
- }
- // src/mock-doc/css-style-declaration.ts
- var MockCSSStyleDeclaration = class {
- constructor() {
- this._styles = /* @__PURE__ */ new Map();
- }
- setProperty(prop, value) {
- prop = jsCaseToCssCase(prop);
- if (value == null || value === "") {
- this._styles.delete(prop);
- } else {
- this._styles.set(prop, String(value));
- }
- }
- getPropertyValue(prop) {
- prop = jsCaseToCssCase(prop);
- return String(this._styles.get(prop) || "");
- }
- removeProperty(prop) {
- prop = jsCaseToCssCase(prop);
- this._styles.delete(prop);
- }
- get length() {
- return this._styles.size;
- }
- get cssText() {
- const cssText = [];
- this._styles.forEach((value, prop) => {
- cssText.push(`${prop}: ${value};`);
- });
- return cssText.join(" ").trim();
- }
- set cssText(cssText) {
- if (cssText == null || cssText === "") {
- this._styles.clear();
- return;
- }
- cssText.split(";").forEach((rule) => {
- rule = rule.trim();
- if (rule.length > 0) {
- const splt = rule.split(":");
- if (splt.length > 1) {
- const prop = splt[0].trim();
- const value = splt.slice(1).join(":").trim();
- if (prop !== "" && value !== "") {
- this._styles.set(jsCaseToCssCase(prop), value);
- }
- }
- }
- });
- }
- };
- function createCSSStyleDeclaration() {
- return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
- }
- var cssProxyHandler = {
- get(cssStyle, prop) {
- if (prop in cssStyle) {
- return cssStyle[prop];
- }
- prop = cssCaseToJsCase(prop);
- return cssStyle.getPropertyValue(prop);
- },
- set(cssStyle, prop, value) {
- if (prop in cssStyle) {
- cssStyle[prop] = value;
- } else {
- cssStyle.setProperty(prop, value);
- }
- return true;
- }
- };
- function cssCaseToJsCase(str) {
- if (str.length > 1 && str.includes("-") === true) {
- str = str.toLowerCase().split("-").map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join("");
- str = str.slice(0, 1).toLowerCase() + str.slice(1);
- }
- return str;
- }
- function jsCaseToCssCase(str) {
- if (str.length > 1 && str.includes("-") === false && /[A-Z]/.test(str) === true) {
- str = str.replace(/([A-Z])/g, (g) => " " + g[0]).trim().replace(/ /g, "-").toLowerCase();
- }
- return str;
- }
- // src/mock-doc/custom-element-registry.ts
- var MockCustomElementRegistry = class {
- constructor(win) {
- this.win = win;
- }
- define(tagName, cstr, options) {
- if (tagName.toLowerCase() !== tagName) {
- throw new Error(
- `Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`
- );
- }
- if (this.__registry == null) {
- this.__registry = /* @__PURE__ */ new Map();
- }
- this.__registry.set(tagName, { cstr, options });
- if (this.__whenDefined != null) {
- const whenDefinedResolveFns = this.__whenDefined.get(tagName);
- if (whenDefinedResolveFns != null) {
- whenDefinedResolveFns.forEach((whenDefinedResolveFn) => {
- whenDefinedResolveFn();
- });
- whenDefinedResolveFns.length = 0;
- this.__whenDefined.delete(tagName);
- }
- }
- const doc = this.win.document;
- if (doc != null) {
- const hosts = doc.querySelectorAll(tagName);
- hosts.forEach((host) => {
- if (upgradedElements.has(host) === false) {
- tempDisableCallbacks.add(doc);
- const upgradedCmp = createCustomElement(this, doc, tagName);
- for (let i = 0; i < host.childNodes.length; i++) {
- const childNode = host.childNodes[i];
- childNode.remove();
- upgradedCmp.appendChild(childNode);
- }
- tempDisableCallbacks.delete(doc);
- if (proxyElements.has(host)) {
- proxyElements.set(host, upgradedCmp);
- }
- }
- fireConnectedCallback(host);
- });
- }
- }
- get(tagName) {
- if (this.__registry != null) {
- const def = this.__registry.get(tagName.toLowerCase());
- if (def != null) {
- return def.cstr;
- }
- }
- return void 0;
- }
- getName(cstr) {
- for (const [tagName, def] of this.__registry.entries()) {
- if (def.cstr === cstr) {
- return tagName;
- }
- }
- return void 0;
- }
- upgrade(_rootNode) {
- }
- clear() {
- if (this.__registry != null) {
- this.__registry.clear();
- }
- if (this.__whenDefined != null) {
- this.__whenDefined.clear();
- }
- }
- whenDefined(tagName) {
- tagName = tagName.toLowerCase();
- if (this.__registry != null && this.__registry.has(tagName) === true) {
- return Promise.resolve(this.__registry.get(tagName).cstr);
- }
- return new Promise((resolve) => {
- if (this.__whenDefined == null) {
- this.__whenDefined = /* @__PURE__ */ new Map();
- }
- let whenDefinedResolveFns = this.__whenDefined.get(tagName);
- if (whenDefinedResolveFns == null) {
- whenDefinedResolveFns = [];
- this.__whenDefined.set(tagName, whenDefinedResolveFns);
- }
- whenDefinedResolveFns.push(resolve);
- });
- }
- };
- function createCustomElement(customElements, ownerDocument, tagName) {
- const Cstr = customElements.get(tagName);
- if (Cstr != null) {
- const cmp = new Cstr(ownerDocument);
- cmp.nodeName = tagName.toUpperCase();
- upgradedElements.add(cmp);
- return cmp;
- }
- const host = new Proxy(
- {},
- {
- get(obj, prop) {
- const elm2 = proxyElements.get(host);
- if (elm2 != null) {
- return elm2[prop];
- }
- return obj[prop];
- },
- set(obj, prop, val) {
- const elm2 = proxyElements.get(host);
- if (elm2 != null) {
- elm2[prop] = val;
- } else {
- obj[prop] = val;
- }
- return true;
- },
- has(obj, prop) {
- const elm2 = proxyElements.get(host);
- if (prop in elm2) {
- return true;
- }
- if (prop in obj) {
- return true;
- }
- return false;
- }
- }
- );
- const elm = new MockHTMLElement(ownerDocument, tagName);
- proxyElements.set(host, elm);
- return host;
- }
- var proxyElements = /* @__PURE__ */ new WeakMap();
- var upgradedElements = /* @__PURE__ */ new WeakSet();
- function connectNode(ownerDocument, node) {
- node.ownerDocument = ownerDocument;
- if (node.nodeType === 1 /* ELEMENT_NODE */) {
- if (ownerDocument != null && node.nodeName.includes("-")) {
- const win = ownerDocument.defaultView;
- if (win != null && typeof node.connectedCallback === "function" && node.isConnected) {
- fireConnectedCallback(node);
- }
- const shadowRoot = node.shadowRoot;
- if (shadowRoot != null) {
- shadowRoot.childNodes.forEach((childNode) => {
- connectNode(ownerDocument, childNode);
- });
- }
- }
- node.childNodes.forEach((childNode) => {
- connectNode(ownerDocument, childNode);
- });
- } else {
- node.childNodes.forEach((childNode) => {
- childNode.ownerDocument = ownerDocument;
- });
- }
- }
- function fireConnectedCallback(node) {
- if (typeof node.connectedCallback === "function") {
- if (tempDisableCallbacks.has(node.ownerDocument) === false) {
- try {
- node.connectedCallback();
- } catch (e) {
- console.error(e);
- }
- }
- }
- }
- function disconnectNode(node) {
- if (node.nodeType === 1 /* ELEMENT_NODE */) {
- if (node.nodeName.includes("-") === true && typeof node.disconnectedCallback === "function") {
- if (tempDisableCallbacks.has(node.ownerDocument) === false) {
- try {
- node.disconnectedCallback();
- } catch (e) {
- console.error(e);
- }
- }
- }
- node.childNodes.forEach(disconnectNode);
- }
- }
- function attributeChanged(node, attrName, oldValue, newValue) {
- attrName = attrName.toLowerCase();
- const observedAttributes = node.constructor.observedAttributes;
- if (Array.isArray(observedAttributes) === true && observedAttributes.some((obs) => obs.toLowerCase() === attrName) === true) {
- try {
- node.attributeChangedCallback(attrName, oldValue, newValue);
- } catch (e) {
- console.error(e);
- }
- }
- }
- function checkAttributeChanged(node) {
- return node.nodeName.includes("-") === true && typeof node.attributeChangedCallback === "function";
- }
- var tempDisableCallbacks = /* @__PURE__ */ new Set();
- // src/mock-doc/dataset.ts
- function dataset(elm) {
- const ds = {};
- const attributes = elm.attributes;
- const attrLen = attributes.length;
- for (let i = 0; i < attrLen; i++) {
- const attr = attributes.item(i);
- const nodeName = attr.nodeName;
- if (nodeName.startsWith("data-")) {
- ds[dashToPascalCase(nodeName)] = attr.nodeValue;
- }
- }
- return new Proxy(ds, {
- get(_obj, camelCaseProp) {
- return ds[camelCaseProp];
- },
- set(_obj, camelCaseProp, value) {
- const dataAttr = toDataAttribute(camelCaseProp);
- elm.setAttribute(dataAttr, value);
- return true;
- }
- });
- }
- function toDataAttribute(str) {
- return "data-" + String(str).replace(/([A-Z0-9])/g, (g) => " " + g[0]).trim().replace(/ /g, "-").toLowerCase();
- }
- function dashToPascalCase(str) {
- str = String(str).slice(5);
- return str.split("-").map((segment, index) => {
- if (index === 0) {
- return segment.charAt(0).toLowerCase() + segment.slice(1);
- }
- return segment.charAt(0).toUpperCase() + segment.slice(1);
- }).join("");
- }
- // src/mock-doc/event.ts
- var MockEvent = class {
- constructor(type, eventInitDict) {
- this.bubbles = false;
- this.cancelBubble = false;
- this.cancelable = false;
- this.composed = false;
- this.currentTarget = null;
- this.defaultPrevented = false;
- this.srcElement = null;
- this.target = null;
- if (typeof type !== "string") {
- throw new Error(`Event type required`);
- }
- this.type = type;
- this.timeStamp = Date.now();
- if (eventInitDict != null) {
- Object.assign(this, eventInitDict);
- }
- }
- preventDefault() {
- this.defaultPrevented = true;
- }
- stopPropagation() {
- this.cancelBubble = true;
- }
- stopImmediatePropagation() {
- this.cancelBubble = true;
- }
- /**
- * @ref https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
- * @returns a composed path of the event
- */
- composedPath() {
- const composedPath = [];
- let currentElement = this.target;
- while (currentElement) {
- composedPath.push(currentElement);
- if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
- composedPath.push(currentElement.defaultView);
- break;
- }
- if (currentElement.parentElement == null && currentElement.tagName === "HTML") {
- currentElement = currentElement.ownerDocument;
- } else {
- currentElement = currentElement.parentElement;
- }
- }
- return composedPath;
- }
- };
- var MockCustomEvent = class extends MockEvent {
- constructor(type, customEventInitDic) {
- super(type);
- this.detail = null;
- if (customEventInitDic != null) {
- Object.assign(this, customEventInitDic);
- }
- }
- };
- var MockKeyboardEvent = class extends MockEvent {
- constructor(type, keyboardEventInitDic) {
- super(type);
- this.code = "";
- this.key = "";
- this.altKey = false;
- this.ctrlKey = false;
- this.metaKey = false;
- this.shiftKey = false;
- this.location = 0;
- this.repeat = false;
- if (keyboardEventInitDic != null) {
- Object.assign(this, keyboardEventInitDic);
- }
- }
- };
- var MockMouseEvent = class extends MockEvent {
- constructor(type, mouseEventInitDic) {
- super(type);
- this.screenX = 0;
- this.screenY = 0;
- this.clientX = 0;
- this.clientY = 0;
- this.ctrlKey = false;
- this.shiftKey = false;
- this.altKey = false;
- this.metaKey = false;
- this.button = 0;
- this.buttons = 0;
- this.relatedTarget = null;
- if (mouseEventInitDic != null) {
- Object.assign(this, mouseEventInitDic);
- }
- }
- };
- var MockUIEvent = class extends MockEvent {
- constructor(type, uiEventInitDic) {
- super(type);
- this.detail = null;
- this.view = null;
- if (uiEventInitDic != null) {
- Object.assign(this, uiEventInitDic);
- }
- }
- };
- var MockFocusEvent = class extends MockUIEvent {
- constructor(type, focusEventInitDic) {
- super(type);
- this.relatedTarget = null;
- if (focusEventInitDic != null) {
- Object.assign(this, focusEventInitDic);
- }
- }
- };
- var MockEventListener = class {
- constructor(type, handler) {
- this.type = type;
- this.handler = handler;
- }
- };
- function addEventListener(elm, type, handler) {
- const target = elm;
- if (target.__listeners == null) {
- target.__listeners = [];
- }
- target.__listeners.push(new MockEventListener(type, handler));
- }
- function removeEventListener(elm, type, handler) {
- const target = elm;
- if (target != null && Array.isArray(target.__listeners) === true) {
- const elmListener = target.__listeners.find((e) => e.type === type && e.handler === handler);
- if (elmListener != null) {
- const index = target.__listeners.indexOf(elmListener);
- target.__listeners.splice(index, 1);
- }
- }
- }
- function resetEventListeners(target) {
- if (target != null && target.__listeners != null) {
- target.__listeners = null;
- }
- }
- function triggerEventListener(elm, ev) {
- if (elm == null || ev.cancelBubble === true) {
- return;
- }
- const target = elm;
- ev.currentTarget = elm;
- if (Array.isArray(target.__listeners) === true) {
- const listeners = target.__listeners.filter((e) => e.type === ev.type);
- listeners.forEach((listener) => {
- try {
- listener.handler.call(target, ev);
- } catch (err2) {
- console.error(err2);
- }
- });
- }
- if (ev.bubbles === false) {
- return;
- }
- if (elm.nodeName === "#document" /* DOCUMENT_NODE */) {
- triggerEventListener(elm.defaultView, ev);
- } else if (elm.parentElement == null && elm.tagName === "HTML") {
- triggerEventListener(elm.ownerDocument, ev);
- } else {
- triggerEventListener(elm.parentElement, ev);
- }
- }
- function dispatchEvent(currentTarget, ev) {
- ev.target = currentTarget;
- triggerEventListener(currentTarget, ev);
- return true;
- }
- // node_modules/parse5/dist/common/unicode.js
- var UNDEFINED_CODE_POINTS = /* @__PURE__ */ new Set([
- 65534,
- 65535,
- 131070,
- 131071,
- 196606,
- 196607,
- 262142,
- 262143,
- 327678,
- 327679,
- 393214,
- 393215,
- 458750,
- 458751,
- 524286,
- 524287,
- 589822,
- 589823,
- 655358,
- 655359,
- 720894,
- 720895,
- 786430,
- 786431,
- 851966,
- 851967,
- 917502,
- 917503,
- 983038,
- 983039,
- 1048574,
- 1048575,
- 1114110,
- 1114111
- ]);
- var REPLACEMENT_CHARACTER = "\uFFFD";
- var CODE_POINTS;
- (function(CODE_POINTS2) {
- CODE_POINTS2[CODE_POINTS2["EOF"] = -1] = "EOF";
- CODE_POINTS2[CODE_POINTS2["NULL"] = 0] = "NULL";
- CODE_POINTS2[CODE_POINTS2["TABULATION"] = 9] = "TABULATION";
- CODE_POINTS2[CODE_POINTS2["CARRIAGE_RETURN"] = 13] = "CARRIAGE_RETURN";
- CODE_POINTS2[CODE_POINTS2["LINE_FEED"] = 10] = "LINE_FEED";
- CODE_POINTS2[CODE_POINTS2["FORM_FEED"] = 12] = "FORM_FEED";
- CODE_POINTS2[CODE_POINTS2["SPACE"] = 32] = "SPACE";
- CODE_POINTS2[CODE_POINTS2["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
- CODE_POINTS2[CODE_POINTS2["QUOTATION_MARK"] = 34] = "QUOTATION_MARK";
- CODE_POINTS2[CODE_POINTS2["NUMBER_SIGN"] = 35] = "NUMBER_SIGN";
- CODE_POINTS2[CODE_POINTS2["AMPERSAND"] = 38] = "AMPERSAND";
- CODE_POINTS2[CODE_POINTS2["APOSTROPHE"] = 39] = "APOSTROPHE";
- CODE_POINTS2[CODE_POINTS2["HYPHEN_MINUS"] = 45] = "HYPHEN_MINUS";
- CODE_POINTS2[CODE_POINTS2["SOLIDUS"] = 47] = "SOLIDUS";
- CODE_POINTS2[CODE_POINTS2["DIGIT_0"] = 48] = "DIGIT_0";
- CODE_POINTS2[CODE_POINTS2["DIGIT_9"] = 57] = "DIGIT_9";
- CODE_POINTS2[CODE_POINTS2["SEMICOLON"] = 59] = "SEMICOLON";
- CODE_POINTS2[CODE_POINTS2["LESS_THAN_SIGN"] = 60] = "LESS_THAN_SIGN";
- CODE_POINTS2[CODE_POINTS2["EQUALS_SIGN"] = 61] = "EQUALS_SIGN";
- CODE_POINTS2[CODE_POINTS2["GREATER_THAN_SIGN"] = 62] = "GREATER_THAN_SIGN";
- CODE_POINTS2[CODE_POINTS2["QUESTION_MARK"] = 63] = "QUESTION_MARK";
- CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_A"] = 65] = "LATIN_CAPITAL_A";
- CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_F"] = 70] = "LATIN_CAPITAL_F";
- CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_X"] = 88] = "LATIN_CAPITAL_X";
- CODE_POINTS2[CODE_POINTS2["LATIN_CAPITAL_Z"] = 90] = "LATIN_CAPITAL_Z";
- CODE_POINTS2[CODE_POINTS2["RIGHT_SQUARE_BRACKET"] = 93] = "RIGHT_SQUARE_BRACKET";
- CODE_POINTS2[CODE_POINTS2["GRAVE_ACCENT"] = 96] = "GRAVE_ACCENT";
- CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_A"] = 97] = "LATIN_SMALL_A";
- CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_F"] = 102] = "LATIN_SMALL_F";
- CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_X"] = 120] = "LATIN_SMALL_X";
- CODE_POINTS2[CODE_POINTS2["LATIN_SMALL_Z"] = 122] = "LATIN_SMALL_Z";
- CODE_POINTS2[CODE_POINTS2["REPLACEMENT_CHARACTER"] = 65533] = "REPLACEMENT_CHARACTER";
- })(CODE_POINTS = CODE_POINTS || (CODE_POINTS = {}));
- var SEQUENCES = {
- DASH_DASH: "--",
- CDATA_START: "[CDATA[",
- DOCTYPE: "doctype",
- SCRIPT: "script",
- PUBLIC: "public",
- SYSTEM: "system"
- };
- function isSurrogate(cp) {
- return cp >= 55296 && cp <= 57343;
- }
- function isSurrogatePair(cp) {
- return cp >= 56320 && cp <= 57343;
- }
- function getSurrogatePairCodePoint(cp1, cp2) {
- return (cp1 - 55296) * 1024 + 9216 + cp2;
- }
- function isControlCodePoint(cp) {
- return cp !== 32 && cp !== 10 && cp !== 13 && cp !== 9 && cp !== 12 && cp >= 1 && cp <= 31 || cp >= 127 && cp <= 159;
- }
- function isUndefinedCodePoint(cp) {
- return cp >= 64976 && cp <= 65007 || UNDEFINED_CODE_POINTS.has(cp);
- }
- // node_modules/parse5/dist/common/error-codes.js
- var ERR;
- (function(ERR2) {
- ERR2["controlCharacterInInputStream"] = "control-character-in-input-stream";
- ERR2["noncharacterInInputStream"] = "noncharacter-in-input-stream";
- ERR2["surrogateInInputStream"] = "surrogate-in-input-stream";
- ERR2["nonVoidHtmlElementStartTagWithTrailingSolidus"] = "non-void-html-element-start-tag-with-trailing-solidus";
- ERR2["endTagWithAttributes"] = "end-tag-with-attributes";
- ERR2["endTagWithTrailingSolidus"] = "end-tag-with-trailing-solidus";
- ERR2["unexpectedSolidusInTag"] = "unexpected-solidus-in-tag";
- ERR2["unexpectedNullCharacter"] = "unexpected-null-character";
- ERR2["unexpectedQuestionMarkInsteadOfTagName"] = "unexpected-question-mark-instead-of-tag-name";
- ERR2["invalidFirstCharacterOfTagName"] = "invalid-first-character-of-tag-name";
- ERR2["unexpectedEqualsSignBeforeAttributeName"] = "unexpected-equals-sign-before-attribute-name";
- ERR2["missingEndTagName"] = "missing-end-tag-name";
- ERR2["unexpectedCharacterInAttributeName"] = "unexpected-character-in-attribute-name";
- ERR2["unknownNamedCharacterReference"] = "unknown-named-character-reference";
- ERR2["missingSemicolonAfterCharacterReference"] = "missing-semicolon-after-character-reference";
- ERR2["unexpectedCharacterAfterDoctypeSystemIdentifier"] = "unexpected-character-after-doctype-system-identifier";
- ERR2["unexpectedCharacterInUnquotedAttributeValue"] = "unexpected-character-in-unquoted-attribute-value";
- ERR2["eofBeforeTagName"] = "eof-before-tag-name";
- ERR2["eofInTag"] = "eof-in-tag";
- ERR2["missingAttributeValue"] = "missing-attribute-value";
- ERR2["missingWhitespaceBetweenAttributes"] = "missing-whitespace-between-attributes";
- ERR2["missingWhitespaceAfterDoctypePublicKeyword"] = "missing-whitespace-after-doctype-public-keyword";
- ERR2["missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers"] = "missing-whitespace-between-doctype-public-and-system-identifiers";
- ERR2["missingWhitespaceAfterDoctypeSystemKeyword"] = "missing-whitespace-after-doctype-system-keyword";
- ERR2["missingQuoteBeforeDoctypePublicIdentifier"] = "missing-quote-before-doctype-public-identifier";
- ERR2["missingQuoteBeforeDoctypeSystemIdentifier"] = "missing-quote-before-doctype-system-identifier";
- ERR2["missingDoctypePublicIdentifier"] = "missing-doctype-public-identifier";
- ERR2["missingDoctypeSystemIdentifier"] = "missing-doctype-system-identifier";
- ERR2["abruptDoctypePublicIdentifier"] = "abrupt-doctype-public-identifier";
- ERR2["abruptDoctypeSystemIdentifier"] = "abrupt-doctype-system-identifier";
- ERR2["cdataInHtmlContent"] = "cdata-in-html-content";
- ERR2["incorrectlyOpenedComment"] = "incorrectly-opened-comment";
- ERR2["eofInScriptHtmlCommentLikeText"] = "eof-in-script-html-comment-like-text";
- ERR2["eofInDoctype"] = "eof-in-doctype";
- ERR2["nestedComment"] = "nested-comment";
- ERR2["abruptClosingOfEmptyComment"] = "abrupt-closing-of-empty-comment";
- ERR2["eofInComment"] = "eof-in-comment";
- ERR2["incorrectlyClosedComment"] = "incorrectly-closed-comment";
- ERR2["eofInCdata"] = "eof-in-cdata";
- ERR2["absenceOfDigitsInNumericCharacterReference"] = "absence-of-digits-in-numeric-character-reference";
- ERR2["nullCharacterReference"] = "null-character-reference";
- ERR2["surrogateCharacterReference"] = "surrogate-character-reference";
- ERR2["characterReferenceOutsideUnicodeRange"] = "character-reference-outside-unicode-range";
- ERR2["controlCharacterReference"] = "control-character-reference";
- ERR2["noncharacterCharacterReference"] = "noncharacter-character-reference";
- ERR2["missingWhitespaceBeforeDoctypeName"] = "missing-whitespace-before-doctype-name";
- ERR2["missingDoctypeName"] = "missing-doctype-name";
- ERR2["invalidCharacterSequenceAfterDoctypeName"] = "invalid-character-sequence-after-doctype-name";
- ERR2["duplicateAttribute"] = "duplicate-attribute";
- ERR2["nonConformingDoctype"] = "non-conforming-doctype";
- ERR2["missingDoctype"] = "missing-doctype";
- ERR2["misplacedDoctype"] = "misplaced-doctype";
- ERR2["endTagWithoutMatchingOpenElement"] = "end-tag-without-matching-open-element";
- ERR2["closingOfElementWithOpenChildElements"] = "closing-of-element-with-open-child-elements";
- ERR2["disallowedContentInNoscriptInHead"] = "disallowed-content-in-noscript-in-head";
- ERR2["openElementsLeftAfterEof"] = "open-elements-left-after-eof";
- ERR2["abandonedHeadElementChild"] = "abandoned-head-element-child";
- ERR2["misplacedStartTagForHeadElement"] = "misplaced-start-tag-for-head-element";
- ERR2["nestedNoscriptInHead"] = "nested-noscript-in-head";
- ERR2["eofInElementThatCanContainOnlyText"] = "eof-in-element-that-can-contain-only-text";
- })(ERR = ERR || (ERR = {}));
- // node_modules/parse5/dist/tokenizer/preprocessor.js
- var DEFAULT_BUFFER_WATERLINE = 1 << 16;
- var Preprocessor = class {
- constructor(handler) {
- this.handler = handler;
- this.html = "";
- this.pos = -1;
- this.lastGapPos = -2;
- this.gapStack = [];
- this.skipNextNewLine = false;
- this.lastChunkWritten = false;
- this.endOfChunkHit = false;
- this.bufferWaterline = DEFAULT_BUFFER_WATERLINE;
- this.isEol = false;
- this.lineStartPos = 0;
- this.droppedBufferSize = 0;
- this.line = 1;
- this.lastErrOffset = -1;
- }
- /** The column on the current line. If we just saw a gap (eg. a surrogate pair), return the index before. */
- get col() {
- return this.pos - this.lineStartPos + Number(this.lastGapPos !== this.pos);
- }
- get offset() {
- return this.droppedBufferSize + this.pos;
- }
- getError(code) {
- const { line, col, offset } = this;
- return {
- code,
- startLine: line,
- endLine: line,
- startCol: col,
- endCol: col,
- startOffset: offset,
- endOffset: offset
- };
- }
- _err(code) {
- if (this.handler.onParseError && this.lastErrOffset !== this.offset) {
- this.lastErrOffset = this.offset;
- this.handler.onParseError(this.getError(code));
- }
- }
- _addGap() {
- this.gapStack.push(this.lastGapPos);
- this.lastGapPos = this.pos;
- }
- _processSurrogate(cp) {
- if (this.pos !== this.html.length - 1) {
- const nextCp = this.html.charCodeAt(this.pos + 1);
- if (isSurrogatePair(nextCp)) {
- this.pos++;
- this._addGap();
- return getSurrogatePairCodePoint(cp, nextCp);
- }
- } else if (!this.lastChunkWritten) {
- this.endOfChunkHit = true;
- return CODE_POINTS.EOF;
- }
- this._err(ERR.surrogateInInputStream);
- return cp;
- }
- willDropParsedChunk() {
- return this.pos > this.bufferWaterline;
- }
- dropParsedChunk() {
- if (this.willDropParsedChunk()) {
- this.html = this.html.substring(this.pos);
- this.lineStartPos -= this.pos;
- this.droppedBufferSize += this.pos;
- this.pos = 0;
- this.lastGapPos = -2;
- this.gapStack.length = 0;
- }
- }
- write(chunk, isLastChunk) {
- if (this.html.length > 0) {
- this.html += chunk;
- } else {
- this.html = chunk;
- }
- this.endOfChunkHit = false;
- this.lastChunkWritten = isLastChunk;
- }
- insertHtmlAtCurrentPos(chunk) {
- this.html = this.html.substring(0, this.pos + 1) + chunk + this.html.substring(this.pos + 1);
- this.endOfChunkHit = false;
- }
- startsWith(pattern, caseSensitive) {
- if (this.pos + pattern.length > this.html.length) {
- this.endOfChunkHit = !this.lastChunkWritten;
- return false;
- }
- if (caseSensitive) {
- return this.html.startsWith(pattern, this.pos);
- }
- for (let i = 0; i < pattern.length; i++) {
- const cp = this.html.charCodeAt(this.pos + i) | 32;
- if (cp !== pattern.charCodeAt(i)) {
- return false;
- }
- }
- return true;
- }
- peek(offset) {
- const pos = this.pos + offset;
- if (pos >= this.html.length) {
- this.endOfChunkHit = !this.lastChunkWritten;
- return CODE_POINTS.EOF;
- }
- const code = this.html.charCodeAt(pos);
- return code === CODE_POINTS.CARRIAGE_RETURN ? CODE_POINTS.LINE_FEED : code;
- }
- advance() {
- this.pos++;
- if (this.isEol) {
- this.isEol = false;
- this.line++;
- this.lineStartPos = this.pos;
- }
- if (this.pos >= this.html.length) {
- this.endOfChunkHit = !this.lastChunkWritten;
- return CODE_POINTS.EOF;
- }
- let cp = this.html.charCodeAt(this.pos);
- if (cp === CODE_POINTS.CARRIAGE_RETURN) {
- this.isEol = true;
- this.skipNextNewLine = true;
- return CODE_POINTS.LINE_FEED;
- }
- if (cp === CODE_POINTS.LINE_FEED) {
- this.isEol = true;
- if (this.skipNextNewLine) {
- this.line--;
- this.skipNextNewLine = false;
- this._addGap();
- return this.advance();
- }
- }
- this.skipNextNewLine = false;
- if (isSurrogate(cp)) {
- cp = this._processSurrogate(cp);
- }
- const isCommonValidRange = this.handler.onParseError === null || cp > 31 && cp < 127 || cp === CODE_POINTS.LINE_FEED || cp === CODE_POINTS.CARRIAGE_RETURN || cp > 159 && cp < 64976;
- if (!isCommonValidRange) {
- this._checkForProblematicCharacters(cp);
- }
- return cp;
- }
- _checkForProblematicCharacters(cp) {
- if (isControlCodePoint(cp)) {
- this._err(ERR.controlCharacterInInputStream);
- } else if (isUndefinedCodePoint(cp)) {
- this._err(ERR.noncharacterInInputStream);
- }
- }
- retreat(count) {
- this.pos -= count;
- while (this.pos < this.lastGapPos) {
- this.lastGapPos = this.gapStack.pop();
- this.pos--;
- }
- this.isEol = false;
- }
- };
- // node_modules/parse5/dist/common/token.js
- var token_exports = {};
- __export(token_exports, {
- TokenType: () => TokenType,
- getTokenAttr: () => getTokenAttr
- });
- var TokenType;
- (function(TokenType2) {
- TokenType2[TokenType2["CHARACTER"] = 0] = "CHARACTER";
- TokenType2[TokenType2["NULL_CHARACTER"] = 1] = "NULL_CHARACTER";
- TokenType2[TokenType2["WHITESPACE_CHARACTER"] = 2] = "WHITESPACE_CHARACTER";
- TokenType2[TokenType2["START_TAG"] = 3] = "START_TAG";
- TokenType2[TokenType2["END_TAG"] = 4] = "END_TAG";
- TokenType2[TokenType2["COMMENT"] = 5] = "COMMENT";
- TokenType2[TokenType2["DOCTYPE"] = 6] = "DOCTYPE";
- TokenType2[TokenType2["EOF"] = 7] = "EOF";
- TokenType2[TokenType2["HIBERNATION"] = 8] = "HIBERNATION";
- })(TokenType = TokenType || (TokenType = {}));
- function getTokenAttr(token, attrName) {
- for (let i = token.attrs.length - 1; i >= 0; i--) {
- if (token.attrs[i].name === attrName) {
- return token.attrs[i].value;
- }
- }
- return null;
- }
- // node_modules/entities/lib/esm/generated/decode-data-html.js
- var decode_data_html_default = new Uint16Array(
- // prettier-ignore
- '\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map((c) => c.charCodeAt(0))
- );
- // node_modules/entities/lib/esm/generated/decode-data-xml.js
- var decode_data_xml_default = new Uint16Array(
- // prettier-ignore
- "\u0200aglq \x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map((c) => c.charCodeAt(0))
- );
- // node_modules/entities/lib/esm/decode_codepoint.js
- var _a;
- var decodeMap = /* @__PURE__ */ new Map([
- [0, 65533],
- // C1 Unicode control character reference replacements
- [128, 8364],
- [130, 8218],
- [131, 402],
- [132, 8222],
- [133, 8230],
- [134, 8224],
- [135, 8225],
- [136, 710],
- [137, 8240],
- [138, 352],
- [139, 8249],
- [140, 338],
- [142, 381],
- [145, 8216],
- [146, 8217],
- [147, 8220],
- [148, 8221],
- [149, 8226],
- [150, 8211],
- [151, 8212],
- [152, 732],
- [153, 8482],
- [154, 353],
- [155, 8250],
- [156, 339],
- [158, 382],
- [159, 376]
- ]);
- var fromCodePoint = (
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
- (_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function(codePoint) {
- let output = "";
- if (codePoint > 65535) {
- codePoint -= 65536;
- output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296);
- codePoint = 56320 | codePoint & 1023;
- }
- output += String.fromCharCode(codePoint);
- return output;
- }
- );
- function replaceCodePoint(codePoint) {
- var _a2;
- if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) {
- return 65533;
- }
- return (_a2 = decodeMap.get(codePoint)) !== null && _a2 !== void 0 ? _a2 : codePoint;
- }
- // node_modules/entities/lib/esm/decode.js
- var CharCodes;
- (function(CharCodes2) {
- CharCodes2[CharCodes2["NUM"] = 35] = "NUM";
- CharCodes2[CharCodes2["SEMI"] = 59] = "SEMI";
- CharCodes2[CharCodes2["EQUALS"] = 61] = "EQUALS";
- CharCodes2[CharCodes2["ZERO"] = 48] = "ZERO";
- CharCodes2[CharCodes2["NINE"] = 57] = "NINE";
- CharCodes2[CharCodes2["LOWER_A"] = 97] = "LOWER_A";
- CharCodes2[CharCodes2["LOWER_F"] = 102] = "LOWER_F";
- CharCodes2[CharCodes2["LOWER_X"] = 120] = "LOWER_X";
- CharCodes2[CharCodes2["LOWER_Z"] = 122] = "LOWER_Z";
- CharCodes2[CharCodes2["UPPER_A"] = 65] = "UPPER_A";
- CharCodes2[CharCodes2["UPPER_F"] = 70] = "UPPER_F";
- CharCodes2[CharCodes2["UPPER_Z"] = 90] = "UPPER_Z";
- })(CharCodes || (CharCodes = {}));
- var TO_LOWER_BIT = 32;
- var BinTrieFlags;
- (function(BinTrieFlags2) {
- BinTrieFlags2[BinTrieFlags2["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
- BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
- BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE";
- })(BinTrieFlags || (BinTrieFlags = {}));
- function isNumber(code) {
- return code >= CharCodes.ZERO && code <= CharCodes.NINE;
- }
- function isHexadecimalCharacter(code) {
- return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F;
- }
- function isAsciiAlphaNumeric(code) {
- return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber(code);
- }
- function isEntityInAttributeInvalidEnd(code) {
- return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
- }
- var EntityDecoderState;
- (function(EntityDecoderState2) {
- EntityDecoderState2[EntityDecoderState2["EntityStart"] = 0] = "EntityStart";
- EntityDecoderState2[EntityDecoderState2["NumericStart"] = 1] = "NumericStart";
- EntityDecoderState2[EntityDecoderState2["NumericDecimal"] = 2] = "NumericDecimal";
- EntityDecoderState2[EntityDecoderState2["NumericHex"] = 3] = "NumericHex";
- EntityDecoderState2[EntityDecoderState2["NamedEntity"] = 4] = "NamedEntity";
- })(EntityDecoderState || (EntityDecoderState = {}));
- var DecodingMode;
- (function(DecodingMode2) {
- DecodingMode2[DecodingMode2["Legacy"] = 0] = "Legacy";
- DecodingMode2[DecodingMode2["Strict"] = 1] = "Strict";
- DecodingMode2[DecodingMode2["Attribute"] = 2] = "Attribute";
- })(DecodingMode || (DecodingMode = {}));
- var EntityDecoder = class {
- constructor(decodeTree, emitCodePoint, errors) {
- this.decodeTree = decodeTree;
- this.emitCodePoint = emitCodePoint;
- this.errors = errors;
- this.state = EntityDecoderState.EntityStart;
- this.consumed = 1;
- this.result = 0;
- this.treeIndex = 0;
- this.excess = 1;
- this.decodeMode = DecodingMode.Strict;
- }
- /** Resets the instance to make it reusable. */
- startEntity(decodeMode) {
- this.decodeMode = decodeMode;
- this.state = EntityDecoderState.EntityStart;
- this.result = 0;
- this.treeIndex = 0;
- this.excess = 1;
- this.consumed = 1;
- }
- /**
- * Write an entity to the decoder. This can be called multiple times with partial entities.
- * If the entity is incomplete, the decoder will return -1.
- *
- * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
- * entity is incomplete, and resume when the next string is written.
- *
- * @param string The string containing the entity (or a continuation of the entity).
- * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
- * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
- */
- write(str, offset) {
- switch (this.state) {
- case EntityDecoderState.EntityStart: {
- if (str.charCodeAt(offset) === CharCodes.NUM) {
- this.state = EntityDecoderState.NumericStart;
- this.consumed += 1;
- return this.stateNumericStart(str, offset + 1);
- }
- this.state = EntityDecoderState.NamedEntity;
- return this.stateNamedEntity(str, offset);
- }
- case EntityDecoderState.NumericStart: {
- return this.stateNumericStart(str, offset);
- }
- case EntityDecoderState.NumericDecimal: {
- return this.stateNumericDecimal(str, offset);
- }
- case EntityDecoderState.NumericHex: {
- return this.stateNumericHex(str, offset);
- }
- case EntityDecoderState.NamedEntity: {
- return this.stateNamedEntity(str, offset);
- }
- }
- }
- /**
- * Switches between the numeric decimal and hexadecimal states.
- *
- * Equivalent to the `Numeric character reference state` in the HTML spec.
- *
- * @param str The string containing the entity (or a continuation of the entity).
- * @param offset The current offset.
- * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
- */
- stateNumericStart(str, offset) {
- if (offset >= str.length) {
- return -1;
- }
- if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
- this.state = EntityDecoderState.NumericHex;
- this.consumed += 1;
- return this.stateNumericHex(str, offset + 1);
- }
- this.state = EntityDecoderState.NumericDecimal;
- return this.stateNumericDecimal(str, offset);
- }
- addToNumericResult(str, start, end, base) {
- if (start !== end) {
- const digitCount = end - start;
- this.result = this.result * Math.pow(base, digitCount) + parseInt(str.substr(start, digitCount), base);
- this.consumed += digitCount;
- }
- }
- /**
- * Parses a hexadecimal numeric entity.
- *
- * Equivalent to the `Hexademical character reference state` in the HTML spec.
- *
- * @param str The string containing the entity (or a continuation of the entity).
- * @param offset The current offset.
- * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
- */
- stateNumericHex(str, offset) {
- const startIdx = offset;
- while (offset < str.length) {
- const char = str.charCodeAt(offset);
- if (isNumber(char) || isHexadecimalCharacter(char)) {
- offset += 1;
- } else {
- this.addToNumericResult(str, startIdx, offset, 16);
- return this.emitNumericEntity(char, 3);
- }
- }
- this.addToNumericResult(str, startIdx, offset, 16);
- return -1;
- }
- /**
- * Parses a decimal numeric entity.
- *
- * Equivalent to the `Decimal character reference state` in the HTML spec.
- *
- * @param str The string containing the entity (or a continuation of the entity).
- * @param offset The current offset.
- * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
- */
- stateNumericDecimal(str, offset) {
- const startIdx = offset;
- while (offset < str.length) {
- const char = str.charCodeAt(offset);
- if (isNumber(char)) {
- offset += 1;
- } else {
- this.addToNumericResult(str, startIdx, offset, 10);
- return this.emitNumericEntity(char, 2);
- }
- }
- this.addToNumericResult(str, startIdx, offset, 10);
- return -1;
- }
- /**
- * Validate and emit a numeric entity.
- *
- * Implements the logic from the `Hexademical character reference start
- * state` and `Numeric character reference end state` in the HTML spec.
- *
- * @param lastCp The last code point of the entity. Used to see if the
- * entity was terminated with a semicolon.
- * @param expectedLength The minimum number of characters that should be
- * consumed. Used to validate that at least one digit
- * was consumed.
- * @returns The number of characters that were consumed.
- */
- emitNumericEntity(lastCp, expectedLength) {
- var _a2;
- if (this.consumed <= expectedLength) {
- (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.absenceOfDigitsInNumericCharacterReference(this.consumed);
- return 0;
- }
- if (lastCp === CharCodes.SEMI) {
- this.consumed += 1;
- } else if (this.decodeMode === DecodingMode.Strict) {
- return 0;
- }
- this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
- if (this.errors) {
- if (lastCp !== CharCodes.SEMI) {
- this.errors.missingSemicolonAfterCharacterReference();
- }
- this.errors.validateNumericCharacterReference(this.result);
- }
- return this.consumed;
- }
- /**
- * Parses a named entity.
- *
- * Equivalent to the `Named character reference state` in the HTML spec.
- *
- * @param str The string containing the entity (or a continuation of the entity).
- * @param offset The current offset.
- * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
- */
- stateNamedEntity(str, offset) {
- const { decodeTree } = this;
- let current = decodeTree[this.treeIndex];
- let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
- for (; offset < str.length; offset++, this.excess++) {
- const char = str.charCodeAt(offset);
- this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
- if (this.treeIndex < 0) {
- return this.result === 0 || // If we are parsing an attribute
- this.decodeMode === DecodingMode.Attribute && // We shouldn't have consumed any characters after the entity,
- (valueLength === 0 || // And there should be no invalid characters.
- isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity();
- }
- current = decodeTree[this.treeIndex];
- valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
- if (valueLength !== 0) {
- if (char === CharCodes.SEMI) {
- return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
- }
- if (this.decodeMode !== DecodingMode.Strict) {
- this.result = this.treeIndex;
- this.consumed += this.excess;
- this.excess = 0;
- }
- }
- }
- return -1;
- }
- /**
- * Emit a named entity that was not terminated with a semicolon.
- *
- * @returns The number of characters consumed.
- */
- emitNotTerminatedNamedEntity() {
- var _a2;
- const { result, decodeTree } = this;
- const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
- this.emitNamedEntityData(result, valueLength, this.consumed);
- (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.missingSemicolonAfterCharacterReference();
- return this.consumed;
- }
- /**
- * Emit a named entity.
- *
- * @param result The index of the entity in the decode tree.
- * @param valueLength The number of bytes in the entity.
- * @param consumed The number of characters consumed.
- *
- * @returns The number of characters consumed.
- */
- emitNamedEntityData(result, valueLength, consumed) {
- const { decodeTree } = this;
- this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH : decodeTree[result + 1], consumed);
- if (valueLength === 3) {
- this.emitCodePoint(decodeTree[result + 2], consumed);
- }
- return consumed;
- }
- /**
- * Signal to the parser that the end of the input was reached.
- *
- * Remaining data will be emitted and relevant errors will be produced.
- *
- * @returns The number of characters consumed.
- */
- end() {
- var _a2;
- switch (this.state) {
- case EntityDecoderState.NamedEntity: {
- return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
- }
- case EntityDecoderState.NumericDecimal: {
- return this.emitNumericEntity(0, 2);
- }
- case EntityDecoderState.NumericHex: {
- return this.emitNumericEntity(0, 3);
- }
- case EntityDecoderState.NumericStart: {
- (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.absenceOfDigitsInNumericCharacterReference(this.consumed);
- return 0;
- }
- case EntityDecoderState.EntityStart: {
- return 0;
- }
- }
- }
- };
- function getDecoder(decodeTree) {
- let ret = "";
- const decoder = new EntityDecoder(decodeTree, (str) => ret += fromCodePoint(str));
- return function decodeWithTrie(str, decodeMode) {
- let lastIndex = 0;
- let offset = 0;
- while ((offset = str.indexOf("&", offset)) >= 0) {
- ret += str.slice(lastIndex, offset);
- decoder.startEntity(decodeMode);
- const len = decoder.write(
- str,
- // Skip the "&"
- offset + 1
- );
- if (len < 0) {
- lastIndex = offset + decoder.end();
- break;
- }
- lastIndex = offset + len;
- offset = len === 0 ? lastIndex + 1 : lastIndex;
- }
- const result = ret + str.slice(lastIndex);
- ret = "";
- return result;
- };
- }
- function determineBranch(decodeTree, current, nodeIdx, char) {
- const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
- const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
- if (branchCount === 0) {
- return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
- }
- if (jumpOffset) {
- const value = char - jumpOffset;
- return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIdx + value] - 1;
- }
- let lo = nodeIdx;
- let hi = lo + branchCount - 1;
- while (lo <= hi) {
- const mid = lo + hi >>> 1;
- const midVal = decodeTree[mid];
- if (midVal < char) {
- lo = mid + 1;
- } else if (midVal > char) {
- hi = mid - 1;
- } else {
- return decodeTree[mid + branchCount];
- }
- }
- return -1;
- }
- var htmlDecoder = getDecoder(decode_data_html_default);
- var xmlDecoder = getDecoder(decode_data_xml_default);
- // node_modules/parse5/dist/common/html.js
- var html_exports = {};
- __export(html_exports, {
- ATTRS: () => ATTRS,
- DOCUMENT_MODE: () => DOCUMENT_MODE,
- NS: () => NS,
- SPECIAL_ELEMENTS: () => SPECIAL_ELEMENTS,
- TAG_ID: () => TAG_ID,
- TAG_NAMES: () => TAG_NAMES,
- getTagID: () => getTagID,
- hasUnescapedText: () => hasUnescapedText,
- isNumberedHeader: () => isNumberedHeader
- });
- var NS;
- (function(NS2) {
- NS2["HTML"] = "http://www.w3.org/1999/xhtml";
- NS2["MATHML"] = "http://www.w3.org/1998/Math/MathML";
- NS2["SVG"] = "http://www.w3.org/2000/svg";
- NS2["XLINK"] = "http://www.w3.org/1999/xlink";
- NS2["XML"] = "http://www.w3.org/XML/1998/namespace";
- NS2["XMLNS"] = "http://www.w3.org/2000/xmlns/";
- })(NS = NS || (NS = {}));
- var ATTRS;
- (function(ATTRS2) {
- ATTRS2["TYPE"] = "type";
- ATTRS2["ACTION"] = "action";
- ATTRS2["ENCODING"] = "encoding";
- ATTRS2["PROMPT"] = "prompt";
- ATTRS2["NAME"] = "name";
- ATTRS2["COLOR"] = "color";
- ATTRS2["FACE"] = "face";
- ATTRS2["SIZE"] = "size";
- })(ATTRS = ATTRS || (ATTRS = {}));
- var DOCUMENT_MODE;
- (function(DOCUMENT_MODE2) {
- DOCUMENT_MODE2["NO_QUIRKS"] = "no-quirks";
- DOCUMENT_MODE2["QUIRKS"] = "quirks";
- DOCUMENT_MODE2["LIMITED_QUIRKS"] = "limited-quirks";
- })(DOCUMENT_MODE = DOCUMENT_MODE || (DOCUMENT_MODE = {}));
- var TAG_NAMES;
- (function(TAG_NAMES2) {
- TAG_NAMES2["A"] = "a";
- TAG_NAMES2["ADDRESS"] = "address";
- TAG_NAMES2["ANNOTATION_XML"] = "annotation-xml";
- TAG_NAMES2["APPLET"] = "applet";
- TAG_NAMES2["AREA"] = "area";
- TAG_NAMES2["ARTICLE"] = "article";
- TAG_NAMES2["ASIDE"] = "aside";
- TAG_NAMES2["B"] = "b";
- TAG_NAMES2["BASE"] = "base";
- TAG_NAMES2["BASEFONT"] = "basefont";
- TAG_NAMES2["BGSOUND"] = "bgsound";
- TAG_NAMES2["BIG"] = "big";
- TAG_NAMES2["BLOCKQUOTE"] = "blockquote";
- TAG_NAMES2["BODY"] = "body";
- TAG_NAMES2["BR"] = "br";
- TAG_NAMES2["BUTTON"] = "button";
- TAG_NAMES2["CAPTION"] = "caption";
- TAG_NAMES2["CENTER"] = "center";
- TAG_NAMES2["CODE"] = "code";
- TAG_NAMES2["COL"] = "col";
- TAG_NAMES2["COLGROUP"] = "colgroup";
- TAG_NAMES2["DD"] = "dd";
- TAG_NAMES2["DESC"] = "desc";
- TAG_NAMES2["DETAILS"] = "details";
- TAG_NAMES2["DIALOG"] = "dialog";
- TAG_NAMES2["DIR"] = "dir";
- TAG_NAMES2["DIV"] = "div";
- TAG_NAMES2["DL"] = "dl";
- TAG_NAMES2["DT"] = "dt";
- TAG_NAMES2["EM"] = "em";
- TAG_NAMES2["EMBED"] = "embed";
- TAG_NAMES2["FIELDSET"] = "fieldset";
- TAG_NAMES2["FIGCAPTION"] = "figcaption";
- TAG_NAMES2["FIGURE"] = "figure";
- TAG_NAMES2["FONT"] = "font";
- TAG_NAMES2["FOOTER"] = "footer";
- TAG_NAMES2["FOREIGN_OBJECT"] = "foreignObject";
- TAG_NAMES2["FORM"] = "form";
- TAG_NAMES2["FRAME"] = "frame";
- TAG_NAMES2["FRAMESET"] = "frameset";
- TAG_NAMES2["H1"] = "h1";
- TAG_NAMES2["H2"] = "h2";
- TAG_NAMES2["H3"] = "h3";
- TAG_NAMES2["H4"] = "h4";
- TAG_NAMES2["H5"] = "h5";
- TAG_NAMES2["H6"] = "h6";
- TAG_NAMES2["HEAD"] = "head";
- TAG_NAMES2["HEADER"] = "header";
- TAG_NAMES2["HGROUP"] = "hgroup";
- TAG_NAMES2["HR"] = "hr";
- TAG_NAMES2["HTML"] = "html";
- TAG_NAMES2["I"] = "i";
- TAG_NAMES2["IMG"] = "img";
- TAG_NAMES2["IMAGE"] = "image";
- TAG_NAMES2["INPUT"] = "input";
- TAG_NAMES2["IFRAME"] = "iframe";
- TAG_NAMES2["KEYGEN"] = "keygen";
- TAG_NAMES2["LABEL"] = "label";
- TAG_NAMES2["LI"] = "li";
- TAG_NAMES2["LINK"] = "link";
- TAG_NAMES2["LISTING"] = "listing";
- TAG_NAMES2["MAIN"] = "main";
- TAG_NAMES2["MALIGNMARK"] = "malignmark";
- TAG_NAMES2["MARQUEE"] = "marquee";
- TAG_NAMES2["MATH"] = "math";
- TAG_NAMES2["MENU"] = "menu";
- TAG_NAMES2["META"] = "meta";
- TAG_NAMES2["MGLYPH"] = "mglyph";
- TAG_NAMES2["MI"] = "mi";
- TAG_NAMES2["MO"] = "mo";
- TAG_NAMES2["MN"] = "mn";
- TAG_NAMES2["MS"] = "ms";
- TAG_NAMES2["MTEXT"] = "mtext";
- TAG_NAMES2["NAV"] = "nav";
- TAG_NAMES2["NOBR"] = "nobr";
- TAG_NAMES2["NOFRAMES"] = "noframes";
- TAG_NAMES2["NOEMBED"] = "noembed";
- TAG_NAMES2["NOSCRIPT"] = "noscript";
- TAG_NAMES2["OBJECT"] = "object";
- TAG_NAMES2["OL"] = "ol";
- TAG_NAMES2["OPTGROUP"] = "optgroup";
- TAG_NAMES2["OPTION"] = "option";
- TAG_NAMES2["P"] = "p";
- TAG_NAMES2["PARAM"] = "param";
- TAG_NAMES2["PLAINTEXT"] = "plaintext";
- TAG_NAMES2["PRE"] = "pre";
- TAG_NAMES2["RB"] = "rb";
- TAG_NAMES2["RP"] = "rp";
- TAG_NAMES2["RT"] = "rt";
- TAG_NAMES2["RTC"] = "rtc";
- TAG_NAMES2["RUBY"] = "ruby";
- TAG_NAMES2["S"] = "s";
- TAG_NAMES2["SCRIPT"] = "script";
- TAG_NAMES2["SECTION"] = "section";
- TAG_NAMES2["SELECT"] = "select";
- TAG_NAMES2["SOURCE"] = "source";
- TAG_NAMES2["SMALL"] = "small";
- TAG_NAMES2["SPAN"] = "span";
- TAG_NAMES2["STRIKE"] = "strike";
- TAG_NAMES2["STRONG"] = "strong";
- TAG_NAMES2["STYLE"] = "style";
- TAG_NAMES2["SUB"] = "sub";
- TAG_NAMES2["SUMMARY"] = "summary";
- TAG_NAMES2["SUP"] = "sup";
- TAG_NAMES2["TABLE"] = "table";
- TAG_NAMES2["TBODY"] = "tbody";
- TAG_NAMES2["TEMPLATE"] = "template";
- TAG_NAMES2["TEXTAREA"] = "textarea";
- TAG_NAMES2["TFOOT"] = "tfoot";
- TAG_NAMES2["TD"] = "td";
- TAG_NAMES2["TH"] = "th";
- TAG_NAMES2["THEAD"] = "thead";
- TAG_NAMES2["TITLE"] = "title";
- TAG_NAMES2["TR"] = "tr";
- TAG_NAMES2["TRACK"] = "track";
- TAG_NAMES2["TT"] = "tt";
- TAG_NAMES2["U"] = "u";
- TAG_NAMES2["UL"] = "ul";
- TAG_NAMES2["SVG"] = "svg";
- TAG_NAMES2["VAR"] = "var";
- TAG_NAMES2["WBR"] = "wbr";
- TAG_NAMES2["XMP"] = "xmp";
- })(TAG_NAMES = TAG_NAMES || (TAG_NAMES = {}));
- var TAG_ID;
- (function(TAG_ID2) {
- TAG_ID2[TAG_ID2["UNKNOWN"] = 0] = "UNKNOWN";
- TAG_ID2[TAG_ID2["A"] = 1] = "A";
- TAG_ID2[TAG_ID2["ADDRESS"] = 2] = "ADDRESS";
- TAG_ID2[TAG_ID2["ANNOTATION_XML"] = 3] = "ANNOTATION_XML";
- TAG_ID2[TAG_ID2["APPLET"] = 4] = "APPLET";
- TAG_ID2[TAG_ID2["AREA"] = 5] = "AREA";
- TAG_ID2[TAG_ID2["ARTICLE"] = 6] = "ARTICLE";
- TAG_ID2[TAG_ID2["ASIDE"] = 7] = "ASIDE";
- TAG_ID2[TAG_ID2["B"] = 8] = "B";
- TAG_ID2[TAG_ID2["BASE"] = 9] = "BASE";
- TAG_ID2[TAG_ID2["BASEFONT"] = 10] = "BASEFONT";
- TAG_ID2[TAG_ID2["BGSOUND"] = 11] = "BGSOUND";
- TAG_ID2[TAG_ID2["BIG"] = 12] = "BIG";
- TAG_ID2[TAG_ID2["BLOCKQUOTE"] = 13] = "BLOCKQUOTE";
- TAG_ID2[TAG_ID2["BODY"] = 14] = "BODY";
- TAG_ID2[TAG_ID2["BR"] = 15] = "BR";
- TAG_ID2[TAG_ID2["BUTTON"] = 16] = "BUTTON";
- TAG_ID2[TAG_ID2["CAPTION"] = 17] = "CAPTION";
- TAG_ID2[TAG_ID2["CENTER"] = 18] = "CENTER";
- TAG_ID2[TAG_ID2["CODE"] = 19] = "CODE";
- TAG_ID2[TAG_ID2["COL"] = 20] = "COL";
- TAG_ID2[TAG_ID2["COLGROUP"] = 21] = "COLGROUP";
- TAG_ID2[TAG_ID2["DD"] = 22] = "DD";
- TAG_ID2[TAG_ID2["DESC"] = 23] = "DESC";
- TAG_ID2[TAG_ID2["DETAILS"] = 24] = "DETAILS";
- TAG_ID2[TAG_ID2["DIALOG"] = 25] = "DIALOG";
- TAG_ID2[TAG_ID2["DIR"] = 26] = "DIR";
- TAG_ID2[TAG_ID2["DIV"] = 27] = "DIV";
- TAG_ID2[TAG_ID2["DL"] = 28] = "DL";
- TAG_ID2[TAG_ID2["DT"] = 29] = "DT";
- TAG_ID2[TAG_ID2["EM"] = 30] = "EM";
- TAG_ID2[TAG_ID2["EMBED"] = 31] = "EMBED";
- TAG_ID2[TAG_ID2["FIELDSET"] = 32] = "FIELDSET";
- TAG_ID2[TAG_ID2["FIGCAPTION"] = 33] = "FIGCAPTION";
- TAG_ID2[TAG_ID2["FIGURE"] = 34] = "FIGURE";
- TAG_ID2[TAG_ID2["FONT"] = 35] = "FONT";
- TAG_ID2[TAG_ID2["FOOTER"] = 36] = "FOOTER";
- TAG_ID2[TAG_ID2["FOREIGN_OBJECT"] = 37] = "FOREIGN_OBJECT";
- TAG_ID2[TAG_ID2["FORM"] = 38] = "FORM";
- TAG_ID2[TAG_ID2["FRAME"] = 39] = "FRAME";
- TAG_ID2[TAG_ID2["FRAMESET"] = 40] = "FRAMESET";
- TAG_ID2[TAG_ID2["H1"] = 41] = "H1";
- TAG_ID2[TAG_ID2["H2"] = 42] = "H2";
- TAG_ID2[TAG_ID2["H3"] = 43] = "H3";
- TAG_ID2[TAG_ID2["H4"] = 44] = "H4";
- TAG_ID2[TAG_ID2["H5"] = 45] = "H5";
- TAG_ID2[TAG_ID2["H6"] = 46] = "H6";
- TAG_ID2[TAG_ID2["HEAD"] = 47] = "HEAD";
- TAG_ID2[TAG_ID2["HEADER"] = 48] = "HEADER";
- TAG_ID2[TAG_ID2["HGROUP"] = 49] = "HGROUP";
- TAG_ID2[TAG_ID2["HR"] = 50] = "HR";
- TAG_ID2[TAG_ID2["HTML"] = 51] = "HTML";
- TAG_ID2[TAG_ID2["I"] = 52] = "I";
- TAG_ID2[TAG_ID2["IMG"] = 53] = "IMG";
- TAG_ID2[TAG_ID2["IMAGE"] = 54] = "IMAGE";
- TAG_ID2[TAG_ID2["INPUT"] = 55] = "INPUT";
- TAG_ID2[TAG_ID2["IFRAME"] = 56] = "IFRAME";
- TAG_ID2[TAG_ID2["KEYGEN"] = 57] = "KEYGEN";
- TAG_ID2[TAG_ID2["LABEL"] = 58] = "LABEL";
- TAG_ID2[TAG_ID2["LI"] = 59] = "LI";
- TAG_ID2[TAG_ID2["LINK"] = 60] = "LINK";
- TAG_ID2[TAG_ID2["LISTING"] = 61] = "LISTING";
- TAG_ID2[TAG_ID2["MAIN"] = 62] = "MAIN";
- TAG_ID2[TAG_ID2["MALIGNMARK"] = 63] = "MALIGNMARK";
- TAG_ID2[TAG_ID2["MARQUEE"] = 64] = "MARQUEE";
- TAG_ID2[TAG_ID2["MATH"] = 65] = "MATH";
- TAG_ID2[TAG_ID2["MENU"] = 66] = "MENU";
- TAG_ID2[TAG_ID2["META"] = 67] = "META";
- TAG_ID2[TAG_ID2["MGLYPH"] = 68] = "MGLYPH";
- TAG_ID2[TAG_ID2["MI"] = 69] = "MI";
- TAG_ID2[TAG_ID2["MO"] = 70] = "MO";
- TAG_ID2[TAG_ID2["MN"] = 71] = "MN";
- TAG_ID2[TAG_ID2["MS"] = 72] = "MS";
- TAG_ID2[TAG_ID2["MTEXT"] = 73] = "MTEXT";
- TAG_ID2[TAG_ID2["NAV"] = 74] = "NAV";
- TAG_ID2[TAG_ID2["NOBR"] = 75] = "NOBR";
- TAG_ID2[TAG_ID2["NOFRAMES"] = 76] = "NOFRAMES";
- TAG_ID2[TAG_ID2["NOEMBED"] = 77] = "NOEMBED";
- TAG_ID2[TAG_ID2["NOSCRIPT"] = 78] = "NOSCRIPT";
- TAG_ID2[TAG_ID2["OBJECT"] = 79] = "OBJECT";
- TAG_ID2[TAG_ID2["OL"] = 80] = "OL";
- TAG_ID2[TAG_ID2["OPTGROUP"] = 81] = "OPTGROUP";
- TAG_ID2[TAG_ID2["OPTION"] = 82] = "OPTION";
- TAG_ID2[TAG_ID2["P"] = 83] = "P";
- TAG_ID2[TAG_ID2["PARAM"] = 84] = "PARAM";
- TAG_ID2[TAG_ID2["PLAINTEXT"] = 85] = "PLAINTEXT";
- TAG_ID2[TAG_ID2["PRE"] = 86] = "PRE";
- TAG_ID2[TAG_ID2["RB"] = 87] = "RB";
- TAG_ID2[TAG_ID2["RP"] = 88] = "RP";
- TAG_ID2[TAG_ID2["RT"] = 89] = "RT";
- TAG_ID2[TAG_ID2["RTC"] = 90] = "RTC";
- TAG_ID2[TAG_ID2["RUBY"] = 91] = "RUBY";
- TAG_ID2[TAG_ID2["S"] = 92] = "S";
- TAG_ID2[TAG_ID2["SCRIPT"] = 93] = "SCRIPT";
- TAG_ID2[TAG_ID2["SECTION"] = 94] = "SECTION";
- TAG_ID2[TAG_ID2["SELECT"] = 95] = "SELECT";
- TAG_ID2[TAG_ID2["SOURCE"] = 96] = "SOURCE";
- TAG_ID2[TAG_ID2["SMALL"] = 97] = "SMALL";
- TAG_ID2[TAG_ID2["SPAN"] = 98] = "SPAN";
- TAG_ID2[TAG_ID2["STRIKE"] = 99] = "STRIKE";
- TAG_ID2[TAG_ID2["STRONG"] = 100] = "STRONG";
- TAG_ID2[TAG_ID2["STYLE"] = 101] = "STYLE";
- TAG_ID2[TAG_ID2["SUB"] = 102] = "SUB";
- TAG_ID2[TAG_ID2["SUMMARY"] = 103] = "SUMMARY";
- TAG_ID2[TAG_ID2["SUP"] = 104] = "SUP";
- TAG_ID2[TAG_ID2["TABLE"] = 105] = "TABLE";
- TAG_ID2[TAG_ID2["TBODY"] = 106] = "TBODY";
- TAG_ID2[TAG_ID2["TEMPLATE"] = 107] = "TEMPLATE";
- TAG_ID2[TAG_ID2["TEXTAREA"] = 108] = "TEXTAREA";
- TAG_ID2[TAG_ID2["TFOOT"] = 109] = "TFOOT";
- TAG_ID2[TAG_ID2["TD"] = 110] = "TD";
- TAG_ID2[TAG_ID2["TH"] = 111] = "TH";
- TAG_ID2[TAG_ID2["THEAD"] = 112] = "THEAD";
- TAG_ID2[TAG_ID2["TITLE"] = 113] = "TITLE";
- TAG_ID2[TAG_ID2["TR"] = 114] = "TR";
- TAG_ID2[TAG_ID2["TRACK"] = 115] = "TRACK";
- TAG_ID2[TAG_ID2["TT"] = 116] = "TT";
- TAG_ID2[TAG_ID2["U"] = 117] = "U";
- TAG_ID2[TAG_ID2["UL"] = 118] = "UL";
- TAG_ID2[TAG_ID2["SVG"] = 119] = "SVG";
- TAG_ID2[TAG_ID2["VAR"] = 120] = "VAR";
- TAG_ID2[TAG_ID2["WBR"] = 121] = "WBR";
- TAG_ID2[TAG_ID2["XMP"] = 122] = "XMP";
- })(TAG_ID = TAG_ID || (TAG_ID = {}));
- var TAG_NAME_TO_ID = /* @__PURE__ */ new Map([
- [TAG_NAMES.A, TAG_ID.A],
- [TAG_NAMES.ADDRESS, TAG_ID.ADDRESS],
- [TAG_NAMES.ANNOTATION_XML, TAG_ID.ANNOTATION_XML],
- [TAG_NAMES.APPLET, TAG_ID.APPLET],
- [TAG_NAMES.AREA, TAG_ID.AREA],
- [TAG_NAMES.ARTICLE, TAG_ID.ARTICLE],
- [TAG_NAMES.ASIDE, TAG_ID.ASIDE],
- [TAG_NAMES.B, TAG_ID.B],
- [TAG_NAMES.BASE, TAG_ID.BASE],
- [TAG_NAMES.BASEFONT, TAG_ID.BASEFONT],
- [TAG_NAMES.BGSOUND, TAG_ID.BGSOUND],
- [TAG_NAMES.BIG, TAG_ID.BIG],
- [TAG_NAMES.BLOCKQUOTE, TAG_ID.BLOCKQUOTE],
- [TAG_NAMES.BODY, TAG_ID.BODY],
- [TAG_NAMES.BR, TAG_ID.BR],
- [TAG_NAMES.BUTTON, TAG_ID.BUTTON],
- [TAG_NAMES.CAPTION, TAG_ID.CAPTION],
- [TAG_NAMES.CENTER, TAG_ID.CENTER],
- [TAG_NAMES.CODE, TAG_ID.CODE],
- [TAG_NAMES.COL, TAG_ID.COL],
- [TAG_NAMES.COLGROUP, TAG_ID.COLGROUP],
- [TAG_NAMES.DD, TAG_ID.DD],
- [TAG_NAMES.DESC, TAG_ID.DESC],
- [TAG_NAMES.DETAILS, TAG_ID.DETAILS],
- [TAG_NAMES.DIALOG, TAG_ID.DIALOG],
- [TAG_NAMES.DIR, TAG_ID.DIR],
- [TAG_NAMES.DIV, TAG_ID.DIV],
- [TAG_NAMES.DL, TAG_ID.DL],
- [TAG_NAMES.DT, TAG_ID.DT],
- [TAG_NAMES.EM, TAG_ID.EM],
- [TAG_NAMES.EMBED, TAG_ID.EMBED],
- [TAG_NAMES.FIELDSET, TAG_ID.FIELDSET],
- [TAG_NAMES.FIGCAPTION, TAG_ID.FIGCAPTION],
- [TAG_NAMES.FIGURE, TAG_ID.FIGURE],
- [TAG_NAMES.FONT, TAG_ID.FONT],
- [TAG_NAMES.FOOTER, TAG_ID.FOOTER],
- [TAG_NAMES.FOREIGN_OBJECT, TAG_ID.FOREIGN_OBJECT],
- [TAG_NAMES.FORM, TAG_ID.FORM],
- [TAG_NAMES.FRAME, TAG_ID.FRAME],
- [TAG_NAMES.FRAMESET, TAG_ID.FRAMESET],
- [TAG_NAMES.H1, TAG_ID.H1],
- [TAG_NAMES.H2, TAG_ID.H2],
- [TAG_NAMES.H3, TAG_ID.H3],
- [TAG_NAMES.H4, TAG_ID.H4],
- [TAG_NAMES.H5, TAG_ID.H5],
- [TAG_NAMES.H6, TAG_ID.H6],
- [TAG_NAMES.HEAD, TAG_ID.HEAD],
- [TAG_NAMES.HEADER, TAG_ID.HEADER],
- [TAG_NAMES.HGROUP, TAG_ID.HGROUP],
- [TAG_NAMES.HR, TAG_ID.HR],
- [TAG_NAMES.HTML, TAG_ID.HTML],
- [TAG_NAMES.I, TAG_ID.I],
- [TAG_NAMES.IMG, TAG_ID.IMG],
- [TAG_NAMES.IMAGE, TAG_ID.IMAGE],
- [TAG_NAMES.INPUT, TAG_ID.INPUT],
- [TAG_NAMES.IFRAME, TAG_ID.IFRAME],
- [TAG_NAMES.KEYGEN, TAG_ID.KEYGEN],
- [TAG_NAMES.LABEL, TAG_ID.LABEL],
- [TAG_NAMES.LI, TAG_ID.LI],
- [TAG_NAMES.LINK, TAG_ID.LINK],
- [TAG_NAMES.LISTING, TAG_ID.LISTING],
- [TAG_NAMES.MAIN, TAG_ID.MAIN],
- [TAG_NAMES.MALIGNMARK, TAG_ID.MALIGNMARK],
- [TAG_NAMES.MARQUEE, TAG_ID.MARQUEE],
- [TAG_NAMES.MATH, TAG_ID.MATH],
- [TAG_NAMES.MENU, TAG_ID.MENU],
- [TAG_NAMES.META, TAG_ID.META],
- [TAG_NAMES.MGLYPH, TAG_ID.MGLYPH],
- [TAG_NAMES.MI, TAG_ID.MI],
- [TAG_NAMES.MO, TAG_ID.MO],
- [TAG_NAMES.MN, TAG_ID.MN],
- [TAG_NAMES.MS, TAG_ID.MS],
- [TAG_NAMES.MTEXT, TAG_ID.MTEXT],
- [TAG_NAMES.NAV, TAG_ID.NAV],
- [TAG_NAMES.NOBR, TAG_ID.NOBR],
- [TAG_NAMES.NOFRAMES, TAG_ID.NOFRAMES],
- [TAG_NAMES.NOEMBED, TAG_ID.NOEMBED],
- [TAG_NAMES.NOSCRIPT, TAG_ID.NOSCRIPT],
- [TAG_NAMES.OBJECT, TAG_ID.OBJECT],
- [TAG_NAMES.OL, TAG_ID.OL],
- [TAG_NAMES.OPTGROUP, TAG_ID.OPTGROUP],
- [TAG_NAMES.OPTION, TAG_ID.OPTION],
- [TAG_NAMES.P, TAG_ID.P],
- [TAG_NAMES.PARAM, TAG_ID.PARAM],
- [TAG_NAMES.PLAINTEXT, TAG_ID.PLAINTEXT],
- [TAG_NAMES.PRE, TAG_ID.PRE],
- [TAG_NAMES.RB, TAG_ID.RB],
- [TAG_NAMES.RP, TAG_ID.RP],
- [TAG_NAMES.RT, TAG_ID.RT],
- [TAG_NAMES.RTC, TAG_ID.RTC],
- [TAG_NAMES.RUBY, TAG_ID.RUBY],
- [TAG_NAMES.S, TAG_ID.S],
- [TAG_NAMES.SCRIPT, TAG_ID.SCRIPT],
- [TAG_NAMES.SECTION, TAG_ID.SECTION],
- [TAG_NAMES.SELECT, TAG_ID.SELECT],
- [TAG_NAMES.SOURCE, TAG_ID.SOURCE],
- [TAG_NAMES.SMALL, TAG_ID.SMALL],
- [TAG_NAMES.SPAN, TAG_ID.SPAN],
- [TAG_NAMES.STRIKE, TAG_ID.STRIKE],
- [TAG_NAMES.STRONG, TAG_ID.STRONG],
- [TAG_NAMES.STYLE, TAG_ID.STYLE],
- [TAG_NAMES.SUB, TAG_ID.SUB],
- [TAG_NAMES.SUMMARY, TAG_ID.SUMMARY],
- [TAG_NAMES.SUP, TAG_ID.SUP],
- [TAG_NAMES.TABLE, TAG_ID.TABLE],
- [TAG_NAMES.TBODY, TAG_ID.TBODY],
- [TAG_NAMES.TEMPLATE, TAG_ID.TEMPLATE],
- [TAG_NAMES.TEXTAREA, TAG_ID.TEXTAREA],
- [TAG_NAMES.TFOOT, TAG_ID.TFOOT],
- [TAG_NAMES.TD, TAG_ID.TD],
- [TAG_NAMES.TH, TAG_ID.TH],
- [TAG_NAMES.THEAD, TAG_ID.THEAD],
- [TAG_NAMES.TITLE, TAG_ID.TITLE],
- [TAG_NAMES.TR, TAG_ID.TR],
- [TAG_NAMES.TRACK, TAG_ID.TRACK],
- [TAG_NAMES.TT, TAG_ID.TT],
- [TAG_NAMES.U, TAG_ID.U],
- [TAG_NAMES.UL, TAG_ID.UL],
- [TAG_NAMES.SVG, TAG_ID.SVG],
- [TAG_NAMES.VAR, TAG_ID.VAR],
- [TAG_NAMES.WBR, TAG_ID.WBR],
- [TAG_NAMES.XMP, TAG_ID.XMP]
- ]);
- function getTagID(tagName) {
- var _a2;
- return (_a2 = TAG_NAME_TO_ID.get(tagName)) !== null && _a2 !== void 0 ? _a2 : TAG_ID.UNKNOWN;
- }
- var $ = TAG_ID;
- var SPECIAL_ELEMENTS = {
- [NS.HTML]: /* @__PURE__ */ new Set([
- $.ADDRESS,
- $.APPLET,
- $.AREA,
- $.ARTICLE,
- $.ASIDE,
- $.BASE,
- $.BASEFONT,
- $.BGSOUND,
- $.BLOCKQUOTE,
- $.BODY,
- $.BR,
- $.BUTTON,
- $.CAPTION,
- $.CENTER,
- $.COL,
- $.COLGROUP,
- $.DD,
- $.DETAILS,
- $.DIR,
- $.DIV,
- $.DL,
- $.DT,
- $.EMBED,
- $.FIELDSET,
- $.FIGCAPTION,
- $.FIGURE,
- $.FOOTER,
- $.FORM,
- $.FRAME,
- $.FRAMESET,
- $.H1,
- $.H2,
- $.H3,
- $.H4,
- $.H5,
- $.H6,
- $.HEAD,
- $.HEADER,
- $.HGROUP,
- $.HR,
- $.HTML,
- $.IFRAME,
- $.IMG,
- $.INPUT,
- $.LI,
- $.LINK,
- $.LISTING,
- $.MAIN,
- $.MARQUEE,
- $.MENU,
- $.META,
- $.NAV,
- $.NOEMBED,
- $.NOFRAMES,
- $.NOSCRIPT,
- $.OBJECT,
- $.OL,
- $.P,
- $.PARAM,
- $.PLAINTEXT,
- $.PRE,
- $.SCRIPT,
- $.SECTION,
- $.SELECT,
- $.SOURCE,
- $.STYLE,
- $.SUMMARY,
- $.TABLE,
- $.TBODY,
- $.TD,
- $.TEMPLATE,
- $.TEXTAREA,
- $.TFOOT,
- $.TH,
- $.THEAD,
- $.TITLE,
- $.TR,
- $.TRACK,
- $.UL,
- $.WBR,
- $.XMP
- ]),
- [NS.MATHML]: /* @__PURE__ */ new Set([$.MI, $.MO, $.MN, $.MS, $.MTEXT, $.ANNOTATION_XML]),
- [NS.SVG]: /* @__PURE__ */ new Set([$.TITLE, $.FOREIGN_OBJECT, $.DESC]),
- [NS.XLINK]: /* @__PURE__ */ new Set(),
- [NS.XML]: /* @__PURE__ */ new Set(),
- [NS.XMLNS]: /* @__PURE__ */ new Set()
- };
- function isNumberedHeader(tn) {
- return tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6;
- }
- var UNESCAPED_TEXT = /* @__PURE__ */ new Set([
- TAG_NAMES.STYLE,
- TAG_NAMES.SCRIPT,
- TAG_NAMES.XMP,
- TAG_NAMES.IFRAME,
- TAG_NAMES.NOEMBED,
- TAG_NAMES.NOFRAMES,
- TAG_NAMES.PLAINTEXT
- ]);
- function hasUnescapedText(tn, scriptingEnabled) {
- return UNESCAPED_TEXT.has(tn) || scriptingEnabled && tn === TAG_NAMES.NOSCRIPT;
- }
- // node_modules/parse5/dist/tokenizer/index.js
- var C1_CONTROLS_REFERENCE_REPLACEMENTS = /* @__PURE__ */ new Map([
- [128, 8364],
- [130, 8218],
- [131, 402],
- [132, 8222],
- [133, 8230],
- [134, 8224],
- [135, 8225],
- [136, 710],
- [137, 8240],
- [138, 352],
- [139, 8249],
- [140, 338],
- [142, 381],
- [145, 8216],
- [146, 8217],
- [147, 8220],
- [148, 8221],
- [149, 8226],
- [150, 8211],
- [151, 8212],
- [152, 732],
- [153, 8482],
- [154, 353],
- [155, 8250],
- [156, 339],
- [158, 382],
- [159, 376]
- ]);
- var State;
- (function(State2) {
- State2[State2["DATA"] = 0] = "DATA";
- State2[State2["RCDATA"] = 1] = "RCDATA";
- State2[State2["RAWTEXT"] = 2] = "RAWTEXT";
- State2[State2["SCRIPT_DATA"] = 3] = "SCRIPT_DATA";
- State2[State2["PLAINTEXT"] = 4] = "PLAINTEXT";
- State2[State2["TAG_OPEN"] = 5] = "TAG_OPEN";
- State2[State2["END_TAG_OPEN"] = 6] = "END_TAG_OPEN";
- State2[State2["TAG_NAME"] = 7] = "TAG_NAME";
- State2[State2["RCDATA_LESS_THAN_SIGN"] = 8] = "RCDATA_LESS_THAN_SIGN";
- State2[State2["RCDATA_END_TAG_OPEN"] = 9] = "RCDATA_END_TAG_OPEN";
- State2[State2["RCDATA_END_TAG_NAME"] = 10] = "RCDATA_END_TAG_NAME";
- State2[State2["RAWTEXT_LESS_THAN_SIGN"] = 11] = "RAWTEXT_LESS_THAN_SIGN";
- State2[State2["RAWTEXT_END_TAG_OPEN"] = 12] = "RAWTEXT_END_TAG_OPEN";
- State2[State2["RAWTEXT_END_TAG_NAME"] = 13] = "RAWTEXT_END_TAG_NAME";
- State2[State2["SCRIPT_DATA_LESS_THAN_SIGN"] = 14] = "SCRIPT_DATA_LESS_THAN_SIGN";
- State2[State2["SCRIPT_DATA_END_TAG_OPEN"] = 15] = "SCRIPT_DATA_END_TAG_OPEN";
- State2[State2["SCRIPT_DATA_END_TAG_NAME"] = 16] = "SCRIPT_DATA_END_TAG_NAME";
- State2[State2["SCRIPT_DATA_ESCAPE_START"] = 17] = "SCRIPT_DATA_ESCAPE_START";
- State2[State2["SCRIPT_DATA_ESCAPE_START_DASH"] = 18] = "SCRIPT_DATA_ESCAPE_START_DASH";
- State2[State2["SCRIPT_DATA_ESCAPED"] = 19] = "SCRIPT_DATA_ESCAPED";
- State2[State2["SCRIPT_DATA_ESCAPED_DASH"] = 20] = "SCRIPT_DATA_ESCAPED_DASH";
- State2[State2["SCRIPT_DATA_ESCAPED_DASH_DASH"] = 21] = "SCRIPT_DATA_ESCAPED_DASH_DASH";
- State2[State2["SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN"] = 22] = "SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN";
- State2[State2["SCRIPT_DATA_ESCAPED_END_TAG_OPEN"] = 23] = "SCRIPT_DATA_ESCAPED_END_TAG_OPEN";
- State2[State2["SCRIPT_DATA_ESCAPED_END_TAG_NAME"] = 24] = "SCRIPT_DATA_ESCAPED_END_TAG_NAME";
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPE_START"] = 25] = "SCRIPT_DATA_DOUBLE_ESCAPE_START";
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED"] = 26] = "SCRIPT_DATA_DOUBLE_ESCAPED";
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED_DASH"] = 27] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH";
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH"] = 28] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH";
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN"] = 29] = "SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN";
- State2[State2["SCRIPT_DATA_DOUBLE_ESCAPE_END"] = 30] = "SCRIPT_DATA_DOUBLE_ESCAPE_END";
- State2[State2["BEFORE_ATTRIBUTE_NAME"] = 31] = "BEFORE_ATTRIBUTE_NAME";
- State2[State2["ATTRIBUTE_NAME"] = 32] = "ATTRIBUTE_NAME";
- State2[State2["AFTER_ATTRIBUTE_NAME"] = 33] = "AFTER_ATTRIBUTE_NAME";
- State2[State2["BEFORE_ATTRIBUTE_VALUE"] = 34] = "BEFORE_ATTRIBUTE_VALUE";
- State2[State2["ATTRIBUTE_VALUE_DOUBLE_QUOTED"] = 35] = "ATTRIBUTE_VALUE_DOUBLE_QUOTED";
- State2[State2["ATTRIBUTE_VALUE_SINGLE_QUOTED"] = 36] = "ATTRIBUTE_VALUE_SINGLE_QUOTED";
- State2[State2["ATTRIBUTE_VALUE_UNQUOTED"] = 37] = "ATTRIBUTE_VALUE_UNQUOTED";
- State2[State2["AFTER_ATTRIBUTE_VALUE_QUOTED"] = 38] = "AFTER_ATTRIBUTE_VALUE_QUOTED";
- State2[State2["SELF_CLOSING_START_TAG"] = 39] = "SELF_CLOSING_START_TAG";
- State2[State2["BOGUS_COMMENT"] = 40] = "BOGUS_COMMENT";
- State2[State2["MARKUP_DECLARATION_OPEN"] = 41] = "MARKUP_DECLARATION_OPEN";
- State2[State2["COMMENT_START"] = 42] = "COMMENT_START";
- State2[State2["COMMENT_START_DASH"] = 43] = "COMMENT_START_DASH";
- State2[State2["COMMENT"] = 44] = "COMMENT";
- State2[State2["COMMENT_LESS_THAN_SIGN"] = 45] = "COMMENT_LESS_THAN_SIGN";
- State2[State2["COMMENT_LESS_THAN_SIGN_BANG"] = 46] = "COMMENT_LESS_THAN_SIGN_BANG";
- State2[State2["COMMENT_LESS_THAN_SIGN_BANG_DASH"] = 47] = "COMMENT_LESS_THAN_SIGN_BANG_DASH";
- State2[State2["COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH"] = 48] = "COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH";
- State2[State2["COMMENT_END_DASH"] = 49] = "COMMENT_END_DASH";
- State2[State2["COMMENT_END"] = 50] = "COMMENT_END";
- State2[State2["COMMENT_END_BANG"] = 51] = "COMMENT_END_BANG";
- State2[State2["DOCTYPE"] = 52] = "DOCTYPE";
- State2[State2["BEFORE_DOCTYPE_NAME"] = 53] = "BEFORE_DOCTYPE_NAME";
- State2[State2["DOCTYPE_NAME"] = 54] = "DOCTYPE_NAME";
- State2[State2["AFTER_DOCTYPE_NAME"] = 55] = "AFTER_DOCTYPE_NAME";
- State2[State2["AFTER_DOCTYPE_PUBLIC_KEYWORD"] = 56] = "AFTER_DOCTYPE_PUBLIC_KEYWORD";
- State2[State2["BEFORE_DOCTYPE_PUBLIC_IDENTIFIER"] = 57] = "BEFORE_DOCTYPE_PUBLIC_IDENTIFIER";
- State2[State2["DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED"] = 58] = "DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED";
- State2[State2["DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED"] = 59] = "DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED";
- State2[State2["AFTER_DOCTYPE_PUBLIC_IDENTIFIER"] = 60] = "AFTER_DOCTYPE_PUBLIC_IDENTIFIER";
- State2[State2["BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS"] = 61] = "BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS";
- State2[State2["AFTER_DOCTYPE_SYSTEM_KEYWORD"] = 62] = "AFTER_DOCTYPE_SYSTEM_KEYWORD";
- State2[State2["BEFORE_DOCTYPE_SYSTEM_IDENTIFIER"] = 63] = "BEFORE_DOCTYPE_SYSTEM_IDENTIFIER";
- State2[State2["DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED"] = 64] = "DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED";
- State2[State2["DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED"] = 65] = "DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED";
- State2[State2["AFTER_DOCTYPE_SYSTEM_IDENTIFIER"] = 66] = "AFTER_DOCTYPE_SYSTEM_IDENTIFIER";
- State2[State2["BOGUS_DOCTYPE"] = 67] = "BOGUS_DOCTYPE";
- State2[State2["CDATA_SECTION"] = 68] = "CDATA_SECTION";
- State2[State2["CDATA_SECTION_BRACKET"] = 69] = "CDATA_SECTION_BRACKET";
- State2[State2["CDATA_SECTION_END"] = 70] = "CDATA_SECTION_END";
- State2[State2["CHARACTER_REFERENCE"] = 71] = "CHARACTER_REFERENCE";
- State2[State2["NAMED_CHARACTER_REFERENCE"] = 72] = "NAMED_CHARACTER_REFERENCE";
- State2[State2["AMBIGUOUS_AMPERSAND"] = 73] = "AMBIGUOUS_AMPERSAND";
- State2[State2["NUMERIC_CHARACTER_REFERENCE"] = 74] = "NUMERIC_CHARACTER_REFERENCE";
- State2[State2["HEXADEMICAL_CHARACTER_REFERENCE_START"] = 75] = "HEXADEMICAL_CHARACTER_REFERENCE_START";
- State2[State2["HEXADEMICAL_CHARACTER_REFERENCE"] = 76] = "HEXADEMICAL_CHARACTER_REFERENCE";
- State2[State2["DECIMAL_CHARACTER_REFERENCE"] = 77] = "DECIMAL_CHARACTER_REFERENCE";
- State2[State2["NUMERIC_CHARACTER_REFERENCE_END"] = 78] = "NUMERIC_CHARACTER_REFERENCE_END";
- })(State || (State = {}));
- var TokenizerMode = {
- DATA: State.DATA,
- RCDATA: State.RCDATA,
- RAWTEXT: State.RAWTEXT,
- SCRIPT_DATA: State.SCRIPT_DATA,
- PLAINTEXT: State.PLAINTEXT,
- CDATA_SECTION: State.CDATA_SECTION
- };
- function isAsciiDigit(cp) {
- return cp >= CODE_POINTS.DIGIT_0 && cp <= CODE_POINTS.DIGIT_9;
- }
- function isAsciiUpper(cp) {
- return cp >= CODE_POINTS.LATIN_CAPITAL_A && cp <= CODE_POINTS.LATIN_CAPITAL_Z;
- }
- function isAsciiLower(cp) {
- return cp >= CODE_POINTS.LATIN_SMALL_A && cp <= CODE_POINTS.LATIN_SMALL_Z;
- }
- function isAsciiLetter(cp) {
- return isAsciiLower(cp) || isAsciiUpper(cp);
- }
- function isAsciiAlphaNumeric2(cp) {
- return isAsciiLetter(cp) || isAsciiDigit(cp);
- }
- function isAsciiUpperHexDigit(cp) {
- return cp >= CODE_POINTS.LATIN_CAPITAL_A && cp <= CODE_POINTS.LATIN_CAPITAL_F;
- }
- function isAsciiLowerHexDigit(cp) {
- return cp >= CODE_POINTS.LATIN_SMALL_A && cp <= CODE_POINTS.LATIN_SMALL_F;
- }
- function isAsciiHexDigit(cp) {
- return isAsciiDigit(cp) || isAsciiUpperHexDigit(cp) || isAsciiLowerHexDigit(cp);
- }
- function toAsciiLower(cp) {
- return cp + 32;
- }
- function isWhitespace(cp) {
- return cp === CODE_POINTS.SPACE || cp === CODE_POINTS.LINE_FEED || cp === CODE_POINTS.TABULATION || cp === CODE_POINTS.FORM_FEED;
- }
- function isEntityInAttributeInvalidEnd2(nextCp) {
- return nextCp === CODE_POINTS.EQUALS_SIGN || isAsciiAlphaNumeric2(nextCp);
- }
- function isScriptDataDoubleEscapeSequenceEnd(cp) {
- return isWhitespace(cp) || cp === CODE_POINTS.SOLIDUS || cp === CODE_POINTS.GREATER_THAN_SIGN;
- }
- var Tokenizer = class {
- constructor(options, handler) {
- this.options = options;
- this.handler = handler;
- this.paused = false;
- this.inLoop = false;
- this.inForeignNode = false;
- this.lastStartTagName = "";
- this.active = false;
- this.state = State.DATA;
- this.returnState = State.DATA;
- this.charRefCode = -1;
- this.consumedAfterSnapshot = -1;
- this.currentCharacterToken = null;
- this.currentToken = null;
- this.currentAttr = { name: "", value: "" };
- this.preprocessor = new Preprocessor(handler);
- this.currentLocation = this.getCurrentLocation(-1);
- }
- //Errors
- _err(code) {
- var _a2, _b;
- (_b = (_a2 = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a2, this.preprocessor.getError(code));
- }
- // NOTE: `offset` may never run across line boundaries.
- getCurrentLocation(offset) {
- if (!this.options.sourceCodeLocationInfo) {
- return null;
- }
- return {
- startLine: this.preprocessor.line,
- startCol: this.preprocessor.col - offset,
- startOffset: this.preprocessor.offset - offset,
- endLine: -1,
- endCol: -1,
- endOffset: -1
- };
- }
- _runParsingLoop() {
- if (this.inLoop)
- return;
- this.inLoop = true;
- while (this.active && !this.paused) {
- this.consumedAfterSnapshot = 0;
- const cp = this._consume();
- if (!this._ensureHibernation()) {
- this._callState(cp);
- }
- }
- this.inLoop = false;
- }
- //API
- pause() {
- this.paused = true;
- }
- resume(writeCallback) {
- if (!this.paused) {
- throw new Error("Parser was already resumed");
- }
- this.paused = false;
- if (this.inLoop)
- return;
- this._runParsingLoop();
- if (!this.paused) {
- writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();
- }
- }
- write(chunk, isLastChunk, writeCallback) {
- this.active = true;
- this.preprocessor.write(chunk, isLastChunk);
- this._runParsingLoop();
- if (!this.paused) {
- writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();
- }
- }
- insertHtmlAtCurrentPos(chunk) {
- this.active = true;
- this.preprocessor.insertHtmlAtCurrentPos(chunk);
- this._runParsingLoop();
- }
- //Hibernation
- _ensureHibernation() {
- if (this.preprocessor.endOfChunkHit) {
- this._unconsume(this.consumedAfterSnapshot);
- this.active = false;
- return true;
- }
- return false;
- }
- //Consumption
- _consume() {
- this.consumedAfterSnapshot++;
- return this.preprocessor.advance();
- }
- _unconsume(count) {
- this.consumedAfterSnapshot -= count;
- this.preprocessor.retreat(count);
- }
- _reconsumeInState(state, cp) {
- this.state = state;
- this._callState(cp);
- }
- _advanceBy(count) {
- this.consumedAfterSnapshot += count;
- for (let i = 0; i < count; i++) {
- this.preprocessor.advance();
- }
- }
- _consumeSequenceIfMatch(pattern, caseSensitive) {
- if (this.preprocessor.startsWith(pattern, caseSensitive)) {
- this._advanceBy(pattern.length - 1);
- return true;
- }
- return false;
- }
- //Token creation
- _createStartTagToken() {
- this.currentToken = {
- type: TokenType.START_TAG,
- tagName: "",
- tagID: TAG_ID.UNKNOWN,
- selfClosing: false,
- ackSelfClosing: false,
- attrs: [],
- location: this.getCurrentLocation(1)
- };
- }
- _createEndTagToken() {
- this.currentToken = {
- type: TokenType.END_TAG,
- tagName: "",
- tagID: TAG_ID.UNKNOWN,
- selfClosing: false,
- ackSelfClosing: false,
- attrs: [],
- location: this.getCurrentLocation(2)
- };
- }
- _createCommentToken(offset) {
- this.currentToken = {
- type: TokenType.COMMENT,
- data: "",
- location: this.getCurrentLocation(offset)
- };
- }
- _createDoctypeToken(initialName) {
- this.currentToken = {
- type: TokenType.DOCTYPE,
- name: initialName,
- forceQuirks: false,
- publicId: null,
- systemId: null,
- location: this.currentLocation
- };
- }
- _createCharacterToken(type, chars) {
- this.currentCharacterToken = {
- type,
- chars,
- location: this.currentLocation
- };
- }
- //Tag attributes
- _createAttr(attrNameFirstCh) {
- this.currentAttr = {
- name: attrNameFirstCh,
- value: ""
- };
- this.currentLocation = this.getCurrentLocation(0);
- }
- _leaveAttrName() {
- var _a2;
- var _b;
- const token = this.currentToken;
- if (getTokenAttr(token, this.currentAttr.name) === null) {
- token.attrs.push(this.currentAttr);
- if (token.location && this.currentLocation) {
- const attrLocations = (_a2 = (_b = token.location).attrs) !== null && _a2 !== void 0 ? _a2 : _b.attrs = /* @__PURE__ */ Object.create(null);
- attrLocations[this.currentAttr.name] = this.currentLocation;
- this._leaveAttrValue();
- }
- } else {
- this._err(ERR.duplicateAttribute);
- }
- }
- _leaveAttrValue() {
- if (this.currentLocation) {
- this.currentLocation.endLine = this.preprocessor.line;
- this.currentLocation.endCol = this.preprocessor.col;
- this.currentLocation.endOffset = this.preprocessor.offset;
- }
- }
- //Token emission
- prepareToken(ct) {
- this._emitCurrentCharacterToken(ct.location);
- this.currentToken = null;
- if (ct.location) {
- ct.location.endLine = this.preprocessor.line;
- ct.location.endCol = this.preprocessor.col + 1;
- ct.location.endOffset = this.preprocessor.offset + 1;
- }
- this.currentLocation = this.getCurrentLocation(-1);
- }
- emitCurrentTagToken() {
- const ct = this.currentToken;
- this.prepareToken(ct);
- ct.tagID = getTagID(ct.tagName);
- if (ct.type === TokenType.START_TAG) {
- this.lastStartTagName = ct.tagName;
- this.handler.onStartTag(ct);
- } else {
- if (ct.attrs.length > 0) {
- this._err(ERR.endTagWithAttributes);
- }
- if (ct.selfClosing) {
- this._err(ERR.endTagWithTrailingSolidus);
- }
- this.handler.onEndTag(ct);
- }
- this.preprocessor.dropParsedChunk();
- }
- emitCurrentComment(ct) {
- this.prepareToken(ct);
- this.handler.onComment(ct);
- this.preprocessor.dropParsedChunk();
- }
- emitCurrentDoctype(ct) {
- this.prepareToken(ct);
- this.handler.onDoctype(ct);
- this.preprocessor.dropParsedChunk();
- }
- _emitCurrentCharacterToken(nextLocation) {
- if (this.currentCharacterToken) {
- if (nextLocation && this.currentCharacterToken.location) {
- this.currentCharacterToken.location.endLine = nextLocation.startLine;
- this.currentCharacterToken.location.endCol = nextLocation.startCol;
- this.currentCharacterToken.location.endOffset = nextLocation.startOffset;
- }
- switch (this.currentCharacterToken.type) {
- case TokenType.CHARACTER: {
- this.handler.onCharacter(this.currentCharacterToken);
- break;
- }
- case TokenType.NULL_CHARACTER: {
- this.handler.onNullCharacter(this.currentCharacterToken);
- break;
- }
- case TokenType.WHITESPACE_CHARACTER: {
- this.handler.onWhitespaceCharacter(this.currentCharacterToken);
- break;
- }
- }
- this.currentCharacterToken = null;
- }
- }
- _emitEOFToken() {
- const location2 = this.getCurrentLocation(0);
- if (location2) {
- location2.endLine = location2.startLine;
- location2.endCol = location2.startCol;
- location2.endOffset = location2.startOffset;
- }
- this._emitCurrentCharacterToken(location2);
- this.handler.onEof({ type: TokenType.EOF, location: location2 });
- this.active = false;
- }
- //Characters emission
- //OPTIMIZATION: specification uses only one type of character tokens (one token per character).
- //This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters.
- //If we have a sequence of characters that belong to the same group, the parser can process it
- //as a single solid character token.
- //So, there are 3 types of character tokens in parse5:
- //1)TokenType.NULL_CHARACTER - \u0000-character sequences (e.g. '\u0000\u0000\u0000')
- //2)TokenType.WHITESPACE_CHARACTER - any whitespace/new-line character sequences (e.g. '\n \r\t \f')
- //3)TokenType.CHARACTER - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^')
- _appendCharToCurrentCharacterToken(type, ch) {
- if (this.currentCharacterToken) {
- if (this.currentCharacterToken.type !== type) {
- this.currentLocation = this.getCurrentLocation(0);
- this._emitCurrentCharacterToken(this.currentLocation);
- this.preprocessor.dropParsedChunk();
- } else {
- this.currentCharacterToken.chars += ch;
- return;
- }
- }
- this._createCharacterToken(type, ch);
- }
- _emitCodePoint(cp) {
- const type = isWhitespace(cp) ? TokenType.WHITESPACE_CHARACTER : cp === CODE_POINTS.NULL ? TokenType.NULL_CHARACTER : TokenType.CHARACTER;
- this._appendCharToCurrentCharacterToken(type, String.fromCodePoint(cp));
- }
- //NOTE: used when we emit characters explicitly.
- //This is always for non-whitespace and non-null characters, which allows us to avoid additional checks.
- _emitChars(ch) {
- this._appendCharToCurrentCharacterToken(TokenType.CHARACTER, ch);
- }
- // Character reference helpers
- _matchNamedCharacterReference(cp) {
- let result = null;
- let excess = 0;
- let withoutSemicolon = false;
- for (let i = 0, current = decode_data_html_default[0]; i >= 0; cp = this._consume()) {
- i = determineBranch(decode_data_html_default, current, i + 1, cp);
- if (i < 0)
- break;
- excess += 1;
- current = decode_data_html_default[i];
- const masked = current & BinTrieFlags.VALUE_LENGTH;
- if (masked) {
- const valueLength = (masked >> 14) - 1;
- if (cp !== CODE_POINTS.SEMICOLON && this._isCharacterReferenceInAttribute() && isEntityInAttributeInvalidEnd2(this.preprocessor.peek(1))) {
- result = [CODE_POINTS.AMPERSAND];
- i += valueLength;
- } else {
- result = valueLength === 0 ? [decode_data_html_default[i] & ~BinTrieFlags.VALUE_LENGTH] : valueLength === 1 ? [decode_data_html_default[++i]] : [decode_data_html_default[++i], decode_data_html_default[++i]];
- excess = 0;
- withoutSemicolon = cp !== CODE_POINTS.SEMICOLON;
- }
- if (valueLength === 0) {
- this._consume();
- break;
- }
- }
- }
- this._unconsume(excess);
- if (withoutSemicolon && !this.preprocessor.endOfChunkHit) {
- this._err(ERR.missingSemicolonAfterCharacterReference);
- }
- this._unconsume(1);
- return result;
- }
- _isCharacterReferenceInAttribute() {
- return this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_SINGLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_UNQUOTED;
- }
- _flushCodePointConsumedAsCharacterReference(cp) {
- if (this._isCharacterReferenceInAttribute()) {
- this.currentAttr.value += String.fromCodePoint(cp);
- } else {
- this._emitCodePoint(cp);
- }
- }
- // Calling states this way turns out to be much faster than any other approach.
- _callState(cp) {
- switch (this.state) {
- case State.DATA: {
- this._stateData(cp);
- break;
- }
- case State.RCDATA: {
- this._stateRcdata(cp);
- break;
- }
- case State.RAWTEXT: {
- this._stateRawtext(cp);
- break;
- }
- case State.SCRIPT_DATA: {
- this._stateScriptData(cp);
- break;
- }
- case State.PLAINTEXT: {
- this._statePlaintext(cp);
- break;
- }
- case State.TAG_OPEN: {
- this._stateTagOpen(cp);
- break;
- }
- case State.END_TAG_OPEN: {
- this._stateEndTagOpen(cp);
- break;
- }
- case State.TAG_NAME: {
- this._stateTagName(cp);
- break;
- }
- case State.RCDATA_LESS_THAN_SIGN: {
- this._stateRcdataLessThanSign(cp);
- break;
- }
- case State.RCDATA_END_TAG_OPEN: {
- this._stateRcdataEndTagOpen(cp);
- break;
- }
- case State.RCDATA_END_TAG_NAME: {
- this._stateRcdataEndTagName(cp);
- break;
- }
- case State.RAWTEXT_LESS_THAN_SIGN: {
- this._stateRawtextLessThanSign(cp);
- break;
- }
- case State.RAWTEXT_END_TAG_OPEN: {
- this._stateRawtextEndTagOpen(cp);
- break;
- }
- case State.RAWTEXT_END_TAG_NAME: {
- this._stateRawtextEndTagName(cp);
- break;
- }
- case State.SCRIPT_DATA_LESS_THAN_SIGN: {
- this._stateScriptDataLessThanSign(cp);
- break;
- }
- case State.SCRIPT_DATA_END_TAG_OPEN: {
- this._stateScriptDataEndTagOpen(cp);
- break;
- }
- case State.SCRIPT_DATA_END_TAG_NAME: {
- this._stateScriptDataEndTagName(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPE_START: {
- this._stateScriptDataEscapeStart(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPE_START_DASH: {
- this._stateScriptDataEscapeStartDash(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPED: {
- this._stateScriptDataEscaped(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPED_DASH: {
- this._stateScriptDataEscapedDash(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPED_DASH_DASH: {
- this._stateScriptDataEscapedDashDash(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {
- this._stateScriptDataEscapedLessThanSign(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN: {
- this._stateScriptDataEscapedEndTagOpen(cp);
- break;
- }
- case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME: {
- this._stateScriptDataEscapedEndTagName(cp);
- break;
- }
- case State.SCRIPT_DATA_DOUBLE_ESCAPE_START: {
- this._stateScriptDataDoubleEscapeStart(cp);
- break;
- }
- case State.SCRIPT_DATA_DOUBLE_ESCAPED: {
- this._stateScriptDataDoubleEscaped(cp);
- break;
- }
- case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH: {
- this._stateScriptDataDoubleEscapedDash(cp);
- break;
- }
- case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH: {
- this._stateScriptDataDoubleEscapedDashDash(cp);
- break;
- }
- case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN: {
- this._stateScriptDataDoubleEscapedLessThanSign(cp);
- break;
- }
- case State.SCRIPT_DATA_DOUBLE_ESCAPE_END: {
- this._stateScriptDataDoubleEscapeEnd(cp);
- break;
- }
- case State.BEFORE_ATTRIBUTE_NAME: {
- this._stateBeforeAttributeName(cp);
- break;
- }
- case State.ATTRIBUTE_NAME: {
- this._stateAttributeName(cp);
- break;
- }
- case State.AFTER_ATTRIBUTE_NAME: {
- this._stateAfterAttributeName(cp);
- break;
- }
- case State.BEFORE_ATTRIBUTE_VALUE: {
- this._stateBeforeAttributeValue(cp);
- break;
- }
- case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
- this._stateAttributeValueDoubleQuoted(cp);
- break;
- }
- case State.ATTRIBUTE_VALUE_SINGLE_QUOTED: {
- this._stateAttributeValueSingleQuoted(cp);
- break;
- }
- case State.ATTRIBUTE_VALUE_UNQUOTED: {
- this._stateAttributeValueUnquoted(cp);
- break;
- }
- case State.AFTER_ATTRIBUTE_VALUE_QUOTED: {
- this._stateAfterAttributeValueQuoted(cp);
- break;
- }
- case State.SELF_CLOSING_START_TAG: {
- this._stateSelfClosingStartTag(cp);
- break;
- }
- case State.BOGUS_COMMENT: {
- this._stateBogusComment(cp);
- break;
- }
- case State.MARKUP_DECLARATION_OPEN: {
- this._stateMarkupDeclarationOpen(cp);
- break;
- }
- case State.COMMENT_START: {
- this._stateCommentStart(cp);
- break;
- }
- case State.COMMENT_START_DASH: {
- this._stateCommentStartDash(cp);
- break;
- }
- case State.COMMENT: {
- this._stateComment(cp);
- break;
- }
- case State.COMMENT_LESS_THAN_SIGN: {
- this._stateCommentLessThanSign(cp);
- break;
- }
- case State.COMMENT_LESS_THAN_SIGN_BANG: {
- this._stateCommentLessThanSignBang(cp);
- break;
- }
- case State.COMMENT_LESS_THAN_SIGN_BANG_DASH: {
- this._stateCommentLessThanSignBangDash(cp);
- break;
- }
- case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH: {
- this._stateCommentLessThanSignBangDashDash(cp);
- break;
- }
- case State.COMMENT_END_DASH: {
- this._stateCommentEndDash(cp);
- break;
- }
- case State.COMMENT_END: {
- this._stateCommentEnd(cp);
- break;
- }
- case State.COMMENT_END_BANG: {
- this._stateCommentEndBang(cp);
- break;
- }
- case State.DOCTYPE: {
- this._stateDoctype(cp);
- break;
- }
- case State.BEFORE_DOCTYPE_NAME: {
- this._stateBeforeDoctypeName(cp);
- break;
- }
- case State.DOCTYPE_NAME: {
- this._stateDoctypeName(cp);
- break;
- }
- case State.AFTER_DOCTYPE_NAME: {
- this._stateAfterDoctypeName(cp);
- break;
- }
- case State.AFTER_DOCTYPE_PUBLIC_KEYWORD: {
- this._stateAfterDoctypePublicKeyword(cp);
- break;
- }
- case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER: {
- this._stateBeforeDoctypePublicIdentifier(cp);
- break;
- }
- case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED: {
- this._stateDoctypePublicIdentifierDoubleQuoted(cp);
- break;
- }
- case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED: {
- this._stateDoctypePublicIdentifierSingleQuoted(cp);
- break;
- }
- case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER: {
- this._stateAfterDoctypePublicIdentifier(cp);
- break;
- }
- case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS: {
- this._stateBetweenDoctypePublicAndSystemIdentifiers(cp);
- break;
- }
- case State.AFTER_DOCTYPE_SYSTEM_KEYWORD: {
- this._stateAfterDoctypeSystemKeyword(cp);
- break;
- }
- case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER: {
- this._stateBeforeDoctypeSystemIdentifier(cp);
- break;
- }
- case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED: {
- this._stateDoctypeSystemIdentifierDoubleQuoted(cp);
- break;
- }
- case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED: {
- this._stateDoctypeSystemIdentifierSingleQuoted(cp);
- break;
- }
- case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER: {
- this._stateAfterDoctypeSystemIdentifier(cp);
- break;
- }
- case State.BOGUS_DOCTYPE: {
- this._stateBogusDoctype(cp);
- break;
- }
- case State.CDATA_SECTION: {
- this._stateCdataSection(cp);
- break;
- }
- case State.CDATA_SECTION_BRACKET: {
- this._stateCdataSectionBracket(cp);
- break;
- }
- case State.CDATA_SECTION_END: {
- this._stateCdataSectionEnd(cp);
- break;
- }
- case State.CHARACTER_REFERENCE: {
- this._stateCharacterReference(cp);
- break;
- }
- case State.NAMED_CHARACTER_REFERENCE: {
- this._stateNamedCharacterReference(cp);
- break;
- }
- case State.AMBIGUOUS_AMPERSAND: {
- this._stateAmbiguousAmpersand(cp);
- break;
- }
- case State.NUMERIC_CHARACTER_REFERENCE: {
- this._stateNumericCharacterReference(cp);
- break;
- }
- case State.HEXADEMICAL_CHARACTER_REFERENCE_START: {
- this._stateHexademicalCharacterReferenceStart(cp);
- break;
- }
- case State.HEXADEMICAL_CHARACTER_REFERENCE: {
- this._stateHexademicalCharacterReference(cp);
- break;
- }
- case State.DECIMAL_CHARACTER_REFERENCE: {
- this._stateDecimalCharacterReference(cp);
- break;
- }
- case State.NUMERIC_CHARACTER_REFERENCE_END: {
- this._stateNumericCharacterReferenceEnd(cp);
- break;
- }
- default: {
- throw new Error("Unknown state");
- }
- }
- }
- // State machine
- // Data state
- //------------------------------------------------------------------
- _stateData(cp) {
- switch (cp) {
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.TAG_OPEN;
- break;
- }
- case CODE_POINTS.AMPERSAND: {
- this.returnState = State.DATA;
- this.state = State.CHARACTER_REFERENCE;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._emitCodePoint(cp);
- break;
- }
- case CODE_POINTS.EOF: {
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // RCDATA state
- //------------------------------------------------------------------
- _stateRcdata(cp) {
- switch (cp) {
- case CODE_POINTS.AMPERSAND: {
- this.returnState = State.RCDATA;
- this.state = State.CHARACTER_REFERENCE;
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.RCDATA_LESS_THAN_SIGN;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // RAWTEXT state
- //------------------------------------------------------------------
- _stateRawtext(cp) {
- switch (cp) {
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.RAWTEXT_LESS_THAN_SIGN;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // Script data state
- //------------------------------------------------------------------
- _stateScriptData(cp) {
- switch (cp) {
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.SCRIPT_DATA_LESS_THAN_SIGN;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // PLAINTEXT state
- //------------------------------------------------------------------
- _statePlaintext(cp) {
- switch (cp) {
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // Tag open state
- //------------------------------------------------------------------
- _stateTagOpen(cp) {
- if (isAsciiLetter(cp)) {
- this._createStartTagToken();
- this.state = State.TAG_NAME;
- this._stateTagName(cp);
- } else
- switch (cp) {
- case CODE_POINTS.EXCLAMATION_MARK: {
- this.state = State.MARKUP_DECLARATION_OPEN;
- break;
- }
- case CODE_POINTS.SOLIDUS: {
- this.state = State.END_TAG_OPEN;
- break;
- }
- case CODE_POINTS.QUESTION_MARK: {
- this._err(ERR.unexpectedQuestionMarkInsteadOfTagName);
- this._createCommentToken(1);
- this.state = State.BOGUS_COMMENT;
- this._stateBogusComment(cp);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofBeforeTagName);
- this._emitChars("<");
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.invalidFirstCharacterOfTagName);
- this._emitChars("<");
- this.state = State.DATA;
- this._stateData(cp);
- }
- }
- }
- // End tag open state
- //------------------------------------------------------------------
- _stateEndTagOpen(cp) {
- if (isAsciiLetter(cp)) {
- this._createEndTagToken();
- this.state = State.TAG_NAME;
- this._stateTagName(cp);
- } else
- switch (cp) {
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.missingEndTagName);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofBeforeTagName);
- this._emitChars("</");
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.invalidFirstCharacterOfTagName);
- this._createCommentToken(2);
- this.state = State.BOGUS_COMMENT;
- this._stateBogusComment(cp);
- }
- }
- }
- // Tag name state
- //------------------------------------------------------------------
- _stateTagName(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this.state = State.BEFORE_ATTRIBUTE_NAME;
- break;
- }
- case CODE_POINTS.SOLIDUS: {
- this.state = State.SELF_CLOSING_START_TAG;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- this.emitCurrentTagToken();
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.tagName += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInTag);
- this._emitEOFToken();
- break;
- }
- default: {
- token.tagName += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
- }
- }
- }
- // RCDATA less-than sign state
- //------------------------------------------------------------------
- _stateRcdataLessThanSign(cp) {
- if (cp === CODE_POINTS.SOLIDUS) {
- this.state = State.RCDATA_END_TAG_OPEN;
- } else {
- this._emitChars("<");
- this.state = State.RCDATA;
- this._stateRcdata(cp);
- }
- }
- // RCDATA end tag open state
- //------------------------------------------------------------------
- _stateRcdataEndTagOpen(cp) {
- if (isAsciiLetter(cp)) {
- this.state = State.RCDATA_END_TAG_NAME;
- this._stateRcdataEndTagName(cp);
- } else {
- this._emitChars("</");
- this.state = State.RCDATA;
- this._stateRcdata(cp);
- }
- }
- handleSpecialEndTag(_cp) {
- if (!this.preprocessor.startsWith(this.lastStartTagName, false)) {
- return !this._ensureHibernation();
- }
- this._createEndTagToken();
- const token = this.currentToken;
- token.tagName = this.lastStartTagName;
- const cp = this.preprocessor.peek(this.lastStartTagName.length);
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this._advanceBy(this.lastStartTagName.length);
- this.state = State.BEFORE_ATTRIBUTE_NAME;
- return false;
- }
- case CODE_POINTS.SOLIDUS: {
- this._advanceBy(this.lastStartTagName.length);
- this.state = State.SELF_CLOSING_START_TAG;
- return false;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._advanceBy(this.lastStartTagName.length);
- this.emitCurrentTagToken();
- this.state = State.DATA;
- return false;
- }
- default: {
- return !this._ensureHibernation();
- }
- }
- }
- // RCDATA end tag name state
- //------------------------------------------------------------------
- _stateRcdataEndTagName(cp) {
- if (this.handleSpecialEndTag(cp)) {
- this._emitChars("</");
- this.state = State.RCDATA;
- this._stateRcdata(cp);
- }
- }
- // RAWTEXT less-than sign state
- //------------------------------------------------------------------
- _stateRawtextLessThanSign(cp) {
- if (cp === CODE_POINTS.SOLIDUS) {
- this.state = State.RAWTEXT_END_TAG_OPEN;
- } else {
- this._emitChars("<");
- this.state = State.RAWTEXT;
- this._stateRawtext(cp);
- }
- }
- // RAWTEXT end tag open state
- //------------------------------------------------------------------
- _stateRawtextEndTagOpen(cp) {
- if (isAsciiLetter(cp)) {
- this.state = State.RAWTEXT_END_TAG_NAME;
- this._stateRawtextEndTagName(cp);
- } else {
- this._emitChars("</");
- this.state = State.RAWTEXT;
- this._stateRawtext(cp);
- }
- }
- // RAWTEXT end tag name state
- //------------------------------------------------------------------
- _stateRawtextEndTagName(cp) {
- if (this.handleSpecialEndTag(cp)) {
- this._emitChars("</");
- this.state = State.RAWTEXT;
- this._stateRawtext(cp);
- }
- }
- // Script data less-than sign state
- //------------------------------------------------------------------
- _stateScriptDataLessThanSign(cp) {
- switch (cp) {
- case CODE_POINTS.SOLIDUS: {
- this.state = State.SCRIPT_DATA_END_TAG_OPEN;
- break;
- }
- case CODE_POINTS.EXCLAMATION_MARK: {
- this.state = State.SCRIPT_DATA_ESCAPE_START;
- this._emitChars("<!");
- break;
- }
- default: {
- this._emitChars("<");
- this.state = State.SCRIPT_DATA;
- this._stateScriptData(cp);
- }
- }
- }
- // Script data end tag open state
- //------------------------------------------------------------------
- _stateScriptDataEndTagOpen(cp) {
- if (isAsciiLetter(cp)) {
- this.state = State.SCRIPT_DATA_END_TAG_NAME;
- this._stateScriptDataEndTagName(cp);
- } else {
- this._emitChars("</");
- this.state = State.SCRIPT_DATA;
- this._stateScriptData(cp);
- }
- }
- // Script data end tag name state
- //------------------------------------------------------------------
- _stateScriptDataEndTagName(cp) {
- if (this.handleSpecialEndTag(cp)) {
- this._emitChars("</");
- this.state = State.SCRIPT_DATA;
- this._stateScriptData(cp);
- }
- }
- // Script data escape start state
- //------------------------------------------------------------------
- _stateScriptDataEscapeStart(cp) {
- if (cp === CODE_POINTS.HYPHEN_MINUS) {
- this.state = State.SCRIPT_DATA_ESCAPE_START_DASH;
- this._emitChars("-");
- } else {
- this.state = State.SCRIPT_DATA;
- this._stateScriptData(cp);
- }
- }
- // Script data escape start dash state
- //------------------------------------------------------------------
- _stateScriptDataEscapeStartDash(cp) {
- if (cp === CODE_POINTS.HYPHEN_MINUS) {
- this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;
- this._emitChars("-");
- } else {
- this.state = State.SCRIPT_DATA;
- this._stateScriptData(cp);
- }
- }
- // Script data escaped state
- //------------------------------------------------------------------
- _stateScriptDataEscaped(cp) {
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.SCRIPT_DATA_ESCAPED_DASH;
- this._emitChars("-");
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInScriptHtmlCommentLikeText);
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // Script data escaped dash state
- //------------------------------------------------------------------
- _stateScriptDataEscapedDash(cp) {
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;
- this._emitChars("-");
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInScriptHtmlCommentLikeText);
- this._emitEOFToken();
- break;
- }
- default: {
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._emitCodePoint(cp);
- }
- }
- }
- // Script data escaped dash dash state
- //------------------------------------------------------------------
- _stateScriptDataEscapedDashDash(cp) {
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this._emitChars("-");
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.SCRIPT_DATA;
- this._emitChars(">");
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInScriptHtmlCommentLikeText);
- this._emitEOFToken();
- break;
- }
- default: {
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._emitCodePoint(cp);
- }
- }
- }
- // Script data escaped less-than sign state
- //------------------------------------------------------------------
- _stateScriptDataEscapedLessThanSign(cp) {
- if (cp === CODE_POINTS.SOLIDUS) {
- this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN;
- } else if (isAsciiLetter(cp)) {
- this._emitChars("<");
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_START;
- this._stateScriptDataDoubleEscapeStart(cp);
- } else {
- this._emitChars("<");
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._stateScriptDataEscaped(cp);
- }
- }
- // Script data escaped end tag open state
- //------------------------------------------------------------------
- _stateScriptDataEscapedEndTagOpen(cp) {
- if (isAsciiLetter(cp)) {
- this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_NAME;
- this._stateScriptDataEscapedEndTagName(cp);
- } else {
- this._emitChars("</");
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._stateScriptDataEscaped(cp);
- }
- }
- // Script data escaped end tag name state
- //------------------------------------------------------------------
- _stateScriptDataEscapedEndTagName(cp) {
- if (this.handleSpecialEndTag(cp)) {
- this._emitChars("</");
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._stateScriptDataEscaped(cp);
- }
- }
- // Script data double escape start state
- //------------------------------------------------------------------
- _stateScriptDataDoubleEscapeStart(cp) {
- if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) && isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
- this._emitCodePoint(cp);
- for (let i = 0; i < SEQUENCES.SCRIPT.length; i++) {
- this._emitCodePoint(this._consume());
- }
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
- } else if (!this._ensureHibernation()) {
- this.state = State.SCRIPT_DATA_ESCAPED;
- this._stateScriptDataEscaped(cp);
- }
- }
- // Script data double escaped state
- //------------------------------------------------------------------
- _stateScriptDataDoubleEscaped(cp) {
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH;
- this._emitChars("-");
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
- this._emitChars("<");
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInScriptHtmlCommentLikeText);
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // Script data double escaped dash state
- //------------------------------------------------------------------
- _stateScriptDataDoubleEscapedDash(cp) {
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH;
- this._emitChars("-");
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
- this._emitChars("<");
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInScriptHtmlCommentLikeText);
- this._emitEOFToken();
- break;
- }
- default: {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
- this._emitCodePoint(cp);
- }
- }
- }
- // Script data double escaped dash dash state
- //------------------------------------------------------------------
- _stateScriptDataDoubleEscapedDashDash(cp) {
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this._emitChars("-");
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
- this._emitChars("<");
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.SCRIPT_DATA;
- this._emitChars(">");
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
- this._emitChars(REPLACEMENT_CHARACTER);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInScriptHtmlCommentLikeText);
- this._emitEOFToken();
- break;
- }
- default: {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
- this._emitCodePoint(cp);
- }
- }
- }
- // Script data double escaped less-than sign state
- //------------------------------------------------------------------
- _stateScriptDataDoubleEscapedLessThanSign(cp) {
- if (cp === CODE_POINTS.SOLIDUS) {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_END;
- this._emitChars("/");
- } else {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
- this._stateScriptDataDoubleEscaped(cp);
- }
- }
- // Script data double escape end state
- //------------------------------------------------------------------
- _stateScriptDataDoubleEscapeEnd(cp) {
- if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) && isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
- this._emitCodePoint(cp);
- for (let i = 0; i < SEQUENCES.SCRIPT.length; i++) {
- this._emitCodePoint(this._consume());
- }
- this.state = State.SCRIPT_DATA_ESCAPED;
- } else if (!this._ensureHibernation()) {
- this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
- this._stateScriptDataDoubleEscaped(cp);
- }
- }
- // Before attribute name state
- //------------------------------------------------------------------
- _stateBeforeAttributeName(cp) {
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.SOLIDUS:
- case CODE_POINTS.GREATER_THAN_SIGN:
- case CODE_POINTS.EOF: {
- this.state = State.AFTER_ATTRIBUTE_NAME;
- this._stateAfterAttributeName(cp);
- break;
- }
- case CODE_POINTS.EQUALS_SIGN: {
- this._err(ERR.unexpectedEqualsSignBeforeAttributeName);
- this._createAttr("=");
- this.state = State.ATTRIBUTE_NAME;
- break;
- }
- default: {
- this._createAttr("");
- this.state = State.ATTRIBUTE_NAME;
- this._stateAttributeName(cp);
- }
- }
- }
- // Attribute name state
- //------------------------------------------------------------------
- _stateAttributeName(cp) {
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED:
- case CODE_POINTS.SOLIDUS:
- case CODE_POINTS.GREATER_THAN_SIGN:
- case CODE_POINTS.EOF: {
- this._leaveAttrName();
- this.state = State.AFTER_ATTRIBUTE_NAME;
- this._stateAfterAttributeName(cp);
- break;
- }
- case CODE_POINTS.EQUALS_SIGN: {
- this._leaveAttrName();
- this.state = State.BEFORE_ATTRIBUTE_VALUE;
- break;
- }
- case CODE_POINTS.QUOTATION_MARK:
- case CODE_POINTS.APOSTROPHE:
- case CODE_POINTS.LESS_THAN_SIGN: {
- this._err(ERR.unexpectedCharacterInAttributeName);
- this.currentAttr.name += String.fromCodePoint(cp);
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.currentAttr.name += REPLACEMENT_CHARACTER;
- break;
- }
- default: {
- this.currentAttr.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
- }
- }
- }
- // After attribute name state
- //------------------------------------------------------------------
- _stateAfterAttributeName(cp) {
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.SOLIDUS: {
- this.state = State.SELF_CLOSING_START_TAG;
- break;
- }
- case CODE_POINTS.EQUALS_SIGN: {
- this.state = State.BEFORE_ATTRIBUTE_VALUE;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- this.emitCurrentTagToken();
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInTag);
- this._emitEOFToken();
- break;
- }
- default: {
- this._createAttr("");
- this.state = State.ATTRIBUTE_NAME;
- this._stateAttributeName(cp);
- }
- }
- }
- // Before attribute value state
- //------------------------------------------------------------------
- _stateBeforeAttributeValue(cp) {
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.QUOTATION_MARK: {
- this.state = State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
- break;
- }
- case CODE_POINTS.APOSTROPHE: {
- this.state = State.ATTRIBUTE_VALUE_SINGLE_QUOTED;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.missingAttributeValue);
- this.state = State.DATA;
- this.emitCurrentTagToken();
- break;
- }
- default: {
- this.state = State.ATTRIBUTE_VALUE_UNQUOTED;
- this._stateAttributeValueUnquoted(cp);
- }
- }
- }
- // Attribute value (double-quoted) state
- //------------------------------------------------------------------
- _stateAttributeValueDoubleQuoted(cp) {
- switch (cp) {
- case CODE_POINTS.QUOTATION_MARK: {
- this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
- break;
- }
- case CODE_POINTS.AMPERSAND: {
- this.returnState = State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
- this.state = State.CHARACTER_REFERENCE;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.currentAttr.value += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInTag);
- this._emitEOFToken();
- break;
- }
- default: {
- this.currentAttr.value += String.fromCodePoint(cp);
- }
- }
- }
- // Attribute value (single-quoted) state
- //------------------------------------------------------------------
- _stateAttributeValueSingleQuoted(cp) {
- switch (cp) {
- case CODE_POINTS.APOSTROPHE: {
- this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
- break;
- }
- case CODE_POINTS.AMPERSAND: {
- this.returnState = State.ATTRIBUTE_VALUE_SINGLE_QUOTED;
- this.state = State.CHARACTER_REFERENCE;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.currentAttr.value += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInTag);
- this._emitEOFToken();
- break;
- }
- default: {
- this.currentAttr.value += String.fromCodePoint(cp);
- }
- }
- }
- // Attribute value (unquoted) state
- //------------------------------------------------------------------
- _stateAttributeValueUnquoted(cp) {
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this._leaveAttrValue();
- this.state = State.BEFORE_ATTRIBUTE_NAME;
- break;
- }
- case CODE_POINTS.AMPERSAND: {
- this.returnState = State.ATTRIBUTE_VALUE_UNQUOTED;
- this.state = State.CHARACTER_REFERENCE;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._leaveAttrValue();
- this.state = State.DATA;
- this.emitCurrentTagToken();
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this.currentAttr.value += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.QUOTATION_MARK:
- case CODE_POINTS.APOSTROPHE:
- case CODE_POINTS.LESS_THAN_SIGN:
- case CODE_POINTS.EQUALS_SIGN:
- case CODE_POINTS.GRAVE_ACCENT: {
- this._err(ERR.unexpectedCharacterInUnquotedAttributeValue);
- this.currentAttr.value += String.fromCodePoint(cp);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInTag);
- this._emitEOFToken();
- break;
- }
- default: {
- this.currentAttr.value += String.fromCodePoint(cp);
- }
- }
- }
- // After attribute value (quoted) state
- //------------------------------------------------------------------
- _stateAfterAttributeValueQuoted(cp) {
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this._leaveAttrValue();
- this.state = State.BEFORE_ATTRIBUTE_NAME;
- break;
- }
- case CODE_POINTS.SOLIDUS: {
- this._leaveAttrValue();
- this.state = State.SELF_CLOSING_START_TAG;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._leaveAttrValue();
- this.state = State.DATA;
- this.emitCurrentTagToken();
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInTag);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingWhitespaceBetweenAttributes);
- this.state = State.BEFORE_ATTRIBUTE_NAME;
- this._stateBeforeAttributeName(cp);
- }
- }
- }
- // Self-closing start tag state
- //------------------------------------------------------------------
- _stateSelfClosingStartTag(cp) {
- switch (cp) {
- case CODE_POINTS.GREATER_THAN_SIGN: {
- const token = this.currentToken;
- token.selfClosing = true;
- this.state = State.DATA;
- this.emitCurrentTagToken();
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInTag);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.unexpectedSolidusInTag);
- this.state = State.BEFORE_ATTRIBUTE_NAME;
- this._stateBeforeAttributeName(cp);
- }
- }
- }
- // Bogus comment state
- //------------------------------------------------------------------
- _stateBogusComment(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- this.emitCurrentComment(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this.emitCurrentComment(token);
- this._emitEOFToken();
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.data += REPLACEMENT_CHARACTER;
- break;
- }
- default: {
- token.data += String.fromCodePoint(cp);
- }
- }
- }
- // Markup declaration open state
- //------------------------------------------------------------------
- _stateMarkupDeclarationOpen(cp) {
- if (this._consumeSequenceIfMatch(SEQUENCES.DASH_DASH, true)) {
- this._createCommentToken(SEQUENCES.DASH_DASH.length + 1);
- this.state = State.COMMENT_START;
- } else if (this._consumeSequenceIfMatch(SEQUENCES.DOCTYPE, false)) {
- this.currentLocation = this.getCurrentLocation(SEQUENCES.DOCTYPE.length + 1);
- this.state = State.DOCTYPE;
- } else if (this._consumeSequenceIfMatch(SEQUENCES.CDATA_START, true)) {
- if (this.inForeignNode) {
- this.state = State.CDATA_SECTION;
- } else {
- this._err(ERR.cdataInHtmlContent);
- this._createCommentToken(SEQUENCES.CDATA_START.length + 1);
- this.currentToken.data = "[CDATA[";
- this.state = State.BOGUS_COMMENT;
- }
- } else if (!this._ensureHibernation()) {
- this._err(ERR.incorrectlyOpenedComment);
- this._createCommentToken(2);
- this.state = State.BOGUS_COMMENT;
- this._stateBogusComment(cp);
- }
- }
- // Comment start state
- //------------------------------------------------------------------
- _stateCommentStart(cp) {
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.COMMENT_START_DASH;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.abruptClosingOfEmptyComment);
- this.state = State.DATA;
- const token = this.currentToken;
- this.emitCurrentComment(token);
- break;
- }
- default: {
- this.state = State.COMMENT;
- this._stateComment(cp);
- }
- }
- }
- // Comment start dash state
- //------------------------------------------------------------------
- _stateCommentStartDash(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.COMMENT_END;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.abruptClosingOfEmptyComment);
- this.state = State.DATA;
- this.emitCurrentComment(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInComment);
- this.emitCurrentComment(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.data += "-";
- this.state = State.COMMENT;
- this._stateComment(cp);
- }
- }
- }
- // Comment state
- //------------------------------------------------------------------
- _stateComment(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.COMMENT_END_DASH;
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- token.data += "<";
- this.state = State.COMMENT_LESS_THAN_SIGN;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.data += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInComment);
- this.emitCurrentComment(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.data += String.fromCodePoint(cp);
- }
- }
- }
- // Comment less-than sign state
- //------------------------------------------------------------------
- _stateCommentLessThanSign(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.EXCLAMATION_MARK: {
- token.data += "!";
- this.state = State.COMMENT_LESS_THAN_SIGN_BANG;
- break;
- }
- case CODE_POINTS.LESS_THAN_SIGN: {
- token.data += "<";
- break;
- }
- default: {
- this.state = State.COMMENT;
- this._stateComment(cp);
- }
- }
- }
- // Comment less-than sign bang state
- //------------------------------------------------------------------
- _stateCommentLessThanSignBang(cp) {
- if (cp === CODE_POINTS.HYPHEN_MINUS) {
- this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH;
- } else {
- this.state = State.COMMENT;
- this._stateComment(cp);
- }
- }
- // Comment less-than sign bang dash state
- //------------------------------------------------------------------
- _stateCommentLessThanSignBangDash(cp) {
- if (cp === CODE_POINTS.HYPHEN_MINUS) {
- this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH;
- } else {
- this.state = State.COMMENT_END_DASH;
- this._stateCommentEndDash(cp);
- }
- }
- // Comment less-than sign bang dash dash state
- //------------------------------------------------------------------
- _stateCommentLessThanSignBangDashDash(cp) {
- if (cp !== CODE_POINTS.GREATER_THAN_SIGN && cp !== CODE_POINTS.EOF) {
- this._err(ERR.nestedComment);
- }
- this.state = State.COMMENT_END;
- this._stateCommentEnd(cp);
- }
- // Comment end dash state
- //------------------------------------------------------------------
- _stateCommentEndDash(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- this.state = State.COMMENT_END;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInComment);
- this.emitCurrentComment(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.data += "-";
- this.state = State.COMMENT;
- this._stateComment(cp);
- }
- }
- }
- // Comment end state
- //------------------------------------------------------------------
- _stateCommentEnd(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- this.emitCurrentComment(token);
- break;
- }
- case CODE_POINTS.EXCLAMATION_MARK: {
- this.state = State.COMMENT_END_BANG;
- break;
- }
- case CODE_POINTS.HYPHEN_MINUS: {
- token.data += "-";
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInComment);
- this.emitCurrentComment(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.data += "--";
- this.state = State.COMMENT;
- this._stateComment(cp);
- }
- }
- }
- // Comment end bang state
- //------------------------------------------------------------------
- _stateCommentEndBang(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.HYPHEN_MINUS: {
- token.data += "--!";
- this.state = State.COMMENT_END_DASH;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.incorrectlyClosedComment);
- this.state = State.DATA;
- this.emitCurrentComment(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInComment);
- this.emitCurrentComment(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.data += "--!";
- this.state = State.COMMENT;
- this._stateComment(cp);
- }
- }
- }
- // DOCTYPE state
- //------------------------------------------------------------------
- _stateDoctype(cp) {
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this.state = State.BEFORE_DOCTYPE_NAME;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.BEFORE_DOCTYPE_NAME;
- this._stateBeforeDoctypeName(cp);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- this._createDoctypeToken(null);
- const token = this.currentToken;
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingWhitespaceBeforeDoctypeName);
- this.state = State.BEFORE_DOCTYPE_NAME;
- this._stateBeforeDoctypeName(cp);
- }
- }
- }
- // Before DOCTYPE name state
- //------------------------------------------------------------------
- _stateBeforeDoctypeName(cp) {
- if (isAsciiUpper(cp)) {
- this._createDoctypeToken(String.fromCharCode(toAsciiLower(cp)));
- this.state = State.DOCTYPE_NAME;
- } else
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- this._createDoctypeToken(REPLACEMENT_CHARACTER);
- this.state = State.DOCTYPE_NAME;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.missingDoctypeName);
- this._createDoctypeToken(null);
- const token = this.currentToken;
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- this._createDoctypeToken(null);
- const token = this.currentToken;
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._createDoctypeToken(String.fromCodePoint(cp));
- this.state = State.DOCTYPE_NAME;
- }
- }
- }
- // DOCTYPE name state
- //------------------------------------------------------------------
- _stateDoctypeName(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this.state = State.AFTER_DOCTYPE_NAME;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- this.emitCurrentDoctype(token);
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.name += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
- }
- }
- }
- // After DOCTYPE name state
- //------------------------------------------------------------------
- _stateAfterDoctypeName(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- this.emitCurrentDoctype(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- if (this._consumeSequenceIfMatch(SEQUENCES.PUBLIC, false)) {
- this.state = State.AFTER_DOCTYPE_PUBLIC_KEYWORD;
- } else if (this._consumeSequenceIfMatch(SEQUENCES.SYSTEM, false)) {
- this.state = State.AFTER_DOCTYPE_SYSTEM_KEYWORD;
- } else if (!this._ensureHibernation()) {
- this._err(ERR.invalidCharacterSequenceAfterDoctypeName);
- token.forceQuirks = true;
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- }
- // After DOCTYPE public keyword state
- //------------------------------------------------------------------
- _stateAfterDoctypePublicKeyword(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this.state = State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;
- break;
- }
- case CODE_POINTS.QUOTATION_MARK: {
- this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
- token.publicId = "";
- this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
- break;
- }
- case CODE_POINTS.APOSTROPHE: {
- this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
- token.publicId = "";
- this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.missingDoctypePublicIdentifier);
- token.forceQuirks = true;
- this.state = State.DATA;
- this.emitCurrentDoctype(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
- token.forceQuirks = true;
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- // Before DOCTYPE public identifier state
- //------------------------------------------------------------------
- _stateBeforeDoctypePublicIdentifier(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.QUOTATION_MARK: {
- token.publicId = "";
- this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
- break;
- }
- case CODE_POINTS.APOSTROPHE: {
- token.publicId = "";
- this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.missingDoctypePublicIdentifier);
- token.forceQuirks = true;
- this.state = State.DATA;
- this.emitCurrentDoctype(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
- token.forceQuirks = true;
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- // DOCTYPE public identifier (double-quoted) state
- //------------------------------------------------------------------
- _stateDoctypePublicIdentifierDoubleQuoted(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.QUOTATION_MARK: {
- this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.publicId += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.abruptDoctypePublicIdentifier);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.publicId += String.fromCodePoint(cp);
- }
- }
- }
- // DOCTYPE public identifier (single-quoted) state
- //------------------------------------------------------------------
- _stateDoctypePublicIdentifierSingleQuoted(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.APOSTROPHE: {
- this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.publicId += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.abruptDoctypePublicIdentifier);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.publicId += String.fromCodePoint(cp);
- }
- }
- }
- // After DOCTYPE public identifier state
- //------------------------------------------------------------------
- _stateAfterDoctypePublicIdentifier(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this.state = State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- this.emitCurrentDoctype(token);
- break;
- }
- case CODE_POINTS.QUOTATION_MARK: {
- this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
- break;
- }
- case CODE_POINTS.APOSTROPHE: {
- this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- // Between DOCTYPE public and system identifiers state
- //------------------------------------------------------------------
- _stateBetweenDoctypePublicAndSystemIdentifiers(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.QUOTATION_MARK: {
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
- break;
- }
- case CODE_POINTS.APOSTROPHE: {
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- // After DOCTYPE system keyword state
- //------------------------------------------------------------------
- _stateAfterDoctypeSystemKeyword(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- this.state = State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;
- break;
- }
- case CODE_POINTS.QUOTATION_MARK: {
- this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
- break;
- }
- case CODE_POINTS.APOSTROPHE: {
- this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.missingDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.state = State.DATA;
- this.emitCurrentDoctype(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- // Before DOCTYPE system identifier state
- //------------------------------------------------------------------
- _stateBeforeDoctypeSystemIdentifier(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.QUOTATION_MARK: {
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
- break;
- }
- case CODE_POINTS.APOSTROPHE: {
- token.systemId = "";
- this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.missingDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.state = State.DATA;
- this.emitCurrentDoctype(token);
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- // DOCTYPE system identifier (double-quoted) state
- //------------------------------------------------------------------
- _stateDoctypeSystemIdentifierDoubleQuoted(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.QUOTATION_MARK: {
- this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.systemId += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.abruptDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.systemId += String.fromCodePoint(cp);
- }
- }
- }
- // DOCTYPE system identifier (single-quoted) state
- //------------------------------------------------------------------
- _stateDoctypeSystemIdentifierSingleQuoted(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.APOSTROPHE: {
- this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- token.systemId += REPLACEMENT_CHARACTER;
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this._err(ERR.abruptDoctypeSystemIdentifier);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- token.systemId += String.fromCodePoint(cp);
- }
- }
- }
- // After DOCTYPE system identifier state
- //------------------------------------------------------------------
- _stateAfterDoctypeSystemIdentifier(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.SPACE:
- case CODE_POINTS.LINE_FEED:
- case CODE_POINTS.TABULATION:
- case CODE_POINTS.FORM_FEED: {
- break;
- }
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInDoctype);
- token.forceQuirks = true;
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default: {
- this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier);
- this.state = State.BOGUS_DOCTYPE;
- this._stateBogusDoctype(cp);
- }
- }
- }
- // Bogus DOCTYPE state
- //------------------------------------------------------------------
- _stateBogusDoctype(cp) {
- const token = this.currentToken;
- switch (cp) {
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.emitCurrentDoctype(token);
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.NULL: {
- this._err(ERR.unexpectedNullCharacter);
- break;
- }
- case CODE_POINTS.EOF: {
- this.emitCurrentDoctype(token);
- this._emitEOFToken();
- break;
- }
- default:
- }
- }
- // CDATA section state
- //------------------------------------------------------------------
- _stateCdataSection(cp) {
- switch (cp) {
- case CODE_POINTS.RIGHT_SQUARE_BRACKET: {
- this.state = State.CDATA_SECTION_BRACKET;
- break;
- }
- case CODE_POINTS.EOF: {
- this._err(ERR.eofInCdata);
- this._emitEOFToken();
- break;
- }
- default: {
- this._emitCodePoint(cp);
- }
- }
- }
- // CDATA section bracket state
- //------------------------------------------------------------------
- _stateCdataSectionBracket(cp) {
- if (cp === CODE_POINTS.RIGHT_SQUARE_BRACKET) {
- this.state = State.CDATA_SECTION_END;
- } else {
- this._emitChars("]");
- this.state = State.CDATA_SECTION;
- this._stateCdataSection(cp);
- }
- }
- // CDATA section end state
- //------------------------------------------------------------------
- _stateCdataSectionEnd(cp) {
- switch (cp) {
- case CODE_POINTS.GREATER_THAN_SIGN: {
- this.state = State.DATA;
- break;
- }
- case CODE_POINTS.RIGHT_SQUARE_BRACKET: {
- this._emitChars("]");
- break;
- }
- default: {
- this._emitChars("]]");
- this.state = State.CDATA_SECTION;
- this._stateCdataSection(cp);
- }
- }
- }
- // Character reference state
- //------------------------------------------------------------------
- _stateCharacterReference(cp) {
- if (cp === CODE_POINTS.NUMBER_SIGN) {
- this.state = State.NUMERIC_CHARACTER_REFERENCE;
- } else if (isAsciiAlphaNumeric2(cp)) {
- this.state = State.NAMED_CHARACTER_REFERENCE;
- this._stateNamedCharacterReference(cp);
- } else {
- this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
- this._reconsumeInState(this.returnState, cp);
- }
- }
- // Named character reference state
- //------------------------------------------------------------------
- _stateNamedCharacterReference(cp) {
- const matchResult = this._matchNamedCharacterReference(cp);
- if (this._ensureHibernation()) {
- } else if (matchResult) {
- for (let i = 0; i < matchResult.length; i++) {
- this._flushCodePointConsumedAsCharacterReference(matchResult[i]);
- }
- this.state = this.returnState;
- } else {
- this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
- this.state = State.AMBIGUOUS_AMPERSAND;
- }
- }
- // Ambiguos ampersand state
- //------------------------------------------------------------------
- _stateAmbiguousAmpersand(cp) {
- if (isAsciiAlphaNumeric2(cp)) {
- this._flushCodePointConsumedAsCharacterReference(cp);
- } else {
- if (cp === CODE_POINTS.SEMICOLON) {
- this._err(ERR.unknownNamedCharacterReference);
- }
- this._reconsumeInState(this.returnState, cp);
- }
- }
- // Numeric character reference state
- //------------------------------------------------------------------
- _stateNumericCharacterReference(cp) {
- this.charRefCode = 0;
- if (cp === CODE_POINTS.LATIN_SMALL_X || cp === CODE_POINTS.LATIN_CAPITAL_X) {
- this.state = State.HEXADEMICAL_CHARACTER_REFERENCE_START;
- } else if (isAsciiDigit(cp)) {
- this.state = State.DECIMAL_CHARACTER_REFERENCE;
- this._stateDecimalCharacterReference(cp);
- } else {
- this._err(ERR.absenceOfDigitsInNumericCharacterReference);
- this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
- this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.NUMBER_SIGN);
- this._reconsumeInState(this.returnState, cp);
- }
- }
- // Hexademical character reference start state
- //------------------------------------------------------------------
- _stateHexademicalCharacterReferenceStart(cp) {
- if (isAsciiHexDigit(cp)) {
- this.state = State.HEXADEMICAL_CHARACTER_REFERENCE;
- this._stateHexademicalCharacterReference(cp);
- } else {
- this._err(ERR.absenceOfDigitsInNumericCharacterReference);
- this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
- this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.NUMBER_SIGN);
- this._unconsume(2);
- this.state = this.returnState;
- }
- }
- // Hexademical character reference state
- //------------------------------------------------------------------
- _stateHexademicalCharacterReference(cp) {
- if (isAsciiUpperHexDigit(cp)) {
- this.charRefCode = this.charRefCode * 16 + cp - 55;
- } else if (isAsciiLowerHexDigit(cp)) {
- this.charRefCode = this.charRefCode * 16 + cp - 87;
- } else if (isAsciiDigit(cp)) {
- this.charRefCode = this.charRefCode * 16 + cp - 48;
- } else if (cp === CODE_POINTS.SEMICOLON) {
- this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
- } else {
- this._err(ERR.missingSemicolonAfterCharacterReference);
- this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
- this._stateNumericCharacterReferenceEnd(cp);
- }
- }
- // Decimal character reference state
- //------------------------------------------------------------------
- _stateDecimalCharacterReference(cp) {
- if (isAsciiDigit(cp)) {
- this.charRefCode = this.charRefCode * 10 + cp - 48;
- } else if (cp === CODE_POINTS.SEMICOLON) {
- this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
- } else {
- this._err(ERR.missingSemicolonAfterCharacterReference);
- this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
- this._stateNumericCharacterReferenceEnd(cp);
- }
- }
- // Numeric character reference end state
- //------------------------------------------------------------------
- _stateNumericCharacterReferenceEnd(cp) {
- if (this.charRefCode === CODE_POINTS.NULL) {
- this._err(ERR.nullCharacterReference);
- this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
- } else if (this.charRefCode > 1114111) {
- this._err(ERR.characterReferenceOutsideUnicodeRange);
- this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
- } else if (isSurrogate(this.charRefCode)) {
- this._err(ERR.surrogateCharacterReference);
- this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
- } else if (isUndefinedCodePoint(this.charRefCode)) {
- this._err(ERR.noncharacterCharacterReference);
- } else if (isControlCodePoint(this.charRefCode) || this.charRefCode === CODE_POINTS.CARRIAGE_RETURN) {
- this._err(ERR.controlCharacterReference);
- const replacement = C1_CONTROLS_REFERENCE_REPLACEMENTS.get(this.charRefCode);
- if (replacement !== void 0) {
- this.charRefCode = replacement;
- }
- }
- this._flushCodePointConsumedAsCharacterReference(this.charRefCode);
- this._reconsumeInState(this.returnState, cp);
- }
- };
- // node_modules/parse5/dist/parser/open-element-stack.js
- var IMPLICIT_END_TAG_REQUIRED = /* @__PURE__ */ new Set([TAG_ID.DD, TAG_ID.DT, TAG_ID.LI, TAG_ID.OPTGROUP, TAG_ID.OPTION, TAG_ID.P, TAG_ID.RB, TAG_ID.RP, TAG_ID.RT, TAG_ID.RTC]);
- var IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = /* @__PURE__ */ new Set([
- ...IMPLICIT_END_TAG_REQUIRED,
- TAG_ID.CAPTION,
- TAG_ID.COLGROUP,
- TAG_ID.TBODY,
- TAG_ID.TD,
- TAG_ID.TFOOT,
- TAG_ID.TH,
- TAG_ID.THEAD,
- TAG_ID.TR
- ]);
- var SCOPING_ELEMENT_NS = /* @__PURE__ */ new Map([
- [TAG_ID.APPLET, NS.HTML],
- [TAG_ID.CAPTION, NS.HTML],
- [TAG_ID.HTML, NS.HTML],
- [TAG_ID.MARQUEE, NS.HTML],
- [TAG_ID.OBJECT, NS.HTML],
- [TAG_ID.TABLE, NS.HTML],
- [TAG_ID.TD, NS.HTML],
- [TAG_ID.TEMPLATE, NS.HTML],
- [TAG_ID.TH, NS.HTML],
- [TAG_ID.ANNOTATION_XML, NS.MATHML],
- [TAG_ID.MI, NS.MATHML],
- [TAG_ID.MN, NS.MATHML],
- [TAG_ID.MO, NS.MATHML],
- [TAG_ID.MS, NS.MATHML],
- [TAG_ID.MTEXT, NS.MATHML],
- [TAG_ID.DESC, NS.SVG],
- [TAG_ID.FOREIGN_OBJECT, NS.SVG],
- [TAG_ID.TITLE, NS.SVG]
- ]);
- var NAMED_HEADERS = [TAG_ID.H1, TAG_ID.H2, TAG_ID.H3, TAG_ID.H4, TAG_ID.H5, TAG_ID.H6];
- var TABLE_ROW_CONTEXT = [TAG_ID.TR, TAG_ID.TEMPLATE, TAG_ID.HTML];
- var TABLE_BODY_CONTEXT = [TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TEMPLATE, TAG_ID.HTML];
- var TABLE_CONTEXT = [TAG_ID.TABLE, TAG_ID.TEMPLATE, TAG_ID.HTML];
- var TABLE_CELLS = [TAG_ID.TD, TAG_ID.TH];
- var OpenElementStack = class {
- get currentTmplContentOrNode() {
- return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
- }
- constructor(document, treeAdapter, handler) {
- this.treeAdapter = treeAdapter;
- this.handler = handler;
- this.items = [];
- this.tagIDs = [];
- this.stackTop = -1;
- this.tmplCount = 0;
- this.currentTagId = TAG_ID.UNKNOWN;
- this.current = document;
- }
- //Index of element
- _indexOf(element) {
- return this.items.lastIndexOf(element, this.stackTop);
- }
- //Update current element
- _isInTemplate() {
- return this.currentTagId === TAG_ID.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML;
- }
- _updateCurrentElement() {
- this.current = this.items[this.stackTop];
- this.currentTagId = this.tagIDs[this.stackTop];
- }
- //Mutations
- push(element, tagID) {
- this.stackTop++;
- this.items[this.stackTop] = element;
- this.current = element;
- this.tagIDs[this.stackTop] = tagID;
- this.currentTagId = tagID;
- if (this._isInTemplate()) {
- this.tmplCount++;
- }
- this.handler.onItemPush(element, tagID, true);
- }
- pop() {
- const popped = this.current;
- if (this.tmplCount > 0 && this._isInTemplate()) {
- this.tmplCount--;
- }
- this.stackTop--;
- this._updateCurrentElement();
- this.handler.onItemPop(popped, true);
- }
- replace(oldElement, newElement) {
- const idx = this._indexOf(oldElement);
- this.items[idx] = newElement;
- if (idx === this.stackTop) {
- this.current = newElement;
- }
- }
- insertAfter(referenceElement, newElement, newElementID) {
- const insertionIdx = this._indexOf(referenceElement) + 1;
- this.items.splice(insertionIdx, 0, newElement);
- this.tagIDs.splice(insertionIdx, 0, newElementID);
- this.stackTop++;
- if (insertionIdx === this.stackTop) {
- this._updateCurrentElement();
- }
- this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);
- }
- popUntilTagNamePopped(tagName) {
- let targetIdx = this.stackTop + 1;
- do {
- targetIdx = this.tagIDs.lastIndexOf(tagName, targetIdx - 1);
- } while (targetIdx > 0 && this.treeAdapter.getNamespaceURI(this.items[targetIdx]) !== NS.HTML);
- this.shortenToLength(targetIdx < 0 ? 0 : targetIdx);
- }
- shortenToLength(idx) {
- while (this.stackTop >= idx) {
- const popped = this.current;
- if (this.tmplCount > 0 && this._isInTemplate()) {
- this.tmplCount -= 1;
- }
- this.stackTop--;
- this._updateCurrentElement();
- this.handler.onItemPop(popped, this.stackTop < idx);
- }
- }
- popUntilElementPopped(element) {
- const idx = this._indexOf(element);
- this.shortenToLength(idx < 0 ? 0 : idx);
- }
- popUntilPopped(tagNames, targetNS) {
- const idx = this._indexOfTagNames(tagNames, targetNS);
- this.shortenToLength(idx < 0 ? 0 : idx);
- }
- popUntilNumberedHeaderPopped() {
- this.popUntilPopped(NAMED_HEADERS, NS.HTML);
- }
- popUntilTableCellPopped() {
- this.popUntilPopped(TABLE_CELLS, NS.HTML);
- }
- popAllUpToHtmlElement() {
- this.tmplCount = 0;
- this.shortenToLength(1);
- }
- _indexOfTagNames(tagNames, namespace) {
- for (let i = this.stackTop; i >= 0; i--) {
- if (tagNames.includes(this.tagIDs[i]) && this.treeAdapter.getNamespaceURI(this.items[i]) === namespace) {
- return i;
- }
- }
- return -1;
- }
- clearBackTo(tagNames, targetNS) {
- const idx = this._indexOfTagNames(tagNames, targetNS);
- this.shortenToLength(idx + 1);
- }
- clearBackToTableContext() {
- this.clearBackTo(TABLE_CONTEXT, NS.HTML);
- }
- clearBackToTableBodyContext() {
- this.clearBackTo(TABLE_BODY_CONTEXT, NS.HTML);
- }
- clearBackToTableRowContext() {
- this.clearBackTo(TABLE_ROW_CONTEXT, NS.HTML);
- }
- remove(element) {
- const idx = this._indexOf(element);
- if (idx >= 0) {
- if (idx === this.stackTop) {
- this.pop();
- } else {
- this.items.splice(idx, 1);
- this.tagIDs.splice(idx, 1);
- this.stackTop--;
- this._updateCurrentElement();
- this.handler.onItemPop(element, false);
- }
- }
- }
- //Search
- tryPeekProperlyNestedBodyElement() {
- return this.stackTop >= 1 && this.tagIDs[1] === TAG_ID.BODY ? this.items[1] : null;
- }
- contains(element) {
- return this._indexOf(element) > -1;
- }
- getCommonAncestor(element) {
- const elementIdx = this._indexOf(element) - 1;
- return elementIdx >= 0 ? this.items[elementIdx] : null;
- }
- isRootHtmlElementCurrent() {
- return this.stackTop === 0 && this.tagIDs[0] === TAG_ID.HTML;
- }
- //Element in scope
- hasInScope(tagName) {
- for (let i = this.stackTop; i >= 0; i--) {
- const tn = this.tagIDs[i];
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
- if (tn === tagName && ns === NS.HTML) {
- return true;
- }
- if (SCOPING_ELEMENT_NS.get(tn) === ns) {
- return false;
- }
- }
- return true;
- }
- hasNumberedHeaderInScope() {
- for (let i = this.stackTop; i >= 0; i--) {
- const tn = this.tagIDs[i];
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
- if (isNumberedHeader(tn) && ns === NS.HTML) {
- return true;
- }
- if (SCOPING_ELEMENT_NS.get(tn) === ns) {
- return false;
- }
- }
- return true;
- }
- hasInListItemScope(tagName) {
- for (let i = this.stackTop; i >= 0; i--) {
- const tn = this.tagIDs[i];
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
- if (tn === tagName && ns === NS.HTML) {
- return true;
- }
- if ((tn === TAG_ID.UL || tn === TAG_ID.OL) && ns === NS.HTML || SCOPING_ELEMENT_NS.get(tn) === ns) {
- return false;
- }
- }
- return true;
- }
- hasInButtonScope(tagName) {
- for (let i = this.stackTop; i >= 0; i--) {
- const tn = this.tagIDs[i];
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
- if (tn === tagName && ns === NS.HTML) {
- return true;
- }
- if (tn === TAG_ID.BUTTON && ns === NS.HTML || SCOPING_ELEMENT_NS.get(tn) === ns) {
- return false;
- }
- }
- return true;
- }
- hasInTableScope(tagName) {
- for (let i = this.stackTop; i >= 0; i--) {
- const tn = this.tagIDs[i];
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
- if (ns !== NS.HTML) {
- continue;
- }
- if (tn === tagName) {
- return true;
- }
- if (tn === TAG_ID.TABLE || tn === TAG_ID.TEMPLATE || tn === TAG_ID.HTML) {
- return false;
- }
- }
- return true;
- }
- hasTableBodyContextInTableScope() {
- for (let i = this.stackTop; i >= 0; i--) {
- const tn = this.tagIDs[i];
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
- if (ns !== NS.HTML) {
- continue;
- }
- if (tn === TAG_ID.TBODY || tn === TAG_ID.THEAD || tn === TAG_ID.TFOOT) {
- return true;
- }
- if (tn === TAG_ID.TABLE || tn === TAG_ID.HTML) {
- return false;
- }
- }
- return true;
- }
- hasInSelectScope(tagName) {
- for (let i = this.stackTop; i >= 0; i--) {
- const tn = this.tagIDs[i];
- const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
- if (ns !== NS.HTML) {
- continue;
- }
- if (tn === tagName) {
- return true;
- }
- if (tn !== TAG_ID.OPTION && tn !== TAG_ID.OPTGROUP) {
- return false;
- }
- }
- return true;
- }
- //Implied end tags
- generateImpliedEndTags() {
- while (IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {
- this.pop();
- }
- }
- generateImpliedEndTagsThoroughly() {
- while (IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
- this.pop();
- }
- }
- generateImpliedEndTagsWithExclusion(exclusionId) {
- while (this.currentTagId !== exclusionId && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
- this.pop();
- }
- }
- };
- // node_modules/parse5/dist/parser/formatting-element-list.js
- var NOAH_ARK_CAPACITY = 3;
- var EntryType;
- (function(EntryType2) {
- EntryType2[EntryType2["Marker"] = 0] = "Marker";
- EntryType2[EntryType2["Element"] = 1] = "Element";
- })(EntryType = EntryType || (EntryType = {}));
- var MARKER = { type: EntryType.Marker };
- var FormattingElementList = class {
- constructor(treeAdapter) {
- this.treeAdapter = treeAdapter;
- this.entries = [];
- this.bookmark = null;
- }
- //Noah Ark's condition
- //OPTIMIZATION: at first we try to find possible candidates for exclusion using
- //lightweight heuristics without thorough attributes check.
- _getNoahArkConditionCandidates(newElement, neAttrs) {
- const candidates = [];
- const neAttrsLength = neAttrs.length;
- const neTagName = this.treeAdapter.getTagName(newElement);
- const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement);
- for (let i = 0; i < this.entries.length; i++) {
- const entry = this.entries[i];
- if (entry.type === EntryType.Marker) {
- break;
- }
- const { element } = entry;
- if (this.treeAdapter.getTagName(element) === neTagName && this.treeAdapter.getNamespaceURI(element) === neNamespaceURI) {
- const elementAttrs = this.treeAdapter.getAttrList(element);
- if (elementAttrs.length === neAttrsLength) {
- candidates.push({ idx: i, attrs: elementAttrs });
- }
- }
- }
- return candidates;
- }
- _ensureNoahArkCondition(newElement) {
- if (this.entries.length < NOAH_ARK_CAPACITY)
- return;
- const neAttrs = this.treeAdapter.getAttrList(newElement);
- const candidates = this._getNoahArkConditionCandidates(newElement, neAttrs);
- if (candidates.length < NOAH_ARK_CAPACITY)
- return;
- const neAttrsMap = new Map(neAttrs.map((neAttr) => [neAttr.name, neAttr.value]));
- let validCandidates = 0;
- for (let i = 0; i < candidates.length; i++) {
- const candidate = candidates[i];
- if (candidate.attrs.every((cAttr) => neAttrsMap.get(cAttr.name) === cAttr.value)) {
- validCandidates += 1;
- if (validCandidates >= NOAH_ARK_CAPACITY) {
- this.entries.splice(candidate.idx, 1);
- }
- }
- }
- }
- //Mutations
- insertMarker() {
- this.entries.unshift(MARKER);
- }
- pushElement(element, token) {
- this._ensureNoahArkCondition(element);
- this.entries.unshift({
- type: EntryType.Element,
- element,
- token
- });
- }
- insertElementAfterBookmark(element, token) {
- const bookmarkIdx = this.entries.indexOf(this.bookmark);
- this.entries.splice(bookmarkIdx, 0, {
- type: EntryType.Element,
- element,
- token
- });
- }
- removeEntry(entry) {
- const entryIndex = this.entries.indexOf(entry);
- if (entryIndex >= 0) {
- this.entries.splice(entryIndex, 1);
- }
- }
- /**
- * Clears the list of formatting elements up to the last marker.
- *
- * @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker
- */
- clearToLastMarker() {
- const markerIdx = this.entries.indexOf(MARKER);
- if (markerIdx >= 0) {
- this.entries.splice(0, markerIdx + 1);
- } else {
- this.entries.length = 0;
- }
- }
- //Search
- getElementEntryInScopeWithTagName(tagName) {
- const entry = this.entries.find((entry2) => entry2.type === EntryType.Marker || this.treeAdapter.getTagName(entry2.element) === tagName);
- return entry && entry.type === EntryType.Element ? entry : null;
- }
- getElementEntry(element) {
- return this.entries.find((entry) => entry.type === EntryType.Element && entry.element === element);
- }
- };
- // node_modules/parse5/dist/tree-adapters/default.js
- function createTextNode(value) {
- return {
- nodeName: "#text",
- value,
- parentNode: null
- };
- }
- var defaultTreeAdapter = {
- //Node construction
- createDocument() {
- return {
- nodeName: "#document",
- mode: DOCUMENT_MODE.NO_QUIRKS,
- childNodes: []
- };
- },
- createDocumentFragment() {
- return {
- nodeName: "#document-fragment",
- childNodes: []
- };
- },
- createElement(tagName, namespaceURI, attrs) {
- return {
- nodeName: tagName,
- tagName,
- attrs,
- namespaceURI,
- childNodes: [],
- parentNode: null
- };
- },
- createCommentNode(data) {
- return {
- nodeName: "#comment",
- data,
- parentNode: null
- };
- },
- //Tree mutation
- appendChild(parentNode, newNode) {
- parentNode.childNodes.push(newNode);
- newNode.parentNode = parentNode;
- },
- insertBefore(parentNode, newNode, referenceNode) {
- const insertionIdx = parentNode.childNodes.indexOf(referenceNode);
- parentNode.childNodes.splice(insertionIdx, 0, newNode);
- newNode.parentNode = parentNode;
- },
- setTemplateContent(templateElement, contentElement) {
- templateElement.content = contentElement;
- },
- getTemplateContent(templateElement) {
- return templateElement.content;
- },
- setDocumentType(document, name, publicId, systemId) {
- const doctypeNode = document.childNodes.find((node) => node.nodeName === "#documentType");
- if (doctypeNode) {
- doctypeNode.name = name;
- doctypeNode.publicId = publicId;
- doctypeNode.systemId = systemId;
- } else {
- const node = {
- nodeName: "#documentType",
- name,
- publicId,
- systemId,
- parentNode: null
- };
- defaultTreeAdapter.appendChild(document, node);
- }
- },
- setDocumentMode(document, mode) {
- document.mode = mode;
- },
- getDocumentMode(document) {
- return document.mode;
- },
- detachNode(node) {
- if (node.parentNode) {
- const idx = node.parentNode.childNodes.indexOf(node);
- node.parentNode.childNodes.splice(idx, 1);
- node.parentNode = null;
- }
- },
- insertText(parentNode, text) {
- if (parentNode.childNodes.length > 0) {
- const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];
- if (defaultTreeAdapter.isTextNode(prevNode)) {
- prevNode.value += text;
- return;
- }
- }
- defaultTreeAdapter.appendChild(parentNode, createTextNode(text));
- },
- insertTextBefore(parentNode, text, referenceNode) {
- const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
- if (prevNode && defaultTreeAdapter.isTextNode(prevNode)) {
- prevNode.value += text;
- } else {
- defaultTreeAdapter.insertBefore(parentNode, createTextNode(text), referenceNode);
- }
- },
- adoptAttributes(recipient, attrs) {
- const recipientAttrsMap = new Set(recipient.attrs.map((attr) => attr.name));
- for (let j = 0; j < attrs.length; j++) {
- if (!recipientAttrsMap.has(attrs[j].name)) {
- recipient.attrs.push(attrs[j]);
- }
- }
- },
- //Tree traversing
- getFirstChild(node) {
- return node.childNodes[0];
- },
- getChildNodes(node) {
- return node.childNodes;
- },
- getParentNode(node) {
- return node.parentNode;
- },
- getAttrList(element) {
- return element.attrs;
- },
- //Node data
- getTagName(element) {
- return element.tagName;
- },
- getNamespaceURI(element) {
- return element.namespaceURI;
- },
- getTextNodeContent(textNode) {
- return textNode.value;
- },
- getCommentNodeContent(commentNode) {
- return commentNode.data;
- },
- getDocumentTypeNodeName(doctypeNode) {
- return doctypeNode.name;
- },
- getDocumentTypeNodePublicId(doctypeNode) {
- return doctypeNode.publicId;
- },
- getDocumentTypeNodeSystemId(doctypeNode) {
- return doctypeNode.systemId;
- },
- //Node types
- isTextNode(node) {
- return node.nodeName === "#text";
- },
- isCommentNode(node) {
- return node.nodeName === "#comment";
- },
- isDocumentTypeNode(node) {
- return node.nodeName === "#documentType";
- },
- isElementNode(node) {
- return Object.prototype.hasOwnProperty.call(node, "tagName");
- },
- // Source code location
- setNodeSourceCodeLocation(node, location2) {
- node.sourceCodeLocation = location2;
- },
- getNodeSourceCodeLocation(node) {
- return node.sourceCodeLocation;
- },
- updateNodeSourceCodeLocation(node, endLocation) {
- node.sourceCodeLocation = { ...node.sourceCodeLocation, ...endLocation };
- }
- };
- // node_modules/parse5/dist/common/doctype.js
- var VALID_DOCTYPE_NAME = "html";
- var VALID_SYSTEM_ID = "about:legacy-compat";
- var QUIRKS_MODE_SYSTEM_ID = "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd";
- var QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
- "+//silmaril//dtd html pro v0r11 19970101//",
- "-//as//dtd html 3.0 aswedit + extensions//",
- "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
- "-//ietf//dtd html 2.0 level 1//",
- "-//ietf//dtd html 2.0 level 2//",
- "-//ietf//dtd html 2.0 strict level 1//",
- "-//ietf//dtd html 2.0 strict level 2//",
- "-//ietf//dtd html 2.0 strict//",
- "-//ietf//dtd html 2.0//",
- "-//ietf//dtd html 2.1e//",
- "-//ietf//dtd html 3.0//",
- "-//ietf//dtd html 3.2 final//",
- "-//ietf//dtd html 3.2//",
- "-//ietf//dtd html 3//",
- "-//ietf//dtd html level 0//",
- "-//ietf//dtd html level 1//",
- "-//ietf//dtd html level 2//",
- "-//ietf//dtd html level 3//",
- "-//ietf//dtd html strict level 0//",
- "-//ietf//dtd html strict level 1//",
- "-//ietf//dtd html strict level 2//",
- "-//ietf//dtd html strict level 3//",
- "-//ietf//dtd html strict//",
- "-//ietf//dtd html//",
- "-//metrius//dtd metrius presentational//",
- "-//microsoft//dtd internet explorer 2.0 html strict//",
- "-//microsoft//dtd internet explorer 2.0 html//",
- "-//microsoft//dtd internet explorer 2.0 tables//",
- "-//microsoft//dtd internet explorer 3.0 html strict//",
- "-//microsoft//dtd internet explorer 3.0 html//",
- "-//microsoft//dtd internet explorer 3.0 tables//",
- "-//netscape comm. corp.//dtd html//",
- "-//netscape comm. corp.//dtd strict html//",
- "-//o'reilly and associates//dtd html 2.0//",
- "-//o'reilly and associates//dtd html extended 1.0//",
- "-//o'reilly and associates//dtd html extended relaxed 1.0//",
- "-//sq//dtd html 2.0 hotmetal + extensions//",
- "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
- "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
- "-//spyglass//dtd html 2.0 extended//",
- "-//sun microsystems corp.//dtd hotjava html//",
- "-//sun microsystems corp.//dtd hotjava strict html//",
- "-//w3c//dtd html 3 1995-03-24//",
- "-//w3c//dtd html 3.2 draft//",
- "-//w3c//dtd html 3.2 final//",
- "-//w3c//dtd html 3.2//",
- "-//w3c//dtd html 3.2s draft//",
- "-//w3c//dtd html 4.0 frameset//",
- "-//w3c//dtd html 4.0 transitional//",
- "-//w3c//dtd html experimental 19960712//",
- "-//w3c//dtd html experimental 970421//",
- "-//w3c//dtd w3 html//",
- "-//w3o//dtd w3 html 3.0//",
- "-//webtechs//dtd mozilla html 2.0//",
- "-//webtechs//dtd mozilla html//"
- ];
- var QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
- ...QUIRKS_MODE_PUBLIC_ID_PREFIXES,
- "-//w3c//dtd html 4.01 frameset//",
- "-//w3c//dtd html 4.01 transitional//"
- ];
- var QUIRKS_MODE_PUBLIC_IDS = /* @__PURE__ */ new Set([
- "-//w3o//dtd w3 html strict 3.0//en//",
- "-/w3c/dtd html 4.0 transitional/en",
- "html"
- ]);
- var LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ["-//w3c//dtd xhtml 1.0 frameset//", "-//w3c//dtd xhtml 1.0 transitional//"];
- var LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
- ...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,
- "-//w3c//dtd html 4.01 frameset//",
- "-//w3c//dtd html 4.01 transitional//"
- ];
- function hasPrefix(publicId, prefixes) {
- return prefixes.some((prefix) => publicId.startsWith(prefix));
- }
- function isConforming(token) {
- return token.name === VALID_DOCTYPE_NAME && token.publicId === null && (token.systemId === null || token.systemId === VALID_SYSTEM_ID);
- }
- function getDocumentMode(token) {
- if (token.name !== VALID_DOCTYPE_NAME) {
- return DOCUMENT_MODE.QUIRKS;
- }
- const { systemId } = token;
- if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
- return DOCUMENT_MODE.QUIRKS;
- }
- let { publicId } = token;
- if (publicId !== null) {
- publicId = publicId.toLowerCase();
- if (QUIRKS_MODE_PUBLIC_IDS.has(publicId)) {
- return DOCUMENT_MODE.QUIRKS;
- }
- let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
- if (hasPrefix(publicId, prefixes)) {
- return DOCUMENT_MODE.QUIRKS;
- }
- prefixes = systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
- if (hasPrefix(publicId, prefixes)) {
- return DOCUMENT_MODE.LIMITED_QUIRKS;
- }
- }
- return DOCUMENT_MODE.NO_QUIRKS;
- }
- // node_modules/parse5/dist/common/foreign-content.js
- var foreign_content_exports = {};
- __export(foreign_content_exports, {
- SVG_TAG_NAMES_ADJUSTMENT_MAP: () => SVG_TAG_NAMES_ADJUSTMENT_MAP,
- adjustTokenMathMLAttrs: () => adjustTokenMathMLAttrs,
- adjustTokenSVGAttrs: () => adjustTokenSVGAttrs,
- adjustTokenSVGTagName: () => adjustTokenSVGTagName,
- adjustTokenXMLAttrs: () => adjustTokenXMLAttrs,
- causesExit: () => causesExit,
- isIntegrationPoint: () => isIntegrationPoint
- });
- var MIME_TYPES = {
- TEXT_HTML: "text/html",
- APPLICATION_XML: "application/xhtml+xml"
- };
- var DEFINITION_URL_ATTR = "definitionurl";
- var ADJUSTED_DEFINITION_URL_ATTR = "definitionURL";
- var SVG_ATTRS_ADJUSTMENT_MAP = new Map([
- "attributeName",
- "attributeType",
- "baseFrequency",
- "baseProfile",
- "calcMode",
- "clipPathUnits",
- "diffuseConstant",
- "edgeMode",
- "filterUnits",
- "glyphRef",
- "gradientTransform",
- "gradientUnits",
- "kernelMatrix",
- "kernelUnitLength",
- "keyPoints",
- "keySplines",
- "keyTimes",
- "lengthAdjust",
- "limitingConeAngle",
- "markerHeight",
- "markerUnits",
- "markerWidth",
- "maskContentUnits",
- "maskUnits",
- "numOctaves",
- "pathLength",
- "patternContentUnits",
- "patternTransform",
- "patternUnits",
- "pointsAtX",
- "pointsAtY",
- "pointsAtZ",
- "preserveAlpha",
- "preserveAspectRatio",
- "primitiveUnits",
- "refX",
- "refY",
- "repeatCount",
- "repeatDur",
- "requiredExtensions",
- "requiredFeatures",
- "specularConstant",
- "specularExponent",
- "spreadMethod",
- "startOffset",
- "stdDeviation",
- "stitchTiles",
- "surfaceScale",
- "systemLanguage",
- "tableValues",
- "targetX",
- "targetY",
- "textLength",
- "viewBox",
- "viewTarget",
- "xChannelSelector",
- "yChannelSelector",
- "zoomAndPan"
- ].map((attr) => [attr.toLowerCase(), attr]));
- var XML_ATTRS_ADJUSTMENT_MAP = /* @__PURE__ */ new Map([
- ["xlink:actuate", { prefix: "xlink", name: "actuate", namespace: NS.XLINK }],
- ["xlink:arcrole", { prefix: "xlink", name: "arcrole", namespace: NS.XLINK }],
- ["xlink:href", { prefix: "xlink", name: "href", namespace: NS.XLINK }],
- ["xlink:role", { prefix: "xlink", name: "role", namespace: NS.XLINK }],
- ["xlink:show", { prefix: "xlink", name: "show", namespace: NS.XLINK }],
- ["xlink:title", { prefix: "xlink", name: "title", namespace: NS.XLINK }],
- ["xlink:type", { prefix: "xlink", name: "type", namespace: NS.XLINK }],
- ["xml:base", { prefix: "xml", name: "base", namespace: NS.XML }],
- ["xml:lang", { prefix: "xml", name: "lang", namespace: NS.XML }],
- ["xml:space", { prefix: "xml", name: "space", namespace: NS.XML }],
- ["xmlns", { prefix: "", name: "xmlns", namespace: NS.XMLNS }],
- ["xmlns:xlink", { prefix: "xmlns", name: "xlink", namespace: NS.XMLNS }]
- ]);
- var SVG_TAG_NAMES_ADJUSTMENT_MAP = new Map([
- "altGlyph",
- "altGlyphDef",
- "altGlyphItem",
- "animateColor",
- "animateMotion",
- "animateTransform",
- "clipPath",
- "feBlend",
- "feColorMatrix",
- "feComponentTransfer",
- "feComposite",
- "feConvolveMatrix",
- "feDiffuseLighting",
- "feDisplacementMap",
- "feDistantLight",
- "feFlood",
- "feFuncA",
- "feFuncB",
- "feFuncG",
- "feFuncR",
- "feGaussianBlur",
- "feImage",
- "feMerge",
- "feMergeNode",
- "feMorphology",
- "feOffset",
- "fePointLight",
- "feSpecularLighting",
- "feSpotLight",
- "feTile",
- "feTurbulence",
- "foreignObject",
- "glyphRef",
- "linearGradient",
- "radialGradient",
- "textPath"
- ].map((tn) => [tn.toLowerCase(), tn]));
- var EXITS_FOREIGN_CONTENT = /* @__PURE__ */ new Set([
- TAG_ID.B,
- TAG_ID.BIG,
- TAG_ID.BLOCKQUOTE,
- TAG_ID.BODY,
- TAG_ID.BR,
- TAG_ID.CENTER,
- TAG_ID.CODE,
- TAG_ID.DD,
- TAG_ID.DIV,
- TAG_ID.DL,
- TAG_ID.DT,
- TAG_ID.EM,
- TAG_ID.EMBED,
- TAG_ID.H1,
- TAG_ID.H2,
- TAG_ID.H3,
- TAG_ID.H4,
- TAG_ID.H5,
- TAG_ID.H6,
- TAG_ID.HEAD,
- TAG_ID.HR,
- TAG_ID.I,
- TAG_ID.IMG,
- TAG_ID.LI,
- TAG_ID.LISTING,
- TAG_ID.MENU,
- TAG_ID.META,
- TAG_ID.NOBR,
- TAG_ID.OL,
- TAG_ID.P,
- TAG_ID.PRE,
- TAG_ID.RUBY,
- TAG_ID.S,
- TAG_ID.SMALL,
- TAG_ID.SPAN,
- TAG_ID.STRONG,
- TAG_ID.STRIKE,
- TAG_ID.SUB,
- TAG_ID.SUP,
- TAG_ID.TABLE,
- TAG_ID.TT,
- TAG_ID.U,
- TAG_ID.UL,
- TAG_ID.VAR
- ]);
- function causesExit(startTagToken) {
- const tn = startTagToken.tagID;
- const isFontWithAttrs = tn === TAG_ID.FONT && startTagToken.attrs.some(({ name }) => name === ATTRS.COLOR || name === ATTRS.SIZE || name === ATTRS.FACE);
- return isFontWithAttrs || EXITS_FOREIGN_CONTENT.has(tn);
- }
- function adjustTokenMathMLAttrs(token) {
- for (let i = 0; i < token.attrs.length; i++) {
- if (token.attrs[i].name === DEFINITION_URL_ATTR) {
- token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;
- break;
- }
- }
- }
- function adjustTokenSVGAttrs(token) {
- for (let i = 0; i < token.attrs.length; i++) {
- const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);
- if (adjustedAttrName != null) {
- token.attrs[i].name = adjustedAttrName;
- }
- }
- }
- function adjustTokenXMLAttrs(token) {
- for (let i = 0; i < token.attrs.length; i++) {
- const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);
- if (adjustedAttrEntry) {
- token.attrs[i].prefix = adjustedAttrEntry.prefix;
- token.attrs[i].name = adjustedAttrEntry.name;
- token.attrs[i].namespace = adjustedAttrEntry.namespace;
- }
- }
- }
- function adjustTokenSVGTagName(token) {
- const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP.get(token.tagName);
- if (adjustedTagName != null) {
- token.tagName = adjustedTagName;
- token.tagID = getTagID(token.tagName);
- }
- }
- function isMathMLTextIntegrationPoint(tn, ns) {
- return ns === NS.MATHML && (tn === TAG_ID.MI || tn === TAG_ID.MO || tn === TAG_ID.MN || tn === TAG_ID.MS || tn === TAG_ID.MTEXT);
- }
- function isHtmlIntegrationPoint(tn, ns, attrs) {
- if (ns === NS.MATHML && tn === TAG_ID.ANNOTATION_XML) {
- for (let i = 0; i < attrs.length; i++) {
- if (attrs[i].name === ATTRS.ENCODING) {
- const value = attrs[i].value.toLowerCase();
- return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML;
- }
- }
- }
- return ns === NS.SVG && (tn === TAG_ID.FOREIGN_OBJECT || tn === TAG_ID.DESC || tn === TAG_ID.TITLE);
- }
- function isIntegrationPoint(tn, ns, attrs, foreignNS) {
- return (!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs) || (!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns);
- }
- // node_modules/parse5/dist/parser/index.js
- var HIDDEN_INPUT_TYPE = "hidden";
- var AA_OUTER_LOOP_ITER = 8;
- var AA_INNER_LOOP_ITER = 3;
- var InsertionMode;
- (function(InsertionMode2) {
- InsertionMode2[InsertionMode2["INITIAL"] = 0] = "INITIAL";
- InsertionMode2[InsertionMode2["BEFORE_HTML"] = 1] = "BEFORE_HTML";
- InsertionMode2[InsertionMode2["BEFORE_HEAD"] = 2] = "BEFORE_HEAD";
- InsertionMode2[InsertionMode2["IN_HEAD"] = 3] = "IN_HEAD";
- InsertionMode2[InsertionMode2["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT";
- InsertionMode2[InsertionMode2["AFTER_HEAD"] = 5] = "AFTER_HEAD";
- InsertionMode2[InsertionMode2["IN_BODY"] = 6] = "IN_BODY";
- InsertionMode2[InsertionMode2["TEXT"] = 7] = "TEXT";
- InsertionMode2[InsertionMode2["IN_TABLE"] = 8] = "IN_TABLE";
- InsertionMode2[InsertionMode2["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT";
- InsertionMode2[InsertionMode2["IN_CAPTION"] = 10] = "IN_CAPTION";
- InsertionMode2[InsertionMode2["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP";
- InsertionMode2[InsertionMode2["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY";
- InsertionMode2[InsertionMode2["IN_ROW"] = 13] = "IN_ROW";
- InsertionMode2[InsertionMode2["IN_CELL"] = 14] = "IN_CELL";
- InsertionMode2[InsertionMode2["IN_SELECT"] = 15] = "IN_SELECT";
- InsertionMode2[InsertionMode2["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE";
- InsertionMode2[InsertionMode2["IN_TEMPLATE"] = 17] = "IN_TEMPLATE";
- InsertionMode2[InsertionMode2["AFTER_BODY"] = 18] = "AFTER_BODY";
- InsertionMode2[InsertionMode2["IN_FRAMESET"] = 19] = "IN_FRAMESET";
- InsertionMode2[InsertionMode2["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET";
- InsertionMode2[InsertionMode2["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY";
- InsertionMode2[InsertionMode2["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET";
- })(InsertionMode || (InsertionMode = {}));
- var BASE_LOC = {
- startLine: -1,
- startCol: -1,
- startOffset: -1,
- endLine: -1,
- endCol: -1,
- endOffset: -1
- };
- var TABLE_STRUCTURE_TAGS = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TR]);
- var defaultParserOptions = {
- scriptingEnabled: true,
- sourceCodeLocationInfo: false,
- treeAdapter: defaultTreeAdapter,
- onParseError: null
- };
- var Parser = class {
- constructor(options, document, fragmentContext = null, scriptHandler = null) {
- this.fragmentContext = fragmentContext;
- this.scriptHandler = scriptHandler;
- this.currentToken = null;
- this.stopped = false;
- this.insertionMode = InsertionMode.INITIAL;
- this.originalInsertionMode = InsertionMode.INITIAL;
- this.headElement = null;
- this.formElement = null;
- this.currentNotInHTML = false;
- this.tmplInsertionModeStack = [];
- this.pendingCharacterTokens = [];
- this.hasNonWhitespacePendingCharacterToken = false;
- this.framesetOk = true;
- this.skipNextNewLine = false;
- this.fosterParentingEnabled = false;
- this.options = {
- ...defaultParserOptions,
- ...options
- };
- this.treeAdapter = this.options.treeAdapter;
- this.onParseError = this.options.onParseError;
- if (this.onParseError) {
- this.options.sourceCodeLocationInfo = true;
- }
- this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();
- this.tokenizer = new Tokenizer(this.options, this);
- this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
- this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : TAG_ID.UNKNOWN;
- this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID);
- this.openElements = new OpenElementStack(this.document, this.treeAdapter, this);
- }
- // API
- static parse(html, options) {
- const parser = new this(options);
- parser.tokenizer.write(html, true);
- return parser.document;
- }
- static getFragmentParser(fragmentContext, options) {
- const opts = {
- ...defaultParserOptions,
- ...options
- };
- fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : fragmentContext = opts.treeAdapter.createElement(TAG_NAMES.TEMPLATE, NS.HTML, []);
- const documentMock = opts.treeAdapter.createElement("documentmock", NS.HTML, []);
- const parser = new this(opts, documentMock, fragmentContext);
- if (parser.fragmentContextID === TAG_ID.TEMPLATE) {
- parser.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
- }
- parser._initTokenizerForFragmentParsing();
- parser._insertFakeRootElement();
- parser._resetInsertionMode();
- parser._findFormInFragmentContext();
- return parser;
- }
- getFragment() {
- const rootElement = this.treeAdapter.getFirstChild(this.document);
- const fragment = this.treeAdapter.createDocumentFragment();
- this._adoptNodes(rootElement, fragment);
- return fragment;
- }
- //Errors
- _err(token, code, beforeToken) {
- var _a2;
- if (!this.onParseError)
- return;
- const loc = (_a2 = token.location) !== null && _a2 !== void 0 ? _a2 : BASE_LOC;
- const err2 = {
- code,
- startLine: loc.startLine,
- startCol: loc.startCol,
- startOffset: loc.startOffset,
- endLine: beforeToken ? loc.startLine : loc.endLine,
- endCol: beforeToken ? loc.startCol : loc.endCol,
- endOffset: beforeToken ? loc.startOffset : loc.endOffset
- };
- this.onParseError(err2);
- }
- //Stack events
- onItemPush(node, tid, isTop) {
- var _a2, _b;
- (_b = (_a2 = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a2, node);
- if (isTop && this.openElements.stackTop > 0)
- this._setContextModes(node, tid);
- }
- onItemPop(node, isTop) {
- var _a2, _b;
- if (this.options.sourceCodeLocationInfo) {
- this._setEndLocation(node, this.currentToken);
- }
- (_b = (_a2 = this.treeAdapter).onItemPop) === null || _b === void 0 ? void 0 : _b.call(_a2, node, this.openElements.current);
- if (isTop) {
- let current;
- let currentTagId;
- if (this.openElements.stackTop === 0 && this.fragmentContext) {
- current = this.fragmentContext;
- currentTagId = this.fragmentContextID;
- } else {
- ({ current, currentTagId } = this.openElements);
- }
- this._setContextModes(current, currentTagId);
- }
- }
- _setContextModes(current, tid) {
- const isHTML = current === this.document || this.treeAdapter.getNamespaceURI(current) === NS.HTML;
- this.currentNotInHTML = !isHTML;
- this.tokenizer.inForeignNode = !isHTML && !this._isIntegrationPoint(tid, current);
- }
- _switchToTextParsing(currentToken, nextTokenizerState) {
- this._insertElement(currentToken, NS.HTML);
- this.tokenizer.state = nextTokenizerState;
- this.originalInsertionMode = this.insertionMode;
- this.insertionMode = InsertionMode.TEXT;
- }
- switchToPlaintextParsing() {
- this.insertionMode = InsertionMode.TEXT;
- this.originalInsertionMode = InsertionMode.IN_BODY;
- this.tokenizer.state = TokenizerMode.PLAINTEXT;
- }
- //Fragment parsing
- _getAdjustedCurrentElement() {
- return this.openElements.stackTop === 0 && this.fragmentContext ? this.fragmentContext : this.openElements.current;
- }
- _findFormInFragmentContext() {
- let node = this.fragmentContext;
- while (node) {
- if (this.treeAdapter.getTagName(node) === TAG_NAMES.FORM) {
- this.formElement = node;
- break;
- }
- node = this.treeAdapter.getParentNode(node);
- }
- }
- _initTokenizerForFragmentParsing() {
- if (!this.fragmentContext || this.treeAdapter.getNamespaceURI(this.fragmentContext) !== NS.HTML) {
- return;
- }
- switch (this.fragmentContextID) {
- case TAG_ID.TITLE:
- case TAG_ID.TEXTAREA: {
- this.tokenizer.state = TokenizerMode.RCDATA;
- break;
- }
- case TAG_ID.STYLE:
- case TAG_ID.XMP:
- case TAG_ID.IFRAME:
- case TAG_ID.NOEMBED:
- case TAG_ID.NOFRAMES:
- case TAG_ID.NOSCRIPT: {
- this.tokenizer.state = TokenizerMode.RAWTEXT;
- break;
- }
- case TAG_ID.SCRIPT: {
- this.tokenizer.state = TokenizerMode.SCRIPT_DATA;
- break;
- }
- case TAG_ID.PLAINTEXT: {
- this.tokenizer.state = TokenizerMode.PLAINTEXT;
- break;
- }
- default:
- }
- }
- //Tree mutation
- _setDocumentType(token) {
- const name = token.name || "";
- const publicId = token.publicId || "";
- const systemId = token.systemId || "";
- this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
- if (token.location) {
- const documentChildren = this.treeAdapter.getChildNodes(this.document);
- const docTypeNode = documentChildren.find((node) => this.treeAdapter.isDocumentTypeNode(node));
- if (docTypeNode) {
- this.treeAdapter.setNodeSourceCodeLocation(docTypeNode, token.location);
- }
- }
- }
- _attachElementToTree(element, location2) {
- if (this.options.sourceCodeLocationInfo) {
- const loc = location2 && {
- ...location2,
- startTag: location2
- };
- this.treeAdapter.setNodeSourceCodeLocation(element, loc);
- }
- if (this._shouldFosterParentOnInsertion()) {
- this._fosterParentElement(element);
- } else {
- const parent = this.openElements.currentTmplContentOrNode;
- this.treeAdapter.appendChild(parent, element);
- }
- }
- _appendElement(token, namespaceURI) {
- const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
- this._attachElementToTree(element, token.location);
- }
- _insertElement(token, namespaceURI) {
- const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
- this._attachElementToTree(element, token.location);
- this.openElements.push(element, token.tagID);
- }
- _insertFakeElement(tagName, tagID) {
- const element = this.treeAdapter.createElement(tagName, NS.HTML, []);
- this._attachElementToTree(element, null);
- this.openElements.push(element, tagID);
- }
- _insertTemplate(token) {
- const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
- const content = this.treeAdapter.createDocumentFragment();
- this.treeAdapter.setTemplateContent(tmpl, content);
- this._attachElementToTree(tmpl, token.location);
- this.openElements.push(tmpl, token.tagID);
- if (this.options.sourceCodeLocationInfo)
- this.treeAdapter.setNodeSourceCodeLocation(content, null);
- }
- _insertFakeRootElement() {
- const element = this.treeAdapter.createElement(TAG_NAMES.HTML, NS.HTML, []);
- if (this.options.sourceCodeLocationInfo)
- this.treeAdapter.setNodeSourceCodeLocation(element, null);
- this.treeAdapter.appendChild(this.openElements.current, element);
- this.openElements.push(element, TAG_ID.HTML);
- }
- _appendCommentNode(token, parent) {
- const commentNode = this.treeAdapter.createCommentNode(token.data);
- this.treeAdapter.appendChild(parent, commentNode);
- if (this.options.sourceCodeLocationInfo) {
- this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
- }
- }
- _insertCharacters(token) {
- let parent;
- let beforeElement;
- if (this._shouldFosterParentOnInsertion()) {
- ({ parent, beforeElement } = this._findFosterParentingLocation());
- if (beforeElement) {
- this.treeAdapter.insertTextBefore(parent, token.chars, beforeElement);
- } else {
- this.treeAdapter.insertText(parent, token.chars);
- }
- } else {
- parent = this.openElements.currentTmplContentOrNode;
- this.treeAdapter.insertText(parent, token.chars);
- }
- if (!token.location)
- return;
- const siblings = this.treeAdapter.getChildNodes(parent);
- const textNodeIdx = beforeElement ? siblings.lastIndexOf(beforeElement) : siblings.length;
- const textNode = siblings[textNodeIdx - 1];
- const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);
- if (tnLoc) {
- const { endLine, endCol, endOffset } = token.location;
- this.treeAdapter.updateNodeSourceCodeLocation(textNode, { endLine, endCol, endOffset });
- } else if (this.options.sourceCodeLocationInfo) {
- this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
- }
- }
- _adoptNodes(donor, recipient) {
- for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
- this.treeAdapter.detachNode(child);
- this.treeAdapter.appendChild(recipient, child);
- }
- }
- _setEndLocation(element, closingToken) {
- if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
- const ctLoc = closingToken.location;
- const tn = this.treeAdapter.getTagName(element);
- const endLoc = (
- // NOTE: For cases like <p> <p> </p> - First 'p' closes without a closing
- // tag and for cases like <td> <p> </td> - 'p' closes without a closing tag.
- closingToken.type === TokenType.END_TAG && tn === closingToken.tagName ? {
- endTag: { ...ctLoc },
- endLine: ctLoc.endLine,
- endCol: ctLoc.endCol,
- endOffset: ctLoc.endOffset
- } : {
- endLine: ctLoc.startLine,
- endCol: ctLoc.startCol,
- endOffset: ctLoc.startOffset
- }
- );
- this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc);
- }
- }
- //Token processing
- shouldProcessStartTagTokenInForeignContent(token) {
- if (!this.currentNotInHTML)
- return false;
- let current;
- let currentTagId;
- if (this.openElements.stackTop === 0 && this.fragmentContext) {
- current = this.fragmentContext;
- currentTagId = this.fragmentContextID;
- } else {
- ({ current, currentTagId } = this.openElements);
- }
- if (token.tagID === TAG_ID.SVG && this.treeAdapter.getTagName(current) === TAG_NAMES.ANNOTATION_XML && this.treeAdapter.getNamespaceURI(current) === NS.MATHML) {
- return false;
- }
- return (
- // Check that `current` is not an integration point for HTML or MathML elements.
- this.tokenizer.inForeignNode || // If it _is_ an integration point, then we might have to check that it is not an HTML
- // integration point.
- (token.tagID === TAG_ID.MGLYPH || token.tagID === TAG_ID.MALIGNMARK) && !this._isIntegrationPoint(currentTagId, current, NS.HTML)
- );
- }
- _processToken(token) {
- switch (token.type) {
- case TokenType.CHARACTER: {
- this.onCharacter(token);
- break;
- }
- case TokenType.NULL_CHARACTER: {
- this.onNullCharacter(token);
- break;
- }
- case TokenType.COMMENT: {
- this.onComment(token);
- break;
- }
- case TokenType.DOCTYPE: {
- this.onDoctype(token);
- break;
- }
- case TokenType.START_TAG: {
- this._processStartTag(token);
- break;
- }
- case TokenType.END_TAG: {
- this.onEndTag(token);
- break;
- }
- case TokenType.EOF: {
- this.onEof(token);
- break;
- }
- case TokenType.WHITESPACE_CHARACTER: {
- this.onWhitespaceCharacter(token);
- break;
- }
- }
- }
- //Integration points
- _isIntegrationPoint(tid, element, foreignNS) {
- const ns = this.treeAdapter.getNamespaceURI(element);
- const attrs = this.treeAdapter.getAttrList(element);
- return isIntegrationPoint(tid, ns, attrs, foreignNS);
- }
- //Active formatting elements reconstruction
- _reconstructActiveFormattingElements() {
- const listLength = this.activeFormattingElements.entries.length;
- if (listLength) {
- const endIndex = this.activeFormattingElements.entries.findIndex((entry) => entry.type === EntryType.Marker || this.openElements.contains(entry.element));
- const unopenIdx = endIndex < 0 ? listLength - 1 : endIndex - 1;
- for (let i = unopenIdx; i >= 0; i--) {
- const entry = this.activeFormattingElements.entries[i];
- this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));
- entry.element = this.openElements.current;
- }
- }
- }
- //Close elements
- _closeTableCell() {
- this.openElements.generateImpliedEndTags();
- this.openElements.popUntilTableCellPopped();
- this.activeFormattingElements.clearToLastMarker();
- this.insertionMode = InsertionMode.IN_ROW;
- }
- _closePElement() {
- this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P);
- this.openElements.popUntilTagNamePopped(TAG_ID.P);
- }
- //Insertion modes
- _resetInsertionMode() {
- for (let i = this.openElements.stackTop; i >= 0; i--) {
- switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {
- case TAG_ID.TR: {
- this.insertionMode = InsertionMode.IN_ROW;
- return;
- }
- case TAG_ID.TBODY:
- case TAG_ID.THEAD:
- case TAG_ID.TFOOT: {
- this.insertionMode = InsertionMode.IN_TABLE_BODY;
- return;
- }
- case TAG_ID.CAPTION: {
- this.insertionMode = InsertionMode.IN_CAPTION;
- return;
- }
- case TAG_ID.COLGROUP: {
- this.insertionMode = InsertionMode.IN_COLUMN_GROUP;
- return;
- }
- case TAG_ID.TABLE: {
- this.insertionMode = InsertionMode.IN_TABLE;
- return;
- }
- case TAG_ID.BODY: {
- this.insertionMode = InsertionMode.IN_BODY;
- return;
- }
- case TAG_ID.FRAMESET: {
- this.insertionMode = InsertionMode.IN_FRAMESET;
- return;
- }
- case TAG_ID.SELECT: {
- this._resetInsertionModeForSelect(i);
- return;
- }
- case TAG_ID.TEMPLATE: {
- this.insertionMode = this.tmplInsertionModeStack[0];
- return;
- }
- case TAG_ID.HTML: {
- this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD;
- return;
- }
- case TAG_ID.TD:
- case TAG_ID.TH: {
- if (i > 0) {
- this.insertionMode = InsertionMode.IN_CELL;
- return;
- }
- break;
- }
- case TAG_ID.HEAD: {
- if (i > 0) {
- this.insertionMode = InsertionMode.IN_HEAD;
- return;
- }
- break;
- }
- }
- }
- this.insertionMode = InsertionMode.IN_BODY;
- }
- _resetInsertionModeForSelect(selectIdx) {
- if (selectIdx > 0) {
- for (let i = selectIdx - 1; i > 0; i--) {
- const tn = this.openElements.tagIDs[i];
- if (tn === TAG_ID.TEMPLATE) {
- break;
- } else if (tn === TAG_ID.TABLE) {
- this.insertionMode = InsertionMode.IN_SELECT_IN_TABLE;
- return;
- }
- }
- }
- this.insertionMode = InsertionMode.IN_SELECT;
- }
- //Foster parenting
- _isElementCausesFosterParenting(tn) {
- return TABLE_STRUCTURE_TAGS.has(tn);
- }
- _shouldFosterParentOnInsertion() {
- return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.currentTagId);
- }
- _findFosterParentingLocation() {
- for (let i = this.openElements.stackTop; i >= 0; i--) {
- const openElement = this.openElements.items[i];
- switch (this.openElements.tagIDs[i]) {
- case TAG_ID.TEMPLATE: {
- if (this.treeAdapter.getNamespaceURI(openElement) === NS.HTML) {
- return { parent: this.treeAdapter.getTemplateContent(openElement), beforeElement: null };
- }
- break;
- }
- case TAG_ID.TABLE: {
- const parent = this.treeAdapter.getParentNode(openElement);
- if (parent) {
- return { parent, beforeElement: openElement };
- }
- return { parent: this.openElements.items[i - 1], beforeElement: null };
- }
- default:
- }
- }
- return { parent: this.openElements.items[0], beforeElement: null };
- }
- _fosterParentElement(element) {
- const location2 = this._findFosterParentingLocation();
- if (location2.beforeElement) {
- this.treeAdapter.insertBefore(location2.parent, element, location2.beforeElement);
- } else {
- this.treeAdapter.appendChild(location2.parent, element);
- }
- }
- //Special elements
- _isSpecialElement(element, id) {
- const ns = this.treeAdapter.getNamespaceURI(element);
- return SPECIAL_ELEMENTS[ns].has(id);
- }
- onCharacter(token) {
- this.skipNextNewLine = false;
- if (this.tokenizer.inForeignNode) {
- characterInForeignContent(this, token);
- return;
- }
- switch (this.insertionMode) {
- case InsertionMode.INITIAL: {
- tokenInInitialMode(this, token);
- break;
- }
- case InsertionMode.BEFORE_HTML: {
- tokenBeforeHtml(this, token);
- break;
- }
- case InsertionMode.BEFORE_HEAD: {
- tokenBeforeHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD: {
- tokenInHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
- tokenInHeadNoScript(this, token);
- break;
- }
- case InsertionMode.AFTER_HEAD: {
- tokenAfterHead(this, token);
- break;
- }
- case InsertionMode.IN_BODY:
- case InsertionMode.IN_CAPTION:
- case InsertionMode.IN_CELL:
- case InsertionMode.IN_TEMPLATE: {
- characterInBody(this, token);
- break;
- }
- case InsertionMode.TEXT:
- case InsertionMode.IN_SELECT:
- case InsertionMode.IN_SELECT_IN_TABLE: {
- this._insertCharacters(token);
- break;
- }
- case InsertionMode.IN_TABLE:
- case InsertionMode.IN_TABLE_BODY:
- case InsertionMode.IN_ROW: {
- characterInTable(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_TEXT: {
- characterInTableText(this, token);
- break;
- }
- case InsertionMode.IN_COLUMN_GROUP: {
- tokenInColumnGroup(this, token);
- break;
- }
- case InsertionMode.AFTER_BODY: {
- tokenAfterBody(this, token);
- break;
- }
- case InsertionMode.AFTER_AFTER_BODY: {
- tokenAfterAfterBody(this, token);
- break;
- }
- default:
- }
- }
- onNullCharacter(token) {
- this.skipNextNewLine = false;
- if (this.tokenizer.inForeignNode) {
- nullCharacterInForeignContent(this, token);
- return;
- }
- switch (this.insertionMode) {
- case InsertionMode.INITIAL: {
- tokenInInitialMode(this, token);
- break;
- }
- case InsertionMode.BEFORE_HTML: {
- tokenBeforeHtml(this, token);
- break;
- }
- case InsertionMode.BEFORE_HEAD: {
- tokenBeforeHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD: {
- tokenInHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
- tokenInHeadNoScript(this, token);
- break;
- }
- case InsertionMode.AFTER_HEAD: {
- tokenAfterHead(this, token);
- break;
- }
- case InsertionMode.TEXT: {
- this._insertCharacters(token);
- break;
- }
- case InsertionMode.IN_TABLE:
- case InsertionMode.IN_TABLE_BODY:
- case InsertionMode.IN_ROW: {
- characterInTable(this, token);
- break;
- }
- case InsertionMode.IN_COLUMN_GROUP: {
- tokenInColumnGroup(this, token);
- break;
- }
- case InsertionMode.AFTER_BODY: {
- tokenAfterBody(this, token);
- break;
- }
- case InsertionMode.AFTER_AFTER_BODY: {
- tokenAfterAfterBody(this, token);
- break;
- }
- default:
- }
- }
- onComment(token) {
- this.skipNextNewLine = false;
- if (this.currentNotInHTML) {
- appendComment(this, token);
- return;
- }
- switch (this.insertionMode) {
- case InsertionMode.INITIAL:
- case InsertionMode.BEFORE_HTML:
- case InsertionMode.BEFORE_HEAD:
- case InsertionMode.IN_HEAD:
- case InsertionMode.IN_HEAD_NO_SCRIPT:
- case InsertionMode.AFTER_HEAD:
- case InsertionMode.IN_BODY:
- case InsertionMode.IN_TABLE:
- case InsertionMode.IN_CAPTION:
- case InsertionMode.IN_COLUMN_GROUP:
- case InsertionMode.IN_TABLE_BODY:
- case InsertionMode.IN_ROW:
- case InsertionMode.IN_CELL:
- case InsertionMode.IN_SELECT:
- case InsertionMode.IN_SELECT_IN_TABLE:
- case InsertionMode.IN_TEMPLATE:
- case InsertionMode.IN_FRAMESET:
- case InsertionMode.AFTER_FRAMESET: {
- appendComment(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_TEXT: {
- tokenInTableText(this, token);
- break;
- }
- case InsertionMode.AFTER_BODY: {
- appendCommentToRootHtmlElement(this, token);
- break;
- }
- case InsertionMode.AFTER_AFTER_BODY:
- case InsertionMode.AFTER_AFTER_FRAMESET: {
- appendCommentToDocument(this, token);
- break;
- }
- default:
- }
- }
- onDoctype(token) {
- this.skipNextNewLine = false;
- switch (this.insertionMode) {
- case InsertionMode.INITIAL: {
- doctypeInInitialMode(this, token);
- break;
- }
- case InsertionMode.BEFORE_HEAD:
- case InsertionMode.IN_HEAD:
- case InsertionMode.IN_HEAD_NO_SCRIPT:
- case InsertionMode.AFTER_HEAD: {
- this._err(token, ERR.misplacedDoctype);
- break;
- }
- case InsertionMode.IN_TABLE_TEXT: {
- tokenInTableText(this, token);
- break;
- }
- default:
- }
- }
- onStartTag(token) {
- this.skipNextNewLine = false;
- this.currentToken = token;
- this._processStartTag(token);
- if (token.selfClosing && !token.ackSelfClosing) {
- this._err(token, ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
- }
- }
- /**
- * Processes a given start tag.
- *
- * `onStartTag` checks if a self-closing tag was recognized. When a token
- * is moved inbetween multiple insertion modes, this check for self-closing
- * could lead to false positives. To avoid this, `_processStartTag` is used
- * for nested calls.
- *
- * @param token The token to process.
- */
- _processStartTag(token) {
- if (this.shouldProcessStartTagTokenInForeignContent(token)) {
- startTagInForeignContent(this, token);
- } else {
- this._startTagOutsideForeignContent(token);
- }
- }
- _startTagOutsideForeignContent(token) {
- switch (this.insertionMode) {
- case InsertionMode.INITIAL: {
- tokenInInitialMode(this, token);
- break;
- }
- case InsertionMode.BEFORE_HTML: {
- startTagBeforeHtml(this, token);
- break;
- }
- case InsertionMode.BEFORE_HEAD: {
- startTagBeforeHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD: {
- startTagInHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
- startTagInHeadNoScript(this, token);
- break;
- }
- case InsertionMode.AFTER_HEAD: {
- startTagAfterHead(this, token);
- break;
- }
- case InsertionMode.IN_BODY: {
- startTagInBody(this, token);
- break;
- }
- case InsertionMode.IN_TABLE: {
- startTagInTable(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_TEXT: {
- tokenInTableText(this, token);
- break;
- }
- case InsertionMode.IN_CAPTION: {
- startTagInCaption(this, token);
- break;
- }
- case InsertionMode.IN_COLUMN_GROUP: {
- startTagInColumnGroup(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_BODY: {
- startTagInTableBody(this, token);
- break;
- }
- case InsertionMode.IN_ROW: {
- startTagInRow(this, token);
- break;
- }
- case InsertionMode.IN_CELL: {
- startTagInCell(this, token);
- break;
- }
- case InsertionMode.IN_SELECT: {
- startTagInSelect(this, token);
- break;
- }
- case InsertionMode.IN_SELECT_IN_TABLE: {
- startTagInSelectInTable(this, token);
- break;
- }
- case InsertionMode.IN_TEMPLATE: {
- startTagInTemplate(this, token);
- break;
- }
- case InsertionMode.AFTER_BODY: {
- startTagAfterBody(this, token);
- break;
- }
- case InsertionMode.IN_FRAMESET: {
- startTagInFrameset(this, token);
- break;
- }
- case InsertionMode.AFTER_FRAMESET: {
- startTagAfterFrameset(this, token);
- break;
- }
- case InsertionMode.AFTER_AFTER_BODY: {
- startTagAfterAfterBody(this, token);
- break;
- }
- case InsertionMode.AFTER_AFTER_FRAMESET: {
- startTagAfterAfterFrameset(this, token);
- break;
- }
- default:
- }
- }
- onEndTag(token) {
- this.skipNextNewLine = false;
- this.currentToken = token;
- if (this.currentNotInHTML) {
- endTagInForeignContent(this, token);
- } else {
- this._endTagOutsideForeignContent(token);
- }
- }
- _endTagOutsideForeignContent(token) {
- switch (this.insertionMode) {
- case InsertionMode.INITIAL: {
- tokenInInitialMode(this, token);
- break;
- }
- case InsertionMode.BEFORE_HTML: {
- endTagBeforeHtml(this, token);
- break;
- }
- case InsertionMode.BEFORE_HEAD: {
- endTagBeforeHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD: {
- endTagInHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
- endTagInHeadNoScript(this, token);
- break;
- }
- case InsertionMode.AFTER_HEAD: {
- endTagAfterHead(this, token);
- break;
- }
- case InsertionMode.IN_BODY: {
- endTagInBody(this, token);
- break;
- }
- case InsertionMode.TEXT: {
- endTagInText(this, token);
- break;
- }
- case InsertionMode.IN_TABLE: {
- endTagInTable(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_TEXT: {
- tokenInTableText(this, token);
- break;
- }
- case InsertionMode.IN_CAPTION: {
- endTagInCaption(this, token);
- break;
- }
- case InsertionMode.IN_COLUMN_GROUP: {
- endTagInColumnGroup(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_BODY: {
- endTagInTableBody(this, token);
- break;
- }
- case InsertionMode.IN_ROW: {
- endTagInRow(this, token);
- break;
- }
- case InsertionMode.IN_CELL: {
- endTagInCell(this, token);
- break;
- }
- case InsertionMode.IN_SELECT: {
- endTagInSelect(this, token);
- break;
- }
- case InsertionMode.IN_SELECT_IN_TABLE: {
- endTagInSelectInTable(this, token);
- break;
- }
- case InsertionMode.IN_TEMPLATE: {
- endTagInTemplate(this, token);
- break;
- }
- case InsertionMode.AFTER_BODY: {
- endTagAfterBody(this, token);
- break;
- }
- case InsertionMode.IN_FRAMESET: {
- endTagInFrameset(this, token);
- break;
- }
- case InsertionMode.AFTER_FRAMESET: {
- endTagAfterFrameset(this, token);
- break;
- }
- case InsertionMode.AFTER_AFTER_BODY: {
- tokenAfterAfterBody(this, token);
- break;
- }
- default:
- }
- }
- onEof(token) {
- switch (this.insertionMode) {
- case InsertionMode.INITIAL: {
- tokenInInitialMode(this, token);
- break;
- }
- case InsertionMode.BEFORE_HTML: {
- tokenBeforeHtml(this, token);
- break;
- }
- case InsertionMode.BEFORE_HEAD: {
- tokenBeforeHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD: {
- tokenInHead(this, token);
- break;
- }
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
- tokenInHeadNoScript(this, token);
- break;
- }
- case InsertionMode.AFTER_HEAD: {
- tokenAfterHead(this, token);
- break;
- }
- case InsertionMode.IN_BODY:
- case InsertionMode.IN_TABLE:
- case InsertionMode.IN_CAPTION:
- case InsertionMode.IN_COLUMN_GROUP:
- case InsertionMode.IN_TABLE_BODY:
- case InsertionMode.IN_ROW:
- case InsertionMode.IN_CELL:
- case InsertionMode.IN_SELECT:
- case InsertionMode.IN_SELECT_IN_TABLE: {
- eofInBody(this, token);
- break;
- }
- case InsertionMode.TEXT: {
- eofInText(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_TEXT: {
- tokenInTableText(this, token);
- break;
- }
- case InsertionMode.IN_TEMPLATE: {
- eofInTemplate(this, token);
- break;
- }
- case InsertionMode.AFTER_BODY:
- case InsertionMode.IN_FRAMESET:
- case InsertionMode.AFTER_FRAMESET:
- case InsertionMode.AFTER_AFTER_BODY:
- case InsertionMode.AFTER_AFTER_FRAMESET: {
- stopParsing(this, token);
- break;
- }
- default:
- }
- }
- onWhitespaceCharacter(token) {
- if (this.skipNextNewLine) {
- this.skipNextNewLine = false;
- if (token.chars.charCodeAt(0) === CODE_POINTS.LINE_FEED) {
- if (token.chars.length === 1) {
- return;
- }
- token.chars = token.chars.substr(1);
- }
- }
- if (this.tokenizer.inForeignNode) {
- this._insertCharacters(token);
- return;
- }
- switch (this.insertionMode) {
- case InsertionMode.IN_HEAD:
- case InsertionMode.IN_HEAD_NO_SCRIPT:
- case InsertionMode.AFTER_HEAD:
- case InsertionMode.TEXT:
- case InsertionMode.IN_COLUMN_GROUP:
- case InsertionMode.IN_SELECT:
- case InsertionMode.IN_SELECT_IN_TABLE:
- case InsertionMode.IN_FRAMESET:
- case InsertionMode.AFTER_FRAMESET: {
- this._insertCharacters(token);
- break;
- }
- case InsertionMode.IN_BODY:
- case InsertionMode.IN_CAPTION:
- case InsertionMode.IN_CELL:
- case InsertionMode.IN_TEMPLATE:
- case InsertionMode.AFTER_BODY:
- case InsertionMode.AFTER_AFTER_BODY:
- case InsertionMode.AFTER_AFTER_FRAMESET: {
- whitespaceCharacterInBody(this, token);
- break;
- }
- case InsertionMode.IN_TABLE:
- case InsertionMode.IN_TABLE_BODY:
- case InsertionMode.IN_ROW: {
- characterInTable(this, token);
- break;
- }
- case InsertionMode.IN_TABLE_TEXT: {
- whitespaceCharacterInTableText(this, token);
- break;
- }
- default:
- }
- }
- };
- function aaObtainFormattingElementEntry(p, token) {
- let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);
- if (formattingElementEntry) {
- if (!p.openElements.contains(formattingElementEntry.element)) {
- p.activeFormattingElements.removeEntry(formattingElementEntry);
- formattingElementEntry = null;
- } else if (!p.openElements.hasInScope(token.tagID)) {
- formattingElementEntry = null;
- }
- } else {
- genericEndTagInBody(p, token);
- }
- return formattingElementEntry;
- }
- function aaObtainFurthestBlock(p, formattingElementEntry) {
- let furthestBlock = null;
- let idx = p.openElements.stackTop;
- for (; idx >= 0; idx--) {
- const element = p.openElements.items[idx];
- if (element === formattingElementEntry.element) {
- break;
- }
- if (p._isSpecialElement(element, p.openElements.tagIDs[idx])) {
- furthestBlock = element;
- }
- }
- if (!furthestBlock) {
- p.openElements.shortenToLength(idx < 0 ? 0 : idx);
- p.activeFormattingElements.removeEntry(formattingElementEntry);
- }
- return furthestBlock;
- }
- function aaInnerLoop(p, furthestBlock, formattingElement) {
- let lastElement = furthestBlock;
- let nextElement = p.openElements.getCommonAncestor(furthestBlock);
- for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) {
- nextElement = p.openElements.getCommonAncestor(element);
- const elementEntry = p.activeFormattingElements.getElementEntry(element);
- const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;
- const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;
- if (shouldRemoveFromOpenElements) {
- if (counterOverflow) {
- p.activeFormattingElements.removeEntry(elementEntry);
- }
- p.openElements.remove(element);
- } else {
- element = aaRecreateElementFromEntry(p, elementEntry);
- if (lastElement === furthestBlock) {
- p.activeFormattingElements.bookmark = elementEntry;
- }
- p.treeAdapter.detachNode(lastElement);
- p.treeAdapter.appendChild(element, lastElement);
- lastElement = element;
- }
- }
- return lastElement;
- }
- function aaRecreateElementFromEntry(p, elementEntry) {
- const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);
- const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);
- p.openElements.replace(elementEntry.element, newElement);
- elementEntry.element = newElement;
- return newElement;
- }
- function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
- const tn = p.treeAdapter.getTagName(commonAncestor);
- const tid = getTagID(tn);
- if (p._isElementCausesFosterParenting(tid)) {
- p._fosterParentElement(lastElement);
- } else {
- const ns = p.treeAdapter.getNamespaceURI(commonAncestor);
- if (tid === TAG_ID.TEMPLATE && ns === NS.HTML) {
- commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
- }
- p.treeAdapter.appendChild(commonAncestor, lastElement);
- }
- }
- function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {
- const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);
- const { token } = formattingElementEntry;
- const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs);
- p._adoptNodes(furthestBlock, newElement);
- p.treeAdapter.appendChild(furthestBlock, newElement);
- p.activeFormattingElements.insertElementAfterBookmark(newElement, token);
- p.activeFormattingElements.removeEntry(formattingElementEntry);
- p.openElements.remove(formattingElementEntry.element);
- p.openElements.insertAfter(furthestBlock, newElement, token.tagID);
- }
- function callAdoptionAgency(p, token) {
- for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {
- const formattingElementEntry = aaObtainFormattingElementEntry(p, token);
- if (!formattingElementEntry) {
- break;
- }
- const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry);
- if (!furthestBlock) {
- break;
- }
- p.activeFormattingElements.bookmark = formattingElementEntry;
- const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element);
- const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element);
- p.treeAdapter.detachNode(lastElement);
- if (commonAncestor)
- aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement);
- aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry);
- }
- }
- function appendComment(p, token) {
- p._appendCommentNode(token, p.openElements.currentTmplContentOrNode);
- }
- function appendCommentToRootHtmlElement(p, token) {
- p._appendCommentNode(token, p.openElements.items[0]);
- }
- function appendCommentToDocument(p, token) {
- p._appendCommentNode(token, p.document);
- }
- function stopParsing(p, token) {
- p.stopped = true;
- if (token.location) {
- const target = p.fragmentContext ? 0 : 2;
- for (let i = p.openElements.stackTop; i >= target; i--) {
- p._setEndLocation(p.openElements.items[i], token);
- }
- if (!p.fragmentContext && p.openElements.stackTop >= 0) {
- const htmlElement = p.openElements.items[0];
- const htmlLocation = p.treeAdapter.getNodeSourceCodeLocation(htmlElement);
- if (htmlLocation && !htmlLocation.endTag) {
- p._setEndLocation(htmlElement, token);
- if (p.openElements.stackTop >= 1) {
- const bodyElement = p.openElements.items[1];
- const bodyLocation = p.treeAdapter.getNodeSourceCodeLocation(bodyElement);
- if (bodyLocation && !bodyLocation.endTag) {
- p._setEndLocation(bodyElement, token);
- }
- }
- }
- }
- }
- }
- function doctypeInInitialMode(p, token) {
- p._setDocumentType(token);
- const mode = token.forceQuirks ? DOCUMENT_MODE.QUIRKS : getDocumentMode(token);
- if (!isConforming(token)) {
- p._err(token, ERR.nonConformingDoctype);
- }
- p.treeAdapter.setDocumentMode(p.document, mode);
- p.insertionMode = InsertionMode.BEFORE_HTML;
- }
- function tokenInInitialMode(p, token) {
- p._err(token, ERR.missingDoctype, true);
- p.treeAdapter.setDocumentMode(p.document, DOCUMENT_MODE.QUIRKS);
- p.insertionMode = InsertionMode.BEFORE_HTML;
- p._processToken(token);
- }
- function startTagBeforeHtml(p, token) {
- if (token.tagID === TAG_ID.HTML) {
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.BEFORE_HEAD;
- } else {
- tokenBeforeHtml(p, token);
- }
- }
- function endTagBeforeHtml(p, token) {
- const tn = token.tagID;
- if (tn === TAG_ID.HTML || tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.BR) {
- tokenBeforeHtml(p, token);
- }
- }
- function tokenBeforeHtml(p, token) {
- p._insertFakeRootElement();
- p.insertionMode = InsertionMode.BEFORE_HEAD;
- p._processToken(token);
- }
- function startTagBeforeHead(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.HEAD: {
- p._insertElement(token, NS.HTML);
- p.headElement = p.openElements.current;
- p.insertionMode = InsertionMode.IN_HEAD;
- break;
- }
- default: {
- tokenBeforeHead(p, token);
- }
- }
- }
- function endTagBeforeHead(p, token) {
- const tn = token.tagID;
- if (tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.HTML || tn === TAG_ID.BR) {
- tokenBeforeHead(p, token);
- } else {
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
- }
- }
- function tokenBeforeHead(p, token) {
- p._insertFakeElement(TAG_NAMES.HEAD, TAG_ID.HEAD);
- p.headElement = p.openElements.current;
- p.insertionMode = InsertionMode.IN_HEAD;
- p._processToken(token);
- }
- function startTagInHead(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.BASE:
- case TAG_ID.BASEFONT:
- case TAG_ID.BGSOUND:
- case TAG_ID.LINK:
- case TAG_ID.META: {
- p._appendElement(token, NS.HTML);
- token.ackSelfClosing = true;
- break;
- }
- case TAG_ID.TITLE: {
- p._switchToTextParsing(token, TokenizerMode.RCDATA);
- break;
- }
- case TAG_ID.NOSCRIPT: {
- if (p.options.scriptingEnabled) {
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
- } else {
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT;
- }
- break;
- }
- case TAG_ID.NOFRAMES:
- case TAG_ID.STYLE: {
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
- break;
- }
- case TAG_ID.SCRIPT: {
- p._switchToTextParsing(token, TokenizerMode.SCRIPT_DATA);
- break;
- }
- case TAG_ID.TEMPLATE: {
- p._insertTemplate(token);
- p.activeFormattingElements.insertMarker();
- p.framesetOk = false;
- p.insertionMode = InsertionMode.IN_TEMPLATE;
- p.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
- break;
- }
- case TAG_ID.HEAD: {
- p._err(token, ERR.misplacedStartTagForHeadElement);
- break;
- }
- default: {
- tokenInHead(p, token);
- }
- }
- }
- function endTagInHead(p, token) {
- switch (token.tagID) {
- case TAG_ID.HEAD: {
- p.openElements.pop();
- p.insertionMode = InsertionMode.AFTER_HEAD;
- break;
- }
- case TAG_ID.BODY:
- case TAG_ID.BR:
- case TAG_ID.HTML: {
- tokenInHead(p, token);
- break;
- }
- case TAG_ID.TEMPLATE: {
- templateEndTagInHead(p, token);
- break;
- }
- default: {
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
- }
- }
- }
- function templateEndTagInHead(p, token) {
- if (p.openElements.tmplCount > 0) {
- p.openElements.generateImpliedEndTagsThoroughly();
- if (p.openElements.currentTagId !== TAG_ID.TEMPLATE) {
- p._err(token, ERR.closingOfElementWithOpenChildElements);
- }
- p.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
- p.activeFormattingElements.clearToLastMarker();
- p.tmplInsertionModeStack.shift();
- p._resetInsertionMode();
- } else {
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
- }
- }
- function tokenInHead(p, token) {
- p.openElements.pop();
- p.insertionMode = InsertionMode.AFTER_HEAD;
- p._processToken(token);
- }
- function startTagInHeadNoScript(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.BASEFONT:
- case TAG_ID.BGSOUND:
- case TAG_ID.HEAD:
- case TAG_ID.LINK:
- case TAG_ID.META:
- case TAG_ID.NOFRAMES:
- case TAG_ID.STYLE: {
- startTagInHead(p, token);
- break;
- }
- case TAG_ID.NOSCRIPT: {
- p._err(token, ERR.nestedNoscriptInHead);
- break;
- }
- default: {
- tokenInHeadNoScript(p, token);
- }
- }
- }
- function endTagInHeadNoScript(p, token) {
- switch (token.tagID) {
- case TAG_ID.NOSCRIPT: {
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_HEAD;
- break;
- }
- case TAG_ID.BR: {
- tokenInHeadNoScript(p, token);
- break;
- }
- default: {
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
- }
- }
- }
- function tokenInHeadNoScript(p, token) {
- const errCode = token.type === TokenType.EOF ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;
- p._err(token, errCode);
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_HEAD;
- p._processToken(token);
- }
- function startTagAfterHead(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.BODY: {
- p._insertElement(token, NS.HTML);
- p.framesetOk = false;
- p.insertionMode = InsertionMode.IN_BODY;
- break;
- }
- case TAG_ID.FRAMESET: {
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_FRAMESET;
- break;
- }
- case TAG_ID.BASE:
- case TAG_ID.BASEFONT:
- case TAG_ID.BGSOUND:
- case TAG_ID.LINK:
- case TAG_ID.META:
- case TAG_ID.NOFRAMES:
- case TAG_ID.SCRIPT:
- case TAG_ID.STYLE:
- case TAG_ID.TEMPLATE:
- case TAG_ID.TITLE: {
- p._err(token, ERR.abandonedHeadElementChild);
- p.openElements.push(p.headElement, TAG_ID.HEAD);
- startTagInHead(p, token);
- p.openElements.remove(p.headElement);
- break;
- }
- case TAG_ID.HEAD: {
- p._err(token, ERR.misplacedStartTagForHeadElement);
- break;
- }
- default: {
- tokenAfterHead(p, token);
- }
- }
- }
- function endTagAfterHead(p, token) {
- switch (token.tagID) {
- case TAG_ID.BODY:
- case TAG_ID.HTML:
- case TAG_ID.BR: {
- tokenAfterHead(p, token);
- break;
- }
- case TAG_ID.TEMPLATE: {
- templateEndTagInHead(p, token);
- break;
- }
- default: {
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
- }
- }
- }
- function tokenAfterHead(p, token) {
- p._insertFakeElement(TAG_NAMES.BODY, TAG_ID.BODY);
- p.insertionMode = InsertionMode.IN_BODY;
- modeInBody(p, token);
- }
- function modeInBody(p, token) {
- switch (token.type) {
- case TokenType.CHARACTER: {
- characterInBody(p, token);
- break;
- }
- case TokenType.WHITESPACE_CHARACTER: {
- whitespaceCharacterInBody(p, token);
- break;
- }
- case TokenType.COMMENT: {
- appendComment(p, token);
- break;
- }
- case TokenType.START_TAG: {
- startTagInBody(p, token);
- break;
- }
- case TokenType.END_TAG: {
- endTagInBody(p, token);
- break;
- }
- case TokenType.EOF: {
- eofInBody(p, token);
- break;
- }
- default:
- }
- }
- function whitespaceCharacterInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._insertCharacters(token);
- }
- function characterInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._insertCharacters(token);
- p.framesetOk = false;
- }
- function htmlStartTagInBody(p, token) {
- if (p.openElements.tmplCount === 0) {
- p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs);
- }
- }
- function bodyStartTagInBody(p, token) {
- const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
- if (bodyElement && p.openElements.tmplCount === 0) {
- p.framesetOk = false;
- p.treeAdapter.adoptAttributes(bodyElement, token.attrs);
- }
- }
- function framesetStartTagInBody(p, token) {
- const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
- if (p.framesetOk && bodyElement) {
- p.treeAdapter.detachNode(bodyElement);
- p.openElements.popAllUpToHtmlElement();
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_FRAMESET;
- }
- }
- function addressStartTagInBody(p, token) {
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._insertElement(token, NS.HTML);
- }
- function numberedHeaderStartTagInBody(p, token) {
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- if (isNumberedHeader(p.openElements.currentTagId)) {
- p.openElements.pop();
- }
- p._insertElement(token, NS.HTML);
- }
- function preStartTagInBody(p, token) {
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._insertElement(token, NS.HTML);
- p.skipNextNewLine = true;
- p.framesetOk = false;
- }
- function formStartTagInBody(p, token) {
- const inTemplate = p.openElements.tmplCount > 0;
- if (!p.formElement || inTemplate) {
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._insertElement(token, NS.HTML);
- if (!inTemplate) {
- p.formElement = p.openElements.current;
- }
- }
- }
- function listItemStartTagInBody(p, token) {
- p.framesetOk = false;
- const tn = token.tagID;
- for (let i = p.openElements.stackTop; i >= 0; i--) {
- const elementId = p.openElements.tagIDs[i];
- if (tn === TAG_ID.LI && elementId === TAG_ID.LI || (tn === TAG_ID.DD || tn === TAG_ID.DT) && (elementId === TAG_ID.DD || elementId === TAG_ID.DT)) {
- p.openElements.generateImpliedEndTagsWithExclusion(elementId);
- p.openElements.popUntilTagNamePopped(elementId);
- break;
- }
- if (elementId !== TAG_ID.ADDRESS && elementId !== TAG_ID.DIV && elementId !== TAG_ID.P && p._isSpecialElement(p.openElements.items[i], elementId)) {
- break;
- }
- }
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._insertElement(token, NS.HTML);
- }
- function plaintextStartTagInBody(p, token) {
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._insertElement(token, NS.HTML);
- p.tokenizer.state = TokenizerMode.PLAINTEXT;
- }
- function buttonStartTagInBody(p, token) {
- if (p.openElements.hasInScope(TAG_ID.BUTTON)) {
- p.openElements.generateImpliedEndTags();
- p.openElements.popUntilTagNamePopped(TAG_ID.BUTTON);
- }
- p._reconstructActiveFormattingElements();
- p._insertElement(token, NS.HTML);
- p.framesetOk = false;
- }
- function aStartTagInBody(p, token) {
- const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);
- if (activeElementEntry) {
- callAdoptionAgency(p, token);
- p.openElements.remove(activeElementEntry.element);
- p.activeFormattingElements.removeEntry(activeElementEntry);
- }
- p._reconstructActiveFormattingElements();
- p._insertElement(token, NS.HTML);
- p.activeFormattingElements.pushElement(p.openElements.current, token);
- }
- function bStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._insertElement(token, NS.HTML);
- p.activeFormattingElements.pushElement(p.openElements.current, token);
- }
- function nobrStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- if (p.openElements.hasInScope(TAG_ID.NOBR)) {
- callAdoptionAgency(p, token);
- p._reconstructActiveFormattingElements();
- }
- p._insertElement(token, NS.HTML);
- p.activeFormattingElements.pushElement(p.openElements.current, token);
- }
- function appletStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._insertElement(token, NS.HTML);
- p.activeFormattingElements.insertMarker();
- p.framesetOk = false;
- }
- function tableStartTagInBody(p, token) {
- if (p.treeAdapter.getDocumentMode(p.document) !== DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._insertElement(token, NS.HTML);
- p.framesetOk = false;
- p.insertionMode = InsertionMode.IN_TABLE;
- }
- function areaStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._appendElement(token, NS.HTML);
- p.framesetOk = false;
- token.ackSelfClosing = true;
- }
- function isHiddenInput(token) {
- const inputType = getTokenAttr(token, ATTRS.TYPE);
- return inputType != null && inputType.toLowerCase() === HIDDEN_INPUT_TYPE;
- }
- function inputStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._appendElement(token, NS.HTML);
- if (!isHiddenInput(token)) {
- p.framesetOk = false;
- }
- token.ackSelfClosing = true;
- }
- function paramStartTagInBody(p, token) {
- p._appendElement(token, NS.HTML);
- token.ackSelfClosing = true;
- }
- function hrStartTagInBody(p, token) {
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._appendElement(token, NS.HTML);
- p.framesetOk = false;
- token.ackSelfClosing = true;
- }
- function imageStartTagInBody(p, token) {
- token.tagName = TAG_NAMES.IMG;
- token.tagID = TAG_ID.IMG;
- areaStartTagInBody(p, token);
- }
- function textareaStartTagInBody(p, token) {
- p._insertElement(token, NS.HTML);
- p.skipNextNewLine = true;
- p.tokenizer.state = TokenizerMode.RCDATA;
- p.originalInsertionMode = p.insertionMode;
- p.framesetOk = false;
- p.insertionMode = InsertionMode.TEXT;
- }
- function xmpStartTagInBody(p, token) {
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._closePElement();
- }
- p._reconstructActiveFormattingElements();
- p.framesetOk = false;
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
- }
- function iframeStartTagInBody(p, token) {
- p.framesetOk = false;
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
- }
- function noembedStartTagInBody(p, token) {
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
- }
- function selectStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._insertElement(token, NS.HTML);
- p.framesetOk = false;
- p.insertionMode = p.insertionMode === InsertionMode.IN_TABLE || p.insertionMode === InsertionMode.IN_CAPTION || p.insertionMode === InsertionMode.IN_TABLE_BODY || p.insertionMode === InsertionMode.IN_ROW || p.insertionMode === InsertionMode.IN_CELL ? InsertionMode.IN_SELECT_IN_TABLE : InsertionMode.IN_SELECT;
- }
- function optgroupStartTagInBody(p, token) {
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
- p.openElements.pop();
- }
- p._reconstructActiveFormattingElements();
- p._insertElement(token, NS.HTML);
- }
- function rbStartTagInBody(p, token) {
- if (p.openElements.hasInScope(TAG_ID.RUBY)) {
- p.openElements.generateImpliedEndTags();
- }
- p._insertElement(token, NS.HTML);
- }
- function rtStartTagInBody(p, token) {
- if (p.openElements.hasInScope(TAG_ID.RUBY)) {
- p.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC);
- }
- p._insertElement(token, NS.HTML);
- }
- function mathStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- adjustTokenMathMLAttrs(token);
- adjustTokenXMLAttrs(token);
- if (token.selfClosing) {
- p._appendElement(token, NS.MATHML);
- } else {
- p._insertElement(token, NS.MATHML);
- }
- token.ackSelfClosing = true;
- }
- function svgStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- adjustTokenSVGAttrs(token);
- adjustTokenXMLAttrs(token);
- if (token.selfClosing) {
- p._appendElement(token, NS.SVG);
- } else {
- p._insertElement(token, NS.SVG);
- }
- token.ackSelfClosing = true;
- }
- function genericStartTagInBody(p, token) {
- p._reconstructActiveFormattingElements();
- p._insertElement(token, NS.HTML);
- }
- function startTagInBody(p, token) {
- switch (token.tagID) {
- case TAG_ID.I:
- case TAG_ID.S:
- case TAG_ID.B:
- case TAG_ID.U:
- case TAG_ID.EM:
- case TAG_ID.TT:
- case TAG_ID.BIG:
- case TAG_ID.CODE:
- case TAG_ID.FONT:
- case TAG_ID.SMALL:
- case TAG_ID.STRIKE:
- case TAG_ID.STRONG: {
- bStartTagInBody(p, token);
- break;
- }
- case TAG_ID.A: {
- aStartTagInBody(p, token);
- break;
- }
- case TAG_ID.H1:
- case TAG_ID.H2:
- case TAG_ID.H3:
- case TAG_ID.H4:
- case TAG_ID.H5:
- case TAG_ID.H6: {
- numberedHeaderStartTagInBody(p, token);
- break;
- }
- case TAG_ID.P:
- case TAG_ID.DL:
- case TAG_ID.OL:
- case TAG_ID.UL:
- case TAG_ID.DIV:
- case TAG_ID.DIR:
- case TAG_ID.NAV:
- case TAG_ID.MAIN:
- case TAG_ID.MENU:
- case TAG_ID.ASIDE:
- case TAG_ID.CENTER:
- case TAG_ID.FIGURE:
- case TAG_ID.FOOTER:
- case TAG_ID.HEADER:
- case TAG_ID.HGROUP:
- case TAG_ID.DIALOG:
- case TAG_ID.DETAILS:
- case TAG_ID.ADDRESS:
- case TAG_ID.ARTICLE:
- case TAG_ID.SECTION:
- case TAG_ID.SUMMARY:
- case TAG_ID.FIELDSET:
- case TAG_ID.BLOCKQUOTE:
- case TAG_ID.FIGCAPTION: {
- addressStartTagInBody(p, token);
- break;
- }
- case TAG_ID.LI:
- case TAG_ID.DD:
- case TAG_ID.DT: {
- listItemStartTagInBody(p, token);
- break;
- }
- case TAG_ID.BR:
- case TAG_ID.IMG:
- case TAG_ID.WBR:
- case TAG_ID.AREA:
- case TAG_ID.EMBED:
- case TAG_ID.KEYGEN: {
- areaStartTagInBody(p, token);
- break;
- }
- case TAG_ID.HR: {
- hrStartTagInBody(p, token);
- break;
- }
- case TAG_ID.RB:
- case TAG_ID.RTC: {
- rbStartTagInBody(p, token);
- break;
- }
- case TAG_ID.RT:
- case TAG_ID.RP: {
- rtStartTagInBody(p, token);
- break;
- }
- case TAG_ID.PRE:
- case TAG_ID.LISTING: {
- preStartTagInBody(p, token);
- break;
- }
- case TAG_ID.XMP: {
- xmpStartTagInBody(p, token);
- break;
- }
- case TAG_ID.SVG: {
- svgStartTagInBody(p, token);
- break;
- }
- case TAG_ID.HTML: {
- htmlStartTagInBody(p, token);
- break;
- }
- case TAG_ID.BASE:
- case TAG_ID.LINK:
- case TAG_ID.META:
- case TAG_ID.STYLE:
- case TAG_ID.TITLE:
- case TAG_ID.SCRIPT:
- case TAG_ID.BGSOUND:
- case TAG_ID.BASEFONT:
- case TAG_ID.TEMPLATE: {
- startTagInHead(p, token);
- break;
- }
- case TAG_ID.BODY: {
- bodyStartTagInBody(p, token);
- break;
- }
- case TAG_ID.FORM: {
- formStartTagInBody(p, token);
- break;
- }
- case TAG_ID.NOBR: {
- nobrStartTagInBody(p, token);
- break;
- }
- case TAG_ID.MATH: {
- mathStartTagInBody(p, token);
- break;
- }
- case TAG_ID.TABLE: {
- tableStartTagInBody(p, token);
- break;
- }
- case TAG_ID.INPUT: {
- inputStartTagInBody(p, token);
- break;
- }
- case TAG_ID.PARAM:
- case TAG_ID.TRACK:
- case TAG_ID.SOURCE: {
- paramStartTagInBody(p, token);
- break;
- }
- case TAG_ID.IMAGE: {
- imageStartTagInBody(p, token);
- break;
- }
- case TAG_ID.BUTTON: {
- buttonStartTagInBody(p, token);
- break;
- }
- case TAG_ID.APPLET:
- case TAG_ID.OBJECT:
- case TAG_ID.MARQUEE: {
- appletStartTagInBody(p, token);
- break;
- }
- case TAG_ID.IFRAME: {
- iframeStartTagInBody(p, token);
- break;
- }
- case TAG_ID.SELECT: {
- selectStartTagInBody(p, token);
- break;
- }
- case TAG_ID.OPTION:
- case TAG_ID.OPTGROUP: {
- optgroupStartTagInBody(p, token);
- break;
- }
- case TAG_ID.NOEMBED: {
- noembedStartTagInBody(p, token);
- break;
- }
- case TAG_ID.FRAMESET: {
- framesetStartTagInBody(p, token);
- break;
- }
- case TAG_ID.TEXTAREA: {
- textareaStartTagInBody(p, token);
- break;
- }
- case TAG_ID.NOSCRIPT: {
- if (p.options.scriptingEnabled) {
- noembedStartTagInBody(p, token);
- } else {
- genericStartTagInBody(p, token);
- }
- break;
- }
- case TAG_ID.PLAINTEXT: {
- plaintextStartTagInBody(p, token);
- break;
- }
- case TAG_ID.COL:
- case TAG_ID.TH:
- case TAG_ID.TD:
- case TAG_ID.TR:
- case TAG_ID.HEAD:
- case TAG_ID.FRAME:
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD:
- case TAG_ID.CAPTION:
- case TAG_ID.COLGROUP: {
- break;
- }
- default: {
- genericStartTagInBody(p, token);
- }
- }
- }
- function bodyEndTagInBody(p, token) {
- if (p.openElements.hasInScope(TAG_ID.BODY)) {
- p.insertionMode = InsertionMode.AFTER_BODY;
- if (p.options.sourceCodeLocationInfo) {
- const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
- if (bodyElement) {
- p._setEndLocation(bodyElement, token);
- }
- }
- }
- }
- function htmlEndTagInBody(p, token) {
- if (p.openElements.hasInScope(TAG_ID.BODY)) {
- p.insertionMode = InsertionMode.AFTER_BODY;
- endTagAfterBody(p, token);
- }
- }
- function addressEndTagInBody(p, token) {
- const tn = token.tagID;
- if (p.openElements.hasInScope(tn)) {
- p.openElements.generateImpliedEndTags();
- p.openElements.popUntilTagNamePopped(tn);
- }
- }
- function formEndTagInBody(p) {
- const inTemplate = p.openElements.tmplCount > 0;
- const { formElement } = p;
- if (!inTemplate) {
- p.formElement = null;
- }
- if ((formElement || inTemplate) && p.openElements.hasInScope(TAG_ID.FORM)) {
- p.openElements.generateImpliedEndTags();
- if (inTemplate) {
- p.openElements.popUntilTagNamePopped(TAG_ID.FORM);
- } else if (formElement) {
- p.openElements.remove(formElement);
- }
- }
- }
- function pEndTagInBody(p) {
- if (!p.openElements.hasInButtonScope(TAG_ID.P)) {
- p._insertFakeElement(TAG_NAMES.P, TAG_ID.P);
- }
- p._closePElement();
- }
- function liEndTagInBody(p) {
- if (p.openElements.hasInListItemScope(TAG_ID.LI)) {
- p.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI);
- p.openElements.popUntilTagNamePopped(TAG_ID.LI);
- }
- }
- function ddEndTagInBody(p, token) {
- const tn = token.tagID;
- if (p.openElements.hasInScope(tn)) {
- p.openElements.generateImpliedEndTagsWithExclusion(tn);
- p.openElements.popUntilTagNamePopped(tn);
- }
- }
- function numberedHeaderEndTagInBody(p) {
- if (p.openElements.hasNumberedHeaderInScope()) {
- p.openElements.generateImpliedEndTags();
- p.openElements.popUntilNumberedHeaderPopped();
- }
- }
- function appletEndTagInBody(p, token) {
- const tn = token.tagID;
- if (p.openElements.hasInScope(tn)) {
- p.openElements.generateImpliedEndTags();
- p.openElements.popUntilTagNamePopped(tn);
- p.activeFormattingElements.clearToLastMarker();
- }
- }
- function brEndTagInBody(p) {
- p._reconstructActiveFormattingElements();
- p._insertFakeElement(TAG_NAMES.BR, TAG_ID.BR);
- p.openElements.pop();
- p.framesetOk = false;
- }
- function genericEndTagInBody(p, token) {
- const tn = token.tagName;
- const tid = token.tagID;
- for (let i = p.openElements.stackTop; i > 0; i--) {
- const element = p.openElements.items[i];
- const elementId = p.openElements.tagIDs[i];
- if (tid === elementId && (tid !== TAG_ID.UNKNOWN || p.treeAdapter.getTagName(element) === tn)) {
- p.openElements.generateImpliedEndTagsWithExclusion(tid);
- if (p.openElements.stackTop >= i)
- p.openElements.shortenToLength(i);
- break;
- }
- if (p._isSpecialElement(element, elementId)) {
- break;
- }
- }
- }
- function endTagInBody(p, token) {
- switch (token.tagID) {
- case TAG_ID.A:
- case TAG_ID.B:
- case TAG_ID.I:
- case TAG_ID.S:
- case TAG_ID.U:
- case TAG_ID.EM:
- case TAG_ID.TT:
- case TAG_ID.BIG:
- case TAG_ID.CODE:
- case TAG_ID.FONT:
- case TAG_ID.NOBR:
- case TAG_ID.SMALL:
- case TAG_ID.STRIKE:
- case TAG_ID.STRONG: {
- callAdoptionAgency(p, token);
- break;
- }
- case TAG_ID.P: {
- pEndTagInBody(p);
- break;
- }
- case TAG_ID.DL:
- case TAG_ID.UL:
- case TAG_ID.OL:
- case TAG_ID.DIR:
- case TAG_ID.DIV:
- case TAG_ID.NAV:
- case TAG_ID.PRE:
- case TAG_ID.MAIN:
- case TAG_ID.MENU:
- case TAG_ID.ASIDE:
- case TAG_ID.BUTTON:
- case TAG_ID.CENTER:
- case TAG_ID.FIGURE:
- case TAG_ID.FOOTER:
- case TAG_ID.HEADER:
- case TAG_ID.HGROUP:
- case TAG_ID.DIALOG:
- case TAG_ID.ADDRESS:
- case TAG_ID.ARTICLE:
- case TAG_ID.DETAILS:
- case TAG_ID.SECTION:
- case TAG_ID.SUMMARY:
- case TAG_ID.LISTING:
- case TAG_ID.FIELDSET:
- case TAG_ID.BLOCKQUOTE:
- case TAG_ID.FIGCAPTION: {
- addressEndTagInBody(p, token);
- break;
- }
- case TAG_ID.LI: {
- liEndTagInBody(p);
- break;
- }
- case TAG_ID.DD:
- case TAG_ID.DT: {
- ddEndTagInBody(p, token);
- break;
- }
- case TAG_ID.H1:
- case TAG_ID.H2:
- case TAG_ID.H3:
- case TAG_ID.H4:
- case TAG_ID.H5:
- case TAG_ID.H6: {
- numberedHeaderEndTagInBody(p);
- break;
- }
- case TAG_ID.BR: {
- brEndTagInBody(p);
- break;
- }
- case TAG_ID.BODY: {
- bodyEndTagInBody(p, token);
- break;
- }
- case TAG_ID.HTML: {
- htmlEndTagInBody(p, token);
- break;
- }
- case TAG_ID.FORM: {
- formEndTagInBody(p);
- break;
- }
- case TAG_ID.APPLET:
- case TAG_ID.OBJECT:
- case TAG_ID.MARQUEE: {
- appletEndTagInBody(p, token);
- break;
- }
- case TAG_ID.TEMPLATE: {
- templateEndTagInHead(p, token);
- break;
- }
- default: {
- genericEndTagInBody(p, token);
- }
- }
- }
- function eofInBody(p, token) {
- if (p.tmplInsertionModeStack.length > 0) {
- eofInTemplate(p, token);
- } else {
- stopParsing(p, token);
- }
- }
- function endTagInText(p, token) {
- var _a2;
- if (token.tagID === TAG_ID.SCRIPT) {
- (_a2 = p.scriptHandler) === null || _a2 === void 0 ? void 0 : _a2.call(p, p.openElements.current);
- }
- p.openElements.pop();
- p.insertionMode = p.originalInsertionMode;
- }
- function eofInText(p, token) {
- p._err(token, ERR.eofInElementThatCanContainOnlyText);
- p.openElements.pop();
- p.insertionMode = p.originalInsertionMode;
- p.onEof(token);
- }
- function characterInTable(p, token) {
- if (TABLE_STRUCTURE_TAGS.has(p.openElements.currentTagId)) {
- p.pendingCharacterTokens.length = 0;
- p.hasNonWhitespacePendingCharacterToken = false;
- p.originalInsertionMode = p.insertionMode;
- p.insertionMode = InsertionMode.IN_TABLE_TEXT;
- switch (token.type) {
- case TokenType.CHARACTER: {
- characterInTableText(p, token);
- break;
- }
- case TokenType.WHITESPACE_CHARACTER: {
- whitespaceCharacterInTableText(p, token);
- break;
- }
- }
- } else {
- tokenInTable(p, token);
- }
- }
- function captionStartTagInTable(p, token) {
- p.openElements.clearBackToTableContext();
- p.activeFormattingElements.insertMarker();
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_CAPTION;
- }
- function colgroupStartTagInTable(p, token) {
- p.openElements.clearBackToTableContext();
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
- }
- function colStartTagInTable(p, token) {
- p.openElements.clearBackToTableContext();
- p._insertFakeElement(TAG_NAMES.COLGROUP, TAG_ID.COLGROUP);
- p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
- startTagInColumnGroup(p, token);
- }
- function tbodyStartTagInTable(p, token) {
- p.openElements.clearBackToTableContext();
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
- }
- function tdStartTagInTable(p, token) {
- p.openElements.clearBackToTableContext();
- p._insertFakeElement(TAG_NAMES.TBODY, TAG_ID.TBODY);
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
- startTagInTableBody(p, token);
- }
- function tableStartTagInTable(p, token) {
- if (p.openElements.hasInTableScope(TAG_ID.TABLE)) {
- p.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
- p._resetInsertionMode();
- p._processStartTag(token);
- }
- }
- function inputStartTagInTable(p, token) {
- if (isHiddenInput(token)) {
- p._appendElement(token, NS.HTML);
- } else {
- tokenInTable(p, token);
- }
- token.ackSelfClosing = true;
- }
- function formStartTagInTable(p, token) {
- if (!p.formElement && p.openElements.tmplCount === 0) {
- p._insertElement(token, NS.HTML);
- p.formElement = p.openElements.current;
- p.openElements.pop();
- }
- }
- function startTagInTable(p, token) {
- switch (token.tagID) {
- case TAG_ID.TD:
- case TAG_ID.TH:
- case TAG_ID.TR: {
- tdStartTagInTable(p, token);
- break;
- }
- case TAG_ID.STYLE:
- case TAG_ID.SCRIPT:
- case TAG_ID.TEMPLATE: {
- startTagInHead(p, token);
- break;
- }
- case TAG_ID.COL: {
- colStartTagInTable(p, token);
- break;
- }
- case TAG_ID.FORM: {
- formStartTagInTable(p, token);
- break;
- }
- case TAG_ID.TABLE: {
- tableStartTagInTable(p, token);
- break;
- }
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD: {
- tbodyStartTagInTable(p, token);
- break;
- }
- case TAG_ID.INPUT: {
- inputStartTagInTable(p, token);
- break;
- }
- case TAG_ID.CAPTION: {
- captionStartTagInTable(p, token);
- break;
- }
- case TAG_ID.COLGROUP: {
- colgroupStartTagInTable(p, token);
- break;
- }
- default: {
- tokenInTable(p, token);
- }
- }
- }
- function endTagInTable(p, token) {
- switch (token.tagID) {
- case TAG_ID.TABLE: {
- if (p.openElements.hasInTableScope(TAG_ID.TABLE)) {
- p.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
- p._resetInsertionMode();
- }
- break;
- }
- case TAG_ID.TEMPLATE: {
- templateEndTagInHead(p, token);
- break;
- }
- case TAG_ID.BODY:
- case TAG_ID.CAPTION:
- case TAG_ID.COL:
- case TAG_ID.COLGROUP:
- case TAG_ID.HTML:
- case TAG_ID.TBODY:
- case TAG_ID.TD:
- case TAG_ID.TFOOT:
- case TAG_ID.TH:
- case TAG_ID.THEAD:
- case TAG_ID.TR: {
- break;
- }
- default: {
- tokenInTable(p, token);
- }
- }
- }
- function tokenInTable(p, token) {
- const savedFosterParentingState = p.fosterParentingEnabled;
- p.fosterParentingEnabled = true;
- modeInBody(p, token);
- p.fosterParentingEnabled = savedFosterParentingState;
- }
- function whitespaceCharacterInTableText(p, token) {
- p.pendingCharacterTokens.push(token);
- }
- function characterInTableText(p, token) {
- p.pendingCharacterTokens.push(token);
- p.hasNonWhitespacePendingCharacterToken = true;
- }
- function tokenInTableText(p, token) {
- let i = 0;
- if (p.hasNonWhitespacePendingCharacterToken) {
- for (; i < p.pendingCharacterTokens.length; i++) {
- tokenInTable(p, p.pendingCharacterTokens[i]);
- }
- } else {
- for (; i < p.pendingCharacterTokens.length; i++) {
- p._insertCharacters(p.pendingCharacterTokens[i]);
- }
- }
- p.insertionMode = p.originalInsertionMode;
- p._processToken(token);
- }
- var TABLE_VOID_ELEMENTS = /* @__PURE__ */ new Set([TAG_ID.CAPTION, TAG_ID.COL, TAG_ID.COLGROUP, TAG_ID.TBODY, TAG_ID.TD, TAG_ID.TFOOT, TAG_ID.TH, TAG_ID.THEAD, TAG_ID.TR]);
- function startTagInCaption(p, token) {
- const tn = token.tagID;
- if (TABLE_VOID_ELEMENTS.has(tn)) {
- if (p.openElements.hasInTableScope(TAG_ID.CAPTION)) {
- p.openElements.generateImpliedEndTags();
- p.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
- p.activeFormattingElements.clearToLastMarker();
- p.insertionMode = InsertionMode.IN_TABLE;
- startTagInTable(p, token);
- }
- } else {
- startTagInBody(p, token);
- }
- }
- function endTagInCaption(p, token) {
- const tn = token.tagID;
- switch (tn) {
- case TAG_ID.CAPTION:
- case TAG_ID.TABLE: {
- if (p.openElements.hasInTableScope(TAG_ID.CAPTION)) {
- p.openElements.generateImpliedEndTags();
- p.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
- p.activeFormattingElements.clearToLastMarker();
- p.insertionMode = InsertionMode.IN_TABLE;
- if (tn === TAG_ID.TABLE) {
- endTagInTable(p, token);
- }
- }
- break;
- }
- case TAG_ID.BODY:
- case TAG_ID.COL:
- case TAG_ID.COLGROUP:
- case TAG_ID.HTML:
- case TAG_ID.TBODY:
- case TAG_ID.TD:
- case TAG_ID.TFOOT:
- case TAG_ID.TH:
- case TAG_ID.THEAD:
- case TAG_ID.TR: {
- break;
- }
- default: {
- endTagInBody(p, token);
- }
- }
- }
- function startTagInColumnGroup(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.COL: {
- p._appendElement(token, NS.HTML);
- token.ackSelfClosing = true;
- break;
- }
- case TAG_ID.TEMPLATE: {
- startTagInHead(p, token);
- break;
- }
- default: {
- tokenInColumnGroup(p, token);
- }
- }
- }
- function endTagInColumnGroup(p, token) {
- switch (token.tagID) {
- case TAG_ID.COLGROUP: {
- if (p.openElements.currentTagId === TAG_ID.COLGROUP) {
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE;
- }
- break;
- }
- case TAG_ID.TEMPLATE: {
- templateEndTagInHead(p, token);
- break;
- }
- case TAG_ID.COL: {
- break;
- }
- default: {
- tokenInColumnGroup(p, token);
- }
- }
- }
- function tokenInColumnGroup(p, token) {
- if (p.openElements.currentTagId === TAG_ID.COLGROUP) {
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE;
- p._processToken(token);
- }
- }
- function startTagInTableBody(p, token) {
- switch (token.tagID) {
- case TAG_ID.TR: {
- p.openElements.clearBackToTableBodyContext();
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_ROW;
- break;
- }
- case TAG_ID.TH:
- case TAG_ID.TD: {
- p.openElements.clearBackToTableBodyContext();
- p._insertFakeElement(TAG_NAMES.TR, TAG_ID.TR);
- p.insertionMode = InsertionMode.IN_ROW;
- startTagInRow(p, token);
- break;
- }
- case TAG_ID.CAPTION:
- case TAG_ID.COL:
- case TAG_ID.COLGROUP:
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD: {
- if (p.openElements.hasTableBodyContextInTableScope()) {
- p.openElements.clearBackToTableBodyContext();
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE;
- startTagInTable(p, token);
- }
- break;
- }
- default: {
- startTagInTable(p, token);
- }
- }
- }
- function endTagInTableBody(p, token) {
- const tn = token.tagID;
- switch (token.tagID) {
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD: {
- if (p.openElements.hasInTableScope(tn)) {
- p.openElements.clearBackToTableBodyContext();
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE;
- }
- break;
- }
- case TAG_ID.TABLE: {
- if (p.openElements.hasTableBodyContextInTableScope()) {
- p.openElements.clearBackToTableBodyContext();
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE;
- endTagInTable(p, token);
- }
- break;
- }
- case TAG_ID.BODY:
- case TAG_ID.CAPTION:
- case TAG_ID.COL:
- case TAG_ID.COLGROUP:
- case TAG_ID.HTML:
- case TAG_ID.TD:
- case TAG_ID.TH:
- case TAG_ID.TR: {
- break;
- }
- default: {
- endTagInTable(p, token);
- }
- }
- }
- function startTagInRow(p, token) {
- switch (token.tagID) {
- case TAG_ID.TH:
- case TAG_ID.TD: {
- p.openElements.clearBackToTableRowContext();
- p._insertElement(token, NS.HTML);
- p.insertionMode = InsertionMode.IN_CELL;
- p.activeFormattingElements.insertMarker();
- break;
- }
- case TAG_ID.CAPTION:
- case TAG_ID.COL:
- case TAG_ID.COLGROUP:
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD:
- case TAG_ID.TR: {
- if (p.openElements.hasInTableScope(TAG_ID.TR)) {
- p.openElements.clearBackToTableRowContext();
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
- startTagInTableBody(p, token);
- }
- break;
- }
- default: {
- startTagInTable(p, token);
- }
- }
- }
- function endTagInRow(p, token) {
- switch (token.tagID) {
- case TAG_ID.TR: {
- if (p.openElements.hasInTableScope(TAG_ID.TR)) {
- p.openElements.clearBackToTableRowContext();
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
- }
- break;
- }
- case TAG_ID.TABLE: {
- if (p.openElements.hasInTableScope(TAG_ID.TR)) {
- p.openElements.clearBackToTableRowContext();
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
- endTagInTableBody(p, token);
- }
- break;
- }
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD: {
- if (p.openElements.hasInTableScope(token.tagID) || p.openElements.hasInTableScope(TAG_ID.TR)) {
- p.openElements.clearBackToTableRowContext();
- p.openElements.pop();
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
- endTagInTableBody(p, token);
- }
- break;
- }
- case TAG_ID.BODY:
- case TAG_ID.CAPTION:
- case TAG_ID.COL:
- case TAG_ID.COLGROUP:
- case TAG_ID.HTML:
- case TAG_ID.TD:
- case TAG_ID.TH: {
- break;
- }
- default: {
- endTagInTable(p, token);
- }
- }
- }
- function startTagInCell(p, token) {
- const tn = token.tagID;
- if (TABLE_VOID_ELEMENTS.has(tn)) {
- if (p.openElements.hasInTableScope(TAG_ID.TD) || p.openElements.hasInTableScope(TAG_ID.TH)) {
- p._closeTableCell();
- startTagInRow(p, token);
- }
- } else {
- startTagInBody(p, token);
- }
- }
- function endTagInCell(p, token) {
- const tn = token.tagID;
- switch (tn) {
- case TAG_ID.TD:
- case TAG_ID.TH: {
- if (p.openElements.hasInTableScope(tn)) {
- p.openElements.generateImpliedEndTags();
- p.openElements.popUntilTagNamePopped(tn);
- p.activeFormattingElements.clearToLastMarker();
- p.insertionMode = InsertionMode.IN_ROW;
- }
- break;
- }
- case TAG_ID.TABLE:
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD:
- case TAG_ID.TR: {
- if (p.openElements.hasInTableScope(tn)) {
- p._closeTableCell();
- endTagInRow(p, token);
- }
- break;
- }
- case TAG_ID.BODY:
- case TAG_ID.CAPTION:
- case TAG_ID.COL:
- case TAG_ID.COLGROUP:
- case TAG_ID.HTML: {
- break;
- }
- default: {
- endTagInBody(p, token);
- }
- }
- }
- function startTagInSelect(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.OPTION: {
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
- p.openElements.pop();
- }
- p._insertElement(token, NS.HTML);
- break;
- }
- case TAG_ID.OPTGROUP: {
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
- p.openElements.pop();
- }
- if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
- p.openElements.pop();
- }
- p._insertElement(token, NS.HTML);
- break;
- }
- case TAG_ID.INPUT:
- case TAG_ID.KEYGEN:
- case TAG_ID.TEXTAREA:
- case TAG_ID.SELECT: {
- if (p.openElements.hasInSelectScope(TAG_ID.SELECT)) {
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
- p._resetInsertionMode();
- if (token.tagID !== TAG_ID.SELECT) {
- p._processStartTag(token);
- }
- }
- break;
- }
- case TAG_ID.SCRIPT:
- case TAG_ID.TEMPLATE: {
- startTagInHead(p, token);
- break;
- }
- default:
- }
- }
- function endTagInSelect(p, token) {
- switch (token.tagID) {
- case TAG_ID.OPTGROUP: {
- if (p.openElements.stackTop > 0 && p.openElements.currentTagId === TAG_ID.OPTION && p.openElements.tagIDs[p.openElements.stackTop - 1] === TAG_ID.OPTGROUP) {
- p.openElements.pop();
- }
- if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
- p.openElements.pop();
- }
- break;
- }
- case TAG_ID.OPTION: {
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
- p.openElements.pop();
- }
- break;
- }
- case TAG_ID.SELECT: {
- if (p.openElements.hasInSelectScope(TAG_ID.SELECT)) {
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
- p._resetInsertionMode();
- }
- break;
- }
- case TAG_ID.TEMPLATE: {
- templateEndTagInHead(p, token);
- break;
- }
- default:
- }
- }
- function startTagInSelectInTable(p, token) {
- const tn = token.tagID;
- if (tn === TAG_ID.CAPTION || tn === TAG_ID.TABLE || tn === TAG_ID.TBODY || tn === TAG_ID.TFOOT || tn === TAG_ID.THEAD || tn === TAG_ID.TR || tn === TAG_ID.TD || tn === TAG_ID.TH) {
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
- p._resetInsertionMode();
- p._processStartTag(token);
- } else {
- startTagInSelect(p, token);
- }
- }
- function endTagInSelectInTable(p, token) {
- const tn = token.tagID;
- if (tn === TAG_ID.CAPTION || tn === TAG_ID.TABLE || tn === TAG_ID.TBODY || tn === TAG_ID.TFOOT || tn === TAG_ID.THEAD || tn === TAG_ID.TR || tn === TAG_ID.TD || tn === TAG_ID.TH) {
- if (p.openElements.hasInTableScope(tn)) {
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
- p._resetInsertionMode();
- p.onEndTag(token);
- }
- } else {
- endTagInSelect(p, token);
- }
- }
- function startTagInTemplate(p, token) {
- switch (token.tagID) {
- case TAG_ID.BASE:
- case TAG_ID.BASEFONT:
- case TAG_ID.BGSOUND:
- case TAG_ID.LINK:
- case TAG_ID.META:
- case TAG_ID.NOFRAMES:
- case TAG_ID.SCRIPT:
- case TAG_ID.STYLE:
- case TAG_ID.TEMPLATE:
- case TAG_ID.TITLE: {
- startTagInHead(p, token);
- break;
- }
- case TAG_ID.CAPTION:
- case TAG_ID.COLGROUP:
- case TAG_ID.TBODY:
- case TAG_ID.TFOOT:
- case TAG_ID.THEAD: {
- p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;
- p.insertionMode = InsertionMode.IN_TABLE;
- startTagInTable(p, token);
- break;
- }
- case TAG_ID.COL: {
- p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;
- p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
- startTagInColumnGroup(p, token);
- break;
- }
- case TAG_ID.TR: {
- p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
- startTagInTableBody(p, token);
- break;
- }
- case TAG_ID.TD:
- case TAG_ID.TH: {
- p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;
- p.insertionMode = InsertionMode.IN_ROW;
- startTagInRow(p, token);
- break;
- }
- default: {
- p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;
- p.insertionMode = InsertionMode.IN_BODY;
- startTagInBody(p, token);
- }
- }
- }
- function endTagInTemplate(p, token) {
- if (token.tagID === TAG_ID.TEMPLATE) {
- templateEndTagInHead(p, token);
- }
- }
- function eofInTemplate(p, token) {
- if (p.openElements.tmplCount > 0) {
- p.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
- p.activeFormattingElements.clearToLastMarker();
- p.tmplInsertionModeStack.shift();
- p._resetInsertionMode();
- p.onEof(token);
- } else {
- stopParsing(p, token);
- }
- }
- function startTagAfterBody(p, token) {
- if (token.tagID === TAG_ID.HTML) {
- startTagInBody(p, token);
- } else {
- tokenAfterBody(p, token);
- }
- }
- function endTagAfterBody(p, token) {
- var _a2;
- if (token.tagID === TAG_ID.HTML) {
- if (!p.fragmentContext) {
- p.insertionMode = InsertionMode.AFTER_AFTER_BODY;
- }
- if (p.options.sourceCodeLocationInfo && p.openElements.tagIDs[0] === TAG_ID.HTML) {
- p._setEndLocation(p.openElements.items[0], token);
- const bodyElement = p.openElements.items[1];
- if (bodyElement && !((_a2 = p.treeAdapter.getNodeSourceCodeLocation(bodyElement)) === null || _a2 === void 0 ? void 0 : _a2.endTag)) {
- p._setEndLocation(bodyElement, token);
- }
- }
- } else {
- tokenAfterBody(p, token);
- }
- }
- function tokenAfterBody(p, token) {
- p.insertionMode = InsertionMode.IN_BODY;
- modeInBody(p, token);
- }
- function startTagInFrameset(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.FRAMESET: {
- p._insertElement(token, NS.HTML);
- break;
- }
- case TAG_ID.FRAME: {
- p._appendElement(token, NS.HTML);
- token.ackSelfClosing = true;
- break;
- }
- case TAG_ID.NOFRAMES: {
- startTagInHead(p, token);
- break;
- }
- default:
- }
- }
- function endTagInFrameset(p, token) {
- if (token.tagID === TAG_ID.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {
- p.openElements.pop();
- if (!p.fragmentContext && p.openElements.currentTagId !== TAG_ID.FRAMESET) {
- p.insertionMode = InsertionMode.AFTER_FRAMESET;
- }
- }
- }
- function startTagAfterFrameset(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.NOFRAMES: {
- startTagInHead(p, token);
- break;
- }
- default:
- }
- }
- function endTagAfterFrameset(p, token) {
- if (token.tagID === TAG_ID.HTML) {
- p.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET;
- }
- }
- function startTagAfterAfterBody(p, token) {
- if (token.tagID === TAG_ID.HTML) {
- startTagInBody(p, token);
- } else {
- tokenAfterAfterBody(p, token);
- }
- }
- function tokenAfterAfterBody(p, token) {
- p.insertionMode = InsertionMode.IN_BODY;
- modeInBody(p, token);
- }
- function startTagAfterAfterFrameset(p, token) {
- switch (token.tagID) {
- case TAG_ID.HTML: {
- startTagInBody(p, token);
- break;
- }
- case TAG_ID.NOFRAMES: {
- startTagInHead(p, token);
- break;
- }
- default:
- }
- }
- function nullCharacterInForeignContent(p, token) {
- token.chars = REPLACEMENT_CHARACTER;
- p._insertCharacters(token);
- }
- function characterInForeignContent(p, token) {
- p._insertCharacters(token);
- p.framesetOk = false;
- }
- function popUntilHtmlOrIntegrationPoint(p) {
- while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML && !p._isIntegrationPoint(p.openElements.currentTagId, p.openElements.current)) {
- p.openElements.pop();
- }
- }
- function startTagInForeignContent(p, token) {
- if (causesExit(token)) {
- popUntilHtmlOrIntegrationPoint(p);
- p._startTagOutsideForeignContent(token);
- } else {
- const current = p._getAdjustedCurrentElement();
- const currentNs = p.treeAdapter.getNamespaceURI(current);
- if (currentNs === NS.MATHML) {
- adjustTokenMathMLAttrs(token);
- } else if (currentNs === NS.SVG) {
- adjustTokenSVGTagName(token);
- adjustTokenSVGAttrs(token);
- }
- adjustTokenXMLAttrs(token);
- if (token.selfClosing) {
- p._appendElement(token, currentNs);
- } else {
- p._insertElement(token, currentNs);
- }
- token.ackSelfClosing = true;
- }
- }
- function endTagInForeignContent(p, token) {
- if (token.tagID === TAG_ID.P || token.tagID === TAG_ID.BR) {
- popUntilHtmlOrIntegrationPoint(p);
- p._endTagOutsideForeignContent(token);
- return;
- }
- for (let i = p.openElements.stackTop; i > 0; i--) {
- const element = p.openElements.items[i];
- if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) {
- p._endTagOutsideForeignContent(token);
- break;
- }
- const tagName = p.treeAdapter.getTagName(element);
- if (tagName.toLowerCase() === token.tagName) {
- token.tagName = tagName;
- p.openElements.shortenToLength(i);
- break;
- }
- }
- }
- // node_modules/entities/lib/esm/escape.js
- var xmlCodeMap = /* @__PURE__ */ new Map([
- [34, """],
- [38, "&"],
- [39, "'"],
- [60, "<"],
- [62, ">"]
- ]);
- var getCodePoint = (
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
- String.prototype.codePointAt != null ? (str, index) => str.codePointAt(index) : (
- // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
- (c, index) => (c.charCodeAt(index) & 64512) === 55296 ? (c.charCodeAt(index) - 55296) * 1024 + c.charCodeAt(index + 1) - 56320 + 65536 : c.charCodeAt(index)
- )
- );
- function getEscaper(regex, map2) {
- return function escape(data) {
- let match;
- let lastIdx = 0;
- let result = "";
- while (match = regex.exec(data)) {
- if (lastIdx !== match.index) {
- result += data.substring(lastIdx, match.index);
- }
- result += map2.get(match[0].charCodeAt(0));
- lastIdx = match.index + 1;
- }
- return result + data.substring(lastIdx);
- };
- }
- var escapeUTF8 = getEscaper(/[&<>'"]/g, xmlCodeMap);
- var escapeAttribute = getEscaper(/["&\u00A0]/g, /* @__PURE__ */ new Map([
- [34, """],
- [38, "&"],
- [160, " "]
- ]));
- var escapeText = getEscaper(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([
- [38, "&"],
- [60, "<"],
- [62, ">"],
- [160, " "]
- ]));
- // node_modules/parse5/dist/serializer/index.js
- var VOID_ELEMENTS = /* @__PURE__ */ new Set([
- TAG_NAMES.AREA,
- TAG_NAMES.BASE,
- TAG_NAMES.BASEFONT,
- TAG_NAMES.BGSOUND,
- TAG_NAMES.BR,
- TAG_NAMES.COL,
- TAG_NAMES.EMBED,
- TAG_NAMES.FRAME,
- TAG_NAMES.HR,
- TAG_NAMES.IMG,
- TAG_NAMES.INPUT,
- TAG_NAMES.KEYGEN,
- TAG_NAMES.LINK,
- TAG_NAMES.META,
- TAG_NAMES.PARAM,
- TAG_NAMES.SOURCE,
- TAG_NAMES.TRACK,
- TAG_NAMES.WBR
- ]);
- // node_modules/parse5/dist/index.js
- function parse(html, options) {
- return Parser.parse(html, options);
- }
- function parseFragment(fragmentContext, html, options) {
- if (typeof fragmentContext === "string") {
- options = html;
- html = fragmentContext;
- fragmentContext = null;
- }
- const parser = Parser.getFragmentParser(fragmentContext, options);
- parser.tokenizer.write(html, true);
- return parser.getFragment();
- }
- // src/mock-doc/parse-util.ts
- var docParser = /* @__PURE__ */ new WeakMap();
- function parseDocumentUtil(ownerDocument, html) {
- const doc = parse(html.trim(), getParser(ownerDocument));
- doc.documentElement = doc.firstElementChild;
- doc.head = doc.documentElement.firstElementChild;
- doc.body = doc.head.nextElementSibling;
- return doc;
- }
- function parseFragmentUtil(ownerDocument, html) {
- if (typeof html === "string") {
- html = html.trim();
- } else {
- html = "";
- }
- const frag = parseFragment(html, getParser(ownerDocument));
- return frag;
- }
- function getParser(ownerDocument) {
- let parseOptions = docParser.get(ownerDocument);
- if (parseOptions != null) {
- return parseOptions;
- }
- const treeAdapter = {
- createDocument() {
- const doc = ownerDocument.createElement("#document" /* DOCUMENT_NODE */);
- doc["x-mode"] = "no-quirks";
- return doc;
- },
- setNodeSourceCodeLocation(node, location2) {
- node.sourceCodeLocation = location2;
- },
- getNodeSourceCodeLocation(node) {
- return node.sourceCodeLocation;
- },
- createDocumentFragment() {
- return ownerDocument.createDocumentFragment();
- },
- createElement(tagName, namespaceURI, attrs) {
- const elm = ownerDocument.createElementNS(namespaceURI, tagName);
- for (let i = 0; i < attrs.length; i++) {
- const attr = attrs[i];
- if (attr.namespace == null || attr.namespace === "http://www.w3.org/1999/xhtml") {
- elm.setAttribute(attr.name, attr.value);
- } else {
- elm.setAttributeNS(attr.namespace, attr.name, attr.value);
- }
- }
- return elm;
- },
- createCommentNode(data) {
- return ownerDocument.createComment(data);
- },
- appendChild(parentNode, newNode) {
- parentNode.appendChild(newNode);
- },
- insertBefore(parentNode, newNode, referenceNode) {
- parentNode.insertBefore(newNode, referenceNode);
- },
- setTemplateContent(templateElement, contentElement) {
- templateElement.content = contentElement;
- },
- getTemplateContent(templateElement) {
- return templateElement.content;
- },
- setDocumentType(doc, name, publicId, systemId) {
- let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* DOCUMENT_TYPE_NODE */);
- if (doctypeNode == null) {
- doctypeNode = ownerDocument.createDocumentTypeNode();
- doc.insertBefore(doctypeNode, doc.firstChild);
- }
- doctypeNode.nodeValue = "!DOCTYPE";
- doctypeNode["x-name"] = name;
- doctypeNode["x-publicId"] = publicId;
- doctypeNode["x-systemId"] = systemId;
- },
- setDocumentMode(doc, mode) {
- doc["x-mode"] = mode;
- },
- getDocumentMode(doc) {
- return doc["x-mode"];
- },
- detachNode(node) {
- node.remove();
- },
- insertText(parentNode, text) {
- const lastChild = parentNode.lastChild;
- if (lastChild != null && lastChild.nodeType === 3 /* TEXT_NODE */) {
- lastChild.nodeValue += text;
- } else {
- parentNode.appendChild(ownerDocument.createTextNode(text));
- }
- },
- insertTextBefore(parentNode, text, referenceNode) {
- const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
- if (prevNode != null && prevNode.nodeType === 3 /* TEXT_NODE */) {
- prevNode.nodeValue += text;
- } else {
- parentNode.insertBefore(ownerDocument.createTextNode(text), referenceNode);
- }
- },
- adoptAttributes(recipient, attrs) {
- for (let i = 0; i < attrs.length; i++) {
- const attr = attrs[i];
- if (recipient.hasAttributeNS(attr.namespace, attr.name) === false) {
- recipient.setAttributeNS(attr.namespace, attr.name, attr.value);
- }
- }
- },
- getFirstChild(node) {
- return node.childNodes[0];
- },
- getChildNodes(node) {
- return node.childNodes;
- },
- getParentNode(node) {
- return node.parentNode;
- },
- getAttrList(element) {
- const attrs = element.attributes.__items.map((attr) => {
- return {
- name: attr.name,
- value: attr.value,
- namespace: attr.namespaceURI,
- prefix: null
- };
- });
- return attrs;
- },
- getTagName(element) {
- if (element.namespaceURI === "http://www.w3.org/1999/xhtml") {
- return element.nodeName.toLowerCase();
- } else {
- return element.nodeName;
- }
- },
- getNamespaceURI(element) {
- return element.namespaceURI;
- },
- getTextNodeContent(textNode) {
- return textNode.nodeValue;
- },
- getCommentNodeContent(commentNode) {
- return commentNode.nodeValue;
- },
- getDocumentTypeNodeName(doctypeNode) {
- return doctypeNode["x-name"];
- },
- getDocumentTypeNodePublicId(doctypeNode) {
- return doctypeNode["x-publicId"];
- },
- getDocumentTypeNodeSystemId(doctypeNode) {
- return doctypeNode["x-systemId"];
- },
- // @ts-ignore - a `MockNode` will never be assignable to a `TreeAdapterTypeMap['text']`. As a result, we cannot
- // complete this function signature
- isTextNode(node) {
- return node.nodeType === 3 /* TEXT_NODE */;
- },
- // @ts-ignore - a `MockNode` will never be assignable to a `TreeAdapterTypeMap['comment']`. As a result, we cannot
- // complete this function signature (which requires its return type to be a type predicate)
- isCommentNode(node) {
- return node.nodeType === 8 /* COMMENT_NODE */;
- },
- // @ts-ignore - a `MockNode` will never be assignable to a `TreeAdapterTypeMap['document']`. As a result, we cannot
- // complete this function signature (which requires its return type to be a type predicate)
- isDocumentTypeNode(node) {
- return node.nodeType === 10 /* DOCUMENT_TYPE_NODE */;
- },
- // @ts-ignore - a `MockNode` will never be assignable to a `TreeAdapterTypeMap['element']`. As a result, we cannot
- // complete this function signature (which requires its return type to be a type predicate)
- isElementNode(node) {
- return node.nodeType === 1 /* ELEMENT_NODE */;
- }
- };
- parseOptions = {
- treeAdapter
- };
- docParser.set(ownerDocument, parseOptions);
- return parseOptions;
- }
- // src/mock-doc/third-party/jquery.ts
- var jquery_default = (
- /*!
- * jQuery JavaScript Library v4.0.0-pre+9352011a7.dirty +selector
- * https://jquery.com/
- *
- * Copyright OpenJS Foundation and other contributors
- * Released under the MIT license
- * https://jquery.org/license
- *
- * Date: 2023-12-11T17:55Z
- */
- function(global2, factory) {
- "use strict";
- if (true) {
- return factory(global2, true);
- } else {
- factory(global2);
- }
- }({
- document: {
- createElement() {
- return {};
- },
- nodeType: 9,
- documentElement: {
- nodeType: 1,
- nodeName: "HTML"
- }
- }
- }, function(window, noGlobal) {
- "use strict";
- if (!window.document) {
- throw new Error("jQuery requires a window with a document");
- }
- var arr = [];
- var getProto = Object.getPrototypeOf;
- var slice = arr.slice;
- var flat = arr.flat ? function(array) {
- return arr.flat.call(array);
- } : function(array) {
- return arr.concat.apply([], array);
- };
- var push = arr.push;
- var indexOf = arr.indexOf;
- var class2type = {};
- var toString = class2type.toString;
- var hasOwn = class2type.hasOwnProperty;
- var fnToString = hasOwn.toString;
- var ObjectFunctionString = fnToString.call(Object);
- var support = {};
- function toType(obj) {
- if (obj == null) {
- return obj + "";
- }
- return typeof obj === "object" ? class2type[toString.call(obj)] || "object" : typeof obj;
- }
- function isWindow(obj) {
- return obj != null && obj === obj.window;
- }
- function isArrayLike(obj) {
- var length = !!obj && obj.length, type = toType(obj);
- if (typeof obj === "function" || isWindow(obj)) {
- return false;
- }
- return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
- }
- var document = window.document;
- var preservedScriptAttributes = {
- type: true,
- src: true,
- nonce: true,
- noModule: true
- };
- function DOMEval(code, node, doc) {
- doc = doc || document;
- var i2, script = doc.createElement("script");
- script.text = code;
- if (node) {
- for (i2 in preservedScriptAttributes) {
- if (node[i2]) {
- script[i2] = node[i2];
- }
- }
- }
- doc.head.appendChild(script).parentNode.removeChild(script);
- }
- const jQuery = {};
- var version = "4.0.0-pre+9352011a7.dirty +selector", rhtmlSuffix = /HTML$/i, jQueryOrig = function(selector, context) {
- return new jQuery.fn.init(selector, context);
- };
- jQuery.fn = jQuery.prototype = {
- // The current version of jQuery being used
- jquery: version,
- constructor: jQuery,
- // The default length of a jQuery object is 0
- length: 0,
- toArray: function() {
- return slice.call(this);
- },
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function(num) {
- if (num == null) {
- return slice.call(this);
- }
- return num < 0 ? this[num + this.length] : this[num];
- },
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function(elems) {
- var ret = jQuery.merge(this.constructor(), elems);
- ret.prevObject = this;
- return ret;
- },
- // Execute a callback for every element in the matched set.
- each: function(callback) {
- return jQuery.each(this, callback);
- },
- map: function(callback) {
- return this.pushStack(jQuery.map(this, function(elem, i2) {
- return callback.call(elem, i2, elem);
- }));
- },
- slice: function() {
- return this.pushStack(slice.apply(this, arguments));
- },
- first: function() {
- return this.eq(0);
- },
- last: function() {
- return this.eq(-1);
- },
- even: function() {
- return this.pushStack(jQuery.grep(this, function(_elem, i2) {
- return (i2 + 1) % 2;
- }));
- },
- odd: function() {
- return this.pushStack(jQuery.grep(this, function(_elem, i2) {
- return i2 % 2;
- }));
- },
- eq: function(i2) {
- var len = this.length, j = +i2 + (i2 < 0 ? len : 0);
- return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
- },
- end: function() {
- return this.prevObject || this.constructor();
- }
- };
- jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i2 = 1, length = arguments.length, deep = false;
- if (typeof target === "boolean") {
- deep = target;
- target = arguments[i2] || {};
- i2++;
- }
- if (typeof target !== "object" && typeof target !== "function") {
- target = {};
- }
- if (i2 === length) {
- target = this;
- i2--;
- }
- for (; i2 < length; i2++) {
- if ((options = arguments[i2]) != null) {
- for (name in options) {
- copy = options[name];
- if (name === "__proto__" || target === copy) {
- continue;
- }
- if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
- src = target[name];
- if (copyIsArray && !Array.isArray(src)) {
- clone = [];
- } else if (!copyIsArray && !jQuery.isPlainObject(src)) {
- clone = {};
- } else {
- clone = src;
- }
- copyIsArray = false;
- target[name] = jQuery.extend(deep, clone, copy);
- } else if (copy !== void 0) {
- target[name] = copy;
- }
- }
- }
- }
- return target;
- };
- jQuery.extend({
- // Unique for each copy of jQuery on the page
- expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
- // Assume jQuery is ready without the ready module
- isReady: true,
- error: function(msg) {
- throw new Error(msg);
- },
- noop: function() {
- },
- isPlainObject: function(obj) {
- var proto, Ctor;
- if (!obj || toString.call(obj) !== "[object Object]") {
- return false;
- }
- proto = getProto(obj);
- if (!proto) {
- return true;
- }
- Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
- return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
- },
- isEmptyObject: function(obj) {
- var name;
- for (name in obj) {
- return false;
- }
- return true;
- },
- // Evaluates a script in a provided context; falls back to the global one
- // if not specified.
- globalEval: function(code, options, doc) {
- DOMEval(code, { nonce: options && options.nonce }, doc);
- },
- each: function(obj, callback) {
- var length, i2 = 0;
- if (isArrayLike(obj)) {
- length = obj.length;
- for (; i2 < length; i2++) {
- if (callback.call(obj[i2], i2, obj[i2]) === false) {
- break;
- }
- }
- } else {
- for (i2 in obj) {
- if (callback.call(obj[i2], i2, obj[i2]) === false) {
- break;
- }
- }
- }
- return obj;
- },
- // Retrieve the text value of an array of DOM nodes
- text: function(elem) {
- var node, ret = "", i2 = 0, nodeType = elem.nodeType;
- if (!nodeType) {
- while (node = elem[i2++]) {
- ret += jQuery.text(node);
- }
- }
- if (nodeType === 1 || nodeType === 11) {
- return elem.textContent;
- }
- if (nodeType === 9) {
- return elem.documentElement.textContent;
- }
- if (nodeType === 3 || nodeType === 4) {
- return elem.nodeValue;
- }
- return ret;
- },
- // results is for internal usage only
- makeArray: function(arr2, results) {
- var ret = results || [];
- if (arr2 != null) {
- if (isArrayLike(Object(arr2))) {
- jQuery.merge(
- ret,
- typeof arr2 === "string" ? [arr2] : arr2
- );
- } else {
- push.call(ret, arr2);
- }
- }
- return ret;
- },
- inArray: function(elem, arr2, i2) {
- return arr2 == null ? -1 : indexOf.call(arr2, elem, i2);
- },
- isXMLDoc: function(elem) {
- var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement;
- return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML");
- },
- // Note: an element does not contain itself
- contains: function(a, b) {
- var bup = b && b.parentNode;
- return a === bup || !!(bup && bup.nodeType === 1 && // Support: IE 9 - 11+
- // IE doesn't have `contains` on SVG.
- (a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
- },
- merge: function(first, second) {
- var len = +second.length, j = 0, i2 = first.length;
- for (; j < len; j++) {
- first[i2++] = second[j];
- }
- first.length = i2;
- return first;
- },
- grep: function(elems, callback, invert) {
- var callbackInverse, matches3 = [], i2 = 0, length = elems.length, callbackExpect = !invert;
- for (; i2 < length; i2++) {
- callbackInverse = !callback(elems[i2], i2);
- if (callbackInverse !== callbackExpect) {
- matches3.push(elems[i2]);
- }
- }
- return matches3;
- },
- // arg is for internal usage only
- map: function(elems, callback, arg) {
- var length, value, i2 = 0, ret = [];
- if (isArrayLike(elems)) {
- length = elems.length;
- for (; i2 < length; i2++) {
- value = callback(elems[i2], i2, arg);
- if (value != null) {
- ret.push(value);
- }
- }
- } else {
- for (i2 in elems) {
- value = callback(elems[i2], i2, arg);
- if (value != null) {
- ret.push(value);
- }
- }
- }
- return flat(ret);
- },
- // A global GUID counter for objects
- guid: 1,
- // jQuery.support is not used in Core but other projects attach their
- // properties to it so it needs to exist.
- support
- });
- if (typeof Symbol === "function") {
- jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
- }
- jQuery.each(
- "Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
- function(_i, name) {
- class2type["[object " + name + "]"] = name.toLowerCase();
- }
- );
- function nodeName(elem, name) {
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
- }
- var pop = arr.pop;
- var whitespace = "[\\x20\\t\\r\\n\\f]";
- var isIE = document.documentMode;
- try {
- document.querySelector(":has(*,:jqfake)");
- support.cssHas = false;
- } catch (e) {
- support.cssHas = true;
- }
- var rbuggyQSA = [];
- if (isIE) {
- rbuggyQSA.push(
- // Support: IE 9 - 11+
- // IE's :disabled selector does not pick up the children of disabled fieldsets
- ":enabled",
- ":disabled",
- // Support: IE 11+
- // IE 11 doesn't find elements on a `[name='']` query in some cases.
- // Adding a temporary attribute to the document before the selection works
- // around the issue.
- "\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`
- );
- }
- if (!support.cssHas) {
- rbuggyQSA.push(":has");
- }
- rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
- var rtrimCSS = new RegExp(
- "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
- "g"
- );
- var identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+";
- var booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped";
- var rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*");
- var rdescend = new RegExp(whitespace + "|>");
- var rsibling = /[+~]/;
- var documentElement = document.documentElement;
- var matches2 = documentElement.matches || documentElement.msMatchesSelector;
- function createCache() {
- var keys = [];
- function cache(key, value) {
- if (keys.push(key + " ") > jQuery.expr.cacheLength) {
- delete cache[keys.shift()];
- }
- return cache[key + " "] = value;
- }
- return cache;
- }
- function testContext(context) {
- return context && typeof context.getElementsByTagName !== "undefined" && context;
- }
- var attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2)
- "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
- `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]";
- var pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes + ")*)|.*)\\)|)";
- var filterMatchExpr = {
- ID: new RegExp("^#(" + identifier + ")"),
- CLASS: new RegExp("^\\.(" + identifier + ")"),
- TAG: new RegExp("^(" + identifier + "|[*])"),
- ATTR: new RegExp("^" + attributes),
- PSEUDO: new RegExp("^" + pseudos),
- CHILD: new RegExp(
- "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)",
- "i"
- )
- };
- var rpseudo = new RegExp(pseudos);
- var runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape, nonHex) {
- var high = "0x" + escape.slice(1) - 65536;
- if (nonHex) {
- return nonHex;
- }
- return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
- };
- function unescapeSelector(sel) {
- return sel.replace(runescape, funescape);
- }
- function selectorError(msg) {
- jQuery.error("Syntax error, unrecognized expression: " + msg);
- }
- var rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*");
- var tokenCache = createCache();
- function tokenize(selector, parseOnly) {
- var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
- if (cached) {
- return parseOnly ? 0 : cached.slice(0);
- }
- soFar = selector;
- groups = [];
- preFilters = jQuery.expr.preFilter;
- while (soFar) {
- if (!matched || (match = rcomma.exec(soFar))) {
- if (match) {
- soFar = soFar.slice(match[0].length) || soFar;
- }
- groups.push(tokens = []);
- }
- matched = false;
- if (match = rleadingCombinator.exec(soFar)) {
- matched = match.shift();
- tokens.push({
- value: matched,
- // Cast descendant combinators to space
- type: match[0].replace(rtrimCSS, " ")
- });
- soFar = soFar.slice(matched.length);
- }
- for (type in filterMatchExpr) {
- if ((match = jQuery.expr.match[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
- matched = match.shift();
- tokens.push({
- value: matched,
- type,
- matches: match
- });
- soFar = soFar.slice(matched.length);
- }
- }
- if (!matched) {
- break;
- }
- }
- if (parseOnly) {
- return soFar.length;
- }
- return soFar ? selectorError(selector) : (
- // Cache the tokens
- tokenCache(selector, groups).slice(0)
- );
- }
- var preFilter = {
- ATTR: function(match) {
- match[1] = unescapeSelector(match[1]);
- match[3] = unescapeSelector(match[3] || match[4] || match[5] || "");
- if (match[2] === "~=") {
- match[3] = " " + match[3] + " ";
- }
- return match.slice(0, 4);
- },
- CHILD: function(match) {
- match[1] = match[1].toLowerCase();
- if (match[1].slice(0, 3) === "nth") {
- if (!match[3]) {
- selectorError(match[0]);
- }
- match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
- match[5] = +(match[7] + match[8] || match[3] === "odd");
- } else if (match[3]) {
- selectorError(match[0]);
- }
- return match;
- },
- PSEUDO: function(match) {
- var excess, unquoted = !match[6] && match[2];
- if (filterMatchExpr.CHILD.test(match[0])) {
- return null;
- }
- if (match[3]) {
- match[2] = match[4] || match[5] || "";
- } else if (unquoted && rpseudo.test(unquoted) && // Get excess from tokenize (recursively)
- (excess = tokenize(unquoted, true)) && // advance to the next closing parenthesis
- (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
- match[0] = match[0].slice(0, excess);
- match[2] = unquoted.slice(0, excess);
- }
- return match.slice(0, 3);
- }
- };
- function toSelector(tokens) {
- var i2 = 0, len = tokens.length, selector = "";
- for (; i2 < len; i2++) {
- selector += tokens[i2].value;
- }
- return selector;
- }
- var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
- function fcssescape(ch, asCodePoint) {
- if (asCodePoint) {
- if (ch === "\0") {
- return "\uFFFD";
- }
- return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
- }
- return "\\" + ch;
- }
- jQuery.escapeSelector = function(sel) {
- return (sel + "").replace(rcssescape, fcssescape);
- };
- var sort = arr.sort;
- var splice = arr.splice;
- var hasDuplicate;
- function sortOrder(a, b) {
- if (a === b) {
- hasDuplicate = true;
- return 0;
- }
- var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
- if (compare) {
- return compare;
- }
- compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : (
- // Otherwise we know they are disconnected
- 1
- );
- if (compare & 1) {
- if (a == document || a.ownerDocument == document && jQuery.contains(document, a)) {
- return -1;
- }
- if (b == document || b.ownerDocument == document && jQuery.contains(document, b)) {
- return 1;
- }
- return 0;
- }
- return compare & 4 ? -1 : 1;
- }
- jQuery.uniqueSort = function(results) {
- var elem, duplicates = [], j = 0, i2 = 0;
- hasDuplicate = false;
- sort.call(results, sortOrder);
- if (hasDuplicate) {
- while (elem = results[i2++]) {
- if (elem === results[i2]) {
- j = duplicates.push(i2);
- }
- }
- while (j--) {
- splice.call(results, duplicates[j], 1);
- }
- }
- return results;
- };
- jQuery.fn.uniqueSort = function() {
- return this.pushStack(jQuery.uniqueSort(slice.apply(this)));
- };
- var i, outermostContext, document$1, documentElement$1, documentIsHTML, dirruns = 0, done = 0, classCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), rwhitespace = new RegExp(whitespace + "+", "g"), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = jQuery.extend({
- bool: new RegExp("^(?:" + booleans + ")$", "i"),
- // For use in libraries implementing .is()
- // We use this for POS matching in `select`
- needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
- }, filterMatchExpr), rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, unloadHandler = function() {
- setDocument();
- }, inDisabledFieldset = addCombinator(
- function(elem) {
- return elem.disabled === true && nodeName(elem, "fieldset");
- },
- { dir: "parentNode", next: "legend" }
- );
- function find(selector, context, results, seed) {
- var m, i2, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
- results = results || [];
- if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
- return results;
- }
- if (false) {
- setDocument(context);
- context = context || document$1;
- if (documentIsHTML) {
- if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
- if (m = match[1]) {
- if (nodeType === 9) {
- if (elem = context.getElementById(m)) {
- push.call(results, elem);
- }
- return results;
- } else {
- if (newContext && (elem = newContext.getElementById(m)) && jQuery.contains(context, elem)) {
- push.call(results, elem);
- return results;
- }
- }
- } else if (match[2]) {
- push.apply(results, context.getElementsByTagName(selector));
- return results;
- } else if ((m = match[3]) && context.getElementsByClassName) {
- push.apply(results, context.getElementsByClassName(m));
- return results;
- }
- }
- if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
- newSelector = selector;
- newContext = context;
- if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {
- newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
- if (newContext != context || isIE) {
- if (nid = context.getAttribute("id")) {
- nid = jQuery.escapeSelector(nid);
- } else {
- context.setAttribute("id", nid = jQuery.expando);
- }
- }
- groups = tokenize(selector);
- i2 = groups.length;
- while (i2--) {
- groups[i2] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i2]);
- }
- newSelector = groups.join(",");
- }
- try {
- push.apply(
- results,
- newContext.querySelectorAll(newSelector)
- );
- return results;
- } catch (qsaError) {
- nonnativeSelectorCache(selector, true);
- } finally {
- if (nid === jQuery.expando) {
- context.removeAttribute("id");
- }
- }
- }
- }
- }
- return select(selector.replace(rtrimCSS, "$1"), context, results, seed);
- }
- function markFunction(fn) {
- fn[jQuery.expando] = true;
- return fn;
- }
- function createInputPseudo(type) {
- return function(elem) {
- return nodeName(elem, "input") && elem.type === type;
- };
- }
- function createButtonPseudo(type) {
- return function(elem) {
- return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type;
- };
- }
- function createDisabledPseudo(disabled) {
- return function(elem) {
- if ("form" in elem) {
- if (elem.parentNode && elem.disabled === false) {
- if ("label" in elem) {
- if ("label" in elem.parentNode) {
- return elem.parentNode.disabled === disabled;
- } else {
- return elem.disabled === disabled;
- }
- }
- return elem.isDisabled === disabled || // Where there is no isDisabled, check manually
- elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
- }
- return elem.disabled === disabled;
- } else if ("label" in elem) {
- return elem.disabled === disabled;
- }
- return false;
- };
- }
- function createPositionalPseudo(fn) {
- return markFunction(function(argument) {
- argument = +argument;
- return markFunction(function(seed, matches3) {
- var j, matchIndexes = fn([], seed.length, argument), i2 = matchIndexes.length;
- while (i2--) {
- if (seed[j = matchIndexes[i2]]) {
- seed[j] = !(matches3[j] = seed[j]);
- }
- }
- });
- });
- }
- function setDocument(node) {
- var subWindow, doc = node ? node.ownerDocument || node : document;
- if (doc == document$1 || doc.nodeType !== 9) {
- return;
- }
- document$1 = doc;
- documentElement$1 = document$1.documentElement;
- documentIsHTML = !jQuery.isXMLDoc(document$1);
- if (isIE && document != document$1 && (subWindow = document$1.defaultView) && subWindow.top !== subWindow) {
- subWindow.addEventListener("unload", unloadHandler);
- }
- }
- find.matches = function(expr, elements) {
- return find(expr, null, null, elements);
- };
- find.matchesSelector = function(elem, expr) {
- setDocument(elem);
- if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
- try {
- return matches2.call(elem, expr);
- } catch (e) {
- nonnativeSelectorCache(expr, true);
- }
- }
- return find(expr, document$1, null, [elem]).length > 0;
- };
- jQuery.expr = {
- // Can be adjusted by the user
- cacheLength: 50,
- createPseudo: markFunction,
- match: matchExpr,
- find: {
- ID: function(id, context) {
- if (typeof context.getElementById !== "undefined" && documentIsHTML) {
- var elem = context.getElementById(id);
- return elem ? [elem] : [];
- }
- },
- TAG: function(tag, context) {
- if (typeof context.getElementsByTagName !== "undefined") {
- return context.getElementsByTagName(tag);
- } else {
- return context.querySelectorAll(tag);
- }
- },
- CLASS: function(className, context) {
- if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
- return context.getElementsByClassName(className);
- }
- }
- },
- relative: {
- ">": { dir: "parentNode", first: true },
- " ": { dir: "parentNode" },
- "+": { dir: "previousSibling", first: true },
- "~": { dir: "previousSibling" }
- },
- preFilter,
- filter: {
- ID: function(id) {
- var attrId = unescapeSelector(id);
- return function(elem) {
- return elem.getAttribute("id") === attrId;
- };
- },
- TAG: function(nodeNameSelector) {
- var expectedNodeName = unescapeSelector(nodeNameSelector).toLowerCase();
- return nodeNameSelector === "*" ? function() {
- return true;
- } : function(elem) {
- return nodeName(elem, expectedNodeName);
- };
- },
- CLASS: function(className) {
- var pattern = classCache[className + " "];
- return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
- return pattern.test(
- typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""
- );
- });
- },
- ATTR: function(name, operator, check) {
- return function(elem) {
- var result = elem.getAttribute(name);
- if (result == null) {
- return operator === "!=";
- }
- if (!operator) {
- return true;
- }
- result += "";
- if (operator === "=") {
- return result === check;
- }
- if (operator === "!=") {
- return result !== check;
- }
- if (operator === "^=") {
- return check && result.indexOf(check) === 0;
- }
- if (operator === "*=") {
- return check && result.indexOf(check) > -1;
- }
- if (operator === "$=") {
- return check && result.slice(-check.length) === check;
- }
- if (operator === "~=") {
- return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1;
- }
- if (operator === "|=") {
- return result === check || result.slice(0, check.length + 1) === check + "-";
- }
- return false;
- };
- },
- CHILD: function(type, what, _argument, first, last) {
- var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", ofType = what === "of-type";
- return first === 1 && last === 0 ? (
- // Shortcut for :nth-*(n)
- function(elem) {
- return !!elem.parentNode;
- }
- ) : function(elem, _context, xml) {
- var cache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
- if (parent) {
- if (simple) {
- while (dir) {
- node = elem;
- while (node = node[dir]) {
- if (ofType ? nodeName(node, name) : node.nodeType === 1) {
- return false;
- }
- }
- start = dir = type === "only" && !start && "nextSibling";
- }
- return true;
- }
- start = [forward ? parent.firstChild : parent.lastChild];
- if (forward && useCache) {
- outerCache = parent[jQuery.expando] || (parent[jQuery.expando] = {});
- cache = outerCache[type] || [];
- nodeIndex = cache[0] === dirruns && cache[1];
- diff = nodeIndex && cache[2];
- node = nodeIndex && parent.childNodes[nodeIndex];
- while (node = ++nodeIndex && node && node[dir] || // Fallback to seeking `elem` from the start
- (diff = nodeIndex = 0) || start.pop()) {
- if (node.nodeType === 1 && ++diff && node === elem) {
- outerCache[type] = [dirruns, nodeIndex, diff];
- break;
- }
- }
- } else {
- if (useCache) {
- outerCache = elem[jQuery.expando] || (elem[jQuery.expando] = {});
- cache = outerCache[type] || [];
- nodeIndex = cache[0] === dirruns && cache[1];
- diff = nodeIndex;
- }
- if (diff === false) {
- while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
- if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {
- if (useCache) {
- outerCache = node[jQuery.expando] || (node[jQuery.expando] = {});
- outerCache[type] = [dirruns, diff];
- }
- if (node === elem) {
- break;
- }
- }
- }
- }
- }
- diff -= last;
- return diff === first || diff % first === 0 && diff / first >= 0;
- }
- };
- },
- PSEUDO: function(pseudo, argument) {
- var fn = jQuery.expr.pseudos[pseudo] || jQuery.expr.setFilters[pseudo.toLowerCase()] || selectorError("unsupported pseudo: " + pseudo);
- if (fn[jQuery.expando]) {
- return fn(argument);
- }
- return fn;
- }
- },
- pseudos: {
- // Potentially complex pseudos
- not: markFunction(function(selector) {
- var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1"));
- return matcher[jQuery.expando] ? markFunction(function(seed, matches3, _context, xml) {
- var elem, unmatched = matcher(seed, null, xml, []), i2 = seed.length;
- while (i2--) {
- if (elem = unmatched[i2]) {
- seed[i2] = !(matches3[i2] = elem);
- }
- }
- }) : function(elem, _context, xml) {
- input[0] = elem;
- matcher(input, null, xml, results);
- input[0] = null;
- return !results.pop();
- };
- }),
- has: markFunction(function(selector) {
- return function(elem) {
- return find(selector, elem).length > 0;
- };
- }),
- contains: markFunction(function(text) {
- text = unescapeSelector(text);
- return function(elem) {
- return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;
- };
- }),
- // "Whether an element is represented by a :lang() selector
- // is based solely on the element's language value
- // being equal to the identifier C,
- // or beginning with the identifier C immediately followed by "-".
- // The matching of C against the element's language value is performed case-insensitively.
- // The identifier C does not have to be a valid language name."
- // https://www.w3.org/TR/selectors/#lang-pseudo
- lang: markFunction(function(lang) {
- if (!ridentifier.test(lang || "")) {
- selectorError("unsupported lang: " + lang);
- }
- lang = unescapeSelector(lang).toLowerCase();
- return function(elem) {
- var elemLang;
- do {
- if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
- elemLang = elemLang.toLowerCase();
- return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
- }
- } while ((elem = elem.parentNode) && elem.nodeType === 1);
- return false;
- };
- }),
- // Miscellaneous
- target: function(elem) {
- var hash = window.location && window.location.hash;
- return hash && hash.slice(1) === elem.id;
- },
- root: function(elem) {
- return elem === documentElement$1;
- },
- focus: function(elem) {
- return elem === document$1.activeElement && document$1.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);
- },
- // Boolean properties
- enabled: createDisabledPseudo(false),
- disabled: createDisabledPseudo(true),
- checked: function(elem) {
- return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected;
- },
- selected: function(elem) {
- if (isIE && elem.parentNode) {
- elem.parentNode.selectedIndex;
- }
- return elem.selected === true;
- },
- // Contents
- empty: function(elem) {
- for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
- if (elem.nodeType < 6) {
- return false;
- }
- }
- return true;
- },
- parent: function(elem) {
- return !jQuery.expr.pseudos.empty(elem);
- },
- // Element/input types
- header: function(elem) {
- return rheader.test(elem.nodeName);
- },
- input: function(elem) {
- return rinputs.test(elem.nodeName);
- },
- button: function(elem) {
- return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button");
- },
- text: function(elem) {
- return nodeName(elem, "input") && elem.type === "text";
- },
- // Position-in-collection
- first: createPositionalPseudo(function() {
- return [0];
- }),
- last: createPositionalPseudo(function(_matchIndexes, length) {
- return [length - 1];
- }),
- eq: createPositionalPseudo(function(_matchIndexes, length, argument) {
- return [argument < 0 ? argument + length : argument];
- }),
- even: createPositionalPseudo(function(matchIndexes, length) {
- var i2 = 0;
- for (; i2 < length; i2 += 2) {
- matchIndexes.push(i2);
- }
- return matchIndexes;
- }),
- odd: createPositionalPseudo(function(matchIndexes, length) {
- var i2 = 1;
- for (; i2 < length; i2 += 2) {
- matchIndexes.push(i2);
- }
- return matchIndexes;
- }),
- lt: createPositionalPseudo(function(matchIndexes, length, argument) {
- var i2;
- if (argument < 0) {
- i2 = argument + length;
- } else if (argument > length) {
- i2 = length;
- } else {
- i2 = argument;
- }
- for (; --i2 >= 0; ) {
- matchIndexes.push(i2);
- }
- return matchIndexes;
- }),
- gt: createPositionalPseudo(function(matchIndexes, length, argument) {
- var i2 = argument < 0 ? argument + length : argument;
- for (; ++i2 < length; ) {
- matchIndexes.push(i2);
- }
- return matchIndexes;
- })
- }
- };
- jQuery.expr.pseudos.nth = jQuery.expr.pseudos.eq;
- for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
- jQuery.expr.pseudos[i] = createInputPseudo(i);
- }
- for (i in { submit: true, reset: true }) {
- jQuery.expr.pseudos[i] = createButtonPseudo(i);
- }
- function setFilters() {
- }
- setFilters.prototype = jQuery.expr.filters = jQuery.expr.pseudos;
- jQuery.expr.setFilters = new setFilters();
- function addCombinator(matcher, combinator, base) {
- var dir = combinator.dir, skip = combinator.next, key = skip || dir, checkNonElements = base && key === "parentNode", doneName = done++;
- return combinator.first ? (
- // Check against closest ancestor/preceding element
- function(elem, context, xml) {
- while (elem = elem[dir]) {
- if (elem.nodeType === 1 || checkNonElements) {
- return matcher(elem, context, xml);
- }
- }
- return false;
- }
- ) : (
- // Check against all ancestor/preceding elements
- function(elem, context, xml) {
- var oldCache, outerCache, newCache = [dirruns, doneName];
- if (xml) {
- while (elem = elem[dir]) {
- if (elem.nodeType === 1 || checkNonElements) {
- if (matcher(elem, context, xml)) {
- return true;
- }
- }
- }
- } else {
- while (elem = elem[dir]) {
- if (elem.nodeType === 1 || checkNonElements) {
- outerCache = elem[jQuery.expando] || (elem[jQuery.expando] = {});
- if (skip && nodeName(elem, skip)) {
- elem = elem[dir] || elem;
- } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
- return newCache[2] = oldCache[2];
- } else {
- outerCache[key] = newCache;
- if (newCache[2] = matcher(elem, context, xml)) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- );
- }
- function elementMatcher(matchers) {
- return matchers.length > 1 ? function(elem, context, xml) {
- var i2 = matchers.length;
- while (i2--) {
- if (!matchers[i2](elem, context, xml)) {
- return false;
- }
- }
- return true;
- } : matchers[0];
- }
- function multipleContexts(selector, contexts, results) {
- var i2 = 0, len = contexts.length;
- for (; i2 < len; i2++) {
- find(selector, contexts[i2], results);
- }
- return results;
- }
- function condense(unmatched, map2, filter, context, xml) {
- var elem, newUnmatched = [], i2 = 0, len = unmatched.length, mapped = map2 != null;
- for (; i2 < len; i2++) {
- if (elem = unmatched[i2]) {
- if (!filter || filter(elem, context, xml)) {
- newUnmatched.push(elem);
- if (mapped) {
- map2.push(i2);
- }
- }
- }
- }
- return newUnmatched;
- }
- function setMatcher(preFilter2, selector, matcher, postFilter, postFinder, postSelector) {
- if (postFilter && !postFilter[jQuery.expando]) {
- postFilter = setMatcher(postFilter);
- }
- if (postFinder && !postFinder[jQuery.expando]) {
- postFinder = setMatcher(postFinder, postSelector);
- }
- return markFunction(function(seed, results, context, xml) {
- var temp, i2, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(
- selector || "*",
- context.nodeType ? [context] : context,
- []
- ), matcherIn = preFilter2 && (seed || !selector) ? condense(elems, preMap, preFilter2, context, xml) : elems;
- if (matcher) {
- matcherOut = postFinder || (seed ? preFilter2 : preexisting || postFilter) ? (
- // ...intermediate processing is necessary
- []
- ) : (
- // ...otherwise use results directly
- results
- );
- matcher(matcherIn, matcherOut, context, xml);
- } else {
- matcherOut = matcherIn;
- }
- if (postFilter) {
- temp = condense(matcherOut, postMap);
- postFilter(temp, [], context, xml);
- i2 = temp.length;
- while (i2--) {
- if (elem = temp[i2]) {
- matcherOut[postMap[i2]] = !(matcherIn[postMap[i2]] = elem);
- }
- }
- }
- if (seed) {
- if (postFinder || preFilter2) {
- if (postFinder) {
- temp = [];
- i2 = matcherOut.length;
- while (i2--) {
- if (elem = matcherOut[i2]) {
- temp.push(matcherIn[i2] = elem);
- }
- }
- postFinder(null, matcherOut = [], temp, xml);
- }
- i2 = matcherOut.length;
- while (i2--) {
- if ((elem = matcherOut[i2]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i2]) > -1) {
- seed[temp] = !(results[temp] = elem);
- }
- }
- }
- } else {
- matcherOut = condense(
- matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut
- );
- if (postFinder) {
- postFinder(null, results, matcherOut, xml);
- } else {
- push.apply(results, matcherOut);
- }
- }
- });
- }
- function matcherFromTokens(tokens) {
- var checkContext, matcher, j, len = tokens.length, leadingRelative = jQuery.expr.relative[tokens[0].type], implicitRelative = leadingRelative || jQuery.expr.relative[" "], i2 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) {
- return elem === checkContext;
- }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) {
- return indexOf.call(checkContext, elem) > -1;
- }, implicitRelative, true), matchers = [function(elem, context, xml) {
- var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
- checkContext = null;
- return ret;
- }];
- for (; i2 < len; i2++) {
- if (matcher = jQuery.expr.relative[tokens[i2].type]) {
- matchers = [addCombinator(elementMatcher(matchers), matcher)];
- } else {
- matcher = jQuery.expr.filter[tokens[i2].type].apply(null, tokens[i2].matches);
- if (matcher[jQuery.expando]) {
- j = ++i2;
- for (; j < len; j++) {
- if (jQuery.expr.relative[tokens[j].type]) {
- break;
- }
- }
- return setMatcher(
- i2 > 1 && elementMatcher(matchers),
- i2 > 1 && toSelector(
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
- tokens.slice(0, i2 - 1).concat({ value: tokens[i2 - 2].type === " " ? "*" : "" })
- ).replace(rtrimCSS, "$1"),
- matcher,
- i2 < j && matcherFromTokens(tokens.slice(i2, j)),
- j < len && matcherFromTokens(tokens = tokens.slice(j)),
- j < len && toSelector(tokens)
- );
- }
- matchers.push(matcher);
- }
- }
- return elementMatcher(matchers);
- }
- function matcherFromGroupMatchers(elementMatchers, setMatchers) {
- var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) {
- var elem, j, matcher, matchedCount = 0, i2 = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && jQuery.expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1;
- if (outermost) {
- outermostContext = context == document$1 || context || outermost;
- }
- for (; (elem = elems[i2]) != null; i2++) {
- if (byElement && elem) {
- j = 0;
- if (!context && elem.ownerDocument != document$1) {
- setDocument(elem);
- xml = !documentIsHTML;
- }
- while (matcher = elementMatchers[j++]) {
- if (matcher(elem, context || document$1, xml)) {
- push.call(results, elem);
- break;
- }
- }
- if (outermost) {
- dirruns = dirrunsUnique;
- }
- }
- if (bySet) {
- if (elem = !matcher && elem) {
- matchedCount--;
- }
- if (seed) {
- unmatched.push(elem);
- }
- }
- }
- matchedCount += i2;
- if (bySet && i2 !== matchedCount) {
- j = 0;
- while (matcher = setMatchers[j++]) {
- matcher(unmatched, setMatched, context, xml);
- }
- if (seed) {
- if (matchedCount > 0) {
- while (i2--) {
- if (!(unmatched[i2] || setMatched[i2])) {
- setMatched[i2] = pop.call(results);
- }
- }
- }
- setMatched = condense(setMatched);
- }
- push.apply(results, setMatched);
- if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
- jQuery.uniqueSort(results);
- }
- }
- if (outermost) {
- dirruns = dirrunsUnique;
- outermostContext = contextBackup;
- }
- return unmatched;
- };
- return bySet ? markFunction(superMatcher) : superMatcher;
- }
- function compile(selector, match) {
- var i2, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
- if (!cached) {
- if (!match) {
- match = tokenize(selector);
- }
- i2 = match.length;
- while (i2--) {
- cached = matcherFromTokens(match[i2]);
- if (cached[jQuery.expando]) {
- setMatchers.push(cached);
- } else {
- elementMatchers.push(cached);
- }
- }
- cached = compilerCache(
- selector,
- matcherFromGroupMatchers(elementMatchers, setMatchers)
- );
- cached.selector = selector;
- }
- return cached;
- }
- function select(selector, context, results, seed) {
- var i2, tokens, token, type, find2, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector);
- results = results || [];
- if (match.length === 1) {
- tokens = match[0] = match[0].slice(0);
- if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && jQuery.expr.relative[tokens[1].type]) {
- context = (jQuery.expr.find.ID(
- unescapeSelector(token.matches[0]),
- context
- ) || [])[0];
- if (!context) {
- return results;
- } else if (compiled) {
- context = context.parentNode;
- }
- selector = selector.slice(tokens.shift().value.length);
- }
- i2 = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
- while (i2--) {
- token = tokens[i2];
- if (jQuery.expr.relative[type = token.type]) {
- break;
- }
- if (find2 = jQuery.expr.find[type]) {
- if (seed = find2(
- unescapeSelector(token.matches[0]),
- rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
- )) {
- tokens.splice(i2, 1);
- selector = seed.length && toSelector(tokens);
- if (!selector) {
- push.apply(results, seed);
- return results;
- }
- break;
- }
- }
- }
- }
- (compiled || compile(selector, match))(
- seed,
- context,
- !documentIsHTML,
- results,
- !context || rsibling.test(selector) && testContext(context.parentNode) || context
- );
- return results;
- }
- setDocument();
- jQuery.find = find;
- find.compile = compile;
- find.select = select;
- find.setDocument = setDocument;
- find.tokenize = tokenize;
- return jQuery;
- })
- );
- // src/mock-doc/selector.ts
- function matches(selector, elm) {
- try {
- const r = jquery_default.find(selector, void 0, void 0, [elm]);
- return r.length > 0;
- } catch (e) {
- updateSelectorError(selector, e);
- throw e;
- }
- }
- function selectOne(selector, elm) {
- try {
- const r = jquery_default.find(selector, elm, void 0, void 0);
- return r[0] || null;
- } catch (e) {
- updateSelectorError(selector, e);
- throw e;
- }
- }
- function selectAll(selector, elm) {
- try {
- return jquery_default.find(selector, elm, void 0, void 0);
- } catch (e) {
- updateSelectorError(selector, e);
- throw e;
- }
- }
- var PROBLEMATIC_SELECTORS = [":scope", ":where", ":is"];
- function updateSelectorError(selector, e) {
- const selectorsPresent = PROBLEMATIC_SELECTORS.filter((s) => selector.includes(s));
- if (selectorsPresent.length > 0 && e.message) {
- e.message = `At present jQuery does not support the ${humanReadableList(selectorsPresent)} ${selectorsPresent.length === 1 ? "selector" : "selectors"}.
- If you need this in your test, consider writing an end-to-end test instead.
- ` + e.message;
- }
- }
- function humanReadableList(items) {
- if (items.length <= 1) {
- return items.join("");
- }
- return `${items.slice(0, items.length - 1).join(", ")} and ${items[items.length - 1]}`;
- }
- // src/mock-doc/serialize-node.ts
- function normalizeSerializationOptions(opts = {}) {
- return {
- ...opts,
- outerHtml: typeof opts.outerHtml !== "boolean" ? false : opts.outerHtml,
- ...opts.prettyHtml ? {
- indentSpaces: typeof opts.indentSpaces !== "number" ? 2 : opts.indentSpaces,
- newLines: typeof opts.newLines !== "boolean" ? true : opts.newLines
- } : {
- prettyHtml: false,
- indentSpaces: typeof opts.indentSpaces !== "number" ? 0 : opts.indentSpaces,
- newLines: typeof opts.newLines !== "boolean" ? false : opts.newLines
- },
- approximateLineWidth: typeof opts.approximateLineWidth !== "number" ? -1 : opts.approximateLineWidth,
- removeEmptyAttributes: typeof opts.removeEmptyAttributes !== "boolean" ? true : opts.removeEmptyAttributes,
- removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
- removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
- removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
- serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? true : opts.serializeShadowRoot,
- fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
- };
- }
- function serializeNodeToHtml(elm, serializationOptions = {}) {
- const opts = normalizeSerializationOptions(serializationOptions);
- const output = {
- currentLineWidth: 0,
- indent: 0,
- isWithinBody: false,
- text: []
- };
- let renderedNode = "";
- const children = !opts.fullDocument && elm.body ? Array.from(elm.body.childNodes) : opts.outerHtml ? [elm] : Array.from(elm.childNodes);
- for (let i = 0, ii = children.length; i < ii; i++) {
- const child = children[i];
- const chunks = Array.from(streamToHtml(child, opts, output));
- renderedNode += chunks.join("");
- }
- return renderedNode.trim();
- }
- var shadowRootTag = "mock:shadow-root";
- function* streamToHtml(node, opts, output) {
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
- const isShadowRoot = node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */;
- if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
- const tagName = isShadowRoot ? shadowRootTag : getTagName(node);
- if (tagName === "body") {
- output.isWithinBody = true;
- }
- const ignoreTag = opts.excludeTags != null && opts.excludeTags.includes(tagName);
- if (ignoreTag === false) {
- const isWithinWhitespaceSensitiveNode = opts.newLines || ((_a2 = opts.indentSpaces) != null ? _a2 : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- yield "\n";
- output.currentLineWidth = 0;
- }
- if (((_b = opts.indentSpaces) != null ? _b : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
- for (let i = 0; i < output.indent; i++) {
- yield " ";
- }
- output.currentLineWidth += output.indent;
- }
- const tag = tagName === shadowRootTag ? "template" : tagName;
- yield "<" + tag;
- output.currentLineWidth += tag.length + 1;
- if (tag === "template") {
- const mode = ` shadowrootmode="open"`;
- yield mode;
- output.currentLineWidth += mode.length;
- }
- const attrsLength = node.attributes.length;
- const attributes = opts.prettyHtml && attrsLength > 1 ? cloneAttributes(node.attributes, true) : node.attributes;
- for (let i = 0; i < attrsLength; i++) {
- const attr = attributes.item(i);
- const attrName = attr.name;
- if (attrName === "style") {
- continue;
- }
- let attrValue = attr.value;
- if (opts.removeEmptyAttributes && attrValue === "" && REMOVE_EMPTY_ATTR.has(attrName)) {
- continue;
- }
- const attrNamespaceURI = attr.namespaceURI;
- if (attrNamespaceURI == null) {
- output.currentLineWidth += attrName.length + 1;
- if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
- yield "\n" + attrName;
- output.currentLineWidth = 0;
- } else {
- yield " " + attrName;
- }
- } else if (attrNamespaceURI === "http://www.w3.org/XML/1998/namespace") {
- yield " xml:" + attrName;
- output.currentLineWidth += attrName.length + 5;
- } else if (attrNamespaceURI === "http://www.w3.org/2000/xmlns/") {
- if (attrName !== "xmlns") {
- yield " xmlns:" + attrName;
- output.currentLineWidth += attrName.length + 7;
- } else {
- yield " " + attrName;
- output.currentLineWidth += attrName.length + 1;
- }
- } else if (attrNamespaceURI === XLINK_NS) {
- yield " xlink:" + attrName;
- output.currentLineWidth += attrName.length + 7;
- } else {
- yield " " + attrNamespaceURI + ":" + attrName;
- output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
- }
- if (opts.prettyHtml && attrName === "class") {
- attrValue = attr.value = attrValue.split(" ").filter((t) => t !== "").sort().join(" ").trim();
- }
- if (attrValue === "") {
- if (opts.removeBooleanAttributeQuotes && BOOLEAN_ATTR.has(attrName)) {
- continue;
- }
- if (opts.removeEmptyAttributes && attrName.startsWith("data-")) {
- continue;
- }
- }
- if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
- yield "=" + escapeString(attrValue, true);
- output.currentLineWidth += attrValue.length + 1;
- } else {
- yield '="' + escapeString(attrValue, true) + '"';
- output.currentLineWidth += attrValue.length + 3;
- }
- }
- if (node.hasAttribute("style")) {
- const cssText = node.style.cssText;
- if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
- yield `
- style="${cssText}">`;
- output.currentLineWidth = 0;
- } else {
- yield ` style="${cssText}">`;
- output.currentLineWidth += cssText.length + 10;
- }
- } else {
- yield ">";
- output.currentLineWidth += 1;
- }
- }
- if (EMPTY_ELEMENTS.has(tagName) === false) {
- const shadowRoot = node.shadowRoot;
- if (shadowRoot != null && opts.serializeShadowRoot) {
- output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
- yield* streamToHtml(shadowRoot, opts, output);
- output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
- if (opts.newLines && (node.childNodes.length === 0 || node.childNodes.length === 1 && node.childNodes[0].nodeType === 3 /* TEXT_NODE */ && ((_e = node.childNodes[0].nodeValue) == null ? void 0 : _e.trim()) === "")) {
- yield "\n";
- output.currentLineWidth = 0;
- for (let i = 0; i < output.indent; i++) {
- yield " ";
- }
- output.currentLineWidth += output.indent;
- }
- }
- if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
- const tag = tagName === shadowRootTag ? "template" : tagName;
- const childNodes = tagName === "template" ? node.content.childNodes : node.childNodes;
- const childNodeLength = childNodes.length;
- if (childNodeLength > 0) {
- if (childNodeLength === 1 && childNodes[0].nodeType === 3 /* TEXT_NODE */ && (typeof childNodes[0].nodeValue !== "string" || childNodes[0].nodeValue.trim() === "")) {
- } else {
- const isWithinWhitespaceSensitiveNode = opts.newLines || ((_f = opts.indentSpaces) != null ? _f : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
- if (!isWithinWhitespaceSensitiveNode && ((_g = opts.indentSpaces) != null ? _g : 0) > 0 && ignoreTag === false) {
- output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
- }
- for (let i = 0; i < childNodeLength; i++) {
- yield* streamToHtml(childNodes[i], opts, output);
- }
- if (ignoreTag === false) {
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- yield "\n";
- output.currentLineWidth = 0;
- }
- if (((_i = opts.indentSpaces) != null ? _i : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
- output.indent = output.indent - ((_j = opts.indentSpaces) != null ? _j : 0);
- for (let i = 0; i < output.indent; i++) {
- yield " ";
- }
- output.currentLineWidth += output.indent;
- }
- }
- }
- }
- if (ignoreTag === false) {
- yield "</" + tag + ">";
- output.currentLineWidth += tag.length + 3;
- }
- }
- }
- if (((_k = opts.approximateLineWidth) != null ? _k : 0) > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
- yield "\n";
- output.currentLineWidth = 0;
- }
- if (tagName === "body") {
- output.isWithinBody = false;
- }
- } else if (node.nodeType === 3 /* TEXT_NODE */) {
- let textContent = node.nodeValue;
- if (typeof textContent === "string") {
- const trimmedTextContent = textContent.trim();
- if (trimmedTextContent === "") {
- if (isWithinWhitespaceSensitive(node)) {
- yield textContent;
- output.currentLineWidth += textContent.length;
- } else if (((_l = opts.approximateLineWidth) != null ? _l : 0) > 0 && !output.isWithinBody) {
- } else if (!opts.prettyHtml) {
- output.currentLineWidth += 1;
- if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
- yield "\n";
- output.currentLineWidth = 0;
- } else {
- yield " ";
- }
- }
- } else {
- const isWithinWhitespaceSensitiveNode = opts.newLines || ((_m = opts.indentSpaces) != null ? _m : 0) > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- yield "\n";
- output.currentLineWidth = 0;
- }
- if (((_n = opts.indentSpaces) != null ? _n : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
- for (let i = 0; i < output.indent; i++) {
- yield " ";
- }
- output.currentLineWidth += output.indent;
- }
- let textContentLength = textContent.length;
- if (textContentLength > 0) {
- const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */ ? node.parentNode.nodeName : null;
- if (typeof parentTagName === "string" && NON_ESCAPABLE_CONTENT.has(parentTagName)) {
- if (isWithinWhitespaceSensitive(node)) {
- yield textContent;
- } else {
- yield trimmedTextContent;
- textContentLength = trimmedTextContent.length;
- }
- output.currentLineWidth += textContentLength;
- } else {
- if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
- yield escapeString(textContent.replace(/\s\s+/g, " ").trim(), false);
- output.currentLineWidth += textContentLength;
- } else {
- if (isWithinWhitespaceSensitive(node)) {
- output.currentLineWidth += textContentLength;
- } else {
- if (/\s/.test(textContent.charAt(0))) {
- textContent = " " + textContent.trimLeft();
- }
- textContentLength = textContent.length;
- if (textContentLength > 1) {
- if (/\s/.test(textContent.charAt(textContentLength - 1))) {
- if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + textContentLength > opts.approximateLineWidth) {
- textContent = textContent.trimRight() + "\n";
- output.currentLineWidth = 0;
- } else {
- textContent = textContent.trimRight() + " ";
- }
- }
- }
- output.currentLineWidth += textContentLength;
- }
- yield escapeString(textContent, false);
- }
- }
- }
- }
- }
- } else if (node.nodeType === 8 /* COMMENT_NODE */) {
- const nodeValue = node.nodeValue;
- const isHydrateAnnotation = (nodeValue == null ? void 0 : nodeValue.startsWith(CONTENT_REF_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(ORG_LOCATION_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(SLOT_NODE_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(TEXT_NODE_ID + "."));
- if (opts.removeHtmlComments && !isHydrateAnnotation) {
- return;
- }
- const isWithinWhitespaceSensitiveNode = opts.newLines || ((_o = opts.indentSpaces) != null ? _o : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- yield "\n";
- output.currentLineWidth = 0;
- }
- if (((_p = opts.indentSpaces) != null ? _p : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
- for (let i = 0; i < output.indent; i++) {
- yield " ";
- }
- output.currentLineWidth += output.indent;
- }
- yield "<!--" + nodeValue + "-->";
- if (nodeValue) {
- output.currentLineWidth += nodeValue.length + 7;
- }
- } else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
- yield "<!doctype html>";
- }
- }
- var AMP_REGEX = /&/g;
- var NBSP_REGEX = /\u00a0/g;
- var DOUBLE_QUOTE_REGEX = /"/g;
- var LT_REGEX = /</g;
- var GT_REGEX = />/g;
- var CAN_REMOVE_ATTR_QUOTES = /^[^ \t\n\f\r"'`=<>\/\\-]+$/;
- function getTagName(element) {
- if (element.namespaceURI === "http://www.w3.org/1999/xhtml") {
- return element.nodeName.toLowerCase();
- } else {
- return element.nodeName;
- }
- }
- function escapeString(str, attrMode) {
- str = str.replace(AMP_REGEX, "&").replace(NBSP_REGEX, " ");
- if (attrMode) {
- return str.replace(DOUBLE_QUOTE_REGEX, """);
- }
- return str.replace(LT_REGEX, "<").replace(GT_REGEX, ">");
- }
- function isWithinWhitespaceSensitive(node) {
- let _node = node;
- while (_node == null ? void 0 : _node.nodeName) {
- if (WHITESPACE_SENSITIVE.has(_node.nodeName)) {
- return true;
- }
- _node = _node.parentNode;
- }
- return false;
- }
- var NON_ESCAPABLE_CONTENT = /* @__PURE__ */ new Set([
- "STYLE",
- "SCRIPT",
- "IFRAME",
- "NOSCRIPT",
- "XMP",
- "NOEMBED",
- "NOFRAMES",
- "PLAINTEXT"
- ]);
- var WHITESPACE_SENSITIVE = /* @__PURE__ */ new Set([
- "CODE",
- "OUTPUT",
- "PLAINTEXT",
- "PRE",
- "SCRIPT",
- "TEMPLATE",
- "TEXTAREA"
- ]);
- var EMPTY_ELEMENTS = /* @__PURE__ */ new Set([
- "area",
- "base",
- "basefont",
- "bgsound",
- "br",
- "col",
- "embed",
- "frame",
- "hr",
- "img",
- "input",
- "keygen",
- "link",
- "meta",
- "param",
- "source",
- "trace",
- "track",
- "wbr"
- ]);
- var REMOVE_EMPTY_ATTR = /* @__PURE__ */ new Set(["class", "dir", "id", "lang", "name", "title"]);
- var BOOLEAN_ATTR = /* @__PURE__ */ new Set([
- "allowfullscreen",
- "async",
- "autofocus",
- "autoplay",
- "checked",
- "compact",
- "controls",
- "declare",
- "default",
- "defaultchecked",
- "defaultmuted",
- "defaultselected",
- "defer",
- "disabled",
- "enabled",
- "formnovalidate",
- "hidden",
- "indeterminate",
- "inert",
- "ismap",
- "itemscope",
- "loop",
- "multiple",
- "muted",
- "nohref",
- "nomodule",
- "noresize",
- "noshade",
- "novalidate",
- "nowrap",
- "open",
- "pauseonexit",
- "readonly",
- "required",
- "reversed",
- "scoped",
- "seamless",
- "selected",
- "sortable",
- "truespeed",
- "typemustmatch",
- "visible"
- ]);
- var STRUCTURE_ELEMENTS = /* @__PURE__ */ new Set([
- "html",
- "body",
- "head",
- "iframe",
- "meta",
- "link",
- "base",
- "title",
- "script",
- "style"
- ]);
- // src/mock-doc/node.ts
- var MockNode2 = class {
- constructor(ownerDocument, nodeType, nodeName, nodeValue) {
- this.ownerDocument = ownerDocument;
- this.nodeType = nodeType;
- this.nodeName = nodeName;
- this._nodeValue = nodeValue;
- this.parentNode = null;
- this.childNodes = [];
- }
- appendChild(newNode) {
- if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
- const nodes = newNode.childNodes.slice();
- for (const child of nodes) {
- this.appendChild(child);
- }
- } else {
- newNode.remove();
- newNode.parentNode = this;
- this.childNodes.push(newNode);
- connectNode(this.ownerDocument, newNode);
- }
- return newNode;
- }
- append(...items) {
- items.forEach((item) => {
- const isNode = typeof item === "object" && item !== null && "nodeType" in item;
- this.appendChild(isNode ? item : this.ownerDocument.createTextNode(String(item)));
- });
- }
- prepend(...items) {
- const firstChild = this.firstChild;
- items.forEach((item) => {
- const isNode = typeof item === "object" && item !== null && "nodeType" in item;
- if (firstChild) {
- this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
- }
- });
- }
- cloneNode(deep) {
- throw new Error(`invalid node type to clone: ${this.nodeType}, deep: ${deep}`);
- }
- compareDocumentPosition(_other) {
- return -1;
- }
- get firstChild() {
- return this.childNodes[0] || null;
- }
- insertBefore(newNode, referenceNode) {
- if (newNode.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
- for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
- insertBefore(this, newNode.childNodes[i], referenceNode);
- }
- } else {
- insertBefore(this, newNode, referenceNode);
- }
- return newNode;
- }
- get isConnected() {
- let node = this;
- while (node != null) {
- if (node.nodeType === 9 /* DOCUMENT_NODE */) {
- return true;
- }
- node = node.parentNode;
- if (node != null && node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */) {
- node = node.host;
- }
- }
- return false;
- }
- isSameNode(node) {
- return this === node;
- }
- get lastChild() {
- return this.childNodes[this.childNodes.length - 1] || null;
- }
- get nextSibling() {
- if (this.parentNode != null) {
- const index = this.parentNode.childNodes.indexOf(this) + 1;
- return this.parentNode.childNodes[index] || null;
- }
- return null;
- }
- get nodeValue() {
- var _a2;
- return (_a2 = this._nodeValue) != null ? _a2 : "";
- }
- set nodeValue(value) {
- this._nodeValue = value;
- }
- get parentElement() {
- return this.parentNode || null;
- }
- set parentElement(value) {
- this.parentNode = value;
- }
- get previousSibling() {
- if (this.parentNode != null) {
- const index = this.parentNode.childNodes.indexOf(this) - 1;
- return this.parentNode.childNodes[index] || null;
- }
- return null;
- }
- contains(otherNode) {
- if (otherNode === this) {
- return true;
- }
- const childNodes = Array.from(this.childNodes);
- if (childNodes.includes(otherNode)) {
- return true;
- }
- return childNodes.some((node) => this.contains.bind(node)(otherNode));
- }
- removeChild(childNode) {
- const index = this.childNodes.indexOf(childNode);
- if (index > -1) {
- this.childNodes.splice(index, 1);
- if (this.nodeType === 1 /* ELEMENT_NODE */) {
- const wasConnected = this.isConnected;
- childNode.parentNode = null;
- if (wasConnected === true) {
- disconnectNode(childNode);
- }
- } else {
- childNode.parentNode = null;
- }
- } else {
- throw new Error(`node not found within childNodes during removeChild`);
- }
- return childNode;
- }
- remove() {
- if (this.parentNode != null) {
- this.parentNode.removeChild(this);
- }
- }
- replaceChild(newChild, oldChild) {
- if (oldChild.parentNode === this) {
- this.insertBefore(newChild, oldChild);
- oldChild.remove();
- return newChild;
- }
- return null;
- }
- get textContent() {
- var _a2;
- return (_a2 = this._nodeValue) != null ? _a2 : "";
- }
- set textContent(value) {
- this._nodeValue = String(value);
- }
- };
- MockNode2.ELEMENT_NODE = 1;
- MockNode2.TEXT_NODE = 3;
- MockNode2.PROCESSING_INSTRUCTION_NODE = 7;
- MockNode2.COMMENT_NODE = 8;
- MockNode2.DOCUMENT_NODE = 9;
- MockNode2.DOCUMENT_TYPE_NODE = 10;
- MockNode2.DOCUMENT_FRAGMENT_NODE = 11;
- var MockNodeList = class {
- constructor(ownerDocument, childNodes, length) {
- this.ownerDocument = ownerDocument;
- this.childNodes = childNodes;
- this.length = length;
- }
- };
- var MockElement = class extends MockNode2 {
- attachInternals() {
- return new Proxy({}, {
- get: function(_target, prop, _receiver) {
- console.error(
- `NOTE: Property ${String(prop)} was accessed on ElementInternals, but this property is not implemented.
- Testing components with ElementInternals is fully supported in e2e tests.`
- );
- }
- });
- }
- constructor(ownerDocument, nodeName, namespaceURI = null) {
- super(ownerDocument, 1 /* ELEMENT_NODE */, typeof nodeName === "string" ? nodeName : null, null);
- this.__namespaceURI = namespaceURI;
- this.__shadowRoot = null;
- this.__attributeMap = null;
- }
- addEventListener(type, handler) {
- addEventListener(this, type, handler);
- }
- attachShadow(_opts) {
- const shadowRoot = this.ownerDocument.createDocumentFragment();
- this.shadowRoot = shadowRoot;
- return shadowRoot;
- }
- blur() {
- dispatchEvent(
- this,
- new MockFocusEvent("blur", { relatedTarget: null, bubbles: true, cancelable: true, composed: true })
- );
- }
- get localName() {
- if (!this.nodeName) {
- throw new Error(`Can't compute elements localName without nodeName`);
- }
- return this.nodeName.toLocaleLowerCase();
- }
- get namespaceURI() {
- return this.__namespaceURI;
- }
- get shadowRoot() {
- return this.__shadowRoot || null;
- }
- /**
- * Set shadow root for element
- * @param shadowRoot - ShadowRoot to set
- */
- set shadowRoot(shadowRoot) {
- if (shadowRoot != null) {
- shadowRoot.host = this;
- this.__shadowRoot = shadowRoot;
- } else {
- delete this.__shadowRoot;
- }
- }
- get attributes() {
- if (this.__attributeMap == null) {
- const attrMap = createAttributeProxy(false);
- this.__attributeMap = attrMap;
- return attrMap;
- }
- return this.__attributeMap;
- }
- set attributes(attrs) {
- this.__attributeMap = attrs;
- }
- get children() {
- return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */);
- }
- get childElementCount() {
- return this.childNodes.filter((n) => n.nodeType === 1 /* ELEMENT_NODE */).length;
- }
- get className() {
- return this.getAttributeNS(null, "class") || "";
- }
- set className(value) {
- this.setAttributeNS(null, "class", value);
- }
- get classList() {
- return new MockClassList(this);
- }
- click() {
- dispatchEvent(this, new MockEvent("click", { bubbles: true, cancelable: true, composed: true }));
- }
- cloneNode(_deep) {
- return null;
- }
- closest(selector) {
- let elm = this;
- while (elm != null) {
- if (elm.matches(selector)) {
- return elm;
- }
- elm = elm.parentNode;
- }
- return null;
- }
- get dataset() {
- return dataset(this);
- }
- get dir() {
- return this.getAttributeNS(null, "dir") || "";
- }
- set dir(value) {
- this.setAttributeNS(null, "dir", value);
- }
- dispatchEvent(ev) {
- return dispatchEvent(this, ev);
- }
- get firstElementChild() {
- return this.children[0] || null;
- }
- focus(_options) {
- dispatchEvent(
- this,
- new MockFocusEvent("focus", { relatedTarget: null, bubbles: true, cancelable: true, composed: true })
- );
- }
- getAttribute(attrName) {
- if (attrName === "style") {
- if (this.__style != null && this.__style.length > 0) {
- return this.style.cssText;
- }
- return null;
- }
- const attr = this.attributes.getNamedItem(attrName);
- if (attr != null) {
- return attr.value;
- }
- return null;
- }
- getAttributeNS(namespaceURI, attrName) {
- const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
- if (attr != null) {
- return attr.value;
- }
- return null;
- }
- getAttributeNode(attrName) {
- if (!this.hasAttribute(attrName)) {
- return null;
- }
- return new MockAttr(attrName, this.getAttribute(attrName));
- }
- getBoundingClientRect() {
- return { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };
- }
- getRootNode(opts) {
- const isComposed = opts != null && opts.composed === true;
- let node = this;
- while (node.parentNode != null) {
- node = node.parentNode;
- if (isComposed === true && node.parentNode == null && node.host != null) {
- node = node.host;
- }
- }
- return node;
- }
- get draggable() {
- return this.getAttributeNS(null, "draggable") === "true";
- }
- set draggable(value) {
- this.setAttributeNS(null, "draggable", value);
- }
- hasChildNodes() {
- return this.childNodes.length > 0;
- }
- get id() {
- return this.getAttributeNS(null, "id") || "";
- }
- set id(value) {
- this.setAttributeNS(null, "id", value);
- }
- get innerHTML() {
- if (this.childNodes.length === 0) {
- return "";
- }
- return serializeNodeToHtml(this, {
- newLines: false,
- indentSpaces: 0
- });
- }
- set innerHTML(html) {
- var _a2;
- if (NON_ESCAPABLE_CONTENT.has((_a2 = this.nodeName) != null ? _a2 : "") === true) {
- setTextContent(this, html);
- } else {
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
- this.removeChild(this.childNodes[i]);
- }
- if (typeof html === "string") {
- const frag = parseFragmentUtil(this.ownerDocument, html);
- while (frag.childNodes.length > 0) {
- this.appendChild(frag.childNodes[0]);
- }
- }
- }
- }
- get innerText() {
- const text = [];
- getTextContent(this.childNodes, text);
- return text.join("");
- }
- set innerText(value) {
- setTextContent(this, value);
- }
- insertAdjacentElement(position, elm) {
- if (position === "beforebegin" && this.parentNode) {
- insertBefore(this.parentNode, elm, this);
- } else if (position === "afterbegin") {
- this.prepend(elm);
- } else if (position === "beforeend") {
- this.appendChild(elm);
- } else if (position === "afterend" && this.parentNode) {
- insertBefore(this.parentNode, elm, this.nextSibling);
- }
- return elm;
- }
- insertAdjacentHTML(position, html) {
- const frag = parseFragmentUtil(this.ownerDocument, html);
- if (position === "beforebegin") {
- while (frag.childNodes.length > 0) {
- if (this.parentNode) {
- insertBefore(this.parentNode, frag.childNodes[0], this);
- }
- }
- } else if (position === "afterbegin") {
- while (frag.childNodes.length > 0) {
- this.prepend(frag.childNodes[frag.childNodes.length - 1]);
- }
- } else if (position === "beforeend") {
- while (frag.childNodes.length > 0) {
- this.appendChild(frag.childNodes[0]);
- }
- } else if (position === "afterend") {
- while (frag.childNodes.length > 0) {
- if (this.parentNode) {
- insertBefore(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
- }
- }
- }
- }
- insertAdjacentText(position, text) {
- const elm = this.ownerDocument.createTextNode(text);
- if (position === "beforebegin" && this.parentNode) {
- insertBefore(this.parentNode, elm, this);
- } else if (position === "afterbegin") {
- this.prepend(elm);
- } else if (position === "beforeend") {
- this.appendChild(elm);
- } else if (position === "afterend" && this.parentNode) {
- insertBefore(this.parentNode, elm, this.nextSibling);
- }
- }
- hasAttribute(attrName) {
- if (attrName === "style") {
- return this.__style != null && this.__style.length > 0;
- }
- return this.getAttribute(attrName) !== null;
- }
- hasAttributeNS(namespaceURI, name) {
- return this.getAttributeNS(namespaceURI, name) !== null;
- }
- get hidden() {
- return this.hasAttributeNS(null, "hidden");
- }
- set hidden(isHidden) {
- if (isHidden === true) {
- this.setAttributeNS(null, "hidden", "");
- } else {
- this.removeAttributeNS(null, "hidden");
- }
- }
- get lang() {
- return this.getAttributeNS(null, "lang") || "";
- }
- set lang(value) {
- this.setAttributeNS(null, "lang", value);
- }
- get lastElementChild() {
- const children = this.children;
- return children[children.length - 1] || null;
- }
- matches(selector) {
- return matches(selector, this);
- }
- get nextElementSibling() {
- const parentElement = this.parentElement;
- if (parentElement != null && (parentElement.nodeType === 1 /* ELEMENT_NODE */ || parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ || parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
- const children = parentElement.children;
- const index = children.indexOf(this) + 1;
- return parentElement.children[index] || null;
- }
- return null;
- }
- get outerHTML() {
- return serializeNodeToHtml(this, {
- newLines: false,
- outerHtml: true,
- indentSpaces: 0
- });
- }
- get previousElementSibling() {
- const parentElement = this.parentElement;
- if (parentElement != null && (parentElement.nodeType === 1 /* ELEMENT_NODE */ || parentElement.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */ || parentElement.nodeType === 9 /* DOCUMENT_NODE */)) {
- const children = parentElement.children;
- const index = children.indexOf(this) - 1;
- return parentElement.children[index] || null;
- }
- return null;
- }
- getElementsByClassName(classNames) {
- const classes = classNames.trim().split(" ").filter((c) => c.length > 0);
- const results = [];
- getElementsByClassName(this, classes, results);
- return results;
- }
- getElementsByTagName(tagName) {
- const results = [];
- getElementsByTagName(this, tagName.toLowerCase(), results);
- return results;
- }
- querySelector(selector) {
- return selectOne(selector, this);
- }
- querySelectorAll(selector) {
- return selectAll(selector, this);
- }
- removeAttribute(attrName) {
- if (attrName === "style") {
- delete this.__style;
- } else {
- const attr = this.attributes.getNamedItem(attrName);
- if (attr != null) {
- this.attributes.removeNamedItemNS(attr);
- if (checkAttributeChanged(this) === true) {
- attributeChanged(this, attrName, attr.value, null);
- }
- }
- }
- }
- removeAttributeNS(namespaceURI, attrName) {
- const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
- if (attr != null) {
- this.attributes.removeNamedItemNS(attr);
- if (checkAttributeChanged(this) === true) {
- attributeChanged(this, attrName, attr.value, null);
- }
- }
- }
- removeEventListener(type, handler) {
- removeEventListener(this, type, handler);
- }
- setAttribute(attrName, value) {
- if (attrName === "style") {
- this.style = value;
- } else {
- const attributes = this.attributes;
- let attr = attributes.getNamedItem(attrName);
- const checkAttrChanged = checkAttributeChanged(this);
- if (attr != null) {
- if (checkAttrChanged === true) {
- const oldValue = attr.value;
- attr.value = value;
- if (oldValue !== attr.value) {
- attributeChanged(this, attr.name, oldValue, attr.value);
- }
- } else {
- attr.value = value;
- }
- } else {
- if (attributes.caseInsensitive) {
- attrName = attrName.toLowerCase();
- }
- attr = new MockAttr(attrName, value);
- attributes.__items.push(attr);
- if (checkAttrChanged === true) {
- attributeChanged(this, attrName, null, attr.value);
- }
- }
- }
- }
- setAttributeNS(namespaceURI, attrName, value) {
- const attributes = this.attributes;
- let attr = attributes.getNamedItemNS(namespaceURI, attrName);
- const checkAttrChanged = checkAttributeChanged(this);
- if (attr != null) {
- if (checkAttrChanged === true) {
- const oldValue = attr.value;
- attr.value = value;
- if (oldValue !== attr.value) {
- attributeChanged(this, attr.name, oldValue, attr.value);
- }
- } else {
- attr.value = value;
- }
- } else {
- attr = new MockAttr(attrName, value, namespaceURI);
- attributes.__items.push(attr);
- if (checkAttrChanged === true) {
- attributeChanged(this, attrName, null, attr.value);
- }
- }
- }
- get style() {
- if (this.__style == null) {
- this.__style = createCSSStyleDeclaration();
- }
- return this.__style;
- }
- set style(val) {
- if (typeof val === "string") {
- if (this.__style == null) {
- this.__style = createCSSStyleDeclaration();
- }
- this.__style.cssText = val;
- } else {
- this.__style = val;
- }
- }
- get tabIndex() {
- return parseInt(this.getAttributeNS(null, "tabindex") || "-1", 10);
- }
- set tabIndex(value) {
- this.setAttributeNS(null, "tabindex", value);
- }
- get tagName() {
- var _a2;
- return (_a2 = this.nodeName) != null ? _a2 : "";
- }
- set tagName(value) {
- this.nodeName = value;
- }
- get textContent() {
- const text = [];
- getTextContent(this.childNodes, text);
- return text.join("");
- }
- set textContent(value) {
- setTextContent(this, value);
- }
- get title() {
- return this.getAttributeNS(null, "title") || "";
- }
- set title(value) {
- this.setAttributeNS(null, "title", value);
- }
- animate() {
- }
- onanimationstart() {
- }
- onanimationend() {
- }
- onanimationiteration() {
- }
- onabort() {
- }
- onauxclick() {
- }
- onbeforecopy() {
- }
- onbeforecut() {
- }
- onbeforepaste() {
- }
- onblur() {
- }
- oncancel() {
- }
- oncanplay() {
- }
- oncanplaythrough() {
- }
- onchange() {
- }
- onclick() {
- }
- onclose() {
- }
- oncontextmenu() {
- }
- oncopy() {
- }
- oncuechange() {
- }
- oncut() {
- }
- ondblclick() {
- }
- ondrag() {
- }
- ondragend() {
- }
- ondragenter() {
- }
- ondragleave() {
- }
- ondragover() {
- }
- ondragstart() {
- }
- ondrop() {
- }
- ondurationchange() {
- }
- onemptied() {
- }
- onended() {
- }
- onerror() {
- }
- onfocus() {
- }
- onfocusin() {
- }
- onfocusout() {
- }
- onformdata() {
- }
- onfullscreenchange() {
- }
- onfullscreenerror() {
- }
- ongotpointercapture() {
- }
- oninput() {
- }
- oninvalid() {
- }
- onkeydown() {
- }
- onkeypress() {
- }
- onkeyup() {
- }
- onload() {
- }
- onloadeddata() {
- }
- onloadedmetadata() {
- }
- onloadstart() {
- }
- onlostpointercapture() {
- }
- onmousedown() {
- }
- onmouseenter() {
- }
- onmouseleave() {
- }
- onmousemove() {
- }
- onmouseout() {
- }
- onmouseover() {
- }
- onmouseup() {
- }
- onmousewheel() {
- }
- onpaste() {
- }
- onpause() {
- }
- onplay() {
- }
- onplaying() {
- }
- onpointercancel() {
- }
- onpointerdown() {
- }
- onpointerenter() {
- }
- onpointerleave() {
- }
- onpointermove() {
- }
- onpointerout() {
- }
- onpointerover() {
- }
- onpointerup() {
- }
- onprogress() {
- }
- onratechange() {
- }
- onreset() {
- }
- onresize() {
- }
- onscroll() {
- }
- onsearch() {
- }
- onseeked() {
- }
- onseeking() {
- }
- onselect() {
- }
- onselectstart() {
- }
- onstalled() {
- }
- onsubmit() {
- }
- onsuspend() {
- }
- ontimeupdate() {
- }
- ontoggle() {
- }
- onvolumechange() {
- }
- onwaiting() {
- }
- onwebkitfullscreenchange() {
- }
- onwebkitfullscreenerror() {
- }
- onwheel() {
- }
- requestFullscreen() {
- }
- scrollBy() {
- }
- scrollTo() {
- }
- scrollIntoView() {
- }
- toString(opts) {
- return serializeNodeToHtml(this, opts);
- }
- };
- function getElementsByClassName(elm, classNames, foundElms) {
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- for (let j = 0, jj = classNames.length; j < jj; j++) {
- if (childElm.classList.contains(classNames[j])) {
- foundElms.push(childElm);
- }
- }
- getElementsByClassName(childElm, classNames, foundElms);
- }
- }
- function getElementsByTagName(elm, tagName, foundElms) {
- var _a2;
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- if (tagName === "*" || ((_a2 = childElm.nodeName) != null ? _a2 : "").toLowerCase() === tagName) {
- foundElms.push(childElm);
- }
- getElementsByTagName(childElm, tagName, foundElms);
- }
- }
- function resetElement(elm) {
- resetEventListeners(elm);
- delete elm.__attributeMap;
- delete elm.__shadowRoot;
- delete elm.__style;
- }
- function insertBefore(parentNode, newNode, referenceNode) {
- if (newNode !== referenceNode) {
- newNode.remove();
- newNode.parentNode = parentNode;
- newNode.ownerDocument = parentNode.ownerDocument;
- if (referenceNode != null) {
- const index = parentNode.childNodes.indexOf(referenceNode);
- if (index > -1) {
- parentNode.childNodes.splice(index, 0, newNode);
- } else {
- throw new Error(`referenceNode not found in parentNode.childNodes`);
- }
- } else {
- parentNode.childNodes.push(newNode);
- }
- connectNode(parentNode.ownerDocument, newNode);
- }
- return newNode;
- }
- var MockHTMLElement = class extends MockElement {
- constructor(ownerDocument, nodeName) {
- super(ownerDocument, typeof nodeName === "string" ? nodeName.toUpperCase() : null);
- this.__namespaceURI = "http://www.w3.org/1999/xhtml";
- }
- get tagName() {
- var _a2;
- return (_a2 = this.nodeName) != null ? _a2 : "";
- }
- set tagName(value) {
- this.nodeName = value;
- }
- /**
- * A node’s parent of type Element is known as its parent element.
- * If the node has a parent of a different type, its parent element
- * is null.
- * @returns MockElement
- */
- get parentElement() {
- if (this.nodeName === "HTML") {
- return null;
- }
- return super.parentElement;
- }
- get attributes() {
- if (this.__attributeMap == null) {
- const attrMap = createAttributeProxy(true);
- this.__attributeMap = attrMap;
- return attrMap;
- }
- return this.__attributeMap;
- }
- set attributes(attrs) {
- this.__attributeMap = attrs;
- }
- };
- var MockTextNode = class _MockTextNode extends MockNode2 {
- constructor(ownerDocument, text) {
- super(ownerDocument, 3 /* TEXT_NODE */, "#text" /* TEXT_NODE */, text);
- }
- cloneNode(_deep) {
- return new _MockTextNode(null, this.nodeValue);
- }
- get textContent() {
- return this.nodeValue;
- }
- set textContent(text) {
- this.nodeValue = text;
- }
- get data() {
- return this.nodeValue;
- }
- set data(text) {
- this.nodeValue = text;
- }
- get wholeText() {
- if (this.parentNode != null) {
- const text = [];
- for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
- const childNode = this.parentNode.childNodes[i];
- if (childNode.nodeType === 3 /* TEXT_NODE */) {
- text.push(childNode.nodeValue);
- }
- }
- return text.join("");
- }
- return this.nodeValue;
- }
- };
- function getTextContent(childNodes, text) {
- for (let i = 0, ii = childNodes.length; i < ii; i++) {
- const childNode = childNodes[i];
- if (childNode.nodeType === 3 /* TEXT_NODE */) {
- text.push(childNode.nodeValue);
- } else if (childNode.nodeType === 1 /* ELEMENT_NODE */) {
- getTextContent(childNode.childNodes, text);
- }
- }
- }
- function setTextContent(elm, text) {
- for (let i = elm.childNodes.length - 1; i >= 0; i--) {
- elm.removeChild(elm.childNodes[i]);
- }
- const textNode = new MockTextNode(elm.ownerDocument, text);
- elm.appendChild(textNode);
- }
- // src/mock-doc/comment-node.ts
- var MockComment = class _MockComment extends MockNode2 {
- constructor(ownerDocument, data) {
- super(ownerDocument, 8 /* COMMENT_NODE */, "#comment" /* COMMENT_NODE */, data);
- }
- cloneNode(_deep) {
- return new _MockComment(null, this.nodeValue);
- }
- get textContent() {
- return this.nodeValue;
- }
- set textContent(text) {
- this.nodeValue = text;
- }
- };
- // src/mock-doc/document-fragment.ts
- var MockDocumentFragment = class _MockDocumentFragment extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, null);
- this.nodeName = "#document-fragment" /* DOCUMENT_FRAGMENT_NODE */;
- this.nodeType = 11 /* DOCUMENT_FRAGMENT_NODE */;
- }
- getElementById(id) {
- return getElementById(this, id);
- }
- cloneNode(deep) {
- const cloned = new _MockDocumentFragment(null);
- if (deep) {
- for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
- const childNode = this.childNodes[i];
- if (childNode.nodeType === 1 /* ELEMENT_NODE */ || childNode.nodeType === 3 /* TEXT_NODE */ || childNode.nodeType === 8 /* COMMENT_NODE */) {
- const clonedChildNode = this.childNodes[i].cloneNode(true);
- cloned.appendChild(clonedChildNode);
- }
- }
- }
- return cloned;
- }
- };
- // src/mock-doc/document-type-node.ts
- var MockDocumentTypeNode = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "!DOCTYPE");
- this.nodeType = 10 /* DOCUMENT_TYPE_NODE */;
- this.setAttribute("html", "");
- }
- };
- // src/mock-doc/css-style-sheet.ts
- var MockCSSRule = class {
- constructor(parentStyleSheet) {
- this.parentStyleSheet = parentStyleSheet;
- this.cssText = "";
- this.type = 0;
- }
- };
- var MockCSSStyleSheet = class {
- constructor(ownerNode) {
- this.type = "text/css";
- this.parentStyleSheet = null;
- this.cssRules = [];
- this.ownerNode = ownerNode;
- }
- get rules() {
- return this.cssRules;
- }
- set rules(rules) {
- this.cssRules = rules;
- }
- deleteRule(index) {
- if (index >= 0 && index < this.cssRules.length) {
- this.cssRules.splice(index, 1);
- updateStyleTextNode(this.ownerNode);
- }
- }
- insertRule(rule, index = 0) {
- if (typeof index !== "number") {
- index = 0;
- }
- if (index < 0) {
- index = 0;
- }
- if (index > this.cssRules.length) {
- index = this.cssRules.length;
- }
- const cssRule = new MockCSSRule(this);
- cssRule.cssText = rule;
- this.cssRules.splice(index, 0, cssRule);
- updateStyleTextNode(this.ownerNode);
- return index;
- }
- };
- function getStyleElementText(styleElm) {
- const output = [];
- for (let i = 0; i < styleElm.childNodes.length; i++) {
- output.push(styleElm.childNodes[i].nodeValue);
- }
- return output.join("");
- }
- function setStyleElementText(styleElm, text) {
- const sheet = styleElm.sheet;
- sheet.cssRules.length = 0;
- sheet.insertRule(text);
- updateStyleTextNode(styleElm);
- }
- function updateStyleTextNode(styleElm) {
- const childNodeLen = styleElm.childNodes.length;
- if (childNodeLen > 1) {
- for (let i = childNodeLen - 1; i >= 1; i--) {
- styleElm.removeChild(styleElm.childNodes[i]);
- }
- } else if (childNodeLen < 1) {
- styleElm.appendChild(styleElm.ownerDocument.createTextNode(""));
- }
- const textNode = styleElm.childNodes[0];
- textNode.nodeValue = styleElm.sheet.cssRules.map((r) => r.cssText).join("\n");
- }
- // src/mock-doc/element.ts
- function createElement(ownerDocument, tagName) {
- if (typeof tagName !== "string" || tagName === "" || !/^[a-z0-9-_:]+$/i.test(tagName)) {
- throw new Error(`The tag name provided (${tagName}) is not a valid name.`);
- }
- tagName = tagName.toLowerCase();
- switch (tagName) {
- case "a":
- return new MockAnchorElement(ownerDocument);
- case "base":
- return new MockBaseElement(ownerDocument);
- case "button":
- return new MockButtonElement(ownerDocument);
- case "canvas":
- return new MockCanvasElement(ownerDocument);
- case "form":
- return new MockFormElement(ownerDocument);
- case "img":
- return new MockImageElement(ownerDocument);
- case "input":
- return new MockInputElement(ownerDocument);
- case "link":
- return new MockLinkElement(ownerDocument);
- case "meta":
- return new MockMetaElement(ownerDocument);
- case "script":
- return new MockScriptElement(ownerDocument);
- case "style":
- return new MockStyleElement(ownerDocument);
- case "template":
- return new MockTemplateElement(ownerDocument);
- case "title":
- return new MockTitleElement(ownerDocument);
- case "ul":
- return new MockUListElement(ownerDocument);
- }
- if (ownerDocument != null && tagName.includes("-")) {
- const win = ownerDocument.defaultView;
- if (win != null && win.customElements != null) {
- return createCustomElement(win.customElements, ownerDocument, tagName);
- }
- }
- return new MockHTMLElement(ownerDocument, tagName);
- }
- function createElementNS(ownerDocument, namespaceURI, tagName) {
- if (namespaceURI === "http://www.w3.org/1999/xhtml") {
- return createElement(ownerDocument, tagName);
- } else if (namespaceURI === "http://www.w3.org/2000/svg") {
- switch (tagName.toLowerCase()) {
- case "text":
- case "tspan":
- case "tref":
- case "altglyph":
- case "textpath":
- return new MockSVGTextContentElement(ownerDocument, tagName);
- case "circle":
- case "ellipse":
- case "image":
- case "line":
- case "path":
- case "polygon":
- case "polyline":
- case "rect":
- case "use":
- return new MockSVGGraphicsElement(ownerDocument, tagName);
- case "svg":
- return new MockSVGSVGElement(ownerDocument, tagName);
- default:
- return new MockSVGElement(ownerDocument, tagName);
- }
- } else {
- return new MockElement(ownerDocument, tagName, namespaceURI);
- }
- }
- var MockAnchorElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "a");
- }
- get href() {
- return fullUrl(this, "href");
- }
- set href(value) {
- this.setAttribute("href", value);
- }
- get pathname() {
- return new URL(this.href).pathname;
- }
- };
- var MockButtonElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "button");
- }
- };
- patchPropAttributes(
- MockButtonElement.prototype,
- {
- type: String
- },
- {
- type: "submit"
- }
- );
- var MockImageElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "img");
- }
- get draggable() {
- return this.getAttributeNS(null, "draggable") !== "false";
- }
- set draggable(value) {
- this.setAttributeNS(null, "draggable", value);
- }
- get src() {
- return fullUrl(this, "src");
- }
- set src(value) {
- this.setAttribute("src", value);
- }
- };
- patchPropAttributes(MockImageElement.prototype, {
- height: Number,
- width: Number
- });
- var MockInputElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "input");
- }
- get list() {
- const listId = this.getAttribute("list");
- if (listId) {
- return this.ownerDocument.getElementById(listId);
- }
- return null;
- }
- };
- patchPropAttributes(
- MockInputElement.prototype,
- {
- accept: String,
- autocomplete: String,
- autofocus: Boolean,
- capture: String,
- checked: Boolean,
- disabled: Boolean,
- form: String,
- formaction: String,
- formenctype: String,
- formmethod: String,
- formnovalidate: String,
- formtarget: String,
- height: Number,
- inputmode: String,
- max: String,
- maxLength: Number,
- min: String,
- minLength: Number,
- multiple: Boolean,
- name: String,
- pattern: String,
- placeholder: String,
- required: Boolean,
- readOnly: Boolean,
- size: Number,
- spellCheck: Boolean,
- src: String,
- step: String,
- type: String,
- value: String,
- width: Number
- },
- {
- type: "text"
- }
- );
- var MockFormElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "form");
- }
- };
- patchPropAttributes(MockFormElement.prototype, {
- name: String
- });
- var MockLinkElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "link");
- }
- get href() {
- return fullUrl(this, "href");
- }
- set href(value) {
- this.setAttribute("href", value);
- }
- };
- patchPropAttributes(MockLinkElement.prototype, {
- crossorigin: String,
- media: String,
- rel: String,
- type: String
- });
- var MockMetaElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "meta");
- }
- };
- patchPropAttributes(MockMetaElement.prototype, {
- charset: String,
- content: String,
- name: String
- });
- var MockScriptElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "script");
- }
- get src() {
- return fullUrl(this, "src");
- }
- set src(value) {
- this.setAttribute("src", value);
- }
- };
- patchPropAttributes(MockScriptElement.prototype, {
- type: String
- });
- var MockDOMMatrix = class _MockDOMMatrix {
- constructor() {
- this.a = 1;
- this.b = 0;
- this.c = 0;
- this.d = 1;
- this.e = 0;
- this.f = 0;
- this.m11 = 1;
- this.m12 = 0;
- this.m13 = 0;
- this.m14 = 0;
- this.m21 = 0;
- this.m22 = 1;
- this.m23 = 0;
- this.m24 = 0;
- this.m31 = 0;
- this.m32 = 0;
- this.m33 = 1;
- this.m34 = 0;
- this.m41 = 0;
- this.m42 = 0;
- this.m43 = 0;
- this.m44 = 1;
- this.is2D = true;
- this.isIdentity = true;
- }
- static fromMatrix() {
- return new _MockDOMMatrix();
- }
- inverse() {
- return new _MockDOMMatrix();
- }
- flipX() {
- return new _MockDOMMatrix();
- }
- flipY() {
- return new _MockDOMMatrix();
- }
- multiply() {
- return new _MockDOMMatrix();
- }
- rotate() {
- return new _MockDOMMatrix();
- }
- rotateAxisAngle() {
- return new _MockDOMMatrix();
- }
- rotateFromVector() {
- return new _MockDOMMatrix();
- }
- scale() {
- return new _MockDOMMatrix();
- }
- scaleNonUniform() {
- return new _MockDOMMatrix();
- }
- skewX() {
- return new _MockDOMMatrix();
- }
- skewY() {
- return new _MockDOMMatrix();
- }
- toJSON() {
- }
- toString() {
- }
- transformPoint() {
- return new MockDOMPoint();
- }
- translate() {
- return new _MockDOMMatrix();
- }
- };
- var MockDOMPoint = class {
- constructor() {
- this.w = 1;
- this.x = 0;
- this.y = 0;
- this.z = 0;
- }
- toJSON() {
- }
- matrixTransform() {
- return new MockDOMMatrix();
- }
- };
- var MockSVGRect = class {
- constructor() {
- this.height = 10;
- this.width = 10;
- this.x = 0;
- this.y = 0;
- }
- };
- var MockStyleElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "style");
- this.sheet = new MockCSSStyleSheet(this);
- }
- get innerHTML() {
- return getStyleElementText(this);
- }
- set innerHTML(value) {
- setStyleElementText(this, value);
- }
- get innerText() {
- return getStyleElementText(this);
- }
- set innerText(value) {
- setStyleElementText(this, value);
- }
- get textContent() {
- return getStyleElementText(this);
- }
- set textContent(value) {
- setStyleElementText(this, value);
- }
- };
- var MockSVGElement = class extends MockElement {
- constructor() {
- super(...arguments);
- this.__namespaceURI = "http://www.w3.org/2000/svg";
- }
- // SVGElement properties and methods
- get ownerSVGElement() {
- return null;
- }
- get viewportElement() {
- return null;
- }
- onunload() {
- }
- // SVGGeometryElement properties and methods
- get pathLength() {
- return 0;
- }
- isPointInFill(_pt) {
- return false;
- }
- isPointInStroke(_pt) {
- return false;
- }
- getTotalLength() {
- return 0;
- }
- };
- var MockSVGGraphicsElement = class extends MockSVGElement {
- getBBox(_options) {
- return new MockSVGRect();
- }
- getCTM() {
- return new MockDOMMatrix();
- }
- getScreenCTM() {
- return new MockDOMMatrix();
- }
- };
- var MockSVGSVGElement = class extends MockSVGGraphicsElement {
- createSVGPoint() {
- return new MockDOMPoint();
- }
- };
- var MockSVGTextContentElement = class extends MockSVGGraphicsElement {
- getComputedTextLength() {
- return 0;
- }
- };
- var MockBaseElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "base");
- }
- get href() {
- return fullUrl(this, "href");
- }
- set href(value) {
- this.setAttribute("href", value);
- }
- };
- var MockTemplateElement = class _MockTemplateElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "template");
- this.content = new MockDocumentFragment(ownerDocument);
- }
- get innerHTML() {
- return this.content.innerHTML;
- }
- set innerHTML(html) {
- this.content.innerHTML = html;
- }
- cloneNode(deep) {
- const cloned = new _MockTemplateElement(null);
- cloned.attributes = cloneAttributes(this.attributes);
- const styleCssText = this.getAttribute("style");
- if (styleCssText != null && styleCssText.length > 0) {
- cloned.setAttribute("style", styleCssText);
- }
- cloned.content = this.content.cloneNode(deep);
- if (deep) {
- for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
- const clonedChildNode = this.childNodes[i].cloneNode(true);
- cloned.appendChild(clonedChildNode);
- }
- }
- return cloned;
- }
- };
- var MockTitleElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "title");
- }
- get text() {
- return this.textContent;
- }
- set text(value) {
- this.textContent = value;
- }
- };
- var MockUListElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "ul");
- }
- };
- var CanvasRenderingContext = class {
- constructor(context, contextAttributes) {
- this.context = context;
- this.contextAttributes = contextAttributes;
- }
- fillRect() {
- return;
- }
- clearRect() {
- }
- getImageData(_, __, w, h) {
- return {
- data: new Array(w * h * 4)
- };
- }
- toDataURL() {
- return "data:,";
- }
- putImageData() {
- }
- createImageData() {
- return {};
- }
- setTransform() {
- }
- drawImage() {
- }
- save() {
- }
- fillText() {
- }
- restore() {
- }
- beginPath() {
- }
- moveTo() {
- }
- lineTo() {
- }
- closePath() {
- }
- stroke() {
- }
- translate() {
- }
- scale() {
- }
- rotate() {
- }
- arc() {
- }
- fill() {
- }
- measureText() {
- return { width: 0 };
- }
- transform() {
- }
- rect() {
- }
- clip() {
- }
- };
- var MockCanvasElement = class extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, "canvas");
- }
- getContext(context, contextAttributes) {
- return new CanvasRenderingContext(context, contextAttributes);
- }
- };
- function fullUrl(elm, attrName) {
- const val = elm.getAttribute(attrName) || "";
- if (elm.ownerDocument != null) {
- const win = elm.ownerDocument.defaultView;
- if (win != null) {
- const loc = win.location;
- if (loc != null) {
- try {
- const url = new URL(val, loc.href);
- return url.href;
- } catch (e) {
- }
- }
- }
- }
- return val.replace(/\'|\"/g, "").trim();
- }
- function patchPropAttributes(prototype, attrs, defaults = {}) {
- Object.keys(attrs).forEach((propName) => {
- const attr = attrs[propName];
- const defaultValue = defaults[propName];
- if (attr === Boolean) {
- Object.defineProperty(prototype, propName, {
- get() {
- return this.hasAttribute(propName);
- },
- set(value) {
- if (value) {
- this.setAttribute(propName, "");
- } else {
- this.removeAttribute(propName);
- }
- }
- });
- } else if (attr === Number) {
- Object.defineProperty(prototype, propName, {
- get() {
- const value = this.getAttribute(propName);
- return value ? parseInt(value, 10) : defaultValue === void 0 ? 0 : defaultValue;
- },
- set(value) {
- this.setAttribute(propName, value);
- }
- });
- } else {
- Object.defineProperty(prototype, propName, {
- get() {
- return this.hasAttribute(propName) ? this.getAttribute(propName) : defaultValue || "";
- },
- set(value) {
- this.setAttribute(propName, value);
- }
- });
- }
- });
- }
- MockElement.prototype.cloneNode = function(deep) {
- const cloned = createElement(this.ownerDocument, this.nodeName);
- cloned.attributes = cloneAttributes(this.attributes);
- const styleCssText = this.getAttribute("style");
- if (styleCssText != null && styleCssText.length > 0) {
- cloned.setAttribute("style", styleCssText);
- }
- if (deep) {
- for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
- const clonedChildNode = this.childNodes[i].cloneNode(true);
- cloned.appendChild(clonedChildNode);
- }
- }
- return cloned;
- };
- // src/mock-doc/parse-html.ts
- var sharedDocument;
- function parseHtmlToDocument(html, ownerDocument = null) {
- if (ownerDocument == null) {
- if (sharedDocument == null) {
- sharedDocument = new MockDocument();
- }
- ownerDocument = sharedDocument;
- }
- return parseDocumentUtil(ownerDocument, html);
- }
- // src/mock-doc/console.ts
- var consoleNoop = () => {
- };
- function createConsole() {
- return {
- debug: consoleNoop,
- error: consoleNoop,
- info: consoleNoop,
- log: consoleNoop,
- warn: consoleNoop,
- dir: consoleNoop,
- dirxml: consoleNoop,
- table: consoleNoop,
- trace: consoleNoop,
- group: consoleNoop,
- groupCollapsed: consoleNoop,
- groupEnd: consoleNoop,
- clear: consoleNoop,
- count: consoleNoop,
- countReset: consoleNoop,
- assert: consoleNoop,
- profile: consoleNoop,
- profileEnd: consoleNoop,
- time: consoleNoop,
- timeLog: consoleNoop,
- timeEnd: consoleNoop,
- timeStamp: consoleNoop,
- context: consoleNoop,
- memory: consoleNoop
- };
- }
- // src/mock-doc/headers.ts
- var MockHeaders = class {
- constructor(init) {
- this._values = [];
- if (typeof init === "object") {
- if (typeof init[Symbol.iterator] === "function") {
- const kvs = [];
- for (const kv of init) {
- if (typeof kv[Symbol.iterator] === "function") {
- kvs.push([...kv]);
- }
- }
- for (const kv of kvs) {
- this.append(kv[0], kv[1]);
- }
- } else {
- for (const key in init) {
- this.append(key, init[key]);
- }
- }
- }
- }
- append(key, value) {
- this._values.push([key, value + ""]);
- }
- delete(key) {
- key = key.toLowerCase();
- for (let i = this._values.length - 1; i >= 0; i--) {
- if (this._values[i][0].toLowerCase() === key) {
- this._values.splice(i, 1);
- }
- }
- }
- entries() {
- const entries = [];
- for (const kv of this.keys()) {
- entries.push([kv, this.get(kv)]);
- }
- let index = -1;
- return {
- next() {
- index++;
- return {
- value: entries[index],
- done: !entries[index]
- };
- },
- [Symbol.iterator]() {
- return this;
- }
- };
- }
- forEach(cb) {
- for (const kv of this.entries()) {
- cb(kv[1], kv[0]);
- }
- }
- get(key) {
- const rtn = [];
- key = key.toLowerCase();
- for (const kv of this._values) {
- if (kv[0].toLowerCase() === key) {
- rtn.push(kv[1]);
- }
- }
- return rtn.length > 0 ? rtn.join(", ") : null;
- }
- has(key) {
- key = key.toLowerCase();
- for (const kv of this._values) {
- if (kv[0].toLowerCase() === key) {
- return true;
- }
- }
- return false;
- }
- keys() {
- const keys = [];
- for (const kv of this._values) {
- const key = kv[0].toLowerCase();
- if (!keys.includes(key)) {
- keys.push(key);
- }
- }
- let index = -1;
- return {
- next() {
- index++;
- return {
- value: keys[index],
- done: !keys[index]
- };
- },
- [Symbol.iterator]() {
- return this;
- }
- };
- }
- set(key, value) {
- for (const kv of this._values) {
- if (kv[0].toLowerCase() === key.toLowerCase()) {
- kv[1] = value + "";
- return;
- }
- }
- this.append(key, value);
- }
- values() {
- const values = this._values;
- let index = -1;
- return {
- next() {
- index++;
- const done = !values[index];
- return {
- value: done ? void 0 : values[index][1],
- done
- };
- },
- [Symbol.iterator]() {
- return this;
- }
- };
- }
- [Symbol.iterator]() {
- return this.entries();
- }
- };
- // src/mock-doc/parser.ts
- var MockDOMParser = class {
- parseFromString(htmlToParse, mimeType) {
- if (mimeType !== "text/html") {
- console.error("XML parsing not implemented yet, continuing as html");
- }
- return parseHtmlToDocument(htmlToParse);
- }
- };
- // src/mock-doc/request-response.ts
- var MockRequest = class _MockRequest {
- constructor(input, init = {}) {
- this._method = "GET";
- this._url = "/";
- this.bodyUsed = false;
- this.cache = "default";
- this.credentials = "same-origin";
- this.integrity = "";
- this.keepalive = false;
- this.mode = "cors";
- this.redirect = "follow";
- this.referrer = "about:client";
- this.referrerPolicy = "";
- if (typeof input === "string") {
- this.url = input;
- } else if (input) {
- Object.assign(this, input);
- this.headers = new MockHeaders(input.headers);
- }
- Object.assign(this, init);
- if (init.headers) {
- this.headers = new MockHeaders(init.headers);
- }
- if (!this.headers) {
- this.headers = new MockHeaders();
- }
- }
- get url() {
- if (typeof this._url === "string") {
- return new URL(this._url, location.href).href;
- }
- return new URL("/", location.href).href;
- }
- set url(value) {
- this._url = value;
- }
- get method() {
- if (typeof this._method === "string") {
- return this._method.toUpperCase();
- }
- return "GET";
- }
- set method(value) {
- this._method = value;
- }
- clone() {
- const clone = { ...this };
- clone.headers = new MockHeaders(this.headers);
- return new _MockRequest(clone);
- }
- };
- var MockResponse = class _MockResponse {
- constructor(body, init = {}) {
- this.ok = true;
- this.status = 200;
- this.statusText = "";
- this.type = "default";
- this.url = "";
- this._body = body;
- if (init) {
- Object.assign(this, init);
- }
- this.headers = new MockHeaders(init.headers);
- }
- async json() {
- return JSON.parse(this._body);
- }
- async text() {
- return this._body;
- }
- clone() {
- const initClone = { ...this };
- initClone.headers = new MockHeaders(this.headers);
- return new _MockResponse(this._body, initClone);
- }
- };
- // src/mock-doc/global.ts
- function patchWindow(winToBePatched) {
- const mockWin = new MockWindow(false);
- WINDOW_FUNCTIONS.forEach((fnName) => {
- if (typeof winToBePatched[fnName] !== "function") {
- winToBePatched[fnName] = mockWin[fnName].bind(mockWin);
- }
- });
- WINDOW_PROPS.forEach((propName) => {
- if (winToBePatched === void 0) {
- Object.defineProperty(winToBePatched, propName, {
- get() {
- return mockWin[propName];
- },
- set(val) {
- mockWin[propName] = val;
- },
- configurable: true,
- enumerable: true
- });
- }
- });
- }
- function addGlobalsToWindowPrototype(mockWinPrototype) {
- GLOBAL_CONSTRUCTORS.forEach(([cstrName, Cstr]) => {
- Object.defineProperty(mockWinPrototype, cstrName, {
- get() {
- return this["__" + cstrName] || Cstr;
- },
- set(cstr) {
- this["__" + cstrName] = cstr;
- },
- configurable: true,
- enumerable: true
- });
- });
- }
- var WINDOW_FUNCTIONS = [
- "addEventListener",
- "alert",
- "blur",
- "cancelAnimationFrame",
- "cancelIdleCallback",
- "clearInterval",
- "clearTimeout",
- "close",
- "confirm",
- "dispatchEvent",
- "focus",
- "getComputedStyle",
- "matchMedia",
- "open",
- "prompt",
- "removeEventListener",
- "requestAnimationFrame",
- "requestIdleCallback",
- "URL"
- ];
- var WINDOW_PROPS = [
- "customElements",
- "devicePixelRatio",
- "document",
- "history",
- "innerHeight",
- "innerWidth",
- "localStorage",
- "location",
- "navigator",
- "pageXOffset",
- "pageYOffset",
- "performance",
- "screenLeft",
- "screenTop",
- "screenX",
- "screenY",
- "scrollX",
- "scrollY",
- "sessionStorage",
- "CSS",
- "CustomEvent",
- "Event",
- "Element",
- "HTMLElement",
- "Node",
- "NodeList",
- "FocusEvent",
- "KeyboardEvent",
- "MouseEvent"
- ];
- var GLOBAL_CONSTRUCTORS = [
- ["CustomEvent", MockCustomEvent],
- ["DocumentFragment", MockDocumentFragment],
- ["DOMParser", MockDOMParser],
- ["Event", MockEvent],
- ["FocusEvent", MockFocusEvent],
- ["Headers", MockHeaders],
- ["KeyboardEvent", MockKeyboardEvent],
- ["MouseEvent", MockMouseEvent],
- ["Request", MockRequest],
- ["Response", MockResponse],
- ["ShadowRoot", MockDocumentFragment],
- ["HTMLAnchorElement", MockAnchorElement],
- ["HTMLBaseElement", MockBaseElement],
- ["HTMLButtonElement", MockButtonElement],
- ["HTMLCanvasElement", MockCanvasElement],
- ["HTMLFormElement", MockFormElement],
- ["HTMLImageElement", MockImageElement],
- ["HTMLInputElement", MockInputElement],
- ["HTMLLinkElement", MockLinkElement],
- ["HTMLMetaElement", MockMetaElement],
- ["HTMLScriptElement", MockScriptElement],
- ["HTMLStyleElement", MockStyleElement],
- ["HTMLTemplateElement", MockTemplateElement],
- ["HTMLTitleElement", MockTitleElement],
- ["HTMLUListElement", MockUListElement]
- ];
- // src/mock-doc/history.ts
- var MockHistory = class {
- constructor() {
- this.items = [];
- }
- get length() {
- return this.items.length;
- }
- back() {
- this.go(-1);
- }
- forward() {
- this.go(1);
- }
- go(_value) {
- }
- pushState(_state, _title, _url) {
- }
- replaceState(_state, _title, _url) {
- }
- };
- // src/mock-doc/intersection-observer.ts
- var MockIntersectionObserver = class {
- constructor() {
- }
- disconnect() {
- }
- observe() {
- }
- takeRecords() {
- return [];
- }
- unobserve() {
- }
- };
- // src/mock-doc/location.ts
- var MockLocation = class {
- constructor() {
- this.ancestorOrigins = null;
- this.protocol = "";
- this.host = "";
- this.hostname = "";
- this.port = "";
- this.pathname = "";
- this.search = "";
- this.hash = "";
- this.username = "";
- this.password = "";
- this.origin = "";
- this._href = "";
- }
- get href() {
- return this._href;
- }
- set href(value) {
- const url = new URL(value, "http://mockdoc.stenciljs.com");
- this._href = url.href;
- this.protocol = url.protocol;
- this.host = url.host;
- this.hostname = url.hostname;
- this.port = url.port;
- this.pathname = url.pathname;
- this.search = url.search;
- this.hash = url.hash;
- this.username = url.username;
- this.password = url.password;
- this.origin = url.origin;
- }
- assign(_url) {
- }
- reload(_forcedReload) {
- }
- replace(_url) {
- }
- toString() {
- return this.href;
- }
- };
- // src/mock-doc/navigator.ts
- var MockNavigator = class {
- constructor() {
- this.appCodeName = "MockNavigator";
- this.appName = "MockNavigator";
- this.appVersion = "MockNavigator";
- this.platform = "MockNavigator";
- this.userAgent = "MockNavigator";
- }
- };
- // src/mock-doc/performance.ts
- var MockPerformance = class {
- constructor() {
- this.timeOrigin = Date.now();
- this.eventCounts = /* @__PURE__ */ new Map();
- }
- addEventListener() {
- }
- clearMarks() {
- }
- clearMeasures() {
- }
- clearResourceTimings() {
- }
- dispatchEvent() {
- return true;
- }
- getEntries() {
- return [];
- }
- getEntriesByName() {
- return [];
- }
- getEntriesByType() {
- return [];
- }
- // Stencil's implementation of `mark` is non-compliant with the `Performance` interface. Because Stencil will
- // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
- // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
- // associated errors returned by the type checker)
- // @ts-ignore
- mark() {
- }
- // Stencil's implementation of `measure` is non-compliant with the `Performance` interface. Because Stencil will
- // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
- // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
- // associated errors returned by the type checker)
- // @ts-ignore
- measure() {
- }
- get navigation() {
- return {};
- }
- now() {
- return Date.now() - this.timeOrigin;
- }
- get onresourcetimingbufferfull() {
- return null;
- }
- removeEventListener() {
- }
- setResourceTimingBufferSize() {
- }
- get timing() {
- return {};
- }
- toJSON() {
- }
- };
- function resetPerformance(perf) {
- if (perf != null) {
- try {
- perf.timeOrigin = Date.now();
- } catch (e) {
- }
- }
- }
- // src/mock-doc/storage.ts
- var MockStorage = class {
- constructor() {
- this.items = /* @__PURE__ */ new Map();
- }
- key(_value) {
- }
- getItem(key) {
- key = String(key);
- if (this.items.has(key)) {
- return this.items.get(key);
- }
- return null;
- }
- setItem(key, value) {
- if (value == null) {
- value = "null";
- }
- this.items.set(String(key), String(value));
- }
- removeItem(key) {
- this.items.delete(String(key));
- }
- clear() {
- this.items.clear();
- }
- };
- // src/mock-doc/window.ts
- var nativeClearInterval = clearInterval;
- var nativeClearTimeout = clearTimeout;
- var nativeSetInterval = setInterval;
- var nativeSetTimeout = setTimeout;
- var nativeURL = URL;
- var nativeWindow = globalThis.window;
- var MockWindow = class {
- constructor(html = null) {
- if (html !== false) {
- this.document = new MockDocument(html, this);
- } else {
- this.document = null;
- }
- this.performance = new MockPerformance();
- this.customElements = new MockCustomElementRegistry(this);
- this.console = createConsole();
- resetWindowDefaults(this);
- resetWindowDimensions(this);
- }
- addEventListener(type, handler) {
- addEventListener(this, type, handler);
- }
- alert(msg) {
- if (this.console) {
- this.console.debug(msg);
- } else {
- console.debug(msg);
- }
- }
- blur() {
- }
- cancelAnimationFrame(id) {
- this.__clearTimeout.call(nativeWindow || this, id);
- }
- cancelIdleCallback(id) {
- this.__clearTimeout.call(nativeWindow || this, id);
- }
- get CharacterData() {
- if (this.__charDataCstr == null) {
- const ownerDocument = this.document;
- this.__charDataCstr = class extends MockNode2 {
- constructor() {
- super(ownerDocument, 0, "test", "");
- throw new Error("Illegal constructor: cannot construct CharacterData");
- }
- };
- }
- return this.__charDataCstr;
- }
- set CharacterData(charDataCstr) {
- this.__charDataCstr = charDataCstr;
- }
- clearInterval(id) {
- this.__clearInterval.call(nativeWindow || this, id);
- }
- clearTimeout(id) {
- this.__clearTimeout.call(nativeWindow || this, id);
- }
- close() {
- resetWindow(this);
- }
- confirm() {
- return false;
- }
- get CSS() {
- return {
- supports: () => true
- };
- }
- get Document() {
- if (this.__docCstr == null) {
- const win = this;
- this.__docCstr = class extends MockDocument {
- constructor() {
- super(false, win);
- throw new Error("Illegal constructor: cannot construct Document");
- }
- };
- }
- return this.__docCstr;
- }
- set Document(docCstr) {
- this.__docCstr = docCstr;
- }
- get DocumentFragment() {
- if (this.__docFragCstr == null) {
- const ownerDocument = this.document;
- this.__docFragCstr = class extends MockDocumentFragment {
- constructor() {
- super(ownerDocument);
- throw new Error("Illegal constructor: cannot construct DocumentFragment");
- }
- };
- }
- return this.__docFragCstr;
- }
- set DocumentFragment(docFragCstr) {
- this.__docFragCstr = docFragCstr;
- }
- get DocumentType() {
- if (this.__docTypeCstr == null) {
- const ownerDocument = this.document;
- this.__docTypeCstr = class extends MockNode2 {
- constructor() {
- super(ownerDocument, 0, "test", "");
- throw new Error("Illegal constructor: cannot construct DocumentType");
- }
- };
- }
- return this.__docTypeCstr;
- }
- set DocumentType(docTypeCstr) {
- this.__docTypeCstr = docTypeCstr;
- }
- get DOMTokenList() {
- if (this.__domTokenListCstr == null) {
- this.__domTokenListCstr = class MockDOMTokenList {
- };
- }
- return this.__domTokenListCstr;
- }
- set DOMTokenList(domTokenListCstr) {
- this.__domTokenListCstr = domTokenListCstr;
- }
- dispatchEvent(ev) {
- return dispatchEvent(this, ev);
- }
- get Element() {
- if (this.__elementCstr == null) {
- const ownerDocument = this.document;
- this.__elementCstr = class extends MockElement {
- constructor() {
- super(ownerDocument, "");
- throw new Error("Illegal constructor: cannot construct Element");
- }
- };
- }
- return this.__elementCstr;
- }
- fetch(input, init) {
- if (typeof fetch === "function") {
- return fetch(input, init);
- }
- throw new Error(`fetch() not implemented`);
- }
- focus() {
- }
- getComputedStyle(_) {
- return {
- cssText: "",
- length: 0,
- parentRule: null,
- getPropertyPriority() {
- return null;
- },
- getPropertyValue() {
- return "";
- },
- item() {
- return null;
- },
- removeProperty() {
- return null;
- },
- setProperty() {
- return null;
- }
- };
- }
- get globalThis() {
- return this;
- }
- get history() {
- if (this.__history == null) {
- this.__history = new MockHistory();
- }
- return this.__history;
- }
- set history(hsty) {
- this.__history = hsty;
- }
- get JSON() {
- return JSON;
- }
- get HTMLElement() {
- if (this.__htmlElementCstr == null) {
- const ownerDocument = this.document;
- this.__htmlElementCstr = class extends MockHTMLElement {
- constructor() {
- super(ownerDocument, "");
- const observedAttributes = this.constructor.observedAttributes;
- if (Array.isArray(observedAttributes) && typeof this.attributeChangedCallback === "function") {
- observedAttributes.forEach((attrName) => {
- const attrValue = this.getAttribute(attrName);
- if (attrValue != null) {
- this.attributeChangedCallback(attrName, null, attrValue);
- }
- });
- }
- }
- };
- }
- return this.__htmlElementCstr;
- }
- set HTMLElement(htmlElementCstr) {
- this.__htmlElementCstr = htmlElementCstr;
- }
- get IntersectionObserver() {
- return MockIntersectionObserver;
- }
- get localStorage() {
- if (this.__localStorage == null) {
- this.__localStorage = new MockStorage();
- }
- return this.__localStorage;
- }
- set localStorage(locStorage) {
- this.__localStorage = locStorage;
- }
- get location() {
- if (this.__location == null) {
- this.__location = new MockLocation();
- }
- return this.__location;
- }
- set location(val) {
- if (typeof val === "string") {
- if (this.__location == null) {
- this.__location = new MockLocation();
- }
- this.__location.href = val;
- } else {
- this.__location = val;
- }
- }
- matchMedia(media) {
- return {
- media,
- matches: false,
- addListener: (_handler) => {
- },
- removeListener: (_handler) => {
- },
- addEventListener: (_type, _handler) => {
- },
- removeEventListener: (_type, _handler) => {
- },
- dispatchEvent: (_ev) => {
- },
- onchange: null
- };
- }
- get Node() {
- if (this.__nodeCstr == null) {
- const ownerDocument = this.document;
- this.__nodeCstr = class extends MockNode2 {
- constructor() {
- super(ownerDocument, 0, "test", "");
- throw new Error("Illegal constructor: cannot construct Node");
- }
- };
- }
- return this.__nodeCstr;
- }
- get NodeList() {
- if (this.__nodeListCstr == null) {
- const ownerDocument = this.document;
- this.__nodeListCstr = class extends MockNodeList {
- constructor() {
- super(ownerDocument, [], 0);
- throw new Error("Illegal constructor: cannot construct NodeList");
- }
- };
- }
- return this.__nodeListCstr;
- }
- get navigator() {
- if (this.__navigator == null) {
- this.__navigator = new MockNavigator();
- }
- return this.__navigator;
- }
- set navigator(nav) {
- this.__navigator = nav;
- }
- get parent() {
- return null;
- }
- prompt() {
- return "";
- }
- open() {
- return null;
- }
- get origin() {
- return this.location.origin;
- }
- removeEventListener(type, handler) {
- removeEventListener(this, type, handler);
- }
- requestAnimationFrame(callback) {
- return this.setTimeout(() => {
- callback(Date.now());
- }, 0);
- }
- requestIdleCallback(callback) {
- return this.setTimeout(() => {
- callback({
- didTimeout: false,
- timeRemaining: () => 0
- });
- }, 0);
- }
- scroll(_x, _y) {
- }
- scrollBy(_x, _y) {
- }
- scrollTo(_x, _y) {
- }
- get self() {
- return this;
- }
- get sessionStorage() {
- if (this.__sessionStorage == null) {
- this.__sessionStorage = new MockStorage();
- }
- return this.__sessionStorage;
- }
- set sessionStorage(locStorage) {
- this.__sessionStorage = locStorage;
- }
- setInterval(callback, ms, ...args) {
- if (this.__timeouts == null) {
- this.__timeouts = /* @__PURE__ */ new Set();
- }
- ms = Math.min(ms, this.__maxTimeout);
- if (this.__allowInterval) {
- const intervalId = this.__setInterval(() => {
- if (this.__timeouts) {
- this.__timeouts.delete(intervalId);
- try {
- callback(...args);
- } catch (e) {
- if (this.console) {
- this.console.error(e);
- } else {
- console.error(e);
- }
- }
- }
- }, ms);
- if (this.__timeouts) {
- this.__timeouts.add(intervalId);
- }
- return intervalId;
- }
- const timeoutId = this.__setTimeout.call(
- nativeWindow || this,
- () => {
- if (this.__timeouts) {
- this.__timeouts.delete(timeoutId);
- try {
- callback(...args);
- } catch (e) {
- if (this.console) {
- this.console.error(e);
- } else {
- console.error(e);
- }
- }
- }
- },
- ms
- );
- if (this.__timeouts) {
- this.__timeouts.add(timeoutId);
- }
- return timeoutId;
- }
- setTimeout(callback, ms, ...args) {
- if (this.__timeouts == null) {
- this.__timeouts = /* @__PURE__ */ new Set();
- }
- ms = Math.min(ms, this.__maxTimeout);
- const timeoutId = this.__setTimeout.call(
- nativeWindow || this,
- () => {
- if (this.__timeouts) {
- this.__timeouts.delete(timeoutId);
- try {
- callback(...args);
- } catch (e) {
- if (this.console) {
- this.console.error(e);
- } else {
- console.error(e);
- }
- }
- }
- },
- ms
- );
- if (this.__timeouts) {
- this.__timeouts.add(timeoutId);
- }
- return timeoutId;
- }
- get top() {
- return this;
- }
- get window() {
- return this;
- }
- onanimationstart() {
- }
- onanimationend() {
- }
- onanimationiteration() {
- }
- onabort() {
- }
- onauxclick() {
- }
- onbeforecopy() {
- }
- onbeforecut() {
- }
- onbeforepaste() {
- }
- onblur() {
- }
- oncancel() {
- }
- oncanplay() {
- }
- oncanplaythrough() {
- }
- onchange() {
- }
- onclick() {
- }
- onclose() {
- }
- oncontextmenu() {
- }
- oncopy() {
- }
- oncuechange() {
- }
- oncut() {
- }
- ondblclick() {
- }
- ondrag() {
- }
- ondragend() {
- }
- ondragenter() {
- }
- ondragleave() {
- }
- ondragover() {
- }
- ondragstart() {
- }
- ondrop() {
- }
- ondurationchange() {
- }
- onemptied() {
- }
- onended() {
- }
- onerror() {
- }
- onfocus() {
- }
- onfocusin() {
- }
- onfocusout() {
- }
- onformdata() {
- }
- onfullscreenchange() {
- }
- onfullscreenerror() {
- }
- ongotpointercapture() {
- }
- oninput() {
- }
- oninvalid() {
- }
- onkeydown() {
- }
- onkeypress() {
- }
- onkeyup() {
- }
- onload() {
- }
- onloadeddata() {
- }
- onloadedmetadata() {
- }
- onloadstart() {
- }
- onlostpointercapture() {
- }
- onmousedown() {
- }
- onmouseenter() {
- }
- onmouseleave() {
- }
- onmousemove() {
- }
- onmouseout() {
- }
- onmouseover() {
- }
- onmouseup() {
- }
- onmousewheel() {
- }
- onpaste() {
- }
- onpause() {
- }
- onplay() {
- }
- onplaying() {
- }
- onpointercancel() {
- }
- onpointerdown() {
- }
- onpointerenter() {
- }
- onpointerleave() {
- }
- onpointermove() {
- }
- onpointerout() {
- }
- onpointerover() {
- }
- onpointerup() {
- }
- onprogress() {
- }
- onratechange() {
- }
- onreset() {
- }
- onresize() {
- }
- onscroll() {
- }
- onsearch() {
- }
- onseeked() {
- }
- onseeking() {
- }
- onselect() {
- }
- onselectstart() {
- }
- onstalled() {
- }
- onsubmit() {
- }
- onsuspend() {
- }
- ontimeupdate() {
- }
- ontoggle() {
- }
- onvolumechange() {
- }
- onwaiting() {
- }
- onwebkitfullscreenchange() {
- }
- onwebkitfullscreenerror() {
- }
- onwheel() {
- }
- };
- addGlobalsToWindowPrototype(MockWindow.prototype);
- function resetWindowDefaults(win) {
- win.__clearInterval = nativeClearInterval;
- win.__clearTimeout = nativeClearTimeout;
- win.__setInterval = nativeSetInterval;
- win.__setTimeout = nativeSetTimeout;
- win.__maxTimeout = 3e4;
- win.__allowInterval = true;
- win.URL = nativeURL;
- }
- function cloneWindow(srcWin, opts = {}) {
- if (srcWin == null) {
- return null;
- }
- const clonedWin = new MockWindow(false);
- if (!opts.customElementProxy) {
- srcWin.customElements = null;
- }
- if (srcWin.document != null) {
- const clonedDoc = new MockDocument(false, clonedWin);
- clonedWin.document = clonedDoc;
- clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
- } else {
- clonedWin.document = new MockDocument(null, clonedWin);
- }
- return clonedWin;
- }
- function constrainTimeouts(win) {
- win.__allowInterval = false;
- win.__maxTimeout = 0;
- }
- function resetWindow(win) {
- if (win != null) {
- if (win.__timeouts) {
- win.__timeouts.forEach((timeoutId) => {
- nativeClearInterval(timeoutId);
- nativeClearTimeout(timeoutId);
- });
- win.__timeouts.clear();
- }
- if (win.customElements && win.customElements.clear) {
- win.customElements.clear();
- }
- resetDocument(win.document);
- resetPerformance(win.performance);
- for (const key in win) {
- if (win.hasOwnProperty(key) && key !== "document" && key !== "performance" && key !== "customElements") {
- delete win[key];
- }
- }
- resetWindowDefaults(win);
- resetWindowDimensions(win);
- resetEventListeners(win);
- if (win.document != null) {
- try {
- win.document.defaultView = win;
- } catch (e) {
- }
- }
- win.fetch = null;
- win.Headers = null;
- win.Request = null;
- win.Response = null;
- win.FetchError = null;
- }
- }
- function resetWindowDimensions(win) {
- try {
- win.devicePixelRatio = 1;
- win.innerHeight = 768;
- win.innerWidth = 1366;
- win.pageXOffset = 0;
- win.pageYOffset = 0;
- win.screenLeft = 0;
- win.screenTop = 0;
- win.screenX = 0;
- win.screenY = 0;
- win.scrollX = 0;
- win.scrollY = 0;
- win.screen = {
- availHeight: win.innerHeight,
- availLeft: 0,
- availTop: 0,
- availWidth: win.innerWidth,
- colorDepth: 24,
- height: win.innerHeight,
- keepAwake: false,
- orientation: {
- angle: 0,
- type: "portrait-primary"
- },
- pixelDepth: 24,
- width: win.innerWidth
- };
- } catch (e) {
- }
- }
- // src/mock-doc/document.ts
- var MockDocument = class _MockDocument extends MockHTMLElement {
- constructor(html = null, win = null) {
- super(null, null);
- this.nodeName = "#document" /* DOCUMENT_NODE */;
- this.nodeType = 9 /* DOCUMENT_NODE */;
- this.defaultView = win;
- this.cookie = "";
- this.referrer = "";
- this.appendChild(this.createDocumentTypeNode());
- if (typeof html === "string") {
- const parsedDoc = parseDocumentUtil(this, html);
- const documentElement = parsedDoc.children.find((elm) => elm.nodeName === "HTML");
- if (documentElement != null) {
- this.appendChild(documentElement);
- setOwnerDocument(documentElement, this);
- }
- } else if (html !== false) {
- const documentElement = new MockHTMLElement(this, "html");
- this.appendChild(documentElement);
- documentElement.appendChild(new MockHTMLElement(this, "head"));
- documentElement.appendChild(new MockHTMLElement(this, "body"));
- }
- }
- get dir() {
- return this.documentElement.dir;
- }
- set dir(value) {
- this.documentElement.dir = value;
- }
- get localName() {
- throw new Error("Unimplemented");
- }
- get location() {
- if (this.defaultView != null) {
- return this.defaultView.location;
- }
- return null;
- }
- set location(val) {
- if (this.defaultView != null) {
- this.defaultView.location = val;
- }
- }
- get baseURI() {
- const baseNode = this.head.childNodes.find((node) => node.nodeName === "BASE");
- if (baseNode) {
- return baseNode.href;
- }
- return this.URL;
- }
- get URL() {
- return this.location.href;
- }
- get styleSheets() {
- return this.querySelectorAll("style");
- }
- get scripts() {
- return this.querySelectorAll("script");
- }
- get forms() {
- return this.querySelectorAll("form");
- }
- get images() {
- return this.querySelectorAll("img");
- }
- get scrollingElement() {
- return this.documentElement;
- }
- get documentElement() {
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
- if (this.childNodes[i].nodeName === "HTML") {
- return this.childNodes[i];
- }
- }
- const documentElement = new MockHTMLElement(this, "html");
- this.appendChild(documentElement);
- return documentElement;
- }
- set documentElement(documentElement) {
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
- if (this.childNodes[i].nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {
- this.childNodes[i].remove();
- }
- }
- if (documentElement != null) {
- this.appendChild(documentElement);
- setOwnerDocument(documentElement, this);
- }
- }
- get head() {
- const documentElement = this.documentElement;
- for (let i = 0; i < documentElement.childNodes.length; i++) {
- if (documentElement.childNodes[i].nodeName === "HEAD") {
- return documentElement.childNodes[i];
- }
- }
- const head = new MockHTMLElement(this, "head");
- documentElement.insertBefore(head, documentElement.firstChild);
- return head;
- }
- set head(head) {
- const documentElement = this.documentElement;
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
- if (documentElement.childNodes[i].nodeName === "HEAD") {
- documentElement.childNodes[i].remove();
- }
- }
- if (head != null) {
- documentElement.insertBefore(head, documentElement.firstChild);
- setOwnerDocument(head, this);
- }
- }
- get body() {
- const documentElement = this.documentElement;
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
- if (documentElement.childNodes[i].nodeName === "BODY") {
- return documentElement.childNodes[i];
- }
- }
- const body = new MockHTMLElement(this, "body");
- documentElement.appendChild(body);
- return body;
- }
- set body(body) {
- const documentElement = this.documentElement;
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
- if (documentElement.childNodes[i].nodeName === "BODY") {
- documentElement.childNodes[i].remove();
- }
- }
- if (body != null) {
- documentElement.appendChild(body);
- setOwnerDocument(body, this);
- }
- }
- appendChild(newNode) {
- newNode.remove();
- newNode.parentNode = this;
- this.childNodes.push(newNode);
- return newNode;
- }
- createComment(data) {
- return new MockComment(this, data);
- }
- createAttribute(attrName) {
- return new MockAttr(attrName.toLowerCase(), "");
- }
- createAttributeNS(namespaceURI, attrName) {
- return new MockAttr(attrName, "", namespaceURI);
- }
- createElement(tagName) {
- if (tagName === "#document" /* DOCUMENT_NODE */) {
- const doc = new _MockDocument(false);
- doc.nodeName = tagName;
- doc.parentNode = null;
- return doc;
- }
- return createElement(this, tagName);
- }
- createElementNS(namespaceURI, tagName) {
- const elmNs = createElementNS(this, namespaceURI, tagName);
- return elmNs;
- }
- createTextNode(text) {
- return new MockTextNode(this, text);
- }
- createDocumentFragment() {
- return new MockDocumentFragment(this);
- }
- createDocumentTypeNode() {
- return new MockDocumentTypeNode(this);
- }
- getElementById(id) {
- return getElementById(this, id);
- }
- getElementsByName(elmName) {
- return getElementsByName(this, elmName.toLowerCase());
- }
- get title() {
- const title = this.head.childNodes.find((elm) => elm.nodeName === "TITLE");
- if (title != null && typeof title.textContent === "string") {
- return title.textContent.trim();
- }
- return "";
- }
- set title(value) {
- const head = this.head;
- let title = head.childNodes.find((elm) => elm.nodeName === "TITLE");
- if (title == null) {
- title = this.createElement("title");
- head.appendChild(title);
- }
- title.textContent = value;
- }
- };
- function resetDocument(doc) {
- if (doc != null) {
- resetEventListeners(doc);
- const documentElement = doc.documentElement;
- if (documentElement != null) {
- resetElement(documentElement);
- for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
- const childNode = documentElement.childNodes[i];
- resetElement(childNode);
- childNode.childNodes.length = 0;
- }
- }
- for (const key in doc) {
- if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
- delete doc[key];
- }
- }
- try {
- doc.nodeName = "#document" /* DOCUMENT_NODE */;
- } catch (e) {
- }
- try {
- doc.nodeType = 9 /* DOCUMENT_NODE */;
- } catch (e) {
- }
- try {
- doc.cookie = "";
- } catch (e) {
- }
- try {
- doc.referrer = "";
- } catch (e) {
- }
- }
- }
- var DOC_KEY_KEEPERS = /* @__PURE__ */ new Set([
- "nodeName",
- "nodeType",
- "nodeValue",
- "ownerDocument",
- "parentNode",
- "childNodes",
- "_shadowRoot"
- ]);
- function getElementById(elm, id) {
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- if (childElm.id === id) {
- return childElm;
- }
- const childElmFound = getElementById(childElm, id);
- if (childElmFound != null) {
- return childElmFound;
- }
- }
- return null;
- }
- function getElementsByName(elm, elmName, foundElms = []) {
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- if (childElm.name && childElm.name.toLowerCase() === elmName) {
- foundElms.push(childElm);
- }
- getElementsByName(childElm, elmName, foundElms);
- }
- return foundElms;
- }
- function setOwnerDocument(elm, ownerDocument) {
- for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
- elm.childNodes[i].ownerDocument = ownerDocument;
- if (elm.childNodes[i].nodeType === 1 /* ELEMENT_NODE */) {
- setOwnerDocument(elm.childNodes[i], ownerDocument);
- }
- }
- }
- // src/hydrate/runner/create-window.ts
- var templateWindows = /* @__PURE__ */ new Map();
- function createWindowFromHtml(templateHtml, uniqueId) {
- let templateWindow = templateWindows.get(uniqueId);
- if (templateWindow == null) {
- templateWindow = new MockWindow(templateHtml);
- templateWindows.set(uniqueId, templateWindow);
- }
- const win = cloneWindow(templateWindow);
- return win;
- }
- // src/utils/helpers.ts
- var isString = (v) => typeof v === "string";
- // src/utils/message-utils.ts
- var catchError = (diagnostics, err2, msg) => {
- const diagnostic = {
- level: "error",
- type: "build",
- header: "Build Error",
- messageText: "build error",
- lines: []
- };
- if (isString(msg)) {
- diagnostic.messageText = msg.length ? msg : "UNKNOWN ERROR";
- } else if (err2 != null) {
- if (err2.stack != null) {
- diagnostic.messageText = err2.stack.toString();
- } else {
- if (err2.message != null) {
- diagnostic.messageText = err2.message.length ? err2.message : "UNKNOWN ERROR";
- } else {
- diagnostic.messageText = err2.toString();
- }
- }
- }
- if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
- diagnostics.push(diagnostic);
- }
- return diagnostic;
- };
- var hasError = (diagnostics) => {
- if (diagnostics == null || diagnostics.length === 0) {
- return false;
- }
- return diagnostics.some((d) => d.level === "error" && d.type !== "runtime");
- };
- var shouldIgnoreError = (msg) => {
- return msg === TASK_CANCELED_MSG;
- };
- var TASK_CANCELED_MSG = `task canceled`;
- // src/utils/result.ts
- var result_exports = {};
- __export(result_exports, {
- err: () => err,
- map: () => map,
- ok: () => ok,
- unwrap: () => unwrap,
- unwrapErr: () => unwrapErr
- });
- var ok = (value) => ({
- isOk: true,
- isErr: false,
- value
- });
- var err = (value) => ({
- isOk: false,
- isErr: true,
- value
- });
- function map(result, fn) {
- if (result.isOk) {
- const val = fn(result.value);
- if (val instanceof Promise) {
- return val.then((newVal) => ok(newVal));
- } else {
- return ok(val);
- }
- }
- if (result.isErr) {
- const value = result.value;
- return err(value);
- }
- throw "should never get here";
- }
- var unwrap = (result) => {
- if (result.isOk) {
- return result.value;
- } else {
- throw result.value;
- }
- };
- var unwrapErr = (result) => {
- if (result.isErr) {
- return result.value;
- } else {
- throw result.value;
- }
- };
- // src/compiler/html/canonical-link.ts
- var updateCanonicalLink = (doc, href) => {
- var _a2;
- let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
- if (typeof href === "string") {
- if (canonicalLinkElm == null) {
- canonicalLinkElm = doc.createElement("link");
- canonicalLinkElm.setAttribute("rel", "canonical");
- doc.head.appendChild(canonicalLinkElm);
- }
- canonicalLinkElm.setAttribute("href", href);
- } else {
- if (canonicalLinkElm != null) {
- const existingHref = canonicalLinkElm.getAttribute("href");
- if (!existingHref) {
- (_a2 = canonicalLinkElm.parentNode) == null ? void 0 : _a2.removeChild(canonicalLinkElm);
- }
- }
- }
- };
- // src/compiler/html/relocate-meta-charset.ts
- var relocateMetaCharset = (doc) => {
- const head = doc.head;
- let charsetElm = head.querySelector("meta[charset]");
- if (charsetElm == null) {
- charsetElm = doc.createElement("meta");
- charsetElm.setAttribute("charset", "utf-8");
- } else {
- charsetElm.remove();
- }
- head.insertBefore(charsetElm, head.firstChild);
- };
- // src/compiler/style/css-parser/parse-css.ts
- var parseCss = (css, filePath) => {
- let lineno = 1;
- let column = 1;
- const diagnostics = [];
- const updatePosition = (str) => {
- const lines = str.match(/\n/g);
- if (lines) lineno += lines.length;
- const i = str.lastIndexOf("\n");
- column = ~i ? str.length - i : column + str.length;
- };
- const position = () => {
- const start = { line: lineno, column };
- return (node) => {
- node.position = new ParsePosition(start);
- whitespace();
- return node;
- };
- };
- const error = (msg) => {
- const srcLines = css.split("\n");
- const d = {
- level: "error",
- type: "css",
- language: "css",
- header: "CSS Parse",
- messageText: msg,
- absFilePath: filePath,
- lines: [
- {
- lineIndex: lineno - 1,
- lineNumber: lineno,
- errorCharStart: column,
- text: css[lineno - 1]
- }
- ]
- };
- if (lineno > 1) {
- const previousLine = {
- lineIndex: lineno - 1,
- lineNumber: lineno - 1,
- text: css[lineno - 2],
- errorCharStart: -1,
- errorLength: -1
- };
- d.lines.unshift(previousLine);
- }
- if (lineno + 2 < srcLines.length) {
- const nextLine = {
- lineIndex: lineno,
- lineNumber: lineno + 1,
- text: srcLines[lineno],
- errorCharStart: -1,
- errorLength: -1
- };
- d.lines.push(nextLine);
- }
- diagnostics.push(d);
- return null;
- };
- const stylesheet = () => {
- const rulesList = rules();
- return {
- type: 14 /* StyleSheet */,
- stylesheet: {
- source: filePath,
- rules: rulesList
- }
- };
- };
- const open = () => match(/^{\s*/);
- const close = () => match(/^}/);
- const match = (re) => {
- const m = re.exec(css);
- if (!m) return;
- const str = m[0];
- updatePosition(str);
- css = css.slice(str.length);
- return m;
- };
- const rules = () => {
- let node;
- const rules2 = [];
- whitespace();
- comments(rules2);
- while (css.length && css.charAt(0) !== "}" && (node = atrule() || rule())) {
- rules2.push(node);
- comments(rules2);
- }
- return rules2;
- };
- const whitespace = () => match(/^\s*/);
- const comments = (rules2) => {
- let c;
- rules2 = rules2 || [];
- while (c = comment()) {
- rules2.push(c);
- }
- return rules2;
- };
- const comment = () => {
- const pos = position();
- if ("/" !== css.charAt(0) || "*" !== css.charAt(1)) return null;
- let i = 2;
- while ("" !== css.charAt(i) && ("*" !== css.charAt(i) || "/" !== css.charAt(i + 1))) ++i;
- i += 2;
- if ("" === css.charAt(i - 1)) {
- return error("End of comment missing");
- }
- const comment2 = css.slice(2, i - 2);
- column += 2;
- updatePosition(comment2);
- css = css.slice(i);
- column += 2;
- return pos({
- type: 1 /* Comment */,
- comment: comment2
- });
- };
- const selector = () => {
- const m = match(/^([^{]+)/);
- if (!m) return null;
- return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, "").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function(m2) {
- return m2.replace(/,/g, "\u200C");
- }).split(/\s*(?![^(]*\)),\s*/).map(function(s) {
- return s.replace(/\u200C/g, ",");
- });
- };
- const declaration = () => {
- const pos = position();
- let prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
- if (!prop) return null;
- prop = trim(prop[0]);
- if (!match(/^:\s*/)) return error(`property missing ':'`);
- const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
- const ret = pos({
- type: 4 /* Declaration */,
- property: prop.replace(commentre, ""),
- value: val ? trim(val[0]).replace(commentre, "") : ""
- });
- match(/^[;\s]*/);
- return ret;
- };
- const declarations = () => {
- const decls = [];
- if (!open()) return error(`missing '{'`);
- comments(decls);
- let decl;
- while (decl = declaration()) {
- decls.push(decl);
- comments(decls);
- }
- if (!close()) return error(`missing '}'`);
- return decls;
- };
- const keyframe = () => {
- let m;
- const values = [];
- const pos = position();
- while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
- values.push(m[1]);
- match(/^,\s*/);
- }
- if (!values.length) return null;
- return pos({
- type: 9 /* KeyFrame */,
- values,
- declarations: declarations()
- });
- };
- const atkeyframes = () => {
- const pos = position();
- let m = match(/^@([-\w]+)?keyframes\s*/);
- if (!m) return null;
- const vendor = m[1];
- m = match(/^([-\w]+)\s*/);
- if (!m) return error(`@keyframes missing name`);
- const name = m[1];
- if (!open()) return error(`@keyframes missing '{'`);
- let frame;
- let frames = comments();
- while (frame = keyframe()) {
- frames.push(frame);
- frames = frames.concat(comments());
- }
- if (!close()) return error(`@keyframes missing '}'`);
- return pos({
- type: 8 /* KeyFrames */,
- name,
- vendor,
- keyframes: frames
- });
- };
- const atsupports = () => {
- const pos = position();
- const m = match(/^@supports *([^{]+)/);
- if (!m) return null;
- const supports = trim(m[1]);
- if (!open()) return error(`@supports missing '{'`);
- const style = comments().concat(rules());
- if (!close()) return error(`@supports missing '}'`);
- return pos({
- type: 15 /* Supports */,
- supports,
- rules: style
- });
- };
- const athost = () => {
- const pos = position();
- const m = match(/^@host\s*/);
- if (!m) return null;
- if (!open()) return error(`@host missing '{'`);
- const style = comments().concat(rules());
- if (!close()) return error(`@host missing '}'`);
- return pos({
- type: 6 /* Host */,
- rules: style
- });
- };
- const atmedia = () => {
- const pos = position();
- const m = match(/^@media *([^{]+)/);
- if (!m) return null;
- const media = trim(m[1]);
- if (!open()) return error(`@media missing '{'`);
- const style = comments().concat(rules());
- if (!close()) return error(`@media missing '}'`);
- return pos({
- type: 10 /* Media */,
- media,
- rules: style
- });
- };
- const atcustommedia = () => {
- const pos = position();
- const m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
- if (!m) return null;
- return pos({
- type: 2 /* CustomMedia */,
- name: trim(m[1]),
- media: trim(m[2])
- });
- };
- const atpage = () => {
- const pos = position();
- const m = match(/^@page */);
- if (!m) return null;
- const sel = selector() || [];
- if (!open()) return error(`@page missing '{'`);
- let decls = comments();
- let decl;
- while (decl = declaration()) {
- decls.push(decl);
- decls = decls.concat(comments());
- }
- if (!close()) return error(`@page missing '}'`);
- return pos({
- type: 12 /* Page */,
- selectors: sel,
- declarations: decls
- });
- };
- const atdocument = () => {
- const pos = position();
- const m = match(/^@([-\w]+)?document *([^{]+)/);
- if (!m) return null;
- const vendor = trim(m[1]);
- const doc = trim(m[2]);
- if (!open()) return error(`@document missing '{'`);
- const style = comments().concat(rules());
- if (!close()) return error(`@document missing '}'`);
- return pos({
- type: 3 /* Document */,
- document: doc,
- vendor,
- rules: style
- });
- };
- const atfontface = () => {
- const pos = position();
- const m = match(/^@font-face\s*/);
- if (!m) return null;
- if (!open()) return error(`@font-face missing '{'`);
- let decls = comments();
- let decl;
- while (decl = declaration()) {
- decls.push(decl);
- decls = decls.concat(comments());
- }
- if (!close()) return error(`@font-face missing '}'`);
- return pos({
- type: 5 /* FontFace */,
- declarations: decls
- });
- };
- const compileAtrule = (nodeName, nodeType) => {
- const re = new RegExp("^@" + nodeName + "\\s*([^;]+);");
- return () => {
- const pos = position();
- const m = match(re);
- if (!m) return null;
- const node = {
- type: nodeType
- };
- node[nodeName] = m[1].trim();
- return pos(node);
- };
- };
- const atimport = compileAtrule("import", 7 /* Import */);
- const atcharset = compileAtrule("charset", 0 /* Charset */);
- const atnamespace = compileAtrule("namespace", 11 /* Namespace */);
- const atrule = () => {
- if (css[0] !== "@") return null;
- return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface();
- };
- const rule = () => {
- const pos = position();
- const sel = selector();
- if (!sel) return error("selector missing");
- comments();
- return pos({
- type: 13 /* Rule */,
- selectors: sel,
- declarations: declarations()
- });
- };
- class ParsePosition {
- constructor(start) {
- this.start = start;
- this.end = { line: lineno, column };
- this.source = filePath;
- }
- }
- ParsePosition.prototype.content = css;
- return {
- diagnostics,
- ...addParent(stylesheet())
- };
- };
- var trim = (str) => str ? str.trim() : "";
- var addParent = (obj, parent) => {
- const isNode = obj && typeof obj.type === "string";
- const childParent = isNode ? obj : parent;
- for (const k in obj) {
- const value = obj[k];
- if (Array.isArray(value)) {
- value.forEach(function(v) {
- addParent(v, childParent);
- });
- } else if (value && typeof value === "object") {
- addParent(value, childParent);
- }
- }
- if (isNode) {
- Object.defineProperty(obj, "parent", {
- configurable: true,
- writable: true,
- enumerable: false,
- value: parent || null
- });
- }
- return obj;
- };
- var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
- // src/compiler/style/css-parser/get-css-selectors.ts
- var getCssSelectors = (sel) => {
- SELECTORS.all.length = SELECTORS.tags.length = SELECTORS.classNames.length = SELECTORS.ids.length = SELECTORS.attrs.length = 0;
- sel = sel.replace(/\./g, " .").replace(/\#/g, " #").replace(/\[/g, " [").replace(/\>/g, " > ").replace(/\+/g, " + ").replace(/\~/g, " ~ ").replace(/\*/g, " * ").replace(/\:not\((.*?)\)/g, " ");
- const items = sel.split(" ");
- for (let i = 0, l = items.length; i < l; i++) {
- items[i] = items[i].split(":")[0];
- if (items[i].length === 0) continue;
- if (items[i].charAt(0) === ".") {
- SELECTORS.classNames.push(items[i].slice(1));
- } else if (items[i].charAt(0) === "#") {
- SELECTORS.ids.push(items[i].slice(1));
- } else if (items[i].charAt(0) === "[") {
- items[i] = items[i].slice(1).split("=")[0].split("]")[0].trim();
- SELECTORS.attrs.push(items[i].toLowerCase());
- } else if (/[a-z]/g.test(items[i].charAt(0))) {
- SELECTORS.tags.push(items[i].toLowerCase());
- }
- }
- SELECTORS.classNames = SELECTORS.classNames.sort((a, b) => {
- if (a.length < b.length) return -1;
- if (a.length > b.length) return 1;
- return 0;
- });
- return SELECTORS;
- };
- var SELECTORS = {
- all: [],
- tags: [],
- classNames: [],
- ids: [],
- attrs: []
- };
- // src/compiler/style/css-parser/serialize-css.ts
- var serializeCss = (stylesheet, serializeOpts) => {
- const usedSelectors = serializeOpts.usedSelectors || null;
- const opts = {
- usedSelectors: usedSelectors || null,
- hasUsedAttrs: !!usedSelectors && usedSelectors.attrs.size > 0,
- hasUsedClassNames: !!usedSelectors && usedSelectors.classNames.size > 0,
- hasUsedIds: !!usedSelectors && usedSelectors.ids.size > 0,
- hasUsedTags: !!usedSelectors && usedSelectors.tags.size > 0
- };
- const rules = stylesheet.rules;
- if (!rules) {
- return "";
- }
- const rulesLen = rules.length;
- const out = [];
- for (let i = 0; i < rulesLen; i++) {
- out.push(serializeCssVisitNode(opts, rules[i], i, rulesLen));
- }
- return out.join("");
- };
- var serializeCssVisitNode = (opts, node, index, len) => {
- var _a2;
- const nodeType = node.type;
- if (nodeType === 4 /* Declaration */) {
- return serializeCssDeclaration(node, index, len);
- }
- if (nodeType === 13 /* Rule */) {
- return serializeCssRule(opts, node);
- }
- if (nodeType === 1 /* Comment */) {
- if (((_a2 = node.comment) == null ? void 0 : _a2[0]) === "!") {
- return `/*${node.comment}*/`;
- } else {
- return "";
- }
- }
- if (nodeType === 10 /* Media */) {
- return serializeCssMedia(opts, node);
- }
- if (nodeType === 8 /* KeyFrames */) {
- return serializeCssKeyframes(opts, node);
- }
- if (nodeType === 9 /* KeyFrame */) {
- return serializeCssKeyframe(opts, node);
- }
- if (nodeType === 5 /* FontFace */) {
- return serializeCssFontFace(opts, node);
- }
- if (nodeType === 15 /* Supports */) {
- return serializeCssSupports(opts, node);
- }
- if (nodeType === 7 /* Import */) {
- return "@import " + node.import + ";";
- }
- if (nodeType === 0 /* Charset */) {
- return "@charset " + node.charset + ";";
- }
- if (nodeType === 12 /* Page */) {
- return serializeCssPage(opts, node);
- }
- if (nodeType === 6 /* Host */) {
- return "@host{" + serializeCssMapVisit(opts, node.rules) + "}";
- }
- if (nodeType === 2 /* CustomMedia */) {
- return "@custom-media " + node.name + " " + node.media + ";";
- }
- if (nodeType === 3 /* Document */) {
- return serializeCssDocument(opts, node);
- }
- if (nodeType === 11 /* Namespace */) {
- return "@namespace " + node.namespace + ";";
- }
- return "";
- };
- var serializeCssRule = (opts, node) => {
- var _a2, _b;
- const decls = node.declarations;
- const usedSelectors = opts.usedSelectors;
- const selectors = (_b = (_a2 = node.selectors) == null ? void 0 : _a2.slice()) != null ? _b : [];
- if (decls == null || decls.length === 0) {
- return "";
- }
- if (usedSelectors) {
- let i;
- let j;
- let include = true;
- for (i = selectors.length - 1; i >= 0; i--) {
- const sel = getCssSelectors(selectors[i]);
- include = true;
- let jlen = sel.classNames.length;
- if (jlen > 0 && opts.hasUsedClassNames) {
- for (j = 0; j < jlen; j++) {
- if (!usedSelectors.classNames.has(sel.classNames[j])) {
- include = false;
- break;
- }
- }
- }
- if (include && opts.hasUsedTags) {
- jlen = sel.tags.length;
- if (jlen > 0) {
- for (j = 0; j < jlen; j++) {
- if (!usedSelectors.tags.has(sel.tags[j])) {
- include = false;
- break;
- }
- }
- }
- }
- if (include && opts.hasUsedAttrs) {
- jlen = sel.attrs.length;
- if (jlen > 0) {
- for (j = 0; j < jlen; j++) {
- if (!usedSelectors.attrs.has(sel.attrs[j])) {
- include = false;
- break;
- }
- }
- }
- }
- if (include && opts.hasUsedIds) {
- jlen = sel.ids.length;
- if (jlen > 0) {
- for (j = 0; j < jlen; j++) {
- if (!usedSelectors.ids.has(sel.ids[j])) {
- include = false;
- break;
- }
- }
- }
- }
- if (!include) {
- selectors.splice(i, 1);
- }
- }
- }
- if (selectors.length === 0) {
- return "";
- }
- const cleanedSelectors = [];
- let cleanedSelector = "";
- if (node.selectors) {
- for (const selector of node.selectors) {
- cleanedSelector = removeSelectorWhitespace(selector);
- if (!cleanedSelectors.includes(cleanedSelector)) {
- cleanedSelectors.push(cleanedSelector);
- }
- }
- }
- return `${cleanedSelectors}{${serializeCssMapVisit(opts, decls)}}`;
- };
- var serializeCssDeclaration = (node, index, len) => {
- if (node.value === "") {
- return "";
- }
- if (len - 1 === index) {
- return node.property + ":" + node.value;
- }
- return node.property + ":" + node.value + ";";
- };
- var serializeCssMedia = (opts, node) => {
- const mediaCss = serializeCssMapVisit(opts, node.rules);
- if (mediaCss === "") {
- return "";
- }
- return "@media " + removeMediaWhitespace(node.media) + "{" + mediaCss + "}";
- };
- var serializeCssKeyframes = (opts, node) => {
- const keyframesCss = serializeCssMapVisit(opts, node.keyframes);
- if (keyframesCss === "") {
- return "";
- }
- return "@" + (node.vendor || "") + "keyframes " + node.name + "{" + keyframesCss + "}";
- };
- var serializeCssKeyframe = (opts, node) => {
- var _a2, _b;
- return ((_b = (_a2 = node.values) == null ? void 0 : _a2.join(",")) != null ? _b : "") + "{" + serializeCssMapVisit(opts, node.declarations) + "}";
- };
- var serializeCssFontFace = (opts, node) => {
- const fontCss = serializeCssMapVisit(opts, node.declarations);
- if (fontCss === "") {
- return "";
- }
- return "@font-face{" + fontCss + "}";
- };
- var serializeCssSupports = (opts, node) => {
- const supportsCss = serializeCssMapVisit(opts, node.rules);
- if (supportsCss === "") {
- return "";
- }
- return "@supports " + node.supports + "{" + supportsCss + "}";
- };
- var serializeCssPage = (opts, node) => {
- var _a2, _b;
- const sel = (_b = (_a2 = node.selectors) == null ? void 0 : _a2.join(", ")) != null ? _b : "";
- return "@page " + sel + "{" + serializeCssMapVisit(opts, node.declarations) + "}";
- };
- var serializeCssDocument = (opts, node) => {
- const documentCss = serializeCssMapVisit(opts, node.rules);
- const doc = "@" + (node.vendor || "") + "document " + node.document;
- if (documentCss === "") {
- return "";
- }
- return doc + "{" + documentCss + "}";
- };
- var serializeCssMapVisit = (opts, nodes) => {
- let rtn = "";
- if (nodes) {
- for (let i = 0, len = nodes.length; i < len; i++) {
- rtn += serializeCssVisitNode(opts, nodes[i], i, len);
- }
- }
- return rtn;
- };
- var removeSelectorWhitespace = (selector) => {
- let rtn = "";
- let char = "";
- let inAttr = false;
- selector = selector.trim();
- for (let i = 0, l = selector.length; i < l; i++) {
- char = selector[i];
- if (char === "[" && rtn[rtn.length - 1] !== "\\") {
- inAttr = true;
- } else if (char === "]" && rtn[rtn.length - 1] !== "\\") {
- inAttr = false;
- }
- if (!inAttr && CSS_WS_REG.test(char)) {
- if (CSS_NEXT_CHAR_REG.test(selector[i + 1])) {
- continue;
- }
- if (CSS_PREV_CHAR_REG.test(rtn[rtn.length - 1])) {
- continue;
- }
- rtn += " ";
- } else {
- rtn += char;
- }
- }
- return rtn;
- };
- var removeMediaWhitespace = (media) => {
- var _a2;
- let rtn = "";
- let char = "";
- media = (_a2 = media == null ? void 0 : media.trim()) != null ? _a2 : "";
- for (let i = 0, l = media.length; i < l; i++) {
- char = media[i];
- if (CSS_WS_REG.test(char)) {
- if (CSS_WS_REG.test(rtn[rtn.length - 1])) {
- continue;
- }
- rtn += " ";
- } else {
- rtn += char;
- }
- }
- return rtn;
- };
- var CSS_WS_REG = /\s/;
- var CSS_NEXT_CHAR_REG = /[>\(\)\~\,\+\s]/;
- var CSS_PREV_CHAR_REG = /[>\(\~\,\+]/;
- // src/compiler/style/css-parser/used-selectors.ts
- var getUsedSelectors = (elm) => {
- const usedSelectors = {
- attrs: /* @__PURE__ */ new Set(),
- classNames: /* @__PURE__ */ new Set(),
- ids: /* @__PURE__ */ new Set(),
- tags: /* @__PURE__ */ new Set()
- };
- collectUsedSelectors(usedSelectors, elm);
- return usedSelectors;
- };
- var collectUsedSelectors = (usedSelectors, elm) => {
- if (elm != null && elm.nodeType === 1) {
- const children = elm.children;
- const tagName = elm.nodeName.toLowerCase();
- usedSelectors.tags.add(tagName);
- const attributes = elm.attributes;
- for (let i = 0, l = attributes.length; i < l; i++) {
- const attr = attributes.item(i);
- const attrName = attr.name.toLowerCase();
- usedSelectors.attrs.add(attrName);
- if (attrName === "class") {
- const classList = elm.classList;
- for (let i2 = 0, l2 = classList.length; i2 < l2; i2++) {
- usedSelectors.classNames.add(classList.item(i2));
- }
- } else if (attrName === "id") {
- usedSelectors.ids.add(attr.value);
- }
- }
- if (children) {
- for (let i = 0, l = children.length; i < l; i++) {
- collectUsedSelectors(usedSelectors, children[i]);
- }
- }
- }
- };
- // src/compiler/html/remove-unused-styles.ts
- var removeUnusedStyles = (doc, diagnostics) => {
- try {
- const styleElms = doc.head.querySelectorAll(`style[data-styles]`);
- const styleLen = styleElms.length;
- if (styleLen > 0) {
- const usedSelectors = getUsedSelectors(doc.documentElement);
- for (let i = 0; i < styleLen; i++) {
- removeUnusedStyleText(usedSelectors, diagnostics, styleElms[i]);
- }
- }
- } catch (e) {
- catchError(diagnostics, e);
- }
- };
- var removeUnusedStyleText = (usedSelectors, diagnostics, styleElm) => {
- try {
- const parseResults = parseCss(styleElm.innerHTML);
- diagnostics.push(...parseResults.diagnostics);
- if (hasError(diagnostics)) {
- return;
- }
- try {
- styleElm.innerHTML = serializeCss(parseResults.stylesheet, {
- usedSelectors
- });
- } catch (e) {
- diagnostics.push({
- level: "warn",
- type: "css",
- header: "CSS Stringify",
- messageText: e,
- lines: []
- });
- }
- } catch (e) {
- diagnostics.push({
- level: "warn",
- type: "css",
- header: "CSS Parse",
- messageText: e,
- lines: []
- });
- }
- };
- // src/hydrate/runner/inspect-element.ts
- function inspectElement(results, elm, depth) {
- const children = [...Array.from(elm.children), ...Array.from(elm.shadowRoot ? elm.shadowRoot.children : [])];
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- const tagName = childElm.nodeName.toLowerCase();
- if (tagName.includes("-")) {
- const cmp = results.components.find((c) => c.tag === tagName);
- if (cmp != null) {
- cmp.count++;
- if (depth > cmp.depth) {
- cmp.depth = depth;
- }
- }
- } else {
- switch (tagName) {
- case "a":
- const anchor = collectAttributes(childElm);
- anchor.href = childElm.href;
- if (typeof anchor.href === "string") {
- if (!results.anchors.some((a) => a.href === anchor.href)) {
- results.anchors.push(anchor);
- }
- }
- break;
- case "img":
- const img = collectAttributes(childElm);
- img.src = childElm.src;
- if (typeof img.src === "string") {
- if (!results.imgs.some((a) => a.src === img.src)) {
- results.imgs.push(img);
- }
- }
- break;
- case "link":
- const link = collectAttributes(childElm);
- link.href = childElm.href;
- if (typeof link.rel === "string" && link.rel.toLowerCase() === "stylesheet") {
- if (typeof link.href === "string") {
- if (!results.styles.some((s) => s.link === link.href)) {
- delete link.rel;
- delete link.type;
- results.styles.push(link);
- }
- }
- }
- break;
- case "script":
- const script = collectAttributes(childElm);
- if (childElm.hasAttribute("src")) {
- script.src = childElm.src;
- if (typeof script.src === "string") {
- if (!results.scripts.some((s) => s.src === script.src)) {
- results.scripts.push(script);
- }
- }
- } else {
- const staticDataKey = childElm.getAttribute("data-stencil-static");
- if (staticDataKey) {
- results.staticData.push({
- id: staticDataKey,
- type: childElm.getAttribute("type"),
- content: childElm.textContent
- });
- }
- }
- break;
- }
- }
- depth++;
- inspectElement(results, childElm, depth);
- }
- }
- function collectAttributes(node) {
- const parsedElm = {};
- const attrs = node.attributes;
- for (let i = 0, ii = attrs.length; i < ii; i++) {
- const attr = attrs.item(i);
- const attrName = attr.nodeName.toLowerCase();
- if (SKIP_ATTRS.has(attrName)) {
- continue;
- }
- const attrValue = attr.nodeValue;
- if (attrName === "class" && attrValue === "") {
- continue;
- }
- parsedElm[attrName] = attrValue;
- }
- return parsedElm;
- }
- var SKIP_ATTRS = /* @__PURE__ */ new Set(["s-id", "c-id"]);
- // src/hydrate/runner/patch-dom-implementation.ts
- function patchDomImplementation(doc, opts) {
- let win;
- if (doc.defaultView != null) {
- opts.destroyWindow = true;
- patchWindow(doc.defaultView);
- win = doc.defaultView;
- } else {
- opts.destroyWindow = true;
- opts.destroyDocument = false;
- win = new MockWindow(false);
- }
- if (win.document !== doc) {
- win.document = doc;
- }
- if (doc.defaultView !== win) {
- doc.defaultView = win;
- }
- const HTMLElement = doc.documentElement.constructor.prototype;
- if (typeof HTMLElement.getRootNode !== "function") {
- const elm = doc.createElement("unknown-element");
- const HTMLUnknownElement = elm.constructor.prototype;
- HTMLUnknownElement.getRootNode = getRootNode;
- }
- if (typeof doc.createEvent === "function") {
- const CustomEvent = doc.createEvent("CustomEvent").constructor;
- if (win.CustomEvent !== CustomEvent) {
- win.CustomEvent = CustomEvent;
- }
- }
- try {
- win.__stencil_baseURI = doc.baseURI;
- } catch (e) {
- Object.defineProperty(doc, "baseURI", {
- get() {
- const baseElm = doc.querySelector("base[href]");
- if (baseElm) {
- return new URL(baseElm.getAttribute("href"), win.location.href).href;
- }
- return win.location.href;
- }
- });
- }
- return win;
- }
- function getRootNode(opts) {
- const isComposed = opts != null && opts.composed === true;
- let node = this;
- while (node.parentNode != null) {
- node = node.parentNode;
- if (isComposed === true && node.parentNode == null && node.host != null) {
- node = node.host;
- }
- }
- return node;
- }
- // src/hydrate/runner/render-utils.ts
- function normalizeHydrateOptions(inputOpts) {
- const outputOpts = Object.assign(
- {
- serializeToHtml: false,
- destroyWindow: false,
- destroyDocument: false
- },
- inputOpts || {}
- );
- if (typeof outputOpts.clientHydrateAnnotations !== "boolean") {
- outputOpts.clientHydrateAnnotations = true;
- }
- if (typeof outputOpts.constrainTimeouts !== "boolean") {
- outputOpts.constrainTimeouts = true;
- }
- if (typeof outputOpts.maxHydrateCount !== "number") {
- outputOpts.maxHydrateCount = 300;
- }
- if (typeof outputOpts.runtimeLogging !== "boolean") {
- outputOpts.runtimeLogging = false;
- }
- if (typeof outputOpts.timeout !== "number") {
- outputOpts.timeout = 15e3;
- }
- if (Array.isArray(outputOpts.excludeComponents)) {
- outputOpts.excludeComponents = outputOpts.excludeComponents.filter(filterValidTags).map(mapValidTags);
- } else {
- outputOpts.excludeComponents = [];
- }
- if (Array.isArray(outputOpts.staticComponents)) {
- outputOpts.staticComponents = outputOpts.staticComponents.filter(filterValidTags).map(mapValidTags);
- } else {
- outputOpts.staticComponents = [];
- }
- return outputOpts;
- }
- function filterValidTags(tag) {
- return typeof tag === "string" && tag.includes("-");
- }
- function mapValidTags(tag) {
- return tag.trim().toLowerCase();
- }
- function generateHydrateResults(opts) {
- if (typeof opts.url !== "string") {
- opts.url = `https://hydrate.stenciljs.com/`;
- }
- if (typeof opts.buildId !== "string") {
- opts.buildId = createHydrateBuildId();
- }
- const results = {
- buildId: opts.buildId,
- diagnostics: [],
- url: opts.url,
- host: null,
- hostname: null,
- href: null,
- pathname: null,
- port: null,
- search: null,
- hash: null,
- html: null,
- httpStatus: null,
- hydratedCount: 0,
- anchors: [],
- components: [],
- imgs: [],
- scripts: [],
- staticData: [],
- styles: [],
- title: null
- };
- try {
- const url = new URL(opts.url, `https://hydrate.stenciljs.com/`);
- results.url = url.href;
- results.host = url.host;
- results.hostname = url.hostname;
- results.href = url.href;
- results.port = url.port;
- results.pathname = url.pathname;
- results.search = url.search;
- results.hash = url.hash;
- } catch (e) {
- renderCatchError(results, e);
- }
- return results;
- }
- var createHydrateBuildId = () => {
- let chars = "abcdefghijklmnopqrstuvwxyz";
- let buildId = "";
- while (buildId.length < 8) {
- const char = chars[Math.floor(Math.random() * chars.length)];
- buildId += char;
- if (buildId.length === 1) {
- chars += "0123456789";
- }
- }
- return buildId;
- };
- function renderBuildDiagnostic(results, level, header, msg) {
- const diagnostic = {
- level,
- type: "build",
- header,
- messageText: msg,
- relFilePath: void 0,
- absFilePath: void 0,
- lines: []
- };
- if (results.pathname) {
- if (results.pathname !== "/") {
- diagnostic.header += ": " + results.pathname;
- }
- } else if (results.url) {
- diagnostic.header += ": " + results.url;
- }
- results.diagnostics.push(diagnostic);
- return diagnostic;
- }
- function renderBuildError(results, msg) {
- return renderBuildDiagnostic(results, "error", "Hydrate Error", msg || "");
- }
- function renderCatchError(results, err2) {
- const diagnostic = renderBuildError(results);
- if (err2 != null) {
- if (err2.stack != null) {
- diagnostic.messageText = err2.stack.toString();
- } else {
- if (err2.message != null) {
- diagnostic.messageText = err2.message.toString();
- } else {
- diagnostic.messageText = err2.toString();
- }
- }
- }
- return diagnostic;
- }
- // src/hydrate/runner/runtime-log.ts
- function runtimeLogging(win, opts, results) {
- try {
- const pathname = win.location.pathname;
- win.console.error = (...msgs) => {
- const errMsg = msgs.reduce((errMsg2, m) => {
- if (m) {
- if (m.stack != null) {
- return errMsg2 + " " + String(m.stack);
- } else {
- if (m.message != null) {
- return errMsg2 + " " + String(m.message);
- }
- }
- }
- return String(m);
- }, "").trim();
- if (errMsg !== "") {
- renderCatchError(results, errMsg);
- if (opts.runtimeLogging) {
- runtimeLog(pathname, "error", [errMsg]);
- }
- }
- };
- win.console.debug = (...msgs) => {
- renderBuildDiagnostic(results, "debug", "Hydrate Debug", [...msgs].join(", "));
- if (opts.runtimeLogging) {
- runtimeLog(pathname, "debug", msgs);
- }
- };
- if (opts.runtimeLogging) {
- ["log", "warn", "assert", "info", "trace"].forEach((type) => {
- win.console[type] = (...msgs) => {
- runtimeLog(pathname, type, msgs);
- };
- });
- }
- } catch (e) {
- renderCatchError(results, e);
- }
- }
- function runtimeLog(pathname, type, msgs) {
- global.console[type].apply(global.console, [`[ ${pathname} ${type} ] `, ...msgs]);
- }
- // src/hydrate/runner/window-initialize.ts
- function initializeWindow(win, doc, opts, results) {
- if (typeof opts.url === "string") {
- try {
- win.location.href = opts.url;
- } catch (e) {
- }
- }
- if (typeof opts.userAgent === "string") {
- try {
- win.navigator.userAgent = opts.userAgent;
- } catch (e) {
- }
- }
- if (typeof opts.cookie === "string") {
- try {
- doc.cookie = opts.cookie;
- } catch (e) {
- }
- }
- if (typeof opts.referrer === "string") {
- try {
- doc.referrer = opts.referrer;
- } catch (e) {
- }
- }
- if (typeof opts.direction === "string") {
- try {
- doc.documentElement.setAttribute("dir", opts.direction);
- } catch (e) {
- }
- }
- if (typeof opts.language === "string") {
- try {
- doc.documentElement.setAttribute("lang", opts.language);
- } catch (e) {
- }
- }
- if (typeof opts.buildId === "string") {
- try {
- doc.documentElement.setAttribute("data-stencil-build", opts.buildId);
- } catch (e) {
- }
- }
- try {
- win.customElements = null;
- } catch (e) {
- }
- if (opts.constrainTimeouts) {
- constrainTimeouts(win);
- }
- runtimeLogging(win, opts, results);
- return win;
- }
- // src/hydrate/runner/render.ts
- var NOOP = () => {
- };
- function streamToString(html, option) {
- return renderToString(html, option, true);
- }
- function renderToString(html, options, asStream) {
- const opts = normalizeHydrateOptions(options);
- opts.serializeToHtml = true;
- opts.fullDocument = typeof opts.fullDocument === "boolean" ? opts.fullDocument : true;
- opts.serializeShadowRoot = typeof opts.serializeShadowRoot === "boolean" ? opts.serializeShadowRoot : true;
- opts.constrainTimeouts = false;
- return hydrateDocument(html, opts, asStream);
- }
- function hydrateDocument(doc, options, asStream) {
- const opts = normalizeHydrateOptions(options);
- let win = null;
- const results = generateHydrateResults(opts);
- if (hasError(results.diagnostics)) {
- return Promise.resolve(results);
- }
- if (typeof doc === "string") {
- try {
- opts.destroyWindow = true;
- opts.destroyDocument = true;
- win = new MockWindow(doc);
- if (!asStream) {
- return render(win, opts, results).then(() => results);
- }
- return renderStream(win, opts, results);
- } catch (e) {
- if (win && win.close) {
- win.close();
- }
- win = null;
- renderCatchError(results, e);
- return Promise.resolve(results);
- }
- }
- if (isValidDocument(doc)) {
- try {
- opts.destroyDocument = false;
- win = patchDomImplementation(doc, opts);
- if (!asStream) {
- return render(win, opts, results).then(() => results);
- }
- return renderStream(win, opts, results);
- } catch (e) {
- if (win && win.close) {
- win.close();
- }
- win = null;
- renderCatchError(results, e);
- return Promise.resolve(results);
- }
- }
- renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
- return Promise.resolve(results);
- }
- async function render(win, opts, results) {
- if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
- process.__stencilErrors = true;
- process.on("unhandledRejection", (e) => {
- console.log("unhandledRejection", e);
- });
- }
- initializeWindow(win, win.document, opts, results);
- const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
- try {
- await Promise.resolve(beforeHydrateFn(win.document));
- return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
- } catch (e) {
- renderCatchError(results, e);
- return finalizeHydrate(win, win.document, opts, results);
- }
- }
- function renderStream(win, opts, results) {
- async function* processRender() {
- const renderResult = await render(win, opts, results);
- yield renderResult.html;
- }
- return stream.Readable.from(processRender());
- }
- async function afterHydrate(win, opts, results, resolve) {
- const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
- try {
- await Promise.resolve(afterHydrateFn(win.document));
- return resolve(finalizeHydrate(win, win.document, opts, results));
- } catch (e) {
- renderCatchError(results, e);
- return resolve(finalizeHydrate(win, win.document, opts, results));
- }
- }
- function finalizeHydrate(win, doc, opts, results) {
- try {
- inspectElement(results, doc.documentElement, 0);
- if (opts.removeUnusedStyles !== false) {
- try {
- removeUnusedStyles(doc, results.diagnostics);
- } catch (e) {
- renderCatchError(results, e);
- }
- }
- if (typeof opts.title === "string") {
- try {
- doc.title = opts.title;
- } catch (e) {
- renderCatchError(results, e);
- }
- }
- results.title = doc.title;
- if (opts.removeScripts) {
- removeScripts(doc.documentElement);
- }
- try {
- updateCanonicalLink(doc, opts.canonicalUrl);
- } catch (e) {
- renderCatchError(results, e);
- }
- try {
- relocateMetaCharset(doc);
- } catch (e) {
- }
- if (!hasError(results.diagnostics)) {
- results.httpStatus = 200;
- }
- try {
- const metaStatus = doc.head.querySelector('meta[http-equiv="status"]');
- if (metaStatus != null) {
- const metaStatusContent = metaStatus.getAttribute("content");
- if (metaStatusContent && metaStatusContent.length > 0) {
- results.httpStatus = parseInt(metaStatusContent, 10);
- }
- }
- } catch (e) {
- }
- if (opts.clientHydrateAnnotations) {
- doc.documentElement.classList.add("hydrated");
- }
- if (opts.serializeToHtml) {
- results.html = serializeDocumentToString(doc, opts);
- }
- } catch (e) {
- renderCatchError(results, e);
- }
- destroyWindow(win, doc, opts, results);
- return results;
- }
- function destroyWindow(win, doc, opts, results) {
- if (!opts.destroyWindow) {
- return;
- }
- try {
- if (!opts.destroyDocument) {
- win.document = null;
- doc.defaultView = null;
- }
- if (win.close) {
- win.close();
- }
- } catch (e) {
- renderCatchError(results, e);
- }
- }
- function serializeDocumentToString(doc, opts) {
- return serializeNodeToHtml(doc, {
- approximateLineWidth: opts.approximateLineWidth,
- outerHtml: false,
- prettyHtml: opts.prettyHtml,
- removeAttributeQuotes: opts.removeAttributeQuotes,
- removeBooleanAttributeQuotes: opts.removeBooleanAttributeQuotes,
- removeEmptyAttributes: opts.removeEmptyAttributes,
- removeHtmlComments: opts.removeHtmlComments,
- serializeShadowRoot: opts.serializeShadowRoot,
- fullDocument: opts.fullDocument
- });
- }
- function isValidDocument(doc) {
- return doc != null && doc.nodeType === 9 && doc.documentElement != null && doc.documentElement.nodeType === 1 && doc.body != null && doc.body.nodeType === 1;
- }
- function removeScripts(elm) {
- const children = elm.children;
- for (let i = children.length - 1; i >= 0; i--) {
- const child = children[i];
- removeScripts(child);
- if (child.nodeName === "SCRIPT" || child.nodeName === "LINK" && child.getAttribute("rel") === "modulepreload") {
- child.remove();
- }
- }
- }
- exports.createWindowFromHtml = createWindowFromHtml;
- exports.hydrateDocument = hydrateDocument;
- exports.renderToString = renderToString;
- exports.serializeDocumentToString = serializeDocumentToString;
- exports.streamToString = streamToString;
|